mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
- Restore functionality broken in previous commit; we need to be able to report
multiple installed packages with the same PKGORIGIN. Reported by: marcus MFC after: 1 month
This commit is contained in:
parent
72d9df0aa4
commit
2b520e6990
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=178753
@ -4,11 +4,6 @@
|
||||
|
||||
LIBINSTALL= ${.OBJDIR}/../lib/libinstall.a
|
||||
|
||||
.if ${MK_OPENSSL} != "no" && \
|
||||
defined(LDADD) && ${LDADD:M-lfetch} != ""
|
||||
DPADD+= ${LIBSSL} ${LIBCRYPTO}
|
||||
LDADD+= -lssl -lcrypto
|
||||
.endif
|
||||
|
||||
# Inherit BINDIR from one level up.
|
||||
.include "../Makefile.inc"
|
||||
|
@ -452,7 +452,7 @@ pkg_do(char *pkg)
|
||||
/* Time to record the deed? */
|
||||
if (!NoRecord && !Fake) {
|
||||
char contents[FILENAME_MAX];
|
||||
char **depnames = NULL, **deporigins = NULL, **depmatches;
|
||||
char **depnames = NULL, **deporigins = NULL, ***depmatches;
|
||||
int i, dep_count = 0;
|
||||
FILE *contfile;
|
||||
|
||||
@ -540,20 +540,24 @@ pkg_do(char *pkg)
|
||||
if (!IgnoreDeps && depmatches) {
|
||||
for (i = 0; i < dep_count; i++) {
|
||||
if (depmatches[i]) {
|
||||
/* Origin looked up */
|
||||
sprintf(contents, "%s/%s/%s", LOG_DIR, depmatches[i],
|
||||
REQUIRED_BY_FNAME);
|
||||
if (depnames[i] && strcmp(depnames[i], depmatches[i]) != 0)
|
||||
warnx("warning: package '%s' requires '%s', but '%s' "
|
||||
"is installed", Plist.name, depnames[i], depmatches[i]);
|
||||
contfile = fopen(contents, "a");
|
||||
if (!contfile) {
|
||||
warnx("can't open dependency file '%s'!\n"
|
||||
"dependency registration is incomplete", contents);
|
||||
} else {
|
||||
fprintf(contfile, "%s\n", Plist.name);
|
||||
if (fclose(contfile) == EOF)
|
||||
warnx("cannot properly close file %s", contents);
|
||||
int j;
|
||||
char **tmp = depmatches[i];
|
||||
for (j = 0; tmp[j] != NULL; j++) {
|
||||
/* Origin looked up */
|
||||
sprintf(contents, "%s/%s/%s", LOG_DIR, tmp[j],
|
||||
REQUIRED_BY_FNAME);
|
||||
if (depnames[i] && strcmp(depnames[i], tmp[j]) != 0)
|
||||
warnx("warning: package '%s' requires '%s', but '%s' "
|
||||
"is installed", Plist.name, depnames[i], tmp[j]);
|
||||
contfile = fopen(contents, "a");
|
||||
if (!contfile) {
|
||||
warnx("can't open dependency file '%s'!\n"
|
||||
"dependency registration is incomplete", contents);
|
||||
} else {
|
||||
fprintf(contfile, "%s\n", Plist.name);
|
||||
if (fclose(contfile) == EOF)
|
||||
warnx("cannot properly close file %s", contents);
|
||||
}
|
||||
}
|
||||
} else if (depnames[i]) {
|
||||
/* No package present with this origin, try literal package name */
|
||||
|
@ -122,7 +122,7 @@ static int
|
||||
pkg_do(char *pkg)
|
||||
{
|
||||
FILE *cfile;
|
||||
char *deporigin, **deporigins = NULL, **depnames = NULL, **depmatches, home[FILENAME_MAX];
|
||||
char *deporigin, **deporigins = NULL, **depnames = NULL, ***depmatches, home[FILENAME_MAX];
|
||||
PackingList p;
|
||||
int i, len;
|
||||
int isinstalled;
|
||||
@ -295,7 +295,10 @@ pkg_do(char *pkg)
|
||||
if (depmatches) {
|
||||
for (i = 0; i < dep_count; i++) {
|
||||
if (depmatches[i]) {
|
||||
undepend(depmatches[i], pkg);
|
||||
char **tmp = depmatches[i];
|
||||
int j;
|
||||
for (j = 0; tmp[j] != NULL; j++)
|
||||
undepend(tmp[j], pkg);
|
||||
} else if (depnames[i]) {
|
||||
undepend(depnames[i], pkg);
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ int real_main(int, char **);
|
||||
/* Query installed packages */
|
||||
char **matchinstalled(match_t, char **, int *);
|
||||
char **matchbyorigin(const char *, int *);
|
||||
char **matchallbyorigin(const char **, int *);
|
||||
char ***matchallbyorigin(const char **, int *);
|
||||
int isinstalledpkg(const char *name);
|
||||
int pattern_match(match_t MatchType, char *pattern, const char *pkgname);
|
||||
|
||||
|
@ -237,10 +237,11 @@ pattern_match(match_t MatchType, char *pattern, const char *pkgname)
|
||||
* Synopsis is similar to matchinstalled(), but use origin
|
||||
* as a key for matching packages.
|
||||
*/
|
||||
char **
|
||||
char ***
|
||||
matchallbyorigin(const char **origins, int *retval)
|
||||
{
|
||||
char **installed, **allorigins = NULL, **matches = NULL;
|
||||
char **installed, **allorigins = NULL;
|
||||
char ***matches = NULL;
|
||||
int i, j;
|
||||
|
||||
if (retval != NULL)
|
||||
@ -299,16 +300,20 @@ matchallbyorigin(const char **origins, int *retval)
|
||||
/* Resolve origins into package names, retaining the sequence */
|
||||
for (i = 0; origins[i] != NULL; i++) {
|
||||
matches = realloc(matches, (i + 1) * sizeof(*matches));
|
||||
matches[i] = NULL;
|
||||
struct store *store = NULL;
|
||||
store = storecreate(store);
|
||||
|
||||
for (j = 0; installed[j] != NULL; j++) {
|
||||
if (allorigins[j]) {
|
||||
if (csh_match(origins[i], allorigins[j], FNM_PATHNAME) == 0) {
|
||||
matches[i] = installed[j];
|
||||
break;
|
||||
storeappend(store, installed[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (store->used == 0)
|
||||
matches[i] = NULL;
|
||||
else
|
||||
matches[i] = store->store;
|
||||
}
|
||||
|
||||
if (allorigins) {
|
||||
@ -329,16 +334,14 @@ char **
|
||||
matchbyorigin(const char *origin, int *retval)
|
||||
{
|
||||
const char *origins[2];
|
||||
char **tmp;
|
||||
char ***tmp;
|
||||
|
||||
origins[0] = origin;
|
||||
origins[1] = NULL;
|
||||
|
||||
tmp = matchallbyorigin(origins, retval);
|
||||
if (tmp && tmp[0]) {
|
||||
tmp = realloc(tmp, 2 * sizeof(*tmp));
|
||||
tmp[1] = NULL;
|
||||
return tmp;
|
||||
return tmp[0];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user