mirror of
https://git.yoctoproject.org/poky
synced 2026-09-29 07:36:20 +02:00
rpmresolve: improve debug output
Rename rpmresolve's -d option to -t and make -d enable debug output; add a -o option to specify the output file (so rpm debug output doesn't go to the output file) and also add a little more detail to some of the error messages. (From OE-Core rev: 163dd734d79fd7040b48b10bca6fde28460ac20c) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
5c23b3cc9f
commit
1ce0f3f867
@@ -235,9 +235,9 @@ process_pkg_list_rpm() {
|
|||||||
extraopt="-i"
|
extraopt="-i"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rpmresolve $extraopt ${confbase}-base_archs.conf ${target_rootfs}/install/base_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}.manifest
|
rpmresolve $extraopt ${confbase}-base_archs.conf ${target_rootfs}/install/base_archs.pkglist -o ${target_rootfs}/install/${manifestpfx}.manifest
|
||||||
if [ -s ${target_rootfs}/install/ml_archs.pkglist ] ; then
|
if [ -s ${target_rootfs}/install/ml_archs.pkglist ] ; then
|
||||||
rpmresolve $extraopt ${confbase}-ml_archs.conf ${target_rootfs}/install/ml_archs.pkglist >> ${target_rootfs}/install/${manifestpfx}_multilib.manifest
|
rpmresolve $extraopt ${confbase}-ml_archs.conf ${target_rootfs}/install/ml_archs.pkglist -o ${target_rootfs}/install/${manifestpfx}_multilib.manifest
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ list_installed_packages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rootfs_list_installed_depends() {
|
rootfs_list_installed_depends() {
|
||||||
rpmresolve -d $INSTALL_ROOTFS_RPM/${rpmlibdir}
|
rpmresolve -t $INSTALL_ROOTFS_RPM/${rpmlibdir}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootfs_install_packages() {
|
rootfs_install_packages() {
|
||||||
|
|||||||
@@ -36,6 +36,9 @@
|
|||||||
#include <argv.h>
|
#include <argv.h>
|
||||||
#include <mire.h>
|
#include <mire.h>
|
||||||
|
|
||||||
|
int debugmode;
|
||||||
|
FILE *outf;
|
||||||
|
|
||||||
int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value)
|
int getPackageStr(rpmts ts, const char *NVRA, rpmTag tag, char **value)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
@@ -69,6 +72,8 @@ int loadTs(rpmts **ts, int *tsct, const char *dblistfn)
|
|||||||
listfile = 0;
|
listfile = 0;
|
||||||
|
|
||||||
if(listfile) {
|
if(listfile) {
|
||||||
|
if(debugmode)
|
||||||
|
printf("DEBUG: reading database list file '%s'\n", dblistfn);
|
||||||
*ts = malloc(sz * sizeof(rpmts));
|
*ts = malloc(sz * sizeof(rpmts));
|
||||||
FILE *f = fopen(dblistfn, "r" );
|
FILE *f = fopen(dblistfn, "r" );
|
||||||
if(f) {
|
if(f) {
|
||||||
@@ -87,6 +92,8 @@ int loadTs(rpmts **ts, int *tsct, const char *dblistfn)
|
|||||||
*ts = (rpmts *)realloc(*ts, sz);
|
*ts = (rpmts *)realloc(*ts, sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(debugmode)
|
||||||
|
printf("DEBUG: opening database '%s'\n", line);
|
||||||
char *dbpathm = malloc(strlen(line) + 10);
|
char *dbpathm = malloc(strlen(line) + 10);
|
||||||
sprintf(dbpathm, "_dbpath %s", line);
|
sprintf(dbpathm, "_dbpath %s", line);
|
||||||
rpmDefineMacro(NULL, dbpathm, RMIL_CMDLINE);
|
rpmDefineMacro(NULL, dbpathm, RMIL_CMDLINE);
|
||||||
@@ -113,6 +120,8 @@ int loadTs(rpmts **ts, int *tsct, const char *dblistfn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if(debugmode)
|
||||||
|
printf("DEBUG: opening database '%s'\n", dblistfn);
|
||||||
// Load from single database
|
// Load from single database
|
||||||
*ts = malloc(sizeof(rpmts));
|
*ts = malloc(sizeof(rpmts));
|
||||||
char *dbpathm = malloc(strlen(dblistfn) + 10);
|
char *dbpathm = malloc(strlen(dblistfn) + 10);
|
||||||
@@ -164,13 +173,22 @@ int processPackages(rpmts *ts, int tscount, const char *packagelistfn, int ignor
|
|||||||
char *value = NULL;
|
char *value = NULL;
|
||||||
rc = getPackageStr(ts[i], keys[0], RPMTAG_PACKAGEORIGIN, &value);
|
rc = getPackageStr(ts[i], keys[0], RPMTAG_PACKAGEORIGIN, &value);
|
||||||
if(rc == 0)
|
if(rc == 0)
|
||||||
printf("%s\n", value);
|
fprintf(outf, "%s\n", value);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "Failed to get package origin for %s\n", line);
|
fprintf(stderr, "Failed to get package origin for %s\n", line);
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
else if( nkeys > 1 ) {
|
else if( nkeys > 1 ) {
|
||||||
fprintf(stderr, "Multiple matches for %s!\n", line);
|
int keyindex = 0;
|
||||||
|
fprintf(stderr, "Multiple matches for %s:\n", line);
|
||||||
|
for( keyindex=0; keyindex<nkeys; keyindex++) {
|
||||||
|
char *value = NULL;
|
||||||
|
rc = getPackageStr(ts[i], keys[keyindex], RPMTAG_PACKAGEORIGIN, &value);
|
||||||
|
if(rc == 0)
|
||||||
|
fprintf(outf, " %s\n", value);
|
||||||
|
else
|
||||||
|
fprintf(stderr, " (%s)\n", keys[keyindex]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(found)
|
if(found)
|
||||||
@@ -230,7 +248,7 @@ int printDepList(rpmts *ts, int tscount)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if( tscount > 1 )
|
if( tscount > 1 )
|
||||||
printf(">1 database specified with dependency list, using first only\n");
|
fprintf(stderr, ">1 database specified with dependency list, using first only\n");
|
||||||
|
|
||||||
/* Get list of names */
|
/* Get list of names */
|
||||||
rpmdb db = rpmtsGetRdb(ts[0]);
|
rpmdb db = rpmtsGetRdb(ts[0]);
|
||||||
@@ -274,17 +292,17 @@ int printDepList(rpmts *ts, int tscount)
|
|||||||
}
|
}
|
||||||
if(prov) {
|
if(prov) {
|
||||||
if((int)reqflags[j] & 0x80000)
|
if((int)reqflags[j] & 0x80000)
|
||||||
printf("%s|%s [REC]\n", name, prov);
|
fprintf(outf, "%s|%s [REC]\n", name, prov);
|
||||||
else
|
else
|
||||||
printf("%s|%s\n", name, prov);
|
fprintf(outf, "%s|%s\n", name, prov);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rc = lookupProvider(ts[0], reqs[j], &prov);
|
rc = lookupProvider(ts[0], reqs[j], &prov);
|
||||||
if(rc==0 && prov) {
|
if(rc==0 && prov) {
|
||||||
if((int)reqflags[j] & 0x80000)
|
if((int)reqflags[j] & 0x80000)
|
||||||
printf("%s|%s [REC]\n", name, prov);
|
fprintf(outf, "%s|%s [REC]\n", name, prov);
|
||||||
else
|
else
|
||||||
printf("%s|%s\n", name, prov);
|
fprintf(outf, "%s|%s\n", name, prov);
|
||||||
free(prov);
|
free(prov);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +319,7 @@ int printDepList(rpmts *ts, int tscount)
|
|||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "OpenEmbedded rpm resolver utility\n");
|
fprintf(stderr, "OpenEmbedded rpm resolver utility\n");
|
||||||
fprintf(stderr, "syntax: rpmresolve [-i] [-d] <dblistfile> <packagelistfile>\n");
|
fprintf(stderr, "syntax: rpmresolve [-i] [-d] [-t] <dblistfile> <packagelistfile>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
@@ -313,16 +331,26 @@ int main(int argc, char **argv)
|
|||||||
int c;
|
int c;
|
||||||
int ignoremissing = 0;
|
int ignoremissing = 0;
|
||||||
int deplistmode = 0;
|
int deplistmode = 0;
|
||||||
|
char *outfile = NULL;
|
||||||
|
|
||||||
|
debugmode = 0;
|
||||||
|
outf = stdout;
|
||||||
|
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
while ((c = getopt (argc, argv, "id")) != -1) {
|
while ((c = getopt (argc, argv, "itdo:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'i':
|
case 'i':
|
||||||
ignoremissing = 1;
|
ignoremissing = 1;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 't':
|
||||||
deplistmode = 1;
|
deplistmode = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'd':
|
||||||
|
debugmode = 1;
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
outfile = strdup(optarg);
|
||||||
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
if(isprint(optopt))
|
if(isprint(optopt))
|
||||||
fprintf(stderr, "Unknown option `-%c'.\n", optopt);
|
fprintf(stderr, "Unknown option `-%c'.\n", optopt);
|
||||||
@@ -341,11 +369,18 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( outfile ) {
|
||||||
|
if(debugmode)
|
||||||
|
printf("DEBUG: Using output file %s\n", outfile);
|
||||||
|
outf = fopen(outfile, "w");
|
||||||
|
}
|
||||||
|
|
||||||
const char *dblistfn = argv[optind];
|
const char *dblistfn = argv[optind];
|
||||||
|
|
||||||
rpmcliInit(argc, argv, NULL);
|
rpmcliInit(argc, argv, NULL);
|
||||||
|
|
||||||
//rpmSetVerbosity(RPMLOG_DEBUG);
|
if(debugmode)
|
||||||
|
rpmSetVerbosity(RPMLOG_DEBUG);
|
||||||
|
|
||||||
rpmDefineMacro(NULL, "__dbi_txn create nofsync", RMIL_CMDLINE);
|
rpmDefineMacro(NULL, "__dbi_txn create nofsync", RMIL_CMDLINE);
|
||||||
|
|
||||||
@@ -363,15 +398,21 @@ int main(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
if( argc - optind < 2 ) {
|
if( argc - optind < 2 ) {
|
||||||
fprintf(stderr, "Please specify package list file\n");
|
fprintf(stderr, "Please specify package list file\n");
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
const char *pkglistfn = argv[optind+1];
|
const char *pkglistfn = argv[optind+1];
|
||||||
rc = processPackages(ts, tscount, pkglistfn, ignoremissing);
|
rc = processPackages(ts, tscount, pkglistfn, ignoremissing);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(i=0; i<tscount; i++)
|
for(i=0; i<tscount; i++)
|
||||||
(void) rpmtsCloseDB(ts[i]);
|
(void) rpmtsCloseDB(ts[i]);
|
||||||
free(ts);
|
free(ts);
|
||||||
|
|
||||||
|
if( outfile ) {
|
||||||
|
fclose(outf);
|
||||||
|
free(outfile);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user