[packages/rpm/rpm.org] - add supoort for uname() deps
baggins
baggins at pld-linux.org
Wed Oct 21 16:05:18 CEST 2020
commit f16801b5b5703449949812336f5d8140985326e4
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Wed Oct 21 16:04:48 2020 +0200
- add supoort for uname() deps
rpm.spec | 2 ++
uname-deps.patch | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+)
---
diff --git a/rpm.spec b/rpm.spec
index 246a402..1280ac6 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -70,6 +70,7 @@ Patch16: rpm5-db-compat.patch
Patch17: python-internal-build.patch
Patch18: rpmversion.patch
Patch19: pkgconfig.patch
+Patch20: uname-deps.patch
URL: https://rpm.org/
BuildRequires: db-devel >= %{db_ver}
BuildRequires: autoconf >= 2.63
@@ -555,6 +556,7 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
%patch17 -p1
%patch18 -p1
%patch19 -p1
+%patch20 -p1
install %{SOURCE15} scripts/perl.prov.in
diff --git a/uname-deps.patch b/uname-deps.patch
new file mode 100644
index 0000000..dfe76a7
--- /dev/null
+++ b/uname-deps.patch
@@ -0,0 +1,98 @@
+diff --git a/lib/depends.c b/lib/depends.c
+index 28a4a784d..1d8ce1f8a 100644
+--- a/lib/depends.c
++++ b/lib/depends.c
+@@ -690,6 +690,17 @@ retry:
+ goto unsatisfied;
+ }
+
++ char * N = rpmdsN(dep);
++ if (strstr(N, "uname") == N) {
++ if (tsmem->uname == NULL)
++ rpmdsUnamePool(rpmtsPool(ts), &(tsmem->uname), NULL);
++
++ if (tsmem->uname != NULL && rpmdsSearch(tsmem->uname, dep) >= 0) {
++ rpmdsNotify(dep, "(uname provides)", rc);
++ goto exit;
++ }
++ }
++
+ /* Dont look at pre-requisites of already installed packages */
+ if (!adding && isTransientReq(dsflags))
+ goto exit;
+diff --git a/lib/rpmds.c b/lib/rpmds.c
+index f7ee76392..754969e39 100644
+--- a/lib/rpmds.c
++++ b/lib/rpmds.c
+@@ -2,6 +2,7 @@
+ * \file lib/rpmds.c
+ */
+ #include "system.h"
++#include <sys/utsname.h>
+
+ #include <rpm/rpmtypes.h>
+ #include <rpm/rpmlib.h> /* rpmvercmp */
+@@ -1596,3 +1597,51 @@ rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op,
+ return rc;
+ }
+
++int rpmdsUnamePool(rpmstrPool pool, rpmds * dsp)
++{
++ int rc = -1;
++ static const char * NS = "uname";
++ struct utsname un;
++ rpmds ds;
++
++ if (uname(&un) < 0)
++ goto exit;
++
++ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(sysname)", un.sysname, RPMSENSE_EQUAL);
++ rc = rpmdsMerge(dsp, ds);
++ rpmdsFree(ds);
++ if (rc < 0)
++ goto exit;
++ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(nodename)", un.nodename, RPMSENSE_EQUAL);
++ rc = rpmdsMerge(dsp, ds);
++ rpmdsFree(ds);
++ if (rc < 0)
++ goto exit;
++ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(release)", un.release, RPMSENSE_EQUAL);
++ rc = rpmdsMerge(dsp, ds);
++ rpmdsFree(ds);
++ if (rc < 0)
++ goto exit;
++ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(machine)", un.machine, RPMSENSE_EQUAL);
++ rc = rpmdsMerge(dsp, ds);
++ rpmdsFree(ds);
++ if (rc < 0)
++ goto exit;
++#if defined(__linux__)
++ ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(domainname)", un.domainname, RPMSENSE_EQUAL);
++ rc = rpmdsMerge(dsp, ds);
++ rpmdsFree(ds);
++ if (rc < 0)
++ goto exit;
++#endif
++exit:
++ /* freeze the pool to save memory, but only if private pool */
++ if (*dsp && (*dsp)->pool != pool)
++ rpmstrPoolFreeze((*dsp)->pool, 0);
++ return (rc < 0) ? -1 : 0;
++}
++
++int rpmdsUname(rpmds * dsp)
++{
++ return rpmdsUnamePool(NULL, dsp);
++}
+diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h
+index e69ef2584..ecdb12f0c 100644
+--- a/lib/rpmts_internal.h
++++ b/lib/rpmts_internal.h
+@@ -21,6 +21,7 @@ typedef struct tsMembers_s {
+ rpmal addedPackages; /*!< Set of packages being installed. */
+
+ rpmds rpmlib; /*!< rpmlib() dependency set. */
++ rpmds uname; /*!< uname() dependency set. */
+ rpmte * order; /*!< Packages sorted by dependencies. */
+ int orderCount; /*!< No. of transaction elements. */
+ int orderAlloced; /*!< No. of allocated transaction elements. */
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/f16801b5b5703449949812336f5d8140985326e4
More information about the pld-cvs-commit
mailing list