summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2002-08-08 18:37:07 +0000
committerJeremy Katz <katzj@redhat.com>2002-08-08 18:37:07 +0000
commitb8ea6a0297339177bb81434016ae8182c5ac130e (patch)
tree3fcf64db66dc225e0e8b97a1ebf5a3dd66ff39d7 /scripts
parentd31bcb4845331c375f84516cee4bb1a311a0d665 (diff)
downloadanaconda-b8ea6a0297339177bb81434016ae8182c5ac130e.tar.gz
anaconda-b8ea6a0297339177bb81434016ae8182c5ac130e.tar.xz
anaconda-b8ea6a0297339177bb81434016ae8182c5ac130e.zip
creation of stamp in buildinstall for main tree which becomes the dvd
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/buildinstall25
-rwxr-xr-xscripts/makestamp.py96
-rwxr-xr-xscripts/splitdistro36
3 files changed, 148 insertions, 9 deletions
diff --git a/scripts/buildinstall b/scripts/buildinstall
index e36d980e0..a86aefca9 100755
--- a/scripts/buildinstall
+++ b/scripts/buildinstall
@@ -1,7 +1,7 @@
#!/bin/bash
usage() {
- echo "Usage: buildinstall [--comp <component>] [--pkgorder <file>] [--version <version>] <root>" >&2
+ echo "Usage: buildinstall [--comp <component>] [--pkgorder <file>] [--version <version>] [--release <comment>] <root>" >&2
exit 1
}
@@ -21,6 +21,10 @@ while [ $# -gt 0 ]; do
VERSION=$2
shift; shift
;;
+ --release)
+ RELEASESTR=$2
+ shift; shift
+ ;;
*)
if [ -n "$DIR" -o ! -d $1/RedHat/RPMS ]; then
usage
@@ -39,6 +43,10 @@ if [ -z "$DIR" ]; then
usage
fi
+if [ -z "$RELEASESTR" ]; then
+ usage
+fi
+
p=`cd $DIR; /bin/pwd | sed 's,/md1/,/,g'`
BUILDINSTDIR=$p/buildinstall.tree.$$
@@ -95,5 +103,20 @@ else
$MK_IMAGES $p/RedHat/RPMS $p $p/image-template $BUILDARCH $VERSION
fi
+MK_STAMP=./makestamp.py
+echo "Writing .discinfo file"
+if [ ! -f $MK_STAMP ]; then
+ cd $BUILDINSTDIR
+ rpm2cpio $p/RedHat/RPMS/anaconda-runtime-[0-9]* | cpio --quiet -iumd ./usr/lib/anaconda-runtime/makestamp* usr/lib/anaconda-runtime/makestamp*
+ mv usr/lib/anaconda-runtime/makestamp* .
+ rm -rf usr
+else
+ cp $MK_STAMP* $BUILDINSTDIR/
+fi
+MK_STAMP=$BUILDINSTDIR/makestamp.py
+
+$MK_STAMP --releasestr="$RELEASESTR $VERSION" --arch=$BUILDARCH --discNum="1,2,3" --baseDir=RedHat/base --packagesDir=RedHat/RPMS --pixmapsDir=RedHat/pixmaps --outfile=$p/.discinfo
+
+
rm -rf $BUILDINSTDIR
rm -rf $p/image-template $p/RedHat/instimage
diff --git a/scripts/makestamp.py b/scripts/makestamp.py
new file mode 100755
index 000000000..156d5975e
--- /dev/null
+++ b/scripts/makestamp.py
@@ -0,0 +1,96 @@
+#!/usr/bin/python2.2
+#
+# makes a .discinfo file. if information isn't provided, prompts for it
+#
+# Copyright 2002 Red Hat, Inc.
+#
+# License: GPL
+#
+
+import os,sys,string
+import getopt
+import time
+
+
+def usage():
+ args = ""
+ for key in data:
+ args = "%s [--%s=%s]" %(args, key, key)
+ print "%s: %s" % (sys.argv[0], args)
+ sys.exit(1)
+
+data = {"timestamp": None,
+ "releasestr": None,
+ "arch": None,
+ "discNum": None,
+ "baseDir": None,
+ "packagesDir": None,
+ "pixmapsDir": None,
+ "outfile": None}
+allDiscs = None
+
+opts = []
+for key in data.keys():
+ opts.append("%s=" % (key,))
+opts.append("allDiscs")
+
+(args, extra) = getopt.getopt(sys.argv[1:], '', opts)
+if len(extra) > 0:
+ print "had extra args: %s" % extra
+ usage()
+
+for (str, arg) in args:
+ if str[2:] in data.keys():
+ data[str[2:]] = arg
+ elif str == "--allDiscs":
+ allDiscs = 1
+ else:
+ print "unknown str of ", str
+ usage()
+
+if data["timestamp"] is None:
+ print >> sys.stderr, "timestamp not specified; using the current time"
+ data["timestamp"] = time.time()
+
+if data["releasestr"] is None:
+ print "What should be the release name associated with this disc?"
+ data["releasestr"] = sys.stdin.readline()[:-1]
+
+if data["arch"] is None:
+ print "What arch is this disc for?"
+ data["arch"] = sys.stdin.readline()[:-1]
+
+if data["discNum"] is None and allDiscs is None:
+ print >> sys.stderr, "No disc number specified; assuming disc 1"
+ data["discNum"] = "1"
+
+if data["baseDir"] is None:
+ print "Where is the comps file located?"
+ data["baseDir"] = sys.stdin.readline()[:-1]
+
+if data["packagesDir"] is None:
+ print "Where are the packages located?"
+ data["packagesDir"] = sys.stdin.readline()[:-1]
+
+if data["pixmapsDir"] is None:
+ print "Where are the images located?"
+ data["pixmapsDir"] = sys.stdin.readline()[:-1]
+
+
+if data["outfile"] is None:
+ f = sys.stdout
+else:
+ f = open(data["outfile"], "w")
+
+f.write("%f\n" % data["timestamp"])
+f.write("%s\n" % data["releasestr"])
+f.write("%s\n" % data["arch"])
+if allDiscs is None:
+ f.write("%s\n" % data["discNum"])
+else:
+ f.write("ALL\n")
+f.write("%s\n" % data["baseDir"])
+f.write("%s\n" % data["packagesDir"])
+f.write("%s\n" % data["pixmapsDir"])
+
+
diff --git a/scripts/splitdistro b/scripts/splitdistro
index 004333cc8..98af6fdba 100755
--- a/scripts/splitdistro
+++ b/scripts/splitdistro
@@ -26,12 +26,19 @@ import getopt
import time
import types
-def stamp(path, releasestr, num, arch, startedAt):
+def stamp(path, releasestr, num, arch, startedAt, dirInfo):
+ try:
+ os.unlink("%s/.discinfo" % path)
+ except:
+ pass
f = open("%s/.discinfo" % path, "w")
f.write("%f\n" % startedAt)
f.write("%s\n" % releasestr)
f.write("%s\n" % arch)
f.write("%s\n" % num)
+ if dirInfo is not None:
+ for item in dirInfo:
+ f.write("%s\n" % item)
f.close()
def moveFiles(srcDir, destDir, files):
@@ -101,8 +108,6 @@ def spaceUsed(path):
os.path.walk (path, foo.traverse, None)
return foo.total()
-startedAt = time.time()
-
fns = {}
(args, extra) = getopt.getopt(sys.argv[1:], '', [ 'fileorder=', 'release=' ])
@@ -129,6 +134,21 @@ arch = extra[1]
distDir = os.path.normpath(extra[0] + "/" + arch)
srcDir = os.path.normpath(extra[0] + "/" + arch + "/SRPMS")
+if not os.access("%s/.discinfo" %(distDir,), os.O_RDONLY):
+ startedAt = time.time()
+ dirInfo = None
+else:
+ f = open("%s/.discinfo" %(distDir,), "r")
+ startedAt = string.atof(f.readline()[:-1])
+ releasestr = f.readline()[:-1]
+ newarch = f.readline()[:-1]
+ if newarch != arch:
+ raise RuntimeError, "Passed arch doesn't match arch in .discinfo file"
+ # throw out discnum
+ f.readline()
+ # basedir, packagedir, and pixmapdir
+ dirInfo = [ f.readline()[:-1], f.readline()[:-1], f.readline()[:-1] ]
+
if not os.path.isdir(distDir):
print "error: %s is not a directory" % distDir
sys.exit(1)
@@ -189,13 +209,13 @@ os.system("mkdir -p %s %s/SRPMS %s/SRPMS %s/RedHat/RPMS %s/RedHat/RPMS %s/SRPMS"
print "Creating disc1..."
os.system("cp -al %s/. %s" % (distDir, disc1Dir))
-stamp(disc1Dir, releasestr, "1", arch, startedAt)
+stamp(disc1Dir, releasestr, "1", arch, startedAt, dirInfo)
# remove the srpms dir from disc1 since it shouldn't be there
os.system("rm -rf %s/SRPMS" % (disc1Dir,))
print "Creating disc2..."
-stamp(disc2Dir, releasestr, "2", arch, startedAt)
+stamp(disc2Dir, releasestr, "2", arch, startedAt, dirInfo)
for file in jointfiles:
linkFile(disc1Dir, disc2Dir, file)
@@ -214,7 +234,7 @@ moveFiles("%s/RedHat/RPMS" % disc1Dir,
disc1Size = spaceUsed(disc1Dir)
print "Creating disc3..."
-stamp(disc3Dir, releasestr, "3", arch, startedAt)
+stamp(disc3Dir, releasestr, "3", arch, startedAt, dirInfo)
for file in jointfiles:
linkFile(disc1Dir, disc2Dir, file)
@@ -232,7 +252,7 @@ print "Creating first source disc..."
os.system("cp -al %s %s" % (srcDir, disc1SrcDir))
print "Creating second source disc..."
-stamp(disc2SrcDir, releasestr, "4", arch, startedAt)
+stamp(disc2SrcDir, releasestr, "4", arch, startedAt, dirInfo)
srcPkgList = os.listdir("%s/SRPMS" % disc1SrcDir)
srcPkgList.sort()
@@ -245,7 +265,7 @@ moveFiles("%s/SRPMS" % disc1SrcDir,
srcDisc1Size = spaceUsed(disc1SrcDir)
print "Dropping remainder of sources on third disc..."
-stamp(disc2SrcDir, releasestr, "5", arch, startedAt)
+stamp(disc2SrcDir, releasestr, "5", arch, startedAt, dirInfo)
disc3pkgs = excessFiles(srcDir, srcPkgList,
srcDisc1Size - disc3used + targetSize - fudgeFactor)
print "first src pkg to move to 3rd src cd is", disc3pkgs[0]