Hello community, here is the log from the commit of package libdnf for openSUSE:Factory checked in at 2020-12-09 22:10:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libdnf (Old) and /work/SRC/openSUSE:Factory/.libdnf.new.2328 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libdnf" Wed Dec 9 22:10:57 2020 rev:20 rq:853401 version:0.55.2 Changes: -------- --- /work/SRC/openSUSE:Factory/libdnf/libdnf.changes 2020-12-02 13:57:20.897745938 +0100 +++ /work/SRC/openSUSE:Factory/.libdnf.new.2328/libdnf.changes 2020-12-09 22:10:58.351039741 +0100 @@ -1,0 +2,15 @@ +Sun Dec 6 15:12:12 UTC 2020 - Neal Gompa <ngomp...@gmail.com> + +- Update to version 0.55.2 + + Improve performance of query installed() and available() + + Swdb: Add a method to get the current transaction + + [modules] Add special handling for src artifacts (rh#1809314) + + Better msgs if "basecachedir" or "proxy_password" isn't set (rh#1888946) + + Add new options module_stream_switch + + Support allow_vendor_change setting in dnf context API +- Drop patches incorporated into this release + + Patch: 0001-Support-allow_vendor_change-setting-in-dnf-context-A.patch + + Patch: 0001-context-dnf_keyring_add_public_keys-not-generate-err.patch +- Use cmake_build and cmake_install macros + +------------------------------------------------------------------- Old: ---- 0001-Support-allow_vendor_change-setting-in-dnf-context-A.patch 0001-context-dnf_keyring_add_public_keys-not-generate-err.patch libdnf-0.55.0.tar.gz New: ---- libdnf-0.55.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libdnf.spec ++++++ --- /var/tmp/diff_new_pack.RRn2ie/_old 2020-12-09 22:10:59.067040467 +0100 +++ /var/tmp/diff_new_pack.RRn2ie/_new 2020-12-09 22:10:59.071040471 +0100 @@ -33,7 +33,7 @@ %define devname %{name}-devel Name: libdnf -Version: 0.55.0 +Version: 0.55.2 Release: 0 Summary: Library providing C and Python APIs atop libsolv License: LGPL-2.1-or-later @@ -42,8 +42,7 @@ Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # Backports from upstream -Patch0001: 0001-Support-allow_vendor_change-setting-in-dnf-context-A.patch -Patch0002: 0001-context-dnf_keyring_add_public_keys-not-generate-err.patch + # openSUSE specific fixes ## Fix libdnf build with static libsolvext @@ -159,7 +158,7 @@ %build %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} %{!?with_valgrind:-DDISABLE_VALGRIND=1} -%make_build +%cmake_build %if %{with check} %check @@ -181,9 +180,7 @@ %endif %install -pushd build - %make_install -popd + %cmake_install %find_lang %{name} ++++++ libdnf-0.55.0.tar.gz -> libdnf-0.55.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/CMakeLists.txt new/libdnf-0.55.2/CMakeLists.txt --- old/libdnf-0.55.0/CMakeLists.txt 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/CMakeLists.txt 2020-12-02 16:53:42.000000000 +0100 @@ -146,15 +146,8 @@ if(WITH_SANITIZERS) message(WARNING "Building with sanitizers enabled!") - set(SANITIZER_FLAGS "-fsanitize=address -fsanitize=leak -fsanitize=undefined") - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # requires: compiler-rt package on Fedora - set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -static-libsan") - else() - set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -static-libasan -static-liblsan -static-libubsan") - endif() - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZER_FLAGS}") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${SANITIZER_FLAGS}") + add_compile_options(-fsanitize=address -fsanitize=undefined -fsanitize=leak) + link_libraries(asan ubsan) endif() @@ -183,3 +176,6 @@ if(WITH_BINDINGS) add_subdirectory(python/hawkey) endif() + + +add_subdirectory(etc) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/VERSION.cmake new/libdnf-0.55.2/VERSION.cmake --- old/libdnf-0.55.0/VERSION.cmake 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/VERSION.cmake 2020-12-02 16:53:42.000000000 +0100 @@ -1,6 +1,6 @@ set (DEFAULT_LIBDNF_MAJOR_VERSION 0) set (DEFAULT_LIBDNF_MINOR_VERSION 55) -set (DEFAULT_LIBDNF_MICRO_VERSION 0) +set (DEFAULT_LIBDNF_MICRO_VERSION 2) if(DEFINED LIBDNF_MAJOR_VERSION) if(NOT ${DEFAULT_LIBDNF_MAJOR_VERSION} STREQUAL ${LIBDNF_MAJOR_VERSION}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/docs/release_notes.rst new/libdnf-0.55.2/docs/release_notes.rst --- old/libdnf-0.55.0/docs/release_notes.rst 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/docs/release_notes.rst 2020-12-02 16:53:42.000000000 +0100 @@ -20,6 +20,25 @@ ###################### ==================== +0.55.2 Release Notes +==================== + +- Add a dnf sanitizers wrapper to /etc/profile.d +- Improve performance of query installed() and available() +- Swdb: Add a method to get the current transaction +- [modules] Add special handling for src artifacts (RhBug:1809314) +- Better msgs if "basecachedir" or "proxy_password" isn't set (RhBug:1888946) + +- New features: + - Add new options module_stream_switch + - Support allow_vendor_change setting in dnf context API + +Bugs fixed in 0.55.2: + +* :rhbug:`1888946` +* :rhbug:`1809314` + +==================== 0.55.0 Release Notes ==================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/etc/CMakeLists.txt new/libdnf-0.55.2/etc/CMakeLists.txt --- old/libdnf-0.55.0/etc/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/libdnf-0.55.2/etc/CMakeLists.txt 2020-12-02 16:53:42.000000000 +0100 @@ -0,0 +1,3 @@ +if(WITH_SANITIZERS) + INSTALL (FILES "dnf-sanitizers.sh" DESTINATION /etc/profile.d/) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/etc/dnf-sanitizers.sh new/libdnf-0.55.2/etc/dnf-sanitizers.sh --- old/libdnf-0.55.0/etc/dnf-sanitizers.sh 1970-01-01 01:00:00.000000000 +0100 +++ new/libdnf-0.55.2/etc/dnf-sanitizers.sh 2020-12-02 16:53:42.000000000 +0100 @@ -0,0 +1,5 @@ +function dnf { + ASAN_OPTIONS=verify_asan_link_order=0 /usr/bin/dnf "$@" +} + +export -f dnf diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/conf/ConfigMain.cpp new/libdnf-0.55.2/libdnf/conf/ConfigMain.cpp --- old/libdnf-0.55.0/libdnf/conf/ConfigMain.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/conf/ConfigMain.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -278,6 +278,7 @@ OptionBool downloadonly{false}; // runtime only option OptionBool ignorearch{false}; OptionString module_platform_id{nullptr}; + OptionBool module_stream_switch{false}; OptionString user_agent{getUserAgent()}; OptionBool countme{false}; @@ -434,6 +435,7 @@ owner.optBinds().add("comment", comment); owner.optBinds().add("ignorearch", ignorearch); owner.optBinds().add("module_platform_id", module_platform_id); + owner.optBinds().add("module_stream_switch", module_stream_switch); owner.optBinds().add("user_agent", user_agent); owner.optBinds().add("countme", countme); owner.optBinds().add("protect_running_kernel", protect_running_kernel); @@ -569,6 +571,7 @@ OptionBool & ConfigMain::ignorearch() { return pImpl->ignorearch; } OptionString & ConfigMain::module_platform_id() { return pImpl->module_platform_id; } +OptionBool & ConfigMain::module_stream_switch() { return pImpl->module_stream_switch; } OptionString & ConfigMain::user_agent() { return pImpl->user_agent; } OptionBool & ConfigMain::countme() { return pImpl->countme; } OptionBool & ConfigMain::protect_running_kernel() {return pImpl->protect_running_kernel; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/conf/ConfigMain.hpp new/libdnf-0.55.2/libdnf/conf/ConfigMain.hpp --- old/libdnf-0.55.0/libdnf/conf/ConfigMain.hpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/conf/ConfigMain.hpp 2020-12-02 16:53:42.000000000 +0100 @@ -125,6 +125,7 @@ OptionBool & ignorearch(); OptionString & module_platform_id(); + OptionBool & module_stream_switch(); OptionString & user_agent(); OptionBool & countme(); OptionBool & protect_running_kernel(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/dnf-context.cpp new/libdnf-0.55.2/libdnf/dnf-context.cpp --- old/libdnf-0.55.0/libdnf/dnf-context.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/dnf-context.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -933,6 +933,22 @@ } /** + * dnf_context_get_allow_vendor_change: + * + * Gets allow_vendor_change global configuration value. + * + * Returns: %TRUE if changing vendors in a transaction is allowed + * + * Since: 0.55.2 + */ +gboolean +dnf_context_get_allow_vendor_change() +{ + auto & mainConf = libdnf::getGlobalMainConfig(); + return mainConf.allow_vendor_change().getValue(); +} + +/** * dnf_context_get_check_disk_space: * @context: a #DnfContext instance. * @@ -1410,6 +1426,20 @@ } /** + * dnf_context_set_allow_vendor_change: + * + * Sets allow_vendor_change global configuration value. + * + * Since: 0.55.2 + */ +void +dnf_context_set_allow_vendor_change(gboolean vendorchange) +{ + auto & mainConf = libdnf::getGlobalMainConfig(); + mainConf.allow_vendor_change().set(libdnf::Option::Priority::RUNTIME, vendorchange); +} + +/** * dnf_context_set_cache_only: * @context: a #DnfContext instance. * @cache_only: %TRUE to use only metadata from cache @@ -1725,12 +1755,15 @@ DnfContextPrivate *priv = GET_PRIVATE(context); gboolean ret; g_autofree gchar *solv_dir_real = nullptr; + gboolean vendorchange; /* create empty sack */ solv_dir_real = dnf_realpath(priv->solv_dir); + vendorchange = dnf_context_get_allow_vendor_change(); priv->sack = dnf_sack_new(); dnf_sack_set_cachedir(priv->sack, solv_dir_real); dnf_sack_set_rootdir(priv->sack, priv->install_root); + dnf_sack_set_allow_vendor_change(priv->sack, vendorchange); if (priv->arch) { if(!dnf_sack_set_arch(priv->sack, priv->arch, error)) { return FALSE; @@ -2389,7 +2422,7 @@ /* find installed packages to remove */ query = hy_query_create(priv->sack); - hy_query_filter(query, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + query->installed(); hy_query_filter(query, HY_PKG_NAME, HY_EQ, name); pkglist = hy_query_run(query); @@ -3054,7 +3087,7 @@ } for (auto iter = stream_dict.begin(); iter != stream_dict.end(); ) { if (iter->first != enabledOrDefaultStream) { - stream_dict.erase(iter); + stream_dict.erase(iter++); } else { ++iter; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/dnf-context.h new/libdnf-0.55.2/libdnf/dnf-context.h --- old/libdnf-0.55.0/libdnf/dnf-context.h 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/dnf-context.h 2020-12-02 16:53:42.000000000 +0100 @@ -132,6 +132,7 @@ const gchar **dnf_context_get_installonly_pkgs (DnfContext *context); gboolean dnf_context_get_best (void); gboolean dnf_context_get_install_weak_deps (void); +gboolean dnf_context_get_allow_vendor_change (void); gboolean dnf_context_get_cache_only (DnfContext *context); gboolean dnf_context_get_check_disk_space (DnfContext *context); gboolean dnf_context_get_check_transaction (DnfContext *context); @@ -185,6 +186,7 @@ const gchar *source_root); void dnf_context_set_best (gboolean best); void dnf_context_set_install_weak_deps (gboolean enabled); +void dnf_context_set_allow_vendor_change (gboolean vendorchange); void dnf_context_set_cache_only (DnfContext *context, gboolean cache_only); void dnf_context_set_check_disk_space (DnfContext *context, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/dnf-keyring.cpp new/libdnf-0.55.2/libdnf/dnf-keyring.cpp --- old/libdnf-0.55.0/libdnf/dnf-keyring.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/dnf-keyring.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -189,11 +189,17 @@ const gchar *gpg_dir = "/etc/pki/rpm-gpg"; gboolean ret = TRUE; g_autoptr(GDir) dir = NULL; + GError *localError = NULL; /* search all the public key files */ - dir = g_dir_open(gpg_dir, 0, error); - if (dir == NULL) - return FALSE; + dir = g_dir_open(gpg_dir, 0, &localError); + if (dir == NULL) { + if (localError->domain != G_FILE_ERROR || localError->code != G_FILE_ERROR_NOENT) { + g_warning("%s", localError->message); + } + g_error_free(localError); + return TRUE; + } do { const gchar *filename; g_autofree gchar *path_tmp = NULL; @@ -201,7 +207,6 @@ if (filename == NULL) break; path_tmp = g_build_filename(gpg_dir, filename, NULL); - GError *localError = NULL; ret = dnf_keyring_add_public_key(keyring, path_tmp, &localError); if (!ret) { g_warning("%s", localError->message); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/dnf-sack.cpp new/libdnf-0.55.2/libdnf/dnf-sack.cpp --- old/libdnf-0.55.0/libdnf/dnf-sack.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/dnf-sack.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -2335,20 +2335,29 @@ { dnf_sack_set_module_excludes(sack, nullptr); std::vector<std::string> names; + std::vector<std::string> srcNames; libdnf::DependencyContainer nameDependencies{sack}; libdnf::Nevra nevra; for (const auto &rpm : includeNEVRAs) { if (nevra.parse(rpm.c_str(), HY_FORM_NEVRA)) { - names.push_back(nevra.getName()); - nameDependencies.addReldep(nevra.getName().c_str()); + auto arch = nevra.getArch(); + // source packages do not provide anything and must not cause excluding binary packages + if (arch == "src" || arch == "nosrc") { + srcNames.push_back(nevra.getName()); + } else { + names.push_back(nevra.getName()); + nameDependencies.addReldep(nevra.getName().c_str()); + } } } std::vector<const char *> namesCString(names.size() + 1); + std::vector<const char *> srcNamesCString(srcNames.size() + 1); std::vector<const char *> excludeNEVRAsCString(excludeNEVRAs.size() + 1); std::vector<const char *> includeNEVRAsCString(includeNEVRAs.size() + 1); transform(names.begin(), names.end(), namesCString.begin(), std::mem_fn(&std::string::c_str)); + transform(srcNames.begin(), srcNames.end(), srcNamesCString.begin(), std::mem_fn(&std::string::c_str)); transform(excludeNEVRAs.begin(), excludeNEVRAs.end(), excludeNEVRAsCString.begin(), std::mem_fn(&std::string::c_str)); transform(includeNEVRAs.begin(), includeNEVRAs.end(), includeNEVRAsCString.begin(), @@ -2363,6 +2372,7 @@ libdnf::Query excludeQuery{keepPackages}; libdnf::Query excludeProvidesQuery{keepPackages}; libdnf::Query excludeNamesQuery(keepPackages); + libdnf::Query excludeSrcNamesQuery(keepPackages); includeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, includeNEVRAsCString.data()); excludeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, excludeNEVRAsCString.data()); @@ -2372,8 +2382,14 @@ excludeProvidesQuery.addFilter(HY_PKG_PROVIDES, &nameDependencies); excludeProvidesQuery.queryDifference(includeQuery); - // Requred to filtrate out source packages and packages with incompatible architectures + // Search for source packages with same names as included source artifacts + excludeSrcNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, srcNamesCString.data()); + const char * srcArchs[] = {"src", "nosrc", nullptr}; + excludeSrcNamesQuery.addFilter(HY_PKG_ARCH, HY_EQ, srcArchs); + + // Required to filtrate out source packages and packages with incompatible architectures excludeNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, namesCString.data()); + excludeNamesQuery.queryUnion(excludeSrcNamesQuery); excludeNamesQuery.queryDifference(includeQuery); dnf_sack_set_module_excludes(sack, excludeQuery.getResultPset()); @@ -2463,7 +2479,7 @@ // iterate all @System repo RPMs (rpmdb records) libdnf::Query query{sack, libdnf::Query::ExcludeFlags::IGNORE_EXCLUDES}; - query.addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + query.installed(); auto pset = query.getResultPset(); Id id = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/goal/Goal.cpp new/libdnf-0.55.2/libdnf/goal/Goal.cpp --- old/libdnf-0.55.0/libdnf/goal/Goal.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/goal/Goal.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -711,7 +711,7 @@ pImpl->actions = static_cast<DnfGoalActions>(pImpl->actions | DNF_DISTUPGRADE|DNF_ALLOW_DOWNGRADE); DnfSack * sack = pImpl->sack; Query query(sack); - query.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); + query.available(); Selector selector(sack); selector.set(query.runSet()); sltrToJob(&selector, &pImpl->staging, SOLVER_DISTUPGRADE); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/hy-iutil.cpp new/libdnf-0.55.2/libdnf/hy-iutil.cpp --- old/libdnf-0.55.0/libdnf/hy-iutil.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/hy-iutil.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -459,6 +459,27 @@ return strcpy(dup, s); } +static Id +running_kernel_check_path(DnfSack *sack, const char *fn) +{ + if (access(fn, F_OK)) + g_debug("running_kernel_check_path(): no matching file: %s.", fn); + + HyQuery q = hy_query_create_flags(sack, HY_IGNORE_EXCLUDES); + dnf_sack_make_provides_ready(sack); + q->installed(); + hy_query_filter(q, HY_PKG_FILE, HY_EQ, fn); + DnfPackageSet *pset = hy_query_run_set(q); + + Id id = -1; + id = pset->next(id); + + delete pset; + hy_query_free(q); + + return id; +} + Id running_kernel(DnfSack *sack) { @@ -469,19 +490,14 @@ g_debug("uname(): %s", g_strerror(errno)); return -1; } + char *fn = pool_tmpjoin(pool, "/boot/vmlinuz-", un.release, NULL); - if (access(fn, F_OK)) - g_debug("running_kernel(): no matching file: %s.", fn); + Id kernel_id = running_kernel_check_path(sack, fn); - Id kernel_id = -1; - HyQuery q = hy_query_create_flags(sack, HY_IGNORE_EXCLUDES); - dnf_sack_make_provides_ready(sack); - hy_query_filter(q, HY_PKG_FILE, HY_EQ, fn); - hy_query_filter(q, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); - DnfPackageSet *pset = hy_query_run_set(q); - kernel_id = pset->next(kernel_id); - delete pset; - hy_query_free(q); + if (kernel_id < 0) { + fn = pool_tmpjoin(pool, "/lib/modules/", un.release, NULL); + kernel_id = running_kernel_check_path(sack, fn); + } if (kernel_id >= 0) g_debug("running_kernel(): %s.", id2nevra(pool, kernel_id)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/hy-subject.cpp new/libdnf-0.55.2/libdnf/hy-subject.cpp --- old/libdnf-0.55.0/libdnf/hy-subject.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/hy-subject.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -108,7 +108,7 @@ } if (reponame != NULL) { HyQuery installed_query = hy_query_clone(query); - hy_query_filter(installed_query, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + installed_query->installed(); hy_query_filter(query, HY_PKG_REPONAME, HY_EQ, reponame); hy_query_union(query, installed_query); hy_query_free(installed_query); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/module/ModulePackage.cpp new/libdnf-0.55.2/libdnf/module/ModulePackage.cpp --- old/libdnf-0.55.0/libdnf/module/ModulePackage.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/module/ModulePackage.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -504,7 +504,7 @@ baseQuery.addFilter(HY_PKG_LATEST, HY_EQ, 1); baseQuery.apply(); Query availableQuery(baseQuery); - availableQuery.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); + availableQuery.available(); auto platform = availableQuery.getStringsFromProvide("base-module"); auto platformSize = platform.size(); if (platformSize == 1) { @@ -517,7 +517,7 @@ name = parsedPlatform.first; stream = parsedPlatform.second; } else { - baseQuery.addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + baseQuery.installed(); platform = baseQuery.getStringsFromProvide("base-module"); platformSize = platform.size(); if (platformSize == 1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/module/ModulePackageContainer.cpp new/libdnf-0.55.2/libdnf/module/ModulePackageContainer.cpp --- old/libdnf-0.55.0/libdnf/module/ModulePackageContainer.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/module/ModulePackageContainer.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -672,7 +672,7 @@ std::vector<ModulePackage *> result; Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES); // platform modules are installed and not in modules std::Map. - query.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); + query.available(); std::ostringstream ss; ss << subject << "*"; query.addFilter(HY_PKG_NAME, HY_GLOB, ss.str().c_str()); @@ -692,7 +692,7 @@ std::vector<ModulePackage *> result; Query query(pImpl->moduleSack, Query::ExcludeFlags::IGNORE_EXCLUDES); // platform modules are installed and not in modules std::Map. - query.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); + query.available(); std::ostringstream ss; ss << stringFormater(name) << ":" << stringFormater(stream); ss << ":" << stringFormater(version) << ":"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/repo/Repo.cpp new/libdnf-0.55.2/libdnf/repo/Repo.cpp --- old/libdnf-0.55.0/libdnf/repo/Repo.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/repo/Repo.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -484,8 +484,12 @@ handleSetOpt(h.get(), LRO_LOCAL, 1L); #ifdef LRO_SUPPORTS_CACHEDIR /* If zchunk is enabled, set librepo cache dir */ - if (conf->getMasterConfig().zchunk().getValue()) + if (conf->getMasterConfig().zchunk().getValue()) { + if (conf->basecachedir().empty()) { + throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id)); + } handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str()); + } #endif return h; } @@ -526,6 +530,9 @@ handleSetOpt(h.get(), LRO_METALINKURL, tmp.c_str()); } handleSetOpt(h.get(), LRO_FASTESTMIRROR, conf->fastestmirror().getValue() ? 1L : 0L); + if (conf->basecachedir().empty()) { + throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id)); + } auto fastestMirrorCacheDir = conf->basecachedir().getValue(); if (fastestMirrorCacheDir.back() != '/') fastestMirrorCacheDir.push_back('/'); @@ -569,8 +576,12 @@ #ifdef LRO_SUPPORTS_CACHEDIR /* If zchunk is enabled, set librepo cache dir */ - if (conf->getMasterConfig().zchunk().getValue()) + if (conf->getMasterConfig().zchunk().getValue()) { + if (conf->basecachedir().empty()) { + throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id)); + } handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str()); + } #endif auto minrate = conf->minrate().getValue(); @@ -610,6 +621,9 @@ if (!conf->proxy_username().empty()) { userpwd = conf->proxy_username().getValue(); if (!userpwd.empty()) { + if (conf->proxy_password().empty()) { + throw RepoError(tfm::format(_("repo '%s': 'proxy_username' is set but not 'proxy_password'"), id)); + } userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true); handleSetOpt(h.get(), LRO_PROXYUSERPWD, userpwd.c_str()); } @@ -1346,6 +1360,9 @@ std::string Repo::Impl::getCachedir() const { + if (conf->basecachedir().empty()) { + throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id)); + } auto repodir(conf->basecachedir().getValue()); if (repodir.back() != '/') repodir.push_back('/'); @@ -1690,6 +1707,9 @@ if (!conf->proxy_username().empty()) { auto userpwd = conf->proxy_username().getValue(); if (!userpwd.empty()) { + if (conf->proxy_password().empty()) { + throw RepoError(_("'proxy_username' is set but not 'proxy_password'")); + } userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true); handleSetOpt(h, LRO_PROXYUSERPWD, userpwd.c_str()); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/sack/query.cpp new/libdnf-0.55.2/libdnf/sack/query.cpp --- old/libdnf-0.55.0/libdnf/sack/query.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/sack/query.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -2086,7 +2086,7 @@ Goal goal(sack); Pool *pool = dnf_sack_get_pool(sack); Query installed(sack); - installed.addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + installed.installed(); auto userInstalled = installed.getResultPset(); swdb.filterUserinstalled(*userInstalled); @@ -2314,8 +2314,7 @@ auto resultMap = pImpl->result->getMap(); Query query_installed(*this); - query_installed.addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); - query_installed.apply(); + query_installed.installed(); MAPZERO(resultMap); if (query_installed.size() == 0) { return; @@ -2324,8 +2323,7 @@ // create query with available packages without non-modular excludes. As a extras should be // considered anso packages in non-active modules Query query_available(pImpl->sack, Query::ExcludeFlags::IGNORE_REGULAR_EXCLUDES); - query_available.addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); - query_available.apply(); + query_available.available(); auto resultAvailable = query_available.pImpl->result.get(); Id id_available = -1; @@ -2378,8 +2376,7 @@ IdQueue samename; Pool *pool = dnf_sack_get_pool(pImpl->sack); - addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); - apply(); + installed(); auto resultMap = pImpl->result->getMap(); hy_query_to_name_ordered_queue(this, &samename); @@ -2497,10 +2494,69 @@ void Query::filterUserInstalled(const Swdb &swdb) { - addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + installed(); swdb.filterUserinstalled(*getResultPset()); } +void +Query::installed() +{ + apply(); + Pool * pool = dnf_sack_get_pool(pImpl->sack); + auto * installed_repo = pool->installed; + auto queryResult = pImpl->result.get(); + if (installed_repo == nullptr) { + queryResult->clear(); + return; + } + Map filterResult; + map_init(&filterResult, pool->nsolvables); + Id pkgId = installed_repo->start; + if (!queryResult->has(pkgId)) { + pkgId = queryResult->next(pkgId); + } + for (; pkgId != -1; pkgId = queryResult->next(pkgId)) { + Solvable * solvable = pool_id2solvable(pool, pkgId); + if (solvable->repo == installed_repo) { + MAPSET(&filterResult, pkgId); + continue; + } + if (pkgId < installed_repo->end) { + continue; + } + break; + } + map_and(queryResult->getMap(), &filterResult); + map_free(&filterResult); +} + +void +Query::available() +{ + apply(); + Pool * pool = dnf_sack_get_pool(pImpl->sack); + auto * installed_repo = pool->installed; + if (installed_repo == nullptr) { + return; + } + auto queryResult = pImpl->result.get(); + Id pkgId = installed_repo->start; + if (!queryResult->has(pkgId)) { + pkgId = queryResult->next(pkgId); + } + for (; pkgId != -1; pkgId = queryResult->next(pkgId)) { + Solvable * solvable = pool_id2solvable(pool, pkgId); + if (solvable->repo == installed_repo) { + queryResult->remove(pkgId); + continue; + } + if (pkgId < installed_repo->end) { + continue; + } + break; + } +} + std::pair<bool, std::unique_ptr<Nevra>> Query::filterSubject(const char * subject, HyForm * forms, bool icase, bool with_nevra, bool with_provides, bool with_filenames) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/sack/query.hpp new/libdnf-0.55.2/libdnf/sack/query.hpp --- old/libdnf-0.55.0/libdnf/sack/query.hpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/sack/query.hpp 2020-12-02 16:53:42.000000000 +0100 @@ -179,6 +179,14 @@ int filterSafeToRemove(const Swdb &swdb, bool debug_solver); void getAdvisoryPkgs(int cmpType, std::vector<AdvisoryPkg> & advisoryPkgs); void filterUserInstalled(const Swdb &swdb); + /** + * @brief Applies all filters and keep only installed packages + */ + void installed(); + /** + * @brief Applies all filters and keep only available packages + */ + void available(); /** * @brief Apply query and return a set of strings representing information in provide that begin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/transaction/Swdb.cpp new/libdnf-0.55.2/libdnf/transaction/Swdb.cpp --- old/libdnf-0.55.0/libdnf/transaction/Swdb.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/transaction/Swdb.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -172,8 +172,7 @@ if (transactionInProgress) { throw std::logic_error(_("In progress")); } - transactionInProgress = std::unique_ptr< swdb_private::Transaction >( - new swdb_private::Transaction(conn)); + transactionInProgress = std::make_shared< swdb_private::Transaction >(conn); itemsInProgress.clear(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf/transaction/Swdb.hpp new/libdnf-0.55.2/libdnf/transaction/Swdb.hpp --- old/libdnf-0.55.0/libdnf/transaction/Swdb.hpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf/transaction/Swdb.hpp 2020-12-02 16:53:42.000000000 +0100 @@ -77,6 +77,8 @@ std::vector< TransactionPtr > listTransactions(); // std::vector<long long> transactionIds); + TransactionPtr getCurrent() { return std::dynamic_pointer_cast<Transaction>(transactionInProgress); } + // TransactionItems TransactionItemPtr addItem(ItemPtr item, const std::string &repoid, @@ -125,7 +127,7 @@ explicit Swdb(SQLite3Ptr conn, bool autoClose); SQLite3Ptr conn; bool autoClose; - std::unique_ptr< swdb_private::Transaction > transactionInProgress = nullptr; + std::shared_ptr< swdb_private::Transaction > transactionInProgress = nullptr; std::map< std::string, TransactionItemPtr > itemsInProgress; private: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/libdnf.spec new/libdnf-0.55.2/libdnf.spec --- old/libdnf-0.55.0/libdnf.spec 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/libdnf.spec 2020-12-02 16:53:42.000000000 +0100 @@ -5,7 +5,7 @@ %global swig_version 3.0.12 %global libdnf_major_version 0 %global libdnf_minor_version 55 -%global libdnf_micro_version 0 +%global libdnf_micro_version 2 %define __cmake_in_source_build 1 @@ -90,9 +90,9 @@ BuildRequires: gpgme-devel %if %{with sanitizers} -BuildRequires: libasan-static -BuildRequires: liblsan-static -BuildRequires: libubsan-static +BuildRequires: libasan +BuildRequires: liblsan +BuildRequires: libubsan %endif Requires: libmodulemd%{?_isa} >= %{libmodulemd_version} @@ -280,6 +280,9 @@ %dir %{_libdir}/libdnf/ %dir %{_libdir}/libdnf/plugins/ %{_libdir}/libdnf/plugins/README +%if %{with sanitizers} +%{_sysconfdir}/profile.d/dnf-sanitizers.sh +%endif %files devel %doc %{_datadir}/gtk-doc/html/%{name}/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/python/hawkey/query-py.cpp new/libdnf-0.55.2/python/hawkey/query-py.cpp --- old/libdnf-0.55.0/python/hawkey/query-py.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/python/hawkey/query-py.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -565,7 +565,7 @@ add_available_filter(_QueryObject *self, PyObject *unused) try { HyQuery query = new libdnf::Query(*self->query); - query->addFilter(HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME); + query->available(); PyObject *final_query = queryToPyObject(query, self->sack, Py_TYPE(self)); return final_query; } CATCH_TO_PYTHON @@ -601,7 +601,7 @@ add_installed_filter(_QueryObject *self, PyObject *unused) try { HyQuery query = new libdnf::Query(*self->query); - query->addFilter(HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME); + query->installed(); PyObject *final_query = queryToPyObject(query, self->sack, Py_TYPE(self)); return final_query; } CATCH_TO_PYTHON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/python/hawkey/tests/tests/run_nosetests.in new/libdnf-0.55.2/python/hawkey/tests/tests/run_nosetests.in --- old/libdnf-0.55.0/python/hawkey/tests/tests/run_nosetests.in 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/python/hawkey/tests/tests/run_nosetests.in 2020-12-02 16:53:42.000000000 +0100 @@ -18,6 +18,16 @@ childenv = dict(os.environ) childenv['LD_LIBRARY_PATH'] = '${CMAKE_BINARY_DIR}/libdnf/' childenv['PYTHONPATH'] = '${CMAKE_BINARY_DIR}/python/hawkey' + +# This fixes the "ASan runtime does not come first in initial library list" +# message when built with sanitizers. Note the better solution should be to use +# LD_PRELOAD for the sanitizer library. With the solution used here the +# sanitizer library is loaded when the DSO linked against it is loaded. For any +# calls up to that point the sanitizers aren't active. While hackish, this is +# convenient because python is causing some leaks during module loading which +# this works around. +childenv['ASAN_OPTIONS'] = 'verify_asan_link_order=0' + subprocess.check_call(['${PYTHON_EXECUTABLE}', '-m', 'nose', '--with-xunit', '--xunit-file=xunit.xml', '-s', '-v', '${CMAKE_CURRENT_SOURCE_DIR}'], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libdnf-0.55.0/tests/hawkey/test_query.cpp new/libdnf-0.55.2/tests/hawkey/test_query.cpp --- old/libdnf-0.55.0/tests/hawkey/test_query.cpp 2020-11-09 15:42:13.000000000 +0100 +++ new/libdnf-0.55.2/tests/hawkey/test_query.cpp 2020-12-02 16:53:42.000000000 +0100 @@ -128,6 +128,25 @@ } END_TEST +START_TEST(test_query_installed_available) +{ + HyQuery q; + + q = hy_query_create(test_globals.sack); + q->installed(); + + fail_unless(query_count_results(q) == TEST_EXPECT_SYSTEM_NSOLVABLES); + + hy_query_free(q); + + q = hy_query_create(test_globals.sack); + q->available(); + fail_if(query_count_results(q)); + + hy_query_free(q); +} +END_TEST + START_TEST(test_query_name) { HyQuery q; @@ -1028,6 +1047,7 @@ tcase_add_test(tc, test_query_clone); tcase_add_test(tc, test_query_empty); tcase_add_test(tc, test_query_repo); + tcase_add_test(tc, test_query_installed_available); tcase_add_test(tc, test_query_name); tcase_add_test(tc, test_query_evr); tcase_add_test(tc, test_query_epoch); _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org