]>
Commit | Line | Data |
---|---|---|
f16801b5 JR |
1 | diff --git a/lib/depends.c b/lib/depends.c |
2 | index 28a4a784d..1d8ce1f8a 100644 | |
3 | --- a/lib/depends.c | |
4 | +++ b/lib/depends.c | |
5 | @@ -690,6 +690,17 @@ retry: | |
6 | goto unsatisfied; | |
7 | } | |
8 | ||
9 | + char * N = rpmdsN(dep); | |
10 | + if (strstr(N, "uname") == N) { | |
11 | + if (tsmem->uname == NULL) | |
12 | + rpmdsUnamePool(rpmtsPool(ts), &(tsmem->uname), NULL); | |
13 | + | |
14 | + if (tsmem->uname != NULL && rpmdsSearch(tsmem->uname, dep) >= 0) { | |
15 | + rpmdsNotify(dep, "(uname provides)", rc); | |
16 | + goto exit; | |
17 | + } | |
18 | + } | |
19 | + | |
20 | /* Dont look at pre-requisites of already installed packages */ | |
21 | if (!adding && isTransientReq(dsflags)) | |
22 | goto exit; | |
23 | diff --git a/lib/rpmds.c b/lib/rpmds.c | |
24 | index f7ee76392..754969e39 100644 | |
25 | --- a/lib/rpmds.c | |
26 | +++ b/lib/rpmds.c | |
27 | @@ -2,6 +2,7 @@ | |
28 | * \file lib/rpmds.c | |
29 | */ | |
30 | #include "system.h" | |
31 | +#include <sys/utsname.h> | |
32 | ||
33 | #include <rpm/rpmtypes.h> | |
34 | #include <rpm/rpmlib.h> /* rpmvercmp */ | |
35 | @@ -1596,3 +1597,51 @@ rpmRC rpmdsParseRichDep(rpmds dep, rpmds *leftds, rpmds *rightds, rpmrichOp *op, | |
36 | return rc; | |
37 | } | |
38 | ||
39 | +int rpmdsUnamePool(rpmstrPool pool, rpmds * dsp) | |
40 | +{ | |
41 | + int rc = -1; | |
42 | + static const char * NS = "uname"; | |
43 | + struct utsname un; | |
44 | + rpmds ds; | |
45 | + | |
46 | + if (uname(&un) < 0) | |
47 | + goto exit; | |
48 | + | |
49 | + ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(sysname)", un.sysname, RPMSENSE_EQUAL); | |
50 | + rc = rpmdsMerge(dsp, ds); | |
51 | + rpmdsFree(ds); | |
52 | + if (rc < 0) | |
53 | + goto exit; | |
54 | + ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(nodename)", un.nodename, RPMSENSE_EQUAL); | |
55 | + rc = rpmdsMerge(dsp, ds); | |
56 | + rpmdsFree(ds); | |
57 | + if (rc < 0) | |
58 | + goto exit; | |
59 | + ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(release)", un.release, RPMSENSE_EQUAL); | |
60 | + rc = rpmdsMerge(dsp, ds); | |
61 | + rpmdsFree(ds); | |
62 | + if (rc < 0) | |
63 | + goto exit; | |
64 | + ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(machine)", un.machine, RPMSENSE_EQUAL); | |
65 | + rc = rpmdsMerge(dsp, ds); | |
66 | + rpmdsFree(ds); | |
67 | + if (rc < 0) | |
68 | + goto exit; | |
69 | +#if defined(__linux__) | |
70 | + ds = rpmdsSinglePool(pool, RPMTAG_PROVIDENAME, "uname(domainname)", un.domainname, RPMSENSE_EQUAL); | |
71 | + rc = rpmdsMerge(dsp, ds); | |
72 | + rpmdsFree(ds); | |
73 | + if (rc < 0) | |
74 | + goto exit; | |
75 | +#endif | |
76 | +exit: | |
77 | + /* freeze the pool to save memory, but only if private pool */ | |
78 | + if (*dsp && (*dsp)->pool != pool) | |
79 | + rpmstrPoolFreeze((*dsp)->pool, 0); | |
80 | + return (rc < 0) ? -1 : 0; | |
81 | +} | |
82 | + | |
83 | +int rpmdsUname(rpmds * dsp) | |
84 | +{ | |
85 | + return rpmdsUnamePool(NULL, dsp); | |
86 | +} | |
87 | diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h | |
88 | index e69ef2584..ecdb12f0c 100644 | |
89 | --- a/lib/rpmts_internal.h | |
90 | +++ b/lib/rpmts_internal.h | |
91 | @@ -21,6 +21,7 @@ typedef struct tsMembers_s { | |
92 | rpmal addedPackages; /*!< Set of packages being installed. */ | |
93 | ||
94 | rpmds rpmlib; /*!< rpmlib() dependency set. */ | |
95 | + rpmds uname; /*!< uname() dependency set. */ | |
96 | rpmte * order; /*!< Packages sorted by dependencies. */ | |
97 | int orderCount; /*!< No. of transaction elements. */ | |
98 | int orderAlloced; /*!< No. of allocated transaction elements. */ |