Hello community,

here is the log from the commit of package libdnf for openSUSE:Factory checked 
in at 2017-11-14 12:59:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libdnf (Old)
 and      /work/SRC/openSUSE:Factory/.libdnf.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libdnf"

Tue Nov 14 12:59:31 2017 rev:3 rq:541513 version:0.11.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/libdnf/libdnf.changes    2017-10-11 
23:01:59.603219815 +0200
+++ /work/SRC/openSUSE:Factory/.libdnf.new/libdnf.changes       2017-11-14 
12:59:32.713852061 +0100
@@ -1,0 +2,8 @@
+Mon Nov 13 14:17:07 UTC 2017 - ngomp...@gmail.com
+
+- Update to version 0.11.1:
+  + Make NEVRA parsing stricter
+  + Fix segfault with queries if epoch isn't set
+  + Improve performance of queries of solvables
+
+-------------------------------------------------------------------

Old:
----
  libdnf-0.11.0.tar.gz

New:
----
  libdnf-0.11.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libdnf.spec ++++++
--- /var/tmp/diff_new_pack.JRxt6p/_old  2017-11-14 12:59:33.765813597 +0100
+++ /var/tmp/diff_new_pack.JRxt6p/_new  2017-11-14 12:59:33.769813451 +0100
@@ -1,6 +1,7 @@
 #
 # spec file for package libdnf
 #
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
 # Copyright (c) 2017 Neal Gompa <ngomp...@gmail.com>.
 #
 # All modifications and additions to the file contributed by third parties
@@ -34,7 +35,7 @@
 %define devname %{name}-devel
 
 Name:           libdnf
-Version:        0.11.0
+Version:        0.11.1
 Release:        0
 Summary:        Library providing simplified C and Python API to libsolv
 License:        LGPL-2.0+

++++++ libdnf-0.11.0.tar.gz -> libdnf-0.11.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/VERSION.cmake 
new/libdnf-0.11.1/VERSION.cmake
--- old/libdnf-0.11.0/VERSION.cmake     2017-10-10 12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/VERSION.cmake     2017-10-16 09:00:54.000000000 +0200
@@ -1,4 +1,4 @@
 set (LIBDNF_MAJOR_VERSION 0)
 set (LIBDNF_MINOR_VERSION 11)
-set (LIBDNF_MICRO_VERSION 0)
+set (LIBDNF_MICRO_VERSION 1)
 set (LIBDNF_VERSION 
${LIBDNF_MAJOR_VERSION}.${LIBDNF_MINOR_VERSION}.${LIBDNF_MICRO_VERSION})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/docs/release_notes.rst 
new/libdnf-0.11.1/docs/release_notes.rst
--- old/libdnf-0.11.0/docs/release_notes.rst    2017-10-10 12:37:33.000000000 
+0200
+++ new/libdnf-0.11.1/docs/release_notes.rst    2017-10-16 09:00:54.000000000 
+0200
@@ -19,9 +19,20 @@
  LIBDNF Release Notes
 ###################
 
-===================
+====================
+0.11.1 Release Notes
+====================
+
+* Improvement query performance
+* Run file query in hy_subject_get_best_solution only for files (arguments 
that start with ``/`` or ``*/``)
+
+Bugs fixed in 0.11.1:
+
+* :rhbug:`1498207`
+
+====================
 0.10.1 Release Notes
-===================
+====================
 
 It improves query performance with ``name`` and ``arch`` filters. Also 
``nevra`` filter will now
 handle string with or without ``epoch``.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/dnf-sack-private.h 
new/libdnf-0.11.1/libdnf/dnf-sack-private.h
--- old/libdnf-0.11.0/libdnf/dnf-sack-private.h 2017-10-10 12:37:33.000000000 
+0200
+++ new/libdnf-0.11.1/libdnf/dnf-sack-private.h 2017-10-16 09:00:54.000000000 
+0200
@@ -28,6 +28,32 @@
 
 typedef Id  (*dnf_sack_running_kernel_fn_t) (DnfSack    *sack);
 
