rpmfc.c | rpmfc.c | |||
---|---|---|---|---|
skipping to change at line 33 | skipping to change at line 33 | |||
#define _RPMDS_INTERNAL | #define _RPMDS_INTERNAL | |||
#include <rpmds.h> | #include <rpmds.h> | |||
#include <rpmfi.h> | #include <rpmfi.h> | |||
#include "debug.h" | #include "debug.h" | |||
/*@access rpmds @*/ | /*@access rpmds @*/ | |||
/*@access miRE @*/ | /*@access miRE @*/ | |||
#ifdef __cplusplus | ||||
GENfree(rpmuint16_t *) | ||||
GENfree(rpmuint32_t *) | ||||
#endif /* __cplusplus */ | ||||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static int _filter_values = 1; | static int _filter_values = 1; | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static int _filter_execs = 1; | static int _filter_execs = 1; | |||
/** | /** | |||
*/ | */ | |||
static int rpmfcExpandAppend(/*@out@*/ ARGV_t * argvp, const ARGV_t av) | static int rpmfcExpandAppend(/*@out@*/ ARGV_t * argvp, const ARGV_t av) | |||
/*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, internalState @*/ | |||
/*@modifies *argvp, rpmGlobalMacroContext, internalState @*/ | /*@modifies *argvp, rpmGlobalMacroContext, internalState @*/ | |||
/*@requires maxRead(argvp) >= 0 @*/ | /*@requires maxRead(argvp) >= 0 @*/ | |||
{ | { | |||
ARGV_t argv = *argvp; | ARGV_t argv = *argvp; | |||
int argc = argvCount(argv); | int argc = argvCount(argv); | |||
int ac = argvCount(av); | int ac = argvCount(av); | |||
int i; | int i; | |||
argv = xrealloc(argv, (argc + ac + 1) * sizeof(*argv)); | argv = (ARGV_t) xrealloc(argv, (argc + ac + 1) * sizeof(*argv)); | |||
for (i = 0; i < ac; i++) | for (i = 0; i < ac; i++) | |||
argv[argc + i] = rpmExpand(av[i], NULL); | argv[argc + i] = rpmExpand(av[i], NULL); | |||
argv[argc + ac] = NULL; | argv[argc + ac] = NULL; | |||
*argvp = argv; | *argvp = argv; | |||
return 0; | return 0; | |||
} | } | |||
/* XXX FIXME: more AutoFu testing needed? */ | ||||
#if defined(HAVE_SIG_T) && !defined(SIGHANDLER_T) | ||||
typedef sig_t sighandler_t; | ||||
#endif | ||||
/** | /** | |||
* Return output from helper script. | * Return output from helper script. | |||
* @todo Use poll(2) rather than select(2), if available. | * @todo Use poll(2) rather than select(2), if available. | |||
* @param dir directory to run in (or NULL) | * @param dir directory to run in (or NULL) | |||
* @param argv program and arguments to run | * @param argv program and arguments to run | |||
* @param writePtr bytes to feed to script on stdin (or NULL) | * @param writePtr bytes to feed to script on stdin (or NULL) | |||
* @param writeBytesLeft no. of bytes to feed to script on stdin | * @param writeBytesLeft no. of bytes to feed to script on stdin | |||
* @param failNonZero is script failure an error? | * @param failNonZero is script failure an error? | |||
* @return buffered stdout from script, NULL on error | * @return buffered stdout from script, NULL on error | |||
*/ | */ | |||
skipping to change at line 79 | skipping to change at line 89 | |||
static rpmiob getOutputFrom(/*@null@*/ const char * dir, ARGV_t argv, | static rpmiob getOutputFrom(/*@null@*/ const char * dir, ARGV_t argv, | |||
const char * writePtr, size_t writeBytesLeft, | const char * writePtr, size_t writeBytesLeft, | |||
int failNonZero) | int failNonZero) | |||
/*@globals h_errno, fileSystem, internalState@*/ | /*@globals h_errno, fileSystem, internalState@*/ | |||
/*@modifies fileSystem, internalState@*/ | /*@modifies fileSystem, internalState@*/ | |||
{ | { | |||
pid_t child, reaped; | pid_t child, reaped; | |||
int toProg[2]; | int toProg[2]; | |||
int fromProg[2]; | int fromProg[2]; | |||
int status; | int status; | |||
void *oldhandler; | sighandler_t oldhandler = signal(SIGPIPE, SIG_IGN); | |||
rpmiob iob = NULL; | rpmiob iob = NULL; | |||
int done; | int done; | |||
/*@-type@*/ /* FIX: cast? */ | ||||
oldhandler = signal(SIGPIPE, SIG_IGN); | ||||
/*@=type@*/ | ||||
toProg[0] = toProg[1] = 0; | toProg[0] = toProg[1] = 0; | |||
fromProg[0] = fromProg[1] = 0; | fromProg[0] = fromProg[1] = 0; | |||
if (pipe(toProg) < 0 || pipe(fromProg) < 0) { | if (pipe(toProg) < 0 || pipe(fromProg) < 0) { | |||
rpmlog(RPMLOG_ERR, _("Couldn't create pipe for %s: %m\n"), argv[0]); | rpmlog(RPMLOG_ERR, _("Couldn't create pipe for %s: %m\n"), argv[0]); | |||
return NULL; | return NULL; | |||
} | } | |||
if (!(child = fork())) { | if (!(child = fork())) { | |||
(void) close(toProg[1]); | (void) close(toProg[1]); | |||
(void) close(fromProg[0]); | (void) close(fromProg[0]); | |||
skipping to change at line 199 | skipping to change at line 205 | |||
/* terminate on (non-blocking) EOF or error */ | /* terminate on (non-blocking) EOF or error */ | |||
done = (nbr == 0 || (nbr < 0 && errno != EAGAIN)); | done = (nbr == 0 || (nbr < 0 && errno != EAGAIN)); | |||
} while (!done); | } while (!done); | |||
/* Clean up */ | /* Clean up */ | |||
if (toProg[1] >= 0) | if (toProg[1] >= 0) | |||
(void) close(toProg[1]); | (void) close(toProg[1]); | |||
if (fromProg[0] >= 0) | if (fromProg[0] >= 0) | |||
(void) close(fromProg[0]); | (void) close(fromProg[0]); | |||
/*@-type@*/ /* FIX: cast? */ | ||||
(void) signal(SIGPIPE, oldhandler); | (void) signal(SIGPIPE, oldhandler); | |||
/*@=type@*/ | ||||
/* Collect status from prog */ | /* Collect status from prog */ | |||
reaped = waitpid(child, &status, 0); | reaped = waitpid(child, &status, 0); | |||
rpmlog(RPMLOG_DEBUG, D_("\twaitpid(%d) rc %d status %x\n"), | rpmlog(RPMLOG_DEBUG, D_("\twaitpid(%d) rc %d status %x\n"), | |||
(unsigned)child, (unsigned)reaped, status); | (unsigned)child, (unsigned)reaped, status); | |||
if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) { | if (failNonZero && (!WIFEXITED(status) || WEXITSTATUS(status))) { | |||
const char *cmd = argvJoin(argv, ' '); | const char *cmd = argvJoin(argv, ' '); | |||
int rc = (WIFEXITED(status) ? WEXITSTATUS(status) : -1); | int rc = (WIFEXITED(status) ? WEXITSTATUS(status) : -1); | |||
skipping to change at line 373 | skipping to change at line 377 | |||
if (nmire == 0) | if (nmire == 0) | |||
mire = mireFree(mire); | mire = mireFree(mire); | |||
exit: | exit: | |||
av = _free(av); | av = _free(av); | |||
if (nmirep) | if (nmirep) | |||
*nmirep = nmire; | *nmirep = nmire; | |||
return mire; | return mire; | |||
} | } | |||
static int rpmfcMatchRegexps(void * mires, int nmire, | static int rpmfcMatchRegexps(void * _mire, int nmire, | |||
const char * str, char deptype) | const char * str, char deptype) | |||
/*@modifies mires @*/ | /*@modifies mires @*/ | |||
{ | { | |||
miRE mire = mires; | miRE mire = (miRE) _mire; | |||
int xx; | int xx; | |||
int i; | int i; | |||
for (i = 0; i < nmire; i++) { | for (i = 0; i < nmire; i++) { | |||
#ifdef DYING /* XXX noisy. use --miredebug if you need this spewage */ | #ifdef DYING /* XXX noisy. use --miredebug if you need this spewage */ | |||
rpmlog(RPMLOG_DEBUG, D_("Checking %c: '%s'\n"), deptype, str); | rpmlog(RPMLOG_DEBUG, D_("Checking %c: '%s'\n"), deptype, str); | |||
#endif | #endif | |||
if ((xx = mireRegexec(mire + i, str, 0)) < 0) | if ((xx = mireRegexec(mire + i, str, 0)) < 0) | |||
continue; | continue; | |||
rpmlog(RPMLOG_NOTICE, _("Skipping %c: '%s'\n"), deptype, str); | rpmlog(RPMLOG_NOTICE, _("Skipping %c: '%s'\n"), deptype, str); | |||
return 1; | return 1; | |||
} | } | |||
return 0; | return 0; | |||
} | } | |||
/*@null@*/ | /*@null@*/ | |||
static void * rpmfcFreeRegexps(/*@only@*/ void * mires, int nmire) | static void * rpmfcFreeRegexps(/*@only@*/ void * _mire, int nmire) | |||
/*@modifies mires @*/ | /*@modifies mires @*/ | |||
{ | { | |||
miRE mire = mires; | miRE mire = (miRE) _mire; | |||
/*@-refcounttrans@*/ | /*@-refcounttrans@*/ | |||
return mireFreeAll(mire, nmire); | return mireFreeAll(mire, nmire); | |||
/*@=refcounttrans@*/ | /*@=refcounttrans@*/ | |||
} | } | |||
/** | /** | |||
* Run per-interpreter dependency helper. | * Run per-interpreter dependency helper. | |||
* @param fc file classifier | * @param fc file classifier | |||
* @param deptype 'P' == Provides:, 'R' == Requires:, helper | * @param deptype 'P' == Provides:, 'R' == Requires:, helper | |||
* @param nsdep class name for interpreter (e.g. "perl") | * @param nsdep class name for interpreter (e.g. "perl") | |||
skipping to change at line 444 | skipping to change at line 448 | |||
default: | default: | |||
return -1; | return -1; | |||
/*@notreached@*/ break; | /*@notreached@*/ break; | |||
case 'P': | case 'P': | |||
if (fc->skipProv) | if (fc->skipProv) | |||
return 0; | return 0; | |||
xx = snprintf(buf, sizeof(buf), "%%{?__%s_provides}", nsdep); | xx = snprintf(buf, sizeof(buf), "%%{?__%s_provides}", nsdep); | |||
depsp = &fc->provides; | depsp = &fc->provides; | |||
dsContext = RPMSENSE_FIND_PROVIDES; | dsContext = RPMSENSE_FIND_PROVIDES; | |||
tagN = RPMTAG_PROVIDENAME; | tagN = RPMTAG_PROVIDENAME; | |||
mire = fc->Pmires; | mire = (miRE) fc->Pmires; | |||
nmire = fc->Pnmire; | nmire = fc->Pnmire; | |||
break; | break; | |||
case 'R': | case 'R': | |||
if (fc->skipReq) | if (fc->skipReq) | |||
return 0; | return 0; | |||
xx = snprintf(buf, sizeof(buf), "%%{?__%s_requires}", nsdep); | xx = snprintf(buf, sizeof(buf), "%%{?__%s_requires}", nsdep); | |||
depsp = &fc->requires; | depsp = &fc->requires; | |||
dsContext = RPMSENSE_FIND_REQUIRES; | dsContext = RPMSENSE_FIND_REQUIRES; | |||
tagN = RPMTAG_REQUIRENAME; | tagN = RPMTAG_REQUIRENAME; | |||
mire = fc->Rmires; | mire = (miRE) fc->Rmires; | |||
nmire = fc->Rnmire; | nmire = fc->Rnmire; | |||
break; | break; | |||
} | } | |||
buf[sizeof(buf)-1] = '\0'; | buf[sizeof(buf)-1] = '\0'; | |||
av[0] = buf; | av[0] = buf; | |||
av[1] = NULL; | av[1] = NULL; | |||
iob_stdin = rpmiobNew(0); | iob_stdin = rpmiobNew(0); | |||
iob_stdin = rpmiobAppend(iob_stdin, fn, 1); | iob_stdin = rpmiobAppend(iob_stdin, fn, 1); | |||
iob_stdout = NULL; | iob_stdout = NULL; | |||
skipping to change at line 485 | skipping to change at line 489 | |||
EVR = ""; | EVR = ""; | |||
Flags = dsContext; | Flags = dsContext; | |||
if (pav[i+1] && strchr("=<>", *pav[i+1])) { | if (pav[i+1] && strchr("=<>", *pav[i+1])) { | |||
i++; | i++; | |||
for (s = pav[i]; *s; s++) { | for (s = pav[i]; *s; s++) { | |||
switch(*s) { | switch(*s) { | |||
default: | default: | |||
assert(*s != '\0'); | assert(*s != '\0'); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case '=': | case '=': | |||
Flags |= RPMSENSE_EQUAL; | Flags = (evrFlags) (Flags | RPMSENSE_EQUAL); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case '<': | case '<': | |||
Flags |= RPMSENSE_LESS; | Flags = (evrFlags) (Flags | RPMSENSE_LESS); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case '>': | case '>': | |||
Flags |= RPMSENSE_GREATER; | Flags = (evrFlags) (Flags | RPMSENSE_GREATER); | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
} | } | |||
i++; | i++; | |||
EVR = pav[i]; | EVR = pav[i]; | |||
assert(EVR != NULL); | assert(EVR != NULL); | |||
} | } | |||
if (_filter_values && rpmfcMatchRegexps(mire, nmire, N, deptype) ) | if (_filter_values && rpmfcMatchRegexps(mire, nmire, N, deptype) ) | |||
continue; | continue; | |||
/* Add tracking dependency for versioned Provides: */ | /* Add tracking dependency for versioned Provides: */ | |||
if (!fc->tracked && deptype == 'P' && *EVR != '\0') { | if (!fc->tracked && deptype == 'P' && *EVR != '\0') { | |||
static evrFlags _Flags = (evrFlags) | ||||
(RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL)); | ||||
ds = rpmdsSingle(RPMTAG_REQUIRENAME, | ds = rpmdsSingle(RPMTAG_REQUIRENAME, | |||
"rpmlib(VersionedDependencies)", "3.0.3-1", | "rpmlib(VersionedDependencies)", "3.0.3-1", | |||
RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL)); | _Flags); | |||
xx = rpmdsMerge(&fc->requires, ds); | xx = rpmdsMerge(&fc->requires, ds); | |||
(void)rpmdsFree(ds); | (void)rpmdsFree(ds); | |||
ds = NULL; | ds = NULL; | |||
fc->tracked = 1; | fc->tracked = 1; | |||
} | } | |||
ds = rpmdsSingle(tagN, N, EVR, Flags); | ds = rpmdsSingle(tagN, N, EVR, Flags); | |||
#if defined(RPM_VENDOR_MANDRIVA) /* filter-overlapping-dependencies */ | #if defined(RPM_VENDOR_MANDRIVA) /* filter-overlapping-dependencies */ | |||
int overlap = 0; | int overlap = 0; | |||
skipping to change at line 589 | skipping to change at line 595 | |||
{ " compressed", RPMFC_COMPRESSED }, | { " compressed", RPMFC_COMPRESSED }, | |||
{ "troff or preprocessor input", RPMFC_MANPAGE|RPMFC_INCLUDE }, | { "troff or preprocessor input", RPMFC_MANPAGE|RPMFC_INCLUDE }, | |||
{ "GNU Info", RPMFC_MANPAGE|RPMFC_INCLUDE }, | { "GNU Info", RPMFC_MANPAGE|RPMFC_INCLUDE }, | |||
{ "perl script text", RPMFC_PERL|RPMFC_INCLUDE }, | { "perl script text", RPMFC_PERL|RPMFC_INCLUDE }, | |||
{ "Perl5 module source text", RPMFC_PERL|RPMFC_MODULE|RPMFC_INCLUDE }, | { "Perl5 module source text", RPMFC_PERL|RPMFC_MODULE|RPMFC_INCLUDE }, | |||
{ "PHP script text", RPMFC_PHP|RPMFC_INCLUDE }, | { "PHP script text", RPMFC_PHP|RPMFC_INCLUDE }, | |||
{ "G-IR binary database", RPMFC_TYPELIB|RPMFC_INCLUDE }, | ||||
/* XXX "a /usr/bin/python -t script text executable" */ | /* XXX "a /usr/bin/python -t script text executable" */ | |||
/* XXX "python 2.3 byte-compiled" */ | /* XXX "python 2.3 byte-compiled" */ | |||
{ " /usr/bin/python", RPMFC_PYTHON|RPMFC_INCLUDE }, | { " /usr/bin/python", RPMFC_PYTHON|RPMFC_INCLUDE }, | |||
{ "python ", RPMFC_PYTHON|RPMFC_INCLUDE }, | { "python ", RPMFC_PYTHON|RPMFC_INCLUDE }, | |||
{ "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE }, | { "libtool library ", RPMFC_LIBTOOL|RPMFC_INCLUDE }, | |||
{ "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE }, | { "pkgconfig ", RPMFC_PKGCONFIG|RPMFC_INCLUDE }, | |||
{ "Bourne ", RPMFC_BOURNE|RPMFC_INCLUDE }, | { "Bourne ", RPMFC_BOURNE|RPMFC_INCLUDE }, | |||
skipping to change at line 907 | skipping to change at line 914 | |||
if (is_executable) | if (is_executable) | |||
xx = rpmfcHelper(fc, 'R', "mono"); | xx = rpmfcHelper(fc, 'R', "mono"); | |||
} else | } else | |||
if (fc->fcolor->vals[fc->ix] & RPMFC_RUBY) { | if (fc->fcolor->vals[fc->ix] & RPMFC_RUBY) { | |||
xx = rpmfcHelper(fc, 'P', "ruby"); | xx = rpmfcHelper(fc, 'P', "ruby"); | |||
#ifdef NOTYET | #ifdef NOTYET | |||
if (is_executable) | if (is_executable) | |||
#endif | #endif | |||
xx = rpmfcHelper(fc, 'R', "ruby"); | xx = rpmfcHelper(fc, 'R', "ruby"); | |||
} else | } else | |||
if (fc->fcolor->vals[fc->ix] & RPMFC_FONT) { | ||||
xx = rpmfcHelper(fc, 'P', "font"); | ||||
/* XXX: currently of no use, but for the sake of consistency... */ | ||||
xx = rpmfcHelper(fc, 'R', "font"); | ||||
} else | ||||
if (fc->fcolor->vals[fc->ix] & RPMFC_HASKELL) { | ||||
xx = rpmfcHelper(fc, 'P', "haskell"); | ||||
xx = rpmfcHelper(fc, 'R', "haskell"); | ||||
} else | ||||
if (fc->fcolor->vals[fc->ix] & RPMFC_TYPELIB) { | ||||
xx = rpmfcHelper(fc, 'P', "typelib"); | ||||
#ifdef NOTYET | ||||
if (is_executable) | ||||
#endif | ||||
xx = rpmfcHelper(fc, 'R', "typelib"); | ||||
} else | ||||
if ((fc->fcolor->vals[fc->ix] & (RPMFC_MODULE|RPMFC_LIBRARY)) && | if ((fc->fcolor->vals[fc->ix] & (RPMFC_MODULE|RPMFC_LIBRARY)) && | |||
strstr(fn, "/gstreamer")) { | strstr(fn, "/gstreamer")) { | |||
xx = rpmfcHelper(fc, 'P', "gstreamer"); | xx = rpmfcHelper(fc, 'P', "gstreamer"); | |||
/* XXX: currently of no use, but for the sake of consistency... */ | /* XXX: currently of no use, but for the sake of consistency... */ | |||
xx = rpmfcHelper(fc, 'R', "gstreamer"); | xx = rpmfcHelper(fc, 'R', "gstreamer"); | |||
} | } | |||
/*@-observertrans@*/ | /*@-observertrans@*/ | |||
defaultdocdir = _free(defaultdocdir) ; | defaultdocdir = _free(defaultdocdir) ; | |||
/*@=observertrans@*/ | /*@=observertrans@*/ | |||
skipping to change at line 930 | skipping to change at line 953 | |||
/** | /** | |||
* Merge provides/requires dependencies into a rpmfc container. | * Merge provides/requires dependencies into a rpmfc container. | |||
* @param context merge dependency set(s) container | * @param context merge dependency set(s) container | |||
* @param ds dependency set to merge | * @param ds dependency set to merge | |||
* @return 0 on success | * @return 0 on success | |||
*/ | */ | |||
static int rpmfcMergePR(void * context, rpmds ds) | static int rpmfcMergePR(void * context, rpmds ds) | |||
/*@globals fileSystem, internalState @*/ | /*@globals fileSystem, internalState @*/ | |||
/*@modifies ds, fileSystem, internalState @*/ | /*@modifies ds, fileSystem, internalState @*/ | |||
{ | { | |||
rpmfc fc = context; | rpmfc fc = (rpmfc) context; | |||
char buf[BUFSIZ]; | char buf[BUFSIZ]; | |||
int rc = 0; | int rc = 0; | |||
if (_rpmfc_debug < 0) | if (_rpmfc_debug < 0) | |||
fprintf(stderr, "*** rpmfcMergePR(%p, %p) %s\n", context, ds, tagName(rpmds TagN(ds))); | fprintf(stderr, "*** rpmfcMergePR(%p, %p) %s\n", context, ds, tagName(rpmds TagN(ds))); | |||
switch(rpmdsTagN(ds)) { | switch(rpmdsTagN(ds)) { | |||
default: | default: | |||
rc = -1; | rc = -1; | |||
break; | break; | |||
case RPMTAG_PROVIDENAME: | case RPMTAG_PROVIDENAME: | |||
skipping to change at line 1033 | skipping to change at line 1056 | |||
int colormask; | int colormask; | |||
} * rpmfcApplyTbl; | } * rpmfcApplyTbl; | |||
/** | /** | |||
* XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication. | * XXX Having two entries for rpmfcSCRIPT may be unnecessary duplication. | |||
*/ | */ | |||
/*@-nullassign@*/ | /*@-nullassign@*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static struct rpmfcApplyTbl_s rpmfcApplyTable[] = { | static struct rpmfcApplyTbl_s rpmfcApplyTable[] = { | |||
{ rpmfcELF, RPMFC_ELF }, | { rpmfcELF, RPMFC_ELF }, | |||
{ rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_PERL|RPMFC_PYTHON|RPMFC_LIBTOOL| RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP|RPMFC_MONO) }, | { rpmfcSCRIPT, (RPMFC_SCRIPT|RPMFC_FONT|RPMFC_HASKELL|RPMFC_PERL|RP MFC_PYTHON|RPMFC_LIBTOOL|RPMFC_PKGCONFIG|RPMFC_BOURNE|RPMFC_JAVA|RPMFC_PHP| RPMFC_MONO|RPMFC_TYPELIB) }, | |||
#if defined(RPM_VENDOR_MANDRIVA) | #if defined(RPM_VENDOR_MANDRIVA) | |||
{ rpmfcSYMLINK, RPMFC_SYMLINK }, | { rpmfcSYMLINK, RPMFC_SYMLINK }, | |||
#endif | #endif | |||
{ NULL, 0 } | { NULL, 0 } | |||
}; | }; | |||
/*@=nullassign@*/ | /*@=nullassign@*/ | |||
rpmRC rpmfcApply(rpmfc fc) | rpmRC rpmfcApply(rpmfc fc) | |||
{ | { | |||
rpmfcApplyTbl fcat; | rpmfcApplyTbl fcat; | |||
skipping to change at line 1117 | skipping to change at line 1140 | |||
(fn = strrchr(fn, '.')) && !strcmp(fn, ".gemspec")) | (fn = strrchr(fn, '.')) && !strcmp(fn, ".gemspec")) | |||
fc->fcolor->vals[fc->ix] |= RPMFC_MODULE; | fc->fcolor->vals[fc->ix] |= RPMFC_MODULE; | |||
} | } | |||
/* XXX: lacking better, more generic classifier... */ | /* XXX: lacking better, more generic classifier... */ | |||
else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) && | else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) && | |||
fc->fcolor->vals[fc->ix] & RPMFC_LIBRARY) | fc->fcolor->vals[fc->ix] & RPMFC_LIBRARY) | |||
fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT); | fc->fcolor->vals[fc->ix] |= (RPMFC_MODULE|RPMFC_SCRIPT); | |||
} | } | |||
} | } | |||
/* XXX ugly quick & dirty integration of haskell() dependencies */ | ||||
{ fn = strstr(fc->fn[fc->ix], "/usr/share/haskell-deps"); | ||||
if (fn) | ||||
fc->fcolor->vals[fc->ix] |= RPMFC_HASKELL; | ||||
} | ||||
if (fc->fcolor->vals[fc->ix]) | if (fc->fcolor->vals[fc->ix]) | |||
for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { | for (fcat = rpmfcApplyTable; fcat->func != NULL; fcat++) { | |||
if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | if (!(fc->fcolor->vals[fc->ix] & fcat->colormask)) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
if (_filter_execs) { | if (_filter_execs) { | |||
fc->skipProv = skipProv; | fc->skipProv = skipProv; | |||
fc->skipReq = skipReq; | fc->skipReq = skipReq; | |||
if ((mire = fc->PFmires) != NULL) | if ((mire = (miRE)fc->PFmires) != NULL) | |||
for (j = 0; j < fc->PFnmire; j++, mire++) { | for (j = 0; j < fc->PFnmire; j++, mire++) { | |||
fn = fc->fn[fc->ix] + fc->brlen; | fn = fc->fn[fc->ix] + fc->brlen; | |||
if ((xx = mireRegexec(mire, fn, 0)) < 0) | if ((xx = mireRegexec(mire, fn, 0)) < 0) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
rpmlog(RPMLOG_NOTICE, _("skipping %s provides detection\ n"), | rpmlog(RPMLOG_NOTICE, _("skipping %s provides detection\ n"), | |||
fn); | fn); | |||
fc->skipProv = 1; | fc->skipProv = 1; | |||
/*@innerbreak@*/ break; | /*@innerbreak@*/ break; | |||
} | } | |||
if ((mire = fc->RFmires) != NULL) | if ((mire = (miRE)fc->RFmires) != NULL) | |||
for (j = 0; j < fc->RFnmire; j++, mire++) { | for (j = 0; j < fc->RFnmire; j++, mire++) { | |||
fn = fc->fn[fc->ix] + fc->brlen; | fn = fc->fn[fc->ix] + fc->brlen; | |||
if ((xx = mireRegexec(mire, fn, 0)) < 0) | if ((xx = mireRegexec(mire, fn, 0)) < 0) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
rpmlog(RPMLOG_NOTICE, _("skipping %s requires detection\ n"), | rpmlog(RPMLOG_NOTICE, _("skipping %s requires detection\ n"), | |||
fn); | fn); | |||
fc->skipReq = 1; | fc->skipReq = 1; | |||
/*@innerbreak@*/ break; | /*@innerbreak@*/ break; | |||
} | } | |||
} | } | |||
skipping to change at line 1179 | skipping to change at line 1208 | |||
deptype = *se++; | deptype = *se++; | |||
se++; | se++; | |||
N = se; | N = se; | |||
while (*se && *se != ' ') | while (*se && *se != ' ') | |||
se++; | se++; | |||
*se++ = '\0'; | *se++ = '\0'; | |||
EVR = se; | EVR = se; | |||
while (*se && *se != ' ') | while (*se && *se != ' ') | |||
se++; | se++; | |||
*se++ = '\0'; | *se++ = '\0'; | |||
Flags = strtol(se, NULL, 16); | Flags = (evrFlags) strtol(se, NULL, 16); | |||
dix = -1; | dix = -1; | |||
skipping = 0; | skipping = 0; | |||
switch (deptype) { | switch (deptype) { | |||
default: | default: | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case 'P': | case 'P': | |||
skipping = fc->skipProv; | skipping = fc->skipProv; | |||
ds = rpmdsSingle(RPMTAG_PROVIDENAME, N, EVR, Flags); | ds = rpmdsSingle(RPMTAG_PROVIDENAME, N, EVR, Flags); | |||
dix = rpmdsFind(fc->provides, ds); | dix = rpmdsFind(fc->provides, ds); | |||
skipping to change at line 1309 | skipping to change at line 1338 | |||
ftype = "libtool library file"; | ftype = "libtool library file"; | |||
/* XXX all files with extension ".pc" are pkgconfig for now. */ | /* XXX all files with extension ".pc" are pkgconfig for now. */ | |||
else if (_suffix(s, ".pc")) | else if (_suffix(s, ".pc")) | |||
ftype = "pkgconfig file"; | ftype = "pkgconfig file"; | |||
/* XXX all files with extension ".php" are PHP for now. */ | /* XXX all files with extension ".php" are PHP for now. */ | |||
else if (_suffix(s, ".php")) | else if (_suffix(s, ".php")) | |||
ftype = "PHP script text"; | ftype = "PHP script text"; | |||
/* XXX files with extension ".typelib" are GNOME typelib for now | ||||
. */ | ||||
else if (_suffix(s, ".typelib")) | ||||
ftype = "G-IR binary database"; | ||||
/* XXX files with extension ".js" have GNOME typelib requires fo | ||||
r now */ | ||||
else if (_suffix(s, ".js")) | ||||
ftype = "G-IR binary database"; | ||||
/* XXX skip all files in /dev/ which are (or should be) %dev dum mies. */ | /* XXX skip all files in /dev/ which are (or should be) %dev dum mies. */ | |||
else if (slen >= fc->brlen+sizeof("/dev/") && !strncmp(s+fc->brl en, "/dev/", sizeof("/dev/")-1)) | else if (slen >= fc->brlen+sizeof("/dev/") && !strncmp(s+fc->brl en, "/dev/", sizeof("/dev/")-1)) | |||
ftype = ""; | ftype = ""; | |||
else if (magicfile) { | else if (magicfile) { | |||
ftype = rpmmgFile(mg, s); | ftype = rpmmgFile(mg, s); | |||
assert(ftype != NULL); /* XXX never happens, rpmmgFile() returns "" */ | assert(ftype != NULL); /* XXX never happens, rpmmgFile() returns "" */ | |||
freeftype = 1; | freeftype = 1; | |||
} | } | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
} | } | |||
skipping to change at line 1386 | skipping to change at line 1423 | |||
*/ | */ | |||
struct DepMsg_s { | struct DepMsg_s { | |||
/*@observer@*/ /*@null@*/ | /*@observer@*/ /*@null@*/ | |||
const char * msg; | const char * msg; | |||
/*@observer@*/ | /*@observer@*/ | |||
const char * argv[4]; | const char * argv[4]; | |||
rpmTag ntag; | rpmTag ntag; | |||
rpmTag vtag; | rpmTag vtag; | |||
rpmTag ftag; | rpmTag ftag; | |||
int mask; | int mask; | |||
int xor; | int toggle; | |||
}; | }; | |||
/** | /** | |||
*/ | */ | |||
/*@-nullassign@*/ | /*@-nullassign@*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static struct DepMsg_s depMsgs[] = { | static struct DepMsg_s depMsgs[] = { | |||
{ "Provides", { "%{?__find_provides}", NULL, NULL, NULL }, | { "Provides", { "%{?__find_provides}", NULL, NULL, NULL }, | |||
RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS, | RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_PROVIDEFLAGS, | |||
0, -1 }, | 0, -1 }, | |||
{ "Requires(interp)", { NULL, "interp", NULL, NULL }, | { "Requires(interp)", { NULL, "interp", NULL, NULL }, | |||
RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, RPMTAG_REQUIREFLAGS, | RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_INTERP), 0 }, | _notpre(RPMSENSE_INTERP), 0 }, | |||
{ "Requires(rpmlib)", { NULL, "rpmlib", NULL, NULL }, | { "Requires(rpmlib)", { NULL, "rpmlib", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_RPMLIB), 0 }, | _notpre(RPMSENSE_RPMLIB), 0 }, | |||
{ "Requires(verify)", { NULL, "verify", NULL, NULL }, | { "Requires(verify)", { NULL, "verify", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
RPMSENSE_SCRIPT_VERIFY, 0 }, | RPMSENSE_SCRIPT_VERIFY, 0 }, | |||
{ "Requires(pre)", { NULL, "pre", NULL, NULL }, | { "Requires(pre)", { NULL, "pre", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_SCRIPT_PRE), 0 }, | _notpre(RPMSENSE_SCRIPT_PRE), 0 }, | |||
{ "Requires(post)", { NULL, "post", NULL, NULL }, | { "Requires(post)", { NULL, "post", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_SCRIPT_POST), 0 }, | _notpre(RPMSENSE_SCRIPT_POST), 0 }, | |||
{ "Requires(preun)", { NULL, "preun", NULL, NULL }, | { "Requires(preun)", { NULL, "preun", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_SCRIPT_PREUN), 0 }, | _notpre(RPMSENSE_SCRIPT_PREUN), 0 }, | |||
{ "Requires(postun)", { NULL, "postun", NULL, NULL }, | { "Requires(postun)", { NULL, "postun", NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, | |||
_notpre(RPMSENSE_SCRIPT_POSTUN), 0 }, | _notpre(RPMSENSE_SCRIPT_POSTUN), 0 }, | |||
{ "Requires", { "%{?__find_requires}", NULL, NULL, NULL }, | { "Requires", { "%{?__find_requires}", NULL, NULL, NULL }, | |||
-1, -1, RPMTAG_REQUIREFLAGS, /* XXX inherit name/version arrays * / | (rpmTag)-1, (rpmTag)-1, RPMTAG_REQUIREFLAGS, /* XXX inherit name/ version arrays */ | |||
RPMSENSE_FIND_REQUIRES|RPMSENSE_TRIGGERIN|RPMSENSE_TRIGGERUN|RPMSENS E_TRIGGERPOSTUN|RPMSENSE_TRIGGERPREIN, 0 }, | RPMSENSE_FIND_REQUIRES|RPMSENSE_TRIGGERIN|RPMSENSE_TRIGGERUN|RPMSENS E_TRIGGERPOSTUN|RPMSENSE_TRIGGERPREIN, 0 }, | |||
{ "Conflicts", { "%{?__find_conflicts}", NULL, NULL, NULL }, | { "Conflicts", { "%{?__find_conflicts}", NULL, NULL, NULL }, | |||
RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS, | RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS, | |||
0, -1 }, | 0, -1 }, | |||
{ "Obsoletes", { "%{?__find_obsoletes}", NULL, NULL, NULL }, | { "Obsoletes", { "%{?__find_obsoletes}", NULL, NULL, NULL }, | |||
RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_OBSOLETEFLAGS, | RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_OBSOLETEFLAGS, | |||
0, -1 }, | 0, -1 }, | |||
{ NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 } | { NULL, { NULL, NULL, NULL, NULL }, (rpmTag)0, (rpmTag)0 , (rpmTag)0, 0, 0 } | |||
}; | }; | |||
/*@=nullassign@*/ | /*@=nullassign@*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static DepMsg_t DepMsgs = depMsgs; | static DepMsg_t DepMsgs = depMsgs; | |||
/** | /** | |||
* Print dependencies in a header. | * Print dependencies in a header. | |||
* @param h header | * @param h header | |||
*/ | */ | |||
skipping to change at line 1467 | skipping to change at line 1504 | |||
ds = rpmdsInit(ds); | ds = rpmdsInit(ds); | |||
if (ds == NULL) | if (ds == NULL) | |||
continue; /* XXX can't happen */ | continue; /* XXX can't happen */ | |||
bingo = 0; | bingo = 0; | |||
while (rpmdsNext(ds) >= 0) { | while (rpmdsNext(ds) >= 0) { | |||
Flags = rpmdsFlags(ds); | Flags = rpmdsFlags(ds); | |||
if (!((Flags & dm->mask) ^ dm->xor)) | if (!((Flags & dm->mask) ^ (dm->toggle))) | |||
/*@innercontinue@*/ continue; | /*@innercontinue@*/ continue; | |||
if (bingo == 0) { | if (bingo == 0) { | |||
rpmlog(RPMLOG_NOTICE, "%s:", (dm->msg ? dm->msg : "")); | rpmlog(RPMLOG_NOTICE, "%s:", (dm->msg ? dm->msg : "")); | |||
bingo = 1; | bingo = 1; | |||
} | } | |||
if ((DNEVR = rpmdsDNEVR(ds)) == NULL) | if ((DNEVR = rpmdsDNEVR(ds)) == NULL) | |||
/*@innercontinue@*/ continue; /* XXX can't happen */ | /*@innercontinue@*/ continue; /* XXX can't happen */ | |||
rpmlog(RPMLOG_NOTICE, " %s", DNEVR+2); | rpmlog(RPMLOG_NOTICE, " %s", DNEVR+2); | |||
} | } | |||
if (bingo) | if (bingo) | |||
skipping to change at line 1512 | skipping to change at line 1549 | |||
while (rpmfiNext(fi) >= 0) | while (rpmfiNext(fi) >= 0) | |||
iob_stdin = rpmiobAppend(iob_stdin, rpmfiFN(fi), 1); | iob_stdin = rpmiobAppend(iob_stdin, rpmfiFN(fi), 1); | |||
for (dm = DepMsgs; dm->msg != NULL; dm++) { | for (dm = DepMsgs; dm->msg != NULL; dm++) { | |||
rpmTag tag; | rpmTag tag; | |||
rpmsenseFlags tagflags; | rpmsenseFlags tagflags; | |||
char * s; | char * s; | |||
int xx; | int xx; | |||
tag = (dm->ftag > 0) ? dm->ftag : dm->ntag; | tag = (dm->ftag > 0) ? dm->ftag : dm->ntag; | |||
tagflags = 0; | tagflags = (rpmsenseFlags) 0; | |||
s = NULL; | s = NULL; | |||
switch(tag) { | switch(tag) { | |||
case RPMTAG_PROVIDEFLAGS: | case RPMTAG_PROVIDEFLAGS: | |||
if (!pkg->autoProv) | if (!pkg->autoProv) | |||
continue; | continue; | |||
failnonzero = 1; | failnonzero = 1; | |||
tagflags = RPMSENSE_FIND_PROVIDES; | tagflags = RPMSENSE_FIND_PROVIDES; | |||
/*@switchbreak@*/ break; | /*@switchbreak@*/ break; | |||
case RPMTAG_REQUIREFLAGS: | case RPMTAG_REQUIREFLAGS: | |||
skipping to change at line 1582 | skipping to change at line 1619 | |||
RPMSENSE_SCRIPT_PRE, 0 }, | RPMSENSE_SCRIPT_PRE, 0 }, | |||
{ "Requires(post)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, | { "Requires(post)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, | |||
RPMTAG_POSTINPROG, RPMTAG_POSTIN, RPMTAG_REQUIREFLAGS, | RPMTAG_POSTINPROG, RPMTAG_POSTIN, RPMTAG_REQUIREFLAGS, | |||
RPMSENSE_SCRIPT_POST, 0 }, | RPMSENSE_SCRIPT_POST, 0 }, | |||
{ "Requires(preun)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, | { "Requires(preun)", { "%{?__scriptlet_requires}", NULL, NULL, NULL }, | |||
RPMTAG_PREUNPROG, RPMTAG_PREUN, RPMTAG_REQUIREFLAGS, | RPMTAG_PREUNPROG, RPMTAG_PREUN, RPMTAG_REQUIREFLAGS, | |||
RPMSENSE_SCRIPT_PREUN, 0 }, | RPMSENSE_SCRIPT_PREUN, 0 }, | |||
{ "Requires(postun)", { "%{?__scriptlet_requires}", NULL, NULL, NU LL }, | { "Requires(postun)", { "%{?__scriptlet_requires}", NULL, NULL, NU LL }, | |||
RPMTAG_POSTUNPROG, RPMTAG_POSTUN, RPMTAG_REQUIREFLAGS, | RPMTAG_POSTUNPROG, RPMTAG_POSTUN, RPMTAG_REQUIREFLAGS, | |||
RPMSENSE_SCRIPT_POSTUN, 0 }, | RPMSENSE_SCRIPT_POSTUN, 0 }, | |||
{ NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 } | { NULL, { NULL, NULL, NULL, NULL }, (rpmTag)0, (rpmTag)0 , (rpmTag)0, 0, 0 } | |||
}; | }; | |||
/*@=nullassign@*/ | /*@=nullassign@*/ | |||
/*@unchecked@*/ | /*@unchecked@*/ | |||
static DepMsg_t ScriptMsgs = scriptMsgs; | static DepMsg_t ScriptMsgs = scriptMsgs; | |||
/** | /** | |||
*/ | */ | |||
static int rpmfcGenerateScriptletDeps(const Spec spec, Package pkg) | static int rpmfcGenerateScriptletDeps(const Spec spec, Package pkg) | |||
/*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ | |||
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/ | /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/ | |||
{ | { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
rpmiob iob_stdin = rpmiobNew(0); | rpmiob iob_stdin = rpmiobNew(0); | |||
rpmiob iob_stdout = NULL; | rpmiob iob_stdout = NULL; | |||
DepMsg_t dm; | DepMsg_t dm; | |||
int failnonzero = 0; | int failnonzero = 0; | |||
int rc = 0; | int rc = 0; | |||
int xx; | int xx; | |||
for (dm = ScriptMsgs; dm->msg != NULL; dm++) { | for (dm = ScriptMsgs; dm->msg != NULL; dm++) { | |||
int tag, tagflags; | rpmTag tag; | |||
rpmsenseFlags tagflags; | ||||
char * s; | char * s; | |||
tag = dm->ftag; | tag = dm->ftag; | |||
tagflags = RPMSENSE_FIND_REQUIRES | dm->mask; | tagflags = (rpmsenseFlags) (RPMSENSE_FIND_REQUIRES | dm->mask); | |||
/* Retrieve scriptlet interpreter. */ | /* Retrieve scriptlet interpreter. */ | |||
he->tag = dm->ntag; | he->tag = dm->ntag; | |||
xx = headerGet(pkg->header, he, 0); | xx = headerGet(pkg->header, he, 0); | |||
if (!xx || he->p.str == NULL) | if (!xx || he->p.str == NULL) | |||
continue; | continue; | |||
xx = strcmp(he->p.str, "/bin/sh") && strcmp(he->p.str, "/bin/bash"); | xx = strcmp(he->p.str, "/bin/sh") && strcmp(he->p.str, "/bin/bash"); | |||
he->p.ptr = _free(he->p.ptr); | he->p.ptr = _free(he->p.ptr); | |||
if (xx) | if (xx) | |||
continue; | continue; | |||
skipping to change at line 1661 | skipping to change at line 1699 | |||
} | } | |||
iob_stdout = rpmiobFree(iob_stdout); | iob_stdout = rpmiobFree(iob_stdout); | |||
} | } | |||
iob_stdin = rpmiobFree(iob_stdin); | iob_stdin = rpmiobFree(iob_stdin); | |||
return rc; | return rc; | |||
} | } | |||
rpmRC rpmfcGenerateDepends(void * specp, void * pkgp) | rpmRC rpmfcGenerateDepends(void * _spec, void * _pkg) | |||
{ | { | |||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he)); | HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he)); | |||
const Spec spec = specp; | const Spec spec = (Spec) _spec; | |||
Package pkg = pkgp; | Package pkg = (Package) _pkg; | |||
rpmfi fi = pkg->fi; | rpmfi fi = pkg->fi; | |||
rpmfc fc = NULL; | rpmfc fc = NULL; | |||
rpmds ds; | rpmds ds; | |||
int flags = 0x2; /* XXX no filtering, !scareMem */ | int flags = 0x2; /* XXX no filtering, !scareMem */ | |||
ARGV_t av; | ARGV_t av; | |||
rpmuint16_t * fmode; | rpmuint16_t * fmode; | |||
int ac = rpmfiFC(fi); | int ac = rpmfiFC(fi); | |||
char buf[BUFSIZ]; | char buf[BUFSIZ]; | |||
const char * N; | const char * N; | |||
const char * EVR; | const char * EVR; | |||
skipping to change at line 1704 | skipping to change at line 1742 | |||
printDeps(pkg->header); | printDeps(pkg->header); | |||
return rc; | return rc; | |||
} | } | |||
/* Generate scriptlet Dependencies. */ | /* Generate scriptlet Dependencies. */ | |||
if (internaldeps > 1) | if (internaldeps > 1) | |||
xx = rpmfcGenerateScriptletDeps(spec, pkg); | xx = rpmfcGenerateScriptletDeps(spec, pkg); | |||
/* Extract absolute file paths in argv format. */ | /* Extract absolute file paths in argv format. */ | |||
/* XXX TODO: should use argvFoo ... */ | /* XXX TODO: should use argvFoo ... */ | |||
av = xcalloc(ac+1, sizeof(*av)); | av = (ARGV_t) xcalloc(ac+1, sizeof(*av)); | |||
fmode = xcalloc(ac+1, sizeof(*fmode)); | fmode = (rpmuint16_t *) xcalloc(ac+1, sizeof(*fmode)); | |||
genConfigDeps = 0; | genConfigDeps = 0; | |||
fi = rpmfiInit(fi, 0); | fi = rpmfiInit(fi, 0); | |||
if (fi != NULL) | if (fi != NULL) | |||
while ((i = rpmfiNext(fi)) >= 0) { | while ((i = rpmfiNext(fi)) >= 0) { | |||
rpmfileAttrs fileAttrs; | rpmfileAttrs fileAttrs; | |||
/* Does package have any %config files? */ | /* Does package have any %config files? */ | |||
fileAttrs = rpmfiFFlags(fi); | fileAttrs = (rpmfileAttrs) rpmfiFFlags(fi); | |||
genConfigDeps |= (fileAttrs & RPMFILE_CONFIG); | genConfigDeps |= (fileAttrs & RPMFILE_CONFIG); | |||
av[i] = xstrdup(rpmfiFN(fi)); | av[i] = xstrdup(rpmfiFN(fi)); | |||
fmode[i] = rpmfiFMode(fi); | fmode[i] = rpmfiFMode(fi); | |||
} | } | |||
av[ac] = NULL; | av[ac] = NULL; | |||
fc = rpmfcNew(); | fc = rpmfcNew(); | |||
fc->skipProv = !pkg->autoProv; | fc->skipProv = !pkg->autoProv; | |||
fc->skipReq = !pkg->autoReq; | fc->skipReq = !pkg->autoReq; | |||
skipping to change at line 1751 | skipping to change at line 1789 | |||
ds = NULL; | ds = NULL; | |||
he->tag = RPMTAG_PROVIDENAME; | he->tag = RPMTAG_PROVIDENAME; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
he->tag = RPMTAG_PROVIDEVERSION; | he->tag = RPMTAG_PROVIDEVERSION; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
he->tag = RPMTAG_PROVIDEFLAGS; | he->tag = RPMTAG_PROVIDEFLAGS; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
/* Add config dependency, Provides: config(N) = EVR */ | /* Add config dependency, Provides: config(N) = EVR */ | |||
if (genConfigDeps) { | if (genConfigDeps) { | |||
static evrFlags _Flags = (evrFlags)(RPMSENSE_EQUAL|RPMSENSE_CONF IG); | ||||
N = rpmdsN(pkg->ds); | N = rpmdsN(pkg->ds); | |||
assert(N != NULL); | assert(N != NULL); | |||
EVR = rpmdsEVR(pkg->ds); | EVR = rpmdsEVR(pkg->ds); | |||
assert(EVR != NULL); | assert(EVR != NULL); | |||
sprintf(buf, "config(%s)", N); | sprintf(buf, "config(%s)", N); | |||
ds = rpmdsSingle(RPMTAG_PROVIDENAME, buf, EVR, | ds = rpmdsSingle(RPMTAG_PROVIDENAME, buf, EVR, _Flags); | |||
(RPMSENSE_EQUAL|RPMSENSE_CONFIG)); | ||||
xx = rpmdsMerge(&fc->provides, ds); | xx = rpmdsMerge(&fc->provides, ds); | |||
(void)rpmdsFree(ds); | (void)rpmdsFree(ds); | |||
ds = NULL; | ds = NULL; | |||
} | } | |||
} | } | |||
if (!fc->skipReq) { | if (!fc->skipReq) { | |||
ds = rpmdsNew(pkg->header, RPMTAG_REQUIRENAME, flags); | ds = rpmdsNew(pkg->header, RPMTAG_REQUIRENAME, flags); | |||
xx = rpmdsMerge(&fc->requires, ds); | xx = rpmdsMerge(&fc->requires, ds); | |||
(void)rpmdsFree(ds); | (void)rpmdsFree(ds); | |||
ds = NULL; | ds = NULL; | |||
he->tag = RPMTAG_REQUIRENAME; | he->tag = RPMTAG_REQUIRENAME; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
he->tag = RPMTAG_REQUIREVERSION; | he->tag = RPMTAG_REQUIREVERSION; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
he->tag = RPMTAG_REQUIREFLAGS; | he->tag = RPMTAG_REQUIREFLAGS; | |||
xx = headerDel(pkg->header, he, 0); | xx = headerDel(pkg->header, he, 0); | |||
/* Add config dependency, Requires: config(N) = EVR */ | /* Add config dependency, Requires: config(N) = EVR */ | |||
if (genConfigDeps) { | if (genConfigDeps) { | |||
static evrFlags _Flags = (evrFlags)(RPMSENSE_EQUAL|RPMSENSE_CONF IG); | ||||
N = rpmdsN(pkg->ds); | N = rpmdsN(pkg->ds); | |||
assert(N != NULL); | assert(N != NULL); | |||
EVR = rpmdsEVR(pkg->ds); | EVR = rpmdsEVR(pkg->ds); | |||
assert(EVR != NULL); | assert(EVR != NULL); | |||
sprintf(buf, "config(%s)", N); | sprintf(buf, "config(%s)", N); | |||
ds = rpmdsSingle(RPMTAG_REQUIRENAME, buf, EVR, | ds = rpmdsSingle(RPMTAG_REQUIRENAME, buf, EVR, _Flags); | |||
(RPMSENSE_EQUAL|RPMSENSE_CONFIG)); | ||||
xx = rpmdsMerge(&fc->requires, ds); | xx = rpmdsMerge(&fc->requires, ds); | |||
(void)rpmdsFree(ds); | (void)rpmdsFree(ds); | |||
ds = NULL; | ds = NULL; | |||
} | } | |||
} | } | |||
/* Build file class dictionary. */ | /* Build file class dictionary. */ | |||
xx = rpmfcClassify(fc, av, fmode); | xx = rpmfcClassify(fc, av, fmode); | |||
/* Build file/package dependency dictionary. */ | /* Build file/package dependency dictionary. */ | |||
skipping to change at line 1931 | skipping to change at line 1969 | |||
fc = rpmfcFree(fc); | fc = rpmfcFree(fc); | |||
av = argvFree(av); | av = argvFree(av); | |||
return rc; | return rc; | |||
} | } | |||
/*@-mustmod@*/ | /*@-mustmod@*/ | |||
static void rpmfcFini(void * _fc) | static void rpmfcFini(void * _fc) | |||
/*@modifies _fc @*/ | /*@modifies _fc @*/ | |||
{ | { | |||
rpmfc fc = _fc; | rpmfc fc = (rpmfc) _fc; | |||
fc->fn = argvFree(fc->fn); | fc->fn = argvFree(fc->fn); | |||
fc->fcolor = argiFree(fc->fcolor); | fc->fcolor = argiFree(fc->fcolor); | |||
fc->fcdictx = argiFree(fc->fcdictx); | fc->fcdictx = argiFree(fc->fcdictx); | |||
fc->fddictx = argiFree(fc->fddictx); | fc->fddictx = argiFree(fc->fddictx); | |||
fc->fddictn = argiFree(fc->fddictn); | fc->fddictn = argiFree(fc->fddictn); | |||
fc->cdict = argvFree(fc->cdict); | fc->cdict = argvFree(fc->cdict); | |||
fc->ddict = argvFree(fc->ddict); | fc->ddict = argvFree(fc->ddict); | |||
fc->ddictx = argiFree(fc->ddictx); | fc->ddictx = argiFree(fc->ddictx); | |||
skipping to change at line 1976 | skipping to change at line 2014 | |||
pool = _rpmfcPool; | pool = _rpmfcPool; | |||
} | } | |||
fc = (rpmfc) rpmioGetPool(pool, sizeof(*fc)); | fc = (rpmfc) rpmioGetPool(pool, sizeof(*fc)); | |||
memset(((char *)fc)+sizeof(fc->_item), 0, sizeof(*fc)-sizeof(fc->_item) ); | memset(((char *)fc)+sizeof(fc->_item), 0, sizeof(*fc)-sizeof(fc->_item) ); | |||
return fc; | return fc; | |||
} | } | |||
rpmfc rpmfcNew(void) | rpmfc rpmfcNew(void) | |||
{ | { | |||
rpmfc fc = rpmfcGetPool(_rpmfcPool); | rpmfc fc = rpmfcGetPool(_rpmfcPool); | |||
fc->fn = xcalloc(1, sizeof(*fc->fn)); | fc->fn = (ARGV_t) xcalloc(1, sizeof(*fc->fn)); | |||
return rpmfcLink(fc); | return rpmfcLink(fc); | |||
} | } | |||
End of changes. 52 change blocks. | ||||
51 lines changed or deleted | 91 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |