diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-10-14 19:36:32 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-10-14 19:36:32 +0000 |
commit | 60a8f9866e39b0eb0f5f0e15057f36679d007522 (patch) | |
tree | e86d39f59a06ada627d57addf02b31810730853d /utils | |
parent | 6af42d3070c2528db2c3fb47a3613e150ef1c449 (diff) | |
download | anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.tar.gz anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.tar.xz anaconda-60a8f9866e39b0eb0f5f0e15057f36679d007522.zip |
read product path from the build stamp if possible, default to RedHat if not
available. basically notting's patch with some fixes and genhdlist handled
Diffstat (limited to 'utils')
-rw-r--r-- | utils/genhdlist.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/utils/genhdlist.c b/utils/genhdlist.c index 5bc7be3e8..144d9f988 100644 --- a/utils/genhdlist.c +++ b/utils/genhdlist.c @@ -103,7 +103,7 @@ int getOrder (char * fn) int onePrePass(const char * dirName) { struct dirent * ent; DIR * dir; - char * subdir = alloca(strlen(dirName) + 20); + char * subdir = strdup(dirName); FD_t fd; int rc; Header h; @@ -114,8 +114,6 @@ int onePrePass(const char * dirName) { rpmtsSetVSFlags(ts, ~RPMVSF_NOHDRCHK); rpmtsCloseDB(ts); - sprintf(subdir, "%s/RedHat/RPMS", dirName); - dir = opendir(subdir); if (!dir) { fprintf(stderr,"error opening directory %s: %s\n", subdir, @@ -178,7 +176,7 @@ int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum, int doSplit) { FD_t fd; struct dirent * ent; - char * subdir = alloca(strlen(dirName) + 20); + char * subdir = strdup(dirName); int errno; Header h, nh, h2; int rc; @@ -197,8 +195,6 @@ int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum, rpmtsSetVSFlags(ts, ~RPMVSF_NOHDRCHK); rpmtsCloseDB(ts); - sprintf(subdir, "%s/RedHat/RPMS", dirName); - dir = opendir(subdir); if (!dir) { fprintf(stderr,"error opening directory %s: %s\n", subdir, @@ -420,7 +416,7 @@ int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum, } static void usage(void) { - fprintf(stderr, "genhdlist: genhdlist [--withnumbers] [--fileorder <path>] [--hdlist <path>] <paths>+\n"); + fprintf(stderr, "genhdlist: genhdlist [--withnumbers] [--fileorder <path>] [--hdlist <path>] [--productpath <path>] <paths>+\n"); exit(1); } @@ -436,6 +432,7 @@ int main(int argc, const char ** argv) { char * hdListFile = NULL; char * hdListFile2 = NULL; char * depOrderFile = NULL; + char * prodDir = strdup("RedHat"); poptContext optCon; struct poptOption options[] = { { "hdlist", '\0', POPT_ARG_STRING, &hdListFile, 0 }, @@ -443,6 +440,7 @@ int main(int argc, const char ** argv) { { "fileorder", '\0', POPT_ARG_STRING, &depOrderFile, 0 }, { "nosplit", '\0', 0, &noSplit, 0 }, { "split", '\0', 0, &split, 0 }, + { "productpath", '\0', POPT_ARG_STRING, &prodDir, 0 }, { 0, 0, 0, 0, 0 } }; @@ -504,7 +502,7 @@ int main(int argc, const char ** argv) { if (!hdListFile) { strcpy(buf, args[0]); - strcat(buf, "/RedHat/base/hdlist"); + sprintf(buf, "%s/%s/base/hdlist", buf, prodDir); hdListFile = buf; } @@ -542,14 +540,16 @@ int main(int argc, const char ** argv) { i = 0; while (args[i]) { - if (onePrePass(args[i])) + sprintf(buf, "%s/%s/RPMS", args[i], prodDir); + if (onePrePass(buf)) return 1; i++; } i = 0; while (args[i]) { - if (onePass(outfd, out2fd, args[i], cdNum, doSplit)) + sprintf(buf, "%s/%s/RPMS", args[i], prodDir); + if (onePass(outfd, out2fd, buf, cdNum, doSplit)) return 1; if (doNumber) cdNum++; i++; |