+/**
+ * @brief Store Map with only pkg_solvables to increase query performance
+ *
+ * @param sack p_sack:...
+ * @param pkg_solvables Map with only all pkg_solvables
+ * @param pool_nsolvables Number of pool_nsolvables in pool. It used as 
checksum.
+ */
+void dnf_sack_set_pkg_solvables(DnfSack *sack, Map *pkg_solvables, int 
pool_nsolvables);
+
+/**
+ * @brief Returns number of pool_nsolvables at time of creation of 
pkg_solvables. It can be used to
+ *        verify Map contant
+ *
+ * @param sack p_sack:...
+ * @return int
+ */
+int dnf_sack_get_pool_nsolvables(DnfSack *sack);
+
+/**
+ * @brief Returns Map with every package solvable in pool
+ *
+ * @param sack p_sack:...
+ * @return Map*
+ */
+Map *dnf_sack_get_pkg_solvables(DnfSack *sack);
+
 void         dnf_sack_make_provides_ready   (DnfSack    *sack);
 Id           dnf_sack_running_kernel        (DnfSack    *sack);
 int          dnf_sack_knows                 (DnfSack    *sack,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/dnf-sack.c 
new/libdnf-0.11.1/libdnf/dnf-sack.c
--- old/libdnf-0.11.0/libdnf/dnf-sack.c 2017-10-10 12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/libdnf/dnf-sack.c 2017-10-16 09:00:54.000000000 +0200
@@ -78,6 +78,8 @@
     Map                 *pkg_excludes;
     Map                 *pkg_includes;
     Map                 *repo_excludes;
+    Map                 *pkg_solvables;     /* Map representing only solvable 
pkgs of query */
+    int                  pool_nsolvables;   /* Number of nsolvables for 
creation of pkg_solvables*/
     Pool                *pool;
     Queue                installonly;
     Repo                *cmdline_repo;
@@ -119,6 +121,7 @@
     free_map_fully(priv->pkg_includes);
     free_map_fully(priv->repo_excludes);
     free_map_fully(pool->considered);
+    free_map_fully(priv->pkg_solvables);
     pool_free(priv->pool);
 
     G_OBJECT_CLASS(dnf_sack_parent_class)->finalize(object);
@@ -250,6 +253,36 @@
     priv->running_kernel_fn = fn;
 }
 
+void
+dnf_sack_set_pkg_solvables(DnfSack *sack, Map *pkg_solvables, int 
pool_nsolvables)
+{
+    DnfSackPrivate *priv = GET_PRIVATE(sack);
+
+    Map *pkg_solvables_tmp = g_malloc(sizeof(Map));
+    if (priv->pkg_solvables)
+        free_map_fully(priv->pkg_solvables);
+    map_init_clone(pkg_solvables_tmp, pkg_solvables);
+    priv->pkg_solvables = pkg_solvables_tmp;
+    priv->pool_nsolvables = pool_nsolvables;
+}
+
+int
+dnf_sack_get_pool_nsolvables(DnfSack *sack)
+{
+    DnfSackPrivate *priv = GET_PRIVATE(sack);
+    return priv->pool_nsolvables;
+}
+
+Map *
+dnf_sack_get_pkg_solvables(DnfSack *sack)
+{
+    DnfSackPrivate *priv = GET_PRIVATE(sack);
+    Map *pkg_solvables_tmp = g_malloc(sizeof(Map));
+
+    map_init_clone(pkg_solvables_tmp, priv->pkg_solvables);
+    return pkg_solvables_tmp;
+}
+
 /**
  * dnf_sack_last_solvable: (skip)
  * @sack: a #DnfSack instance.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/hy-query.c 
new/libdnf-0.11.1/libdnf/hy-query.c
--- old/libdnf-0.11.0/libdnf/hy-query.c 2017-10-10 12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/libdnf/hy-query.c 2017-10-16 09:00:54.000000000 +0200
@@ -788,6 +788,9 @@
 
     for (int mi = 0; mi < f->nmatches; ++mi) {
         const char *nevra_pattern = f->matches[mi].str;
+        if (strpbrk(nevra_pattern, "(/=<> "))
+            continue;
+
         gboolean present_epoch = strchr(nevra_pattern, ':') != NULL;
 
         for (Id id = 1; id < pool->nsolvables; ++id) {
@@ -1049,20 +1052,21 @@
     Pool *pool = dnf_sack_get_pool(q->sack);
     Id solvid;
 
-    q->result = g_malloc0(sizeof(Map));
-    map_init(q->result, pool->nsolvables);
-    FOR_PKG_SOLVABLES(solvid)
-        map_set(q->result, solvid);
+    int sack_pool_nsolvables = dnf_sack_get_pool_nsolvables(q->sack);
+    if (sack_pool_nsolvables != 0 && sack_pool_nsolvables == pool->nsolvables)
+        q->result = dnf_sack_get_pkg_solvables(q->sack);
+    else {
+        q->result = g_malloc(sizeof(Map));
+        map_init(q->result, pool->nsolvables);
+        FOR_PKG_SOLVABLES(solvid)
+            map_set(q->result, solvid);
+        dnf_sack_set_pkg_solvables(q->sack, q->result, pool->nsolvables);
+    }
     if (!(q->flags & HY_IGNORE_EXCLUDES)) {
         dnf_sack_recompute_considered(q->sack);
         if (pool->considered)
             map_and(q->result, pool->considered);
     }
-
-    // make sure the odd bits are cleared:
-    unsigned total_bits = q->result->size << 3;
-    for (guint i = pool->nsolvables; i < total_bits; ++i)
-        MAPCLR(q->result, i);
 }
 
 void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/hy-subject-private.c 
new/libdnf-0.11.1/libdnf/hy-subject-private.c
--- old/libdnf-0.11.0/libdnf/hy-subject-private.c       2017-10-10 
12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/libdnf/hy-subject-private.c       2017-10-16 
09:00:54.000000000 +0200
@@ -28,12 +28,18 @@
 #include "hy-iutil.h"
 #include "hy-subject-private.h"
 
+#define PKG_NAME "([^:(/=<> ]+)"
+#define PKG_EPOCH "(([0-9]+):)?"
+#define PKG_VERSION "([^-:(/=<> ]+)"
+#define PKG_RELEASE PKG_VERSION
+#define PKG_ARCH "([^-:.(/=<> ]+)"
+
 const char *nevra_form_regex[] = {
-    "^([^:]+)" "-(([0-9]+):)?" "([^-:]+)" "-(.+)" "\\.([^.]+)$",
-    "^([^:]+)" "-(([0-9]+):)?" "([^-:]+)" "-(.+)" "()$",
-    "^([^:]+)" "-(([0-9]+):)?" "([^-:]+)" "()" "()$",
-    "^([^:]+)" "()()" "()" "()" "\\.([^.]+)$",
-    "^([^:]+)()()()()()$"
+    "^" PKG_NAME "-" PKG_EPOCH PKG_VERSION "-" PKG_RELEASE "\\." PKG_ARCH "$",
+    "^" PKG_NAME "-" PKG_EPOCH PKG_VERSION "-" PKG_RELEASE          "()"  "$",
+    "^" PKG_NAME "-" PKG_EPOCH PKG_VERSION        "()"              "()"  "$",
+    "^" PKG_NAME      "()()"      "()"            "()"     "\\." PKG_ARCH "$",
+    "^" PKG_NAME      "()()"      "()"            "()"              "()"  "$"
 };
 
 #define MODULE_NAME "([-a-zA-Z0-9\\._]+)"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/hy-subject.c 
new/libdnf-0.11.1/libdnf/hy-subject.c
--- old/libdnf-0.11.0/libdnf/hy-subject.c       2017-10-10 12:37:33.000000000 
+0200
+++ new/libdnf-0.11.1/libdnf/hy-subject.c       2017-10-16 09:00:54.000000000 
+0200
@@ -33,6 +33,7 @@
 #include "hy-types.h"
 #include "hy-query.h"
 #include "hy-selector.h"
+#include "hy-util.h"
 
 // most specific to least
 const HyForm HY_FORMS_MOST_SPEC[] = {
@@ -318,12 +319,12 @@
             }
         }
         hy_possibilities_free(iter);
+        g_clear_pointer(nevra, hy_nevra_free);
         query = hy_query_create(sack);
         hy_query_filter(query, HY_PKG_NEVRA, HY_GLOB, subject);
         if (hy_query_is_not_empty(query))
             return query;
         hy_query_free(query);
-        g_clear_pointer(nevra, hy_nevra_free);
     }
     if (with_provides) {
         query = hy_query_create(sack);
@@ -333,7 +334,7 @@
         hy_query_free(query);
     }
 
-    if (with_filenames) {
+    if (with_filenames && hy_is_file_pattern(subject)) {
         query = hy_query_create(sack);
         hy_query_filter(query, HY_PKG_FILE, HY_GLOB, subject);
         return query;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf/hy-util.h 
new/libdnf-0.11.1/libdnf/hy-util.h
--- old/libdnf-0.11.0/libdnf/hy-util.h  2017-10-10 12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/libdnf/hy-util.h  2017-10-16 09:00:54.000000000 +0200
@@ -36,6 +36,18 @@
 
 gboolean hy_is_glob_pattern(const char *pattern);
 
+
+/**
+ * @brief Test if pattern is file path
+ *
+ * @param pattern Strig to analyze
+ * @return gboolean Return TRUE if pattern start with "/" or pattern[0] == '*' 
&& pattern[1] == '/'
+ */
+static inline gboolean hy_is_file_pattern(const char *pattern)
+{
+    return pattern[0] == '/' || (pattern[0] == '*' && pattern[1] == '/');
+}
+
 int hy_split_nevra(const char *nevra, char **name, int *epoch,
                    char **version, char **release, char **arch);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/libdnf.spec 
