From: Michael Schroeder Date: Mon, 23 Jun 2014 14:44:48 +0000 (+0200) Subject: support -X option in rpmmd2solv, make add_autopattern available in bindings X-Git-Tag: 0.6.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a52836206e91b14de83ffa1f9cce7194066f314f;p=thirdparty%2Flibsolv.git support -X option in rpmmd2solv, make add_autopattern available in bindings --- diff --git a/bindings/solv.i b/bindings/solv.i index 68161832..2d8f7752 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -497,6 +497,9 @@ typedef int bool; #ifdef ENABLE_ARCHREPO #include "repo_arch.h" #endif +#ifdef SUSE +#include "repo_autopattern.h" +#endif #include "solv_xfopen.h" /* for old ruby versions */ @@ -1603,6 +1606,11 @@ rb_eval_string( XSolvable *add_arch_pkg(const char *name, int flags = 0) { return new_XSolvable($self->pool, repo_add_arch_pkg($self, name, flags)); } +#endif +#ifdef SUSE + bool add_autopattern(int flags = 0) { + return repo_add_autopattern($self, flags) == 0; + } #endif void internalize() { repo_internalize($self); diff --git a/src/solvable.c b/src/solvable.c index b3e73a62..815e9f08 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -746,10 +746,6 @@ pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *con * both solvables need to come from the same pool */ -#warning HOTFIX [Bug 881493] New: zypper dup does always update sles-release -inline int isProduct(const char *name) -{ return name && strncmp(name, "product:", 8) == 0; } - int solvable_identical(Solvable *s1, Solvable *s2) { @@ -763,12 +759,14 @@ solvable_identical(Solvable *s1, Solvable *s2) if (s1->evr != s2->evr) return 0; - if (isProduct(pool_id2str(s1->repo->pool, s1->name))) // HOTFIX [Bug 881493] end check for products here - return 1; - - /* map missing vendor to empty string */ + /* check vendor, map missing vendor to empty string */ if ((s1->vendor ? s1->vendor : 1) != (s2->vendor ? s2->vendor : 1)) - return 0; + { + /* workaround for bug 881493 */ + if (s1->repo && !strncmp(pool_id2str(s1->repo->pool, s1->name), "product:", 8)) + return 1; + return 0; + } /* looking good, try some fancier stuff */ /* might also look up the package checksum here */ @@ -781,6 +779,9 @@ solvable_identical(Solvable *s1, Solvable *s2) } else { + /* workaround for bug 881493 */ + if (s1->repo && !strncmp(pool_id2str(s1->repo->pool, s1->name), "product:", 8)) + return 1; /* look at requires in a last attempt to find recompiled packages */ rq1 = rq2 = 0; if (s1->requires) diff --git a/tools/rpmmd2solv.c b/tools/rpmmd2solv.c index ee39eac9..d4fe2ff7 100644 --- a/tools/rpmmd2solv.c +++ b/tools/rpmmd2solv.c @@ -19,6 +19,9 @@ #include "pool.h" #include "repo.h" #include "repo_rpmmd.h" +#ifdef SUSE +#include "repo_autopattern.h" +#endif #include "common_write.h" #include "solv_xfopen.h" @@ -44,11 +47,14 @@ main(int argc, char **argv) const char *basefile = 0; const char *dir = 0; const char *locale = 0; +#ifdef SUSE + int add_auto = 0; +#endif Pool *pool = pool_create(); Repo *repo = repo_create(pool, ""); - while ((c = getopt (argc, argv, "hn:b:d:l:")) >= 0) + while ((c = getopt (argc, argv, "hn:b:d:l:X")) >= 0) { switch(c) { @@ -67,6 +73,11 @@ main(int argc, char **argv) case 'l': locale = optarg; break; + case 'X': +#ifdef SUSE + add_auto = 1; +#endif + break; default: usage(1); break; @@ -142,6 +153,10 @@ main(int argc, char **argv) exit(1); } } +#ifdef SUSE + if (add_auto) + repo_add_autopattern(repo, 0); +#endif tool_write(repo, basefile, attrname); pool_free(pool); exit(0);