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 | |
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
-rw-r--r-- | constants.py | 1 | ||||
-rw-r--r-- | findpackageset.py | 4 | ||||
-rw-r--r-- | harddrive.py | 11 | ||||
-rw-r--r-- | hdrlist.py | 12 | ||||
-rw-r--r-- | image.py | 21 | ||||
-rw-r--r-- | installmethod.py | 4 | ||||
-rw-r--r-- | loader2/cdinstall.c | 15 | ||||
-rw-r--r-- | loader2/hdinstall.c | 10 | ||||
-rw-r--r-- | loader2/loader.c | 63 | ||||
-rw-r--r-- | loader2/loader.h | 2 | ||||
-rw-r--r-- | loader2/method.c | 11 | ||||
-rw-r--r-- | loader2/nfsinstall.c | 16 | ||||
-rw-r--r-- | loader2/urlinstall.c | 16 | ||||
-rw-r--r-- | packages.py | 2 | ||||
-rw-r--r-- | product.py | 3 | ||||
-rwxr-xr-x | scripts/buildinstall | 33 | ||||
-rwxr-xr-x | scripts/mk-images | 9 | ||||
-rwxr-xr-x | scripts/mk-rescueimage.i386 | 11 | ||||
-rwxr-xr-x | scripts/pkgorder | 13 | ||||
-rw-r--r-- | scripts/splittree.py | 28 | ||||
-rw-r--r-- | urlinstall.py | 9 | ||||
-rw-r--r-- | utils/genhdlist.c | 20 |
22 files changed, 195 insertions, 119 deletions
diff --git a/constants.py b/constants.py index 73865b1cc..88df39970 100644 --- a/constants.py +++ b/constants.py @@ -65,6 +65,7 @@ FIRSTBOOT_RECONFIG = 2 import product productName = product.productName productVersion = product.productVersion +productPath = product.productPath exceptionText = N_("An unhandled exception has occurred. This " "is most likely a bug. Please copy the " diff --git a/findpackageset.py b/findpackageset.py index f4e402e10..063c98c05 100644 --- a/findpackageset.py +++ b/findpackageset.py @@ -1,5 +1,5 @@ import rpm - +from constants import * # set DB_PRIVATE to make rpm happy rpm.addMacro("__dbi_cdb", "create private mpool mp_mmapsize=16Mb mp_size=1Mb") @@ -105,7 +105,7 @@ if __name__ == "__main__": else: instPath = "/" - fd = os.open("%s/RedHat/base/hdlist" %(tree,), os.O_RDONLY) + fd = os.open("%s/%s/base/hdlist" %(tree, productPath), os.O_RDONLY) hdlist = rpm.readHeaderListFromFD(fd) os.close(fd) diff --git a/harddrive.py b/harddrive.py index 92c3f8bb1..dfa020d8e 100644 --- a/harddrive.py +++ b/harddrive.py @@ -24,6 +24,7 @@ import rpm import string from rhpl.translate import _, cat, N_ from rhpl.log import log +from constants import * FILENAME = 1000000 @@ -138,14 +139,14 @@ class HardDriveInstallMethod(InstallMethod): self.umountMedia() self.mountMedia(h[1000002]) - return self.tree + "/RedHat/RPMS/" + h[1000000] + return "%s/%s/RPMS/%s" % (self.tree, productPath, h[1000000]) def readHeaders(self): self.mountMedia(1) - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): self.umountMedia() raise FileCopyException - hl = HeaderListFromFile(self.tree + "/RedHat/base/hdlist") + hl = HeaderListFromFile("%s/%s/base/hdlist" % (self.tree, productPath)) self.umountMedia() # Make sure all of the correct CD images are available @@ -169,10 +170,10 @@ class HardDriveInstallMethod(InstallMethod): def mergeFullHeaders(self, hdlist): self.mountMedia(1) - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): self.umountMedia() raise FileCopyException - hdlist.mergeFullHeaders(self.tree + "/RedHat/base/hdlist2") + hdlist.mergeFullHeaders("%s/%s/base/hdlist2" % (self.tree, productPath)) self.umountMedia() def systemMounted(self, fsset, mntPoint): diff --git a/hdrlist.py b/hdrlist.py index f4625927a..73c993e9c 100644 --- a/hdrlist.py +++ b/hdrlist.py @@ -25,6 +25,8 @@ from rhpl.translate import _, N_ import rhpl.comps import rhpl.arch +from constants import * + import language ON = 1 @@ -997,8 +999,8 @@ if __name__ == "__main__": if (what == rpm.RPMCALLBACK_INST_OPEN_FILE): print "Installing %s" %(nevra(h),) - rpmfd = os.open("%s/RedHat/RPMS/%s-%s-%s.%s.rpm" - %(tree, h['name'], h['version'], h['release'], + rpmfd = os.open("%s/%s/RPMS/%s-%s-%s.%s.rpm" + %(tree, productPath, h['name'], h['version'], h['release'], h['arch']), os.O_RDONLY) return rpmfd elif (what == rpm.RPMCALLBACK_INST_PROGRESS): @@ -1023,7 +1025,7 @@ if __name__ == "__main__": return 0 - fd = os.open(tree + "/RedHat/base/hdlist", os.O_RDONLY) + fd = os.open("%s/%s/base/hdlist" % (tree, productPath), os.O_RDONLY) hdrs = rpm.readHeaderListFromFD(fd) os.close(fd) showMem() @@ -1031,12 +1033,12 @@ if __name__ == "__main__": # rpm.mergeHeaderListFromFD(hdrs, fd, 1000004) # os.close(fd) showMem() - f = open(tree + "/RedHat/base/comps.xml", "r") + f = open("%s/%s/base/comps.xml" % (tree, productPath), "r") comps = rhpl.comps.Comps(f) f.close() showMem() hdrlist = HeaderList(hdrs) - hdrlist.mergeFullHeaders(tree + "/RedHat/base/hdlist2") + hdrlist.mergeFullHeaders("%s/%s/base/hdlist2" % (tree, productPath)) showMem() groups = GroupSet(comps, hdrlist) showMem() @@ -88,18 +88,18 @@ class ImageInstallMethod(InstallMethod): if self.currentIso is not None and self.currentIso != h[1000002]: log("switching from iso %s to %s for %s-%s-%s.%s" %(self.currentIso, h[1000002], h['name'], h['version'], h['release'], h['arch'])) self.currentIso = h[1000002] - return self.getFilename("/RedHat/RPMS/" + h[1000000], callback=callback) + return self.getFilename("/%s/RPMS/%s" % (productPath, h[1000000]), callback=callback) def readHeaders(self): - if not os.access(self.tree + "/RedHat/base/hdlist", os.R_OK): + if not os.access("%s/%s/base/hdlist" % (self.tree, productPath), os.R_OK): raise FileCopyException - hl = HeaderListFromFile(self.tree + "/RedHat/base/hdlist") + hl = HeaderListFromFile("%s/%s/base/hdlist" % (self.tree, productPath)) return hl def mergeFullHeaders(self, hdlist): - if not os.access(self.tree + "/RedHat/base/hdlist2", os.R_OK): + if not os.access("%s/%s/base/hdlist2" % (self.tree, productPath), os.R_OK): raise FileCopyException - hdlist.mergeFullHeaders(self.tree + "/RedHat/base/hdlist2") + hdlist.mergeFullHeaders("%s/%s/base/hdlist2" % (self.tree, productPath)) def getSourcePath(self): return self.tree @@ -149,7 +149,7 @@ class CdromInstallMethod(ImageInstallMethod): if self.loopbackFile: isys.makeDevInode("loop0", "/tmp/loop") isys.lochangefd("/tmp/loop", - "%s/RedHat/base/stage2.img" % self.tree) + "%s/%s/base/stage2.img" % (self.tree, productPath)) self.loopbackFile = None def systemMounted(self, fsset, chroot): @@ -158,7 +158,7 @@ class CdromInstallMethod(ImageInstallMethod): "/rhinstall-stage2.img") try: - iutil.copyFile("%s/RedHat/base/stage2.img" % self.tree, + iutil.copyFile("%s/%s/base/stage2.img" % (self.tree, productPath), self.loopbackFile, (self.progressWindow, _("Copying File"), _("Transferring install image to hard drive..."))) @@ -316,7 +316,8 @@ class CdromInstallMethod(ImageInstallMethod): # FIXME: should retry a few times then prompt for new cd while tries < 5: try: - shutil.copy(self.tree + "/RedHat/RPMS/" + h[1000000], + shutil.copy("%s/%s/RPMS/%s" % (self.tree, productPath, + h[1000000]), tmppath + h[1000000]) except IOError, (errnum, msg): log("IOError %s occurred copying %s: %s", @@ -429,7 +430,7 @@ def findIsoImages(path, messageWindow): # if it's disc1, it needs to have RedHat/base/stage2.img if (num == 1 and not - os.access("/mnt/cdimage/RedHat/base/stage2.img", + os.access("/mnt/cdimage/%s/base/stage2.img" % (productPath,), os.R_OK)): continue @@ -466,7 +467,7 @@ class NfsIsoInstallMethod(NfsInstallMethod): self.umountImage() self.mountImage(h[1000002]) - return self.getFilename("/RedHat/RPMS/" + h[1000000]) + return self.getFilename("/%s/RPMS/%s" % (productPath, h[1000000])) def readHeaders(self): hl = NfsInstallMethod.readHeaders(self) diff --git a/installmethod.py b/installmethod.py index 354ef1eb9..f55343c89 100644 --- a/installmethod.py +++ b/installmethod.py @@ -30,8 +30,8 @@ class InstallMethod: rc = None tryloc = ["/tmp/updates"] if treebase is not None: - tryloc.append(treebase + "/RHupdates") - tryloc.append(treebase + "/RedHat/base") + tryloc.append("%s/RHupdates" %(treebase,)) + tryloc.append("%s/%s/base" % (treebase, productPath)) for pre in tryloc: tmpname = pre + "/" + file diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 5344ffe69..3e2231029 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -147,6 +147,7 @@ static void wrongCDMessage(void) { static void mountCdromStage2(char *cddev) { int gotcd1=0; int rc; + char path[1024]; devMakeInode(cddev, "/tmp/cdrom"); do { @@ -160,7 +161,8 @@ static void mountCdromStage2(char *cddev) { } } while (1); - rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + rc = mountStage2(path); /* if we failed, umount /mnt/source and keep going */ if (rc) { @@ -318,7 +320,10 @@ char * setupCdrom(char * location, devMakeInode(kd->known[i].name, "/tmp/cdrom"); if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0, NULL, NULL, 0, 0)) { - if (!access("/mnt/source/RedHat/base/stage2.img", R_OK) && + char path[1024]; + + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + if (!access(path, R_OK) && (!requirepkgs || !access("/mnt/source/.discinfo", R_OK))) { @@ -326,11 +331,13 @@ char * setupCdrom(char * location, /* free up the CD drive and user can have it avaiable to */ /* aid system recovery. */ if (FL_RESCUE(flags) && totalMemory() > 128000) { - rc = copyFile("/mnt/source/RedHat/base/stage2.img", "/tmp/ramfs/stage2.img"); + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + rc = copyFile(path, "/tmp/ramfs/stage2.img"); stage2img = "/tmp/ramfs/stage2.img"; stage2inram = 1; } else { - stage2img = "/mnt/source/RedHat/base/stage2.img"; + snprintf(path, sizeof(path), "/mnt/source/%s/base/stage2.img", getProductPath()); + stage2img = strdup(path); stage2inram = 0; } diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index 08e399905..ad1d93a46 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -197,7 +197,7 @@ static int loadHDImages(char * prefix, char * dir, int flags, target = NULL; for (; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/RedHat/base/%s", prefix, dir ? dir : "", target); + sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); logMessage("Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -221,12 +221,12 @@ static int loadHDImages(char * prefix, char * dir, int flags, /* handle updates.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); copyUpdatesImg(path); /* handle product.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/product.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/product.img", prefix, dir ? dir : "", getProductPath()); copyProductImg(path); dest = alloca(strlen(target) + 50); @@ -262,7 +262,7 @@ static int mountHDImages(char * prefix, char * dir, int flags, target = NULL; for (idx=0; stg2list[idx]; idx++) { target = stg2list[idx]; - sprintf(path, "%s/%s/RedHat/base/%s", prefix, dir ? dir : "", target); + sprintf(path, "%s/%s/%s/base/%s", prefix, dir ? dir : "", getProductPath(), target); logMessage("Looking for hd stage2 image %s", path); if (!access(path, F_OK)) @@ -302,7 +302,7 @@ static int mountHDImages(char * prefix, char * dir, int flags, /* handle updates.img now before we copy stage2 over... this allows * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); + sprintf(path, "%s/%s/%s/base/updates.img", prefix, dir ? dir : "", getProductPath()); copyUpdatesImg(path); return rc; diff --git a/loader2/loader.c b/loader2/loader.c index b5aafa4e8..d3086a8ba 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -183,35 +183,56 @@ void stopNewt(void) { newtRunning = 0; } -char * getProductName(void) { - static char * productName = NULL; +static char * productName = NULL; +static char * productPath = NULL; + +static void initProductInfo(void) { FILE *f; int i; - if (!productName) { - f = fopen("/.buildstamp", "r"); - if (!f) { - productName = strdup("anaconda"); - } else { - productName = malloc(256); - fgets(productName, 256, f); /* stamp time */ - fgets(productName, 256, f); /* product name */ - - i = strlen(productName) - 1; - while (isspace(*(productName + i))) { - *(productName + i) = '\0'; - i--; - } - - return productName; - } + f = fopen("/.buildstamp", "r"); + if (!f) { + productName = strdup("anaconda"); + productPath = strdup("RedHat"); } else { - return productName; + productName = malloc(256); + productPath = malloc(256); + fgets(productName, 256, f); /* stamp time */ + fgets(productName, 256, f); /* product name */ + fgets(productPath, 256, f); /* product version */ + fgets(productPath, 256, f); /* product path */ + + i = strlen(productName) - 1; + while (isspace(*(productName + i))) { + *(productName + i) = '\0'; + i--; + } + i = strlen(productPath) - 1; + while (isspace(*(productPath + i))) { + *(productPath + i) = '\0'; + i--; + } } +} - return NULL; +char * getProductName(void) { + if (!productName) { + initProductInfo(); + } + return productName; +} + +char * getProductPath(void) { + if (!productPath) { + initProductInfo(); + } + return productPath; } + + + + void initializeConsole(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags) { if (!FL_NOFB(flags)) diff --git a/loader2/loader.h b/loader2/loader.h index e0f524078..711a969a5 100644 --- a/loader2/loader.h +++ b/loader2/loader.h @@ -65,7 +65,7 @@ void startNewt(int flags); void stopNewt(); char * getProductName(void); - +char * getProductPath(void); #include "modules.h" #include "moduledeps.h" diff --git a/loader2/method.c b/loader2/method.c index 0a9694462..faa85ae89 100644 --- a/loader2/method.c +++ b/loader2/method.c @@ -143,6 +143,7 @@ char * validIsoImages(char * dirName) { DIR * dir; struct dirent * ent; char isoImage[1024]; + char path[1024]; if (!(dir = opendir(dirName))) { newtWinMessage(_("Error"), _("OK"), @@ -167,7 +168,8 @@ char * validIsoImages(char * dirName) { continue; } - if (!access("/tmp/loopimage/RedHat/base/hdstg2.img", F_OK)) { + snprintf(path, sizeof(path), "/tmp/loopimage/%s/base/hdstg2.img", getProductPath()); + if (!access(path, F_OK)) { umountLoopback("/tmp/loopimage", "loop7"); break; } @@ -570,6 +572,7 @@ void umountStage2(void) { /* mount a second stage, verify the stamp file, copy updates * Returns 0 on success, 1 on failure to mount, -1 on bad stamp */ int mountStage2(char * path) { + char imgPath[1024]; if (access(path, R_OK)) { return 1; } @@ -584,10 +587,12 @@ int mountStage2(char * path) { } /* JKFIXME: this is kind of silly.. /mnt/source is hardcoded :/ */ - copyUpdatesImg("/mnt/source/RedHat/base/updates.img"); + snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/updates.img", getProductPath()); + copyUpdatesImg(imgPath); /* more hard coding */ - copyProductImg("/mnt/source/RedHat/base/product.img"); + snprintf(imgPath, sizeof(imgPath), "/mnt/source/%s/base/product.img", getProductPath()); + copyProductImg(imgPath); return 0; } diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index 4f8e9ff5c..80e8ea1e5 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -132,10 +132,13 @@ char * mountNfsImage(struct installMethod * method, stage = NFS_STAGE_NFS; if (!doPwMount(fullPath, "/mnt/source", "nfs", 1, 0, NULL, NULL, 0, 0)) { + char mntPath[1024]; + logMessage("mounted %s on /mnt/source", fullPath); - if (!access("/mnt/source/RedHat/base/stage2.img", R_OK)) { + snprintf(mntPath, sizeof(mntPath), "/mnt/source/%s/base/stage2.img", getProductPath()); + if (!access(mntPath, R_OK)) { logMessage("can access stage2.img"); - rc = mountStage2("/mnt/source/RedHat/base/stage2.img"); + rc = mountStage2(mntPath); logMessage("after mountStage2, rc is %d", rc); if (rc) { if (rc == -1) { @@ -156,7 +159,8 @@ char * mountNfsImage(struct installMethod * method, if (mountLoopback(path, "/mnt/source2", "loop1")) logMessage("failed to mount iso %s loopback", path); else { - rc = mountStage2("/mnt/source2/RedHat/base/stage2.img"); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/stage2.img", getProductPath()); + rc = mountStage2(mntPath); if (rc) { umountLoopback("/mnt/source2", "loop1"); if (rc == -1) @@ -164,8 +168,10 @@ char * mountNfsImage(struct installMethod * method, } else { /* JKFIXME: hack because /mnt/source is hard-coded * in mountStage2() */ - copyUpdatesImg("/mnt/source2/RedHat/base/updates.img"); - copyProductImg("/mnt/source2/RedHat/base/product.img"); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/updates.img", getProductPath()); + copyUpdatesImg(mntPath); + snprintf(mntPath, sizeof(mntPath), "/mnt/source2/%s/base/product.img", getProductPath()); + copyProductImg(mntPath); queryIsoMediaCheck(path, flags); diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index d19766dc5..480e32c74 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -43,8 +43,12 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, int fd; int rc; char * newFile = NULL; + char filepath[1024]; + + /* BNFIXME: hack - all callers want RedHat/<foo>, so add prefix here */ + snprintf(filepath, sizeof(filepath), "%s/%s", getProductPath(), file); - fd = urlinstStartTransfer(ui, file, NULL, 1, flags); + fd = urlinstStartTransfer(ui, filepath, NULL, 1, flags); if (fd == -2) return 2; @@ -52,7 +56,7 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, /* file not found */ newFile = alloca(strlen(device) + 20); - sprintf(newFile, "disc1/%s", file); + sprintf(newFile, "disc1/%s", filepath); fd = urlinstStartTransfer(ui, newFile, NULL, 1, flags); @@ -63,7 +67,7 @@ static int loadSingleUrlImage(struct iurlinfo * ui, char * file, int flags, _("Unable to retrieve %s://%s/%s/%s."), (ui->protocol == URL_METHOD_FTP ? "ftp" : "http"), - ui->address, ui->prefix, file); + ui->address, ui->prefix, filepath); return 2; } } @@ -92,7 +96,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { /* grab the updates.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "RedHat/base/updates.img", flags, + if (!loadSingleUrlImage(ui, "base/updates.img", flags, "/tmp/ramfs/updates-disk.img", "/tmp/update-disk", "loop7", 1)) { copyDirectory("/tmp/update-disk", "/tmp/updates"); @@ -103,7 +107,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { /* grab the product.img before netstg1.img so that we minimize our * ramdisk usage */ - if (!loadSingleUrlImage(ui, "RedHat/base/product.img", flags, + if (!loadSingleUrlImage(ui, "base/product.img", flags, "/tmp/ramfs/product-disk.img", "/tmp/product-disk", "loop7", 1)) { copyDirectory("/tmp/product-disk", "/tmp/product"); @@ -122,7 +126,7 @@ static int loadUrlImages(struct iurlinfo * ui, int flags) { stage2img = "stage2.img"; } - snprintf(tmpstr1, sizeof(tmpstr1), "RedHat/base/%s", stage2img); + snprintf(tmpstr1, sizeof(tmpstr1), "base/%s", stage2img); snprintf(tmpstr2, sizeof(tmpstr2), "/tmp/ramfs/%s", stage2img); rc = loadSingleUrlImage(ui, tmpstr1, flags, tmpstr2, diff --git a/packages.py b/packages.py index 4ec77435b..86675d1d3 100644 --- a/packages.py +++ b/packages.py @@ -705,7 +705,7 @@ def doPreInstall(method, id, intf, instPath, dir): # try to copy the comps package. if it doesn't work, don't worry about it try: - id.compspkg = method.copyFileToTemp("RedHat/base/comps.rpm") + id.compspkg = method.copyFileToTemp("%s/base/comps.rpm" % (productPath,)) except: log("Unable to copy comps package") id.compspkg = None diff --git a/product.py b/product.py index 334b32d14..aa66d9f0c 100644 --- a/product.py +++ b/product.py @@ -22,14 +22,17 @@ else: if path is None: productName = "anaconda" productVersion = "bluesky" + productPath = "RedHat" else: f = open(path, "r") lines = f.readlines() if len(lines) < 3: productName = "anaconda" productVersion = "bluesky" + productPath = "RedHat" else: productName = lines[1][:-1] productVersion = lines[2][:-1] + productPath = lines[3][:-1] diff --git a/scripts/buildinstall b/scripts/buildinstall index fbfb9d6cd..a92ba26a6 100755 --- a/scripts/buildinstall +++ b/scripts/buildinstall @@ -1,12 +1,13 @@ #!/bin/bash usage() { - echo "Usage: buildinstall [--comp <component>] [--pkgorder <file>] [--version <version>] [--product <product>] [--release <comment>] <root>" >&2 + echo "Usage: buildinstall [--comp <component>] [--pkgorder <file>] [--version <version>] [--product <product>] [--release <comment>] [--prodpath <path>] <root>" >&2 exit 1 } COMPNAME=dist-7.0 RUN=1 +PRODUCTPATH="RedHat" while [ $# -gt 0 ]; do case $1 in @@ -31,6 +32,10 @@ while [ $# -gt 0 ]; do PRODUCTSTR=$2 shift; shift ;; + --prodpath) + PRODUCTPATH=$2 + shift; shift + ;; --debug) DEBUGSTR="--debug" shift @@ -44,7 +49,7 @@ while [ $# -gt 0 ]; do shift; shift ;; *) - if [ -n "$DIR" -o ! -d $1/RedHat/RPMS ]; then + if [ -n "$DIR" -o ! -d $1/$PRODUCTPATH/RPMS ]; then usage fi DIR=$1 @@ -58,7 +63,7 @@ if [ -z "$PRODUCTSTR" ]; then fi if [ -z "$VERSION" ]; then - VERSION=$(rpm --qf '%{VERSION}' -qp $DIR/RedHat/RPMS/redhat-release-*.rpm) + VERSION=$(rpm --qf '%{VERSION}' -qp $DIR/$PRODUCTPATH/RPMS/redhat-release-*.rpm) fi if [ -z "$DIR" ]; then @@ -83,13 +88,13 @@ MK_IMAGES=$BUILDINSTDIR/mk-images MK_STAMP=$BUILDINSTDIR/makestamp.py BUILDINSTALL=$BUILDINSTDIR/buildinstall -BUILDARCH=`rpm -qp --qf "%{ARCH}" $p/RedHat/RPMS/anaconda-runtime-[0-9]*` +BUILDARCH=`rpm -qp --qf "%{ARCH}" $p/$PRODUCTPATH/RPMS/anaconda-runtime-[0-9]*` firstRun() { echo "Running buildinstall..." pushd $BUILDINSTDIR -rpm2cpio $p/RedHat/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd './usr*' +rpm2cpio $p/$PRODUCTPATH/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd './usr*' popd UPD_INSTROOT=./upd-instroot @@ -115,9 +120,9 @@ rm -rf $BUILDINSTDIR/usr echo "Going to run buildinstall again" # run it again for the second half if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "$BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release '\"$RELEASESTR\"' --product '\"$PRODUCTSTR\"' $DIR" + runroot $COMPNAME --onlyone --arch $BUILDARCH "$BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release '\"$RELEASESTR\"' --product '\"$PRODUCTSTR\"' --prodpath $PRODUCTPATH $DIR" else - $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release \"$RELEASESTR\" --product \"$PRODUCTSTR\" $DIR + $BUILDINSTALL --buildinstdir $BUILDINSTDIR --second $PKGORDERSTR --comp $COMPNAME --version $VERSION --release \"$RELEASESTR\" --product \"$PRODUCTSTR\" --prodpath $PRODUCTPATH $DIR fi rm -rf $BUILDINSTDIR @@ -126,30 +131,30 @@ rm -rf $BUILDINSTDIR secondRun() { echo "Building images..." if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "$UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/RedHat/RPMS $TREEDIR/image-template $TREEDIR/instimage" + runroot $COMPNAME --onlyone --arch $BUILDARCH "$UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/$PRODUCTPATH/RPMS $TREEDIR/image-template $TREEDIR/instimage" else - $UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/RedHat/RPMS $TREEDIR/image-template $TREEDIR/instimage + $UPD_INSTROOT $DEBUGSTR --comp $COMPNAME $p/$PRODUCTPATH/RPMS $TREEDIR/image-template $TREEDIR/instimage fi if [ -n "$PKGORDER" ]; then echo "Getting package order..." if [ -x /usr/bin/runroot ]; then runroot --quiet $COMPNAME --onlyone --arch $BUILDARCH \ - "PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH" > $PKGORDER + "PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH $PRODUCTPATH" > $PKGORDER else - PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH > $PKGORDER + PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH $PRODUCTPATH > $PKGORDER fi fi echo "Making images..." if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $DEBUGSTR $p/RedHat/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH '\"$PRODUCTSTR\"' $VERSION" + runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $DEBUGSTR $p/$PRODUCTPATH/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH '\"$PRODUCTSTR\"' $VERSION $PRODUCTPATH" else - $MK_IMAGES $DEBUGSTR $p/RedHat/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH "$PRODUCTSTR" $VERSION + $MK_IMAGES $DEBUGSTR $p/$PRODUCTPATH/RPMS $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH "$PRODUCTSTR" $VERSION $PRODUCTPATH fi echo "Writing .discinfo file" -$MK_STAMP --releasestr="$RELEASESTR" --arch=$BUILDARCH --discNum="1,2,3" --baseDir=RedHat/base --packagesDir=RedHat/RPMS --pixmapsDir=RedHat/pixmaps --outfile=$p/.discinfo +$MK_STAMP --releasestr="$RELEASESTR" --arch=$BUILDARCH --discNum="1,2,3" --baseDir=$PRODUCTPATH/base --packagesDir=$PRODUCTPATH/RPMS --pixmapsDir=$PRODUCTPATH/pixmaps --outfile=$p/.discinfo if [ -x /usr/bin/runroot ]; then runroot $COMPNAME --onlyone --arch $BUILDARCH "rm -rf $TREEDIR/image-template $TREEDIR/instimage" diff --git a/scripts/mk-images b/scripts/mk-images index e9c0dd0e6..e38aa4c86 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -4,7 +4,7 @@ PATH=$PATH:/sbin:/usr/sbin IMAGEUUID=$(date +%Y%m%d%H%M) usage () { - echo "usage: mk-images <pkgsrc> <toplevel> <template> <imgdir> <buildarch> <productname> <version>" + echo "usage: mk-images <pkgsrc> <toplevel> <template> <imgdir> <buildarch> <productname> <version> [<productpath>]" exit 0 } @@ -17,6 +17,11 @@ if [ -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" -o -z "$5" -o -z "$6" -o -z "$7" ] PRODUCT=$6 VERSION=$7 +if [ -z "$8" ]; then + PRODUCTPATH="RedHat" +else + PRODUCTPATH=$8 +fi TOPDIR=$(echo $0 | sed "s,/[^/]*$,,") if [ $TOPDIR = $0 ]; then @@ -31,7 +36,7 @@ TOPDIR=$(cd $TOPDIR; pwd) IMAGEPATH=$TOPDESTPATH/images FULLMODPATH=/tmp/instimagemods.$$ FINALFULLMODPATH=$4/modules - INSTIMGPATH=$TOPDESTPATH/RedHat/base + INSTIMGPATH=$TOPDESTPATH/$PRODUCTPATH/base INSTIMGTEMPLATE=$3 IMGPATH=$4 KERNELBASE=/tmp/updboot.kernel.$$ diff --git a/scripts/mk-rescueimage.i386 b/scripts/mk-rescueimage.i386 index 4beba12ca..237710638 100755 --- a/scripts/mk-rescueimage.i386 +++ b/scripts/mk-rescueimage.i386 @@ -15,7 +15,7 @@ import sys import string def usage(): - print "usage: mk-rescueimage.i386 <toplevel> <dest-dir> <productname>" + print "usage: mk-rescueimage.i386 <toplevel> <dest-dir> <productname> [<productpath>]" sys.exit(0) @@ -31,6 +31,11 @@ srcdir = sys.argv[1] destdir = sys.argv[2]+"/i386-rescueimage" productname = sys.argv[3] +if len(sys.argv) > 4: + productpath = sys.argv[4] +else: + productpath = "RedHat" + # clean and create destination directory os.system("rm -rf %s" % (destdir,)) os.system("mkdir %s" % (destdir,)) @@ -43,8 +48,8 @@ for pat in ["*eula*", "*EULA*", "README*", "RELEASE*", "GPL", "RPM-*"]: os.system("cp -a %s/isolinux %s/" % (srcdir, destdir)) # cp stage image -os.system("mkdir -p %s/RedHat/base" % (destdir,)) -os.system("cp -a %s/RedHat/base/stage2.img %s/RedHat/base" % (srcdir, destdir)) +os.system("mkdir -p %s/%s/base" % (destdir,productpath)) +os.system("cp -a %s/%s/base/stage2.img %s/%s/base" % (srcdir, productpath, destdir, productpath)) # munge syslinux config to have a default of rescue mode cfgfile = open("%s/isolinux/isolinux.cfg" % (destdir,), "r") diff --git a/scripts/pkgorder b/scripts/pkgorder index 348aa7afc..d2ea8fd70 100755 --- a/scripts/pkgorder +++ b/scripts/pkgorder @@ -137,6 +137,11 @@ if len(sys.argv) < 3: arch = sys.argv[2] distDir = os.path.normpath(sys.argv[1]) +if len(sys.argv) > 3: + productPath = sys.argv[3] +else + productPath = "RedHat" + if not os.path.isdir(distDir): print "error: %s is not a directory" % distDir sys.exit(1) @@ -146,16 +151,16 @@ disc1SrcDir = distDir + "-srpms" disc2Dir = distDir + "-disc2" # pull in the hdlist -f = distDir + "/RedHat/base/hdlist" +f = distDir + "/%s/base/hdlist" % (productPath,) try: hdlist = hdrlist.HeaderListFromFile(f) - hdlist.mergeFullHeaders(distDir + "/RedHat/base/hdlist2") + hdlist.mergeFullHeaders(distDir + "/%s/base/hdlist2" % (productPath,)) except rpm.error: print "Failed to read header list", f sys.exit(1) # and read the comps file -grpset = hdrlist.groupSetFromCompsFile("file://%s/RedHat/base/comps.xml" - %(distDir,), hdlist, doSelect = 0) +grpset = hdrlist.groupSetFromCompsFile("file://%s/%s/base/comps.xml" + %(distDir,productPath), hdlist, doSelect = 0) grpset.unselectAll() #grpset.groups["everything"].select() diff --git a/scripts/splittree.py b/scripts/splittree.py index 0fcff101e..f9e4b724c 100644 --- a/scripts/splittree.py +++ b/scripts/splittree.py @@ -90,6 +90,7 @@ and RPMs. Set to 1 to turn on.""" self.total_discs = None self.bin_discs = None self.src_discs = None + self.product_path = "RedHat" self.bin_list = [] self.src_list = [] self.shared_list = [] @@ -224,10 +225,10 @@ and RPMs. Set to 1 to turn on.""" pass # now create the RedHat/RPMS dir - os.makedirs("%s-disc%d/RedHat/RPMS" % (self.dist_dir, i)) + os.makedirs("%s-disc%d/%s/RPMS" % (self.dist_dir, i, self.product_path)) else: - os.makedirs("%s-disc%d/RedHat/RPMS" % (self.dist_dir, i)) + os.makedirs("%s-disc%d/%s/RPMS" % (self.dist_dir, i, self.product_path)) self.linkFiles(self.dist_dir, "%s-disc%d" %(self.dist_dir, i), self.common_files) self.createDiscInfo(i) @@ -243,13 +244,13 @@ and RPMs. Set to 1 to turn on.""" packages = {} - rpmlist = os.listdir("%s/RedHat/RPMS" % self.dist_dir) + rpmlist = os.listdir("%s/%s/RPMS" % (self.dist_dir, self.product_path)) rpmlist.sort() # create the packages dictionary in this format: n-v-r.a:['n-v-r.arch.rpm'] for filename in rpmlist: - filesize = os.path.getsize("%s/RedHat/RPMS/%s" % (self.dist_dir, filename)) - pkg_nvr = nvra("%s/RedHat/RPMS/%s" %(self.dist_dir, filename)) + filesize = os.path.getsize("%s/%s/RPMS/%s" % (self.dist_dir, self.product_path, filename)) + pkg_nvr = nvra("%s/%s/RPMS/%s" %(self.dist_dir, self.product_path, filename)) if packages.has_key(pkg_nvr): # append in case we have multiple packages with the @@ -284,7 +285,7 @@ and RPMs. Set to 1 to turn on.""" continue for file_name in packages[rpm_nvr]: curused = self.getSize("%s-disc%s" % (self.dist_dir, disc), blocksize=1) - filesize = self.getSize("%s/RedHat/RPMS/%s" % (self.dist_dir, file_name), blocksize=1) + filesize = self.getSize("%s/%s/RPMS/%s" % (self.dist_dir, self.product_path, file_name), blocksize=1) newsize = filesize + curused # compensate for the size of the comps package which has yet to be created @@ -305,8 +306,8 @@ and RPMs. Set to 1 to turn on.""" try: nextdisc=self.bin_list.index(disc+1) disc = self.bin_list[nextdisc] - os.link("%s/RedHat/RPMS/%s" % (self.dist_dir, file_name), - "%s-disc%d/RedHat/RPMS/%s" % (self.dist_dir, disc, file_name)) + os.link("%s/%s/RPMS/%s" % (self.dist_dir, self.product_path, file_name), + "%s-disc%d/%s/RPMS/%s" % (self.dist_dir, disc, self.product_path, file_name)) packagenum = 1 firstpackage = file_name @@ -317,8 +318,8 @@ and RPMs. Set to 1 to turn on.""" continue else: - os.link("%s/RedHat/RPMS/%s" % (self.dist_dir, file_name), - "%s-disc%d/RedHat/RPMS/%s" % (self.dist_dir, disc, file_name)) + os.link("%s/%s/RPMS/%s" % (self.dist_dir, self.product_path, file_name), + "%s-disc%d/%s/RPMS/%s" % (self.dist_dir, disc, self.product_path, file_name)) lastpackage = file_name if reportSize == 1: @@ -384,7 +385,7 @@ and RPMs. Set to 1 to turn on.""" def usage(theerror): print theerror - print """Usage: %s --arch=i386 --total-discs=6 --bin-discs=3 --src-discs=3 --release-string="Red Hat Linux" --pkgorderfile=/tmp/pkgorder.12345 --distdir=/usr/src/someunifiedtree --srcdir=/usr/src/someunifiedtree/SRPMS""" % sys.argv[0] + print """Usage: %s --arch=i386 --total-discs=6 --bin-discs=3 --src-discs=3 --release-string="Red Hat Linux" --pkgorderfile=/tmp/pkgorder.12345 --distdir=/usr/src/someunifiedtree --srcdir=/usr/src/someunifiedtree/SRPMS --productpath=RedHat""" % sys.argv[0] sys.exit(1) @@ -395,7 +396,7 @@ if "__main__" == __name__: theargs = ["arch=", "total-discs=", "bin-discs=", "src-discs=", "release-string=", "pkgorderfile=", - "distdir=", "srcdir="] + "distdir=", "srcdir=", "productpath="] try: options, args = getopt.getopt(sys.argv[1:], '', theargs) @@ -447,6 +448,9 @@ if "__main__" == __name__: timber.src_dir = options["--srcdir"] else: usage("You forgot to specify --srcdir") + + if (options.has_key("--productpath"): + timber.product_path = options["--productpath"] logfile = timber.main() diff --git a/urlinstall.py b/urlinstall.py index 87754f1e0..1607bc091 100644 --- a/urlinstall.py +++ b/urlinstall.py @@ -24,6 +24,7 @@ import struct import socket from snack import * +from constants import * from rhpl.translate import _ @@ -88,7 +89,7 @@ class UrlInstallMethod(InstallMethod): fname = self.findBestFileMatch(None, 'comps.xml') # if not local then assume its on host if fname is None: - fname = self.baseUrl + '/RedHat/base/comps.xml' + fname = '%s/%s/base/comps.xml' % (self.baseUrl, productPath) log("Comps not in update dirs, using %s",fname) return groupSetFromCompsFile(fname, hdlist) @@ -133,7 +134,7 @@ class UrlInstallMethod(InstallMethod): def getRPMFilename(self, h, timer, callback=None): - fullPath = "/RedHat/RPMS/" + h[FILENAME] + fullPath = "/%s/RPMS/%s" % (productPath, h[FILENAME]) return self.getFilename(fullPath, callback=callback, disc = h[DISCNUM]) @@ -172,7 +173,7 @@ class UrlInstallMethod(InstallMethod): tries = 0 while tries < 5: - hdurl = self.baseUrl + "/RedHat/base/hdlist" + hdurl = "%s/%s/base/hdlist" % (self.baseUrl, productPath) try: url = urllib2.urlopen(hdurl) except urllib2.HTTPError, e: @@ -214,7 +215,7 @@ class UrlInstallMethod(InstallMethod): return HeaderList(hl) def mergeFullHeaders(self, hdlist): - fn = self.getFilename("RedHat/base/hdlist2", callback=None) + fn = self.getFilename("%s/base/hdlist2" % (productPath,), callback=None) hdlist.mergeFullHeaders(fn) os.unlink(fn) 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++; |