new/libdnf-0.11.1/libdnf.spec
--- old/libdnf-0.11.0/libdnf.spec       2017-10-10 12:37:33.000000000 +0200
+++ new/libdnf-0.11.1/libdnf.spec       2017-10-16 09:00:54.000000000 +0200
@@ -21,7 +21,7 @@
     %{nil}
 
 Name:           libdnf
-Version:        0.11.0
+Version:        0.11.1
 Release:        1%{?dist}
 Summary:        Library providing simplified C and Python API to libsolv
 License:        LGPLv2+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libdnf-0.11.0/python/hawkey/nevra-py.c 
new/libdnf-0.11.1/python/hawkey/nevra-py.c
--- old/libdnf-0.11.0/python/hawkey/nevra-py.c  2017-10-10 12:37:33.000000000 
+0200
+++ new/libdnf-0.11.1/python/hawkey/nevra-py.c  2017-10-16 09:00:54.000000000 
+0200
@@ -64,7 +64,9 @@
 static int
 set_epoch(_NevraObject *self, PyObject *value, void *closure)
 {
-    if (PyInt_Check(value))
+    if (value == NULL)
+        self->nevra->epoch = -1;
+    else if (PyInt_Check(value))
         self->nevra->epoch = PyLong_AsLong(value);
     else if (value == Py_None)
         self->nevra->epoch = -1;


Reply via email to