[PATCH] .treeinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again,

So I'm back on my let's-update-.discinfo kick.

This patch adds a new file to scripts/ called 'maketreeinfo.py', which
works similarly to makestamp.py. It creates a file called .treeinfo,
which is like .discinfo except:

1) it's in .ini/ConfigParser format, and
2) it contains slightly more information (and removes some unused
fields).

The patch also modifies buildinstall to add an optional --variant flag ,
and to call maketreeinfo.py (*before* creating the boot images - this is
intentional, see below)

I left .discinfo in place, because I think it'd be premature to
deprecate .discinfo right now. 

If this is accepted, my next trick will be to change mk-images* so that
they add info to .treeinfo describing the locations of the images they
wrote out.

Does this all seem reasonable?

-w
diff -Naur --exclude=CVS --exclude='*.swp' --exclude='.#*' anaconda/scripts/buildinstall anaconda-ww/scripts/buildinstall
--- anaconda/scripts/buildinstall	2007-02-15 10:55:15.000000000 -0500
+++ anaconda-ww/scripts/buildinstall	2007-02-15 16:04:15.000000000 -0500
@@ -30,6 +30,10 @@
 	    PRODUCTSTR=$2
 	    shift; shift
 	    ;;
+	--variant)
+	    VARIANT=$2
+	    shift; shift
+	    ;;
 	--prodpath)
 	    PRODUCTPATH=$2
 	    shift; shift
@@ -101,6 +105,7 @@
 
 UPD_INSTROOT=$BUILDINSTDIR/upd-instroot
 MK_IMAGES=$BUILDINSTDIR/mk-images
+MK_TREEINFO=$BUILDINSTDIR/maketreeinfo.py
 MK_STAMP=$BUILDINSTDIR/makestamp.py
 BUILDINSTALL=$BUILDINSTDIR/buildinstall
 
@@ -114,10 +119,11 @@
 
 UPD_INSTROOT=./upd-instroot
 MK_IMAGES=./mk-images
+MK_TREEINFO=./maketreeinfo.py
 MK_STAMP=./makestamp.py
 BUILDINSTALL=./buildinstall
 
-for f in $UPD_INSTROOT $MK_IMAGES $MK_STAMP $BUILDINSTALL; do
+for f in $UPD_INSTROOT $MK_IMAGES $MK_STAMP $MK_TREEINFO $BUILDINSTALL; do
     if [ ! -f $f ]; then
 	cp -a $BUILDINSTDIR/usr/lib/anaconda-runtime/$f* $BUILDINSTDIR/
     else
@@ -127,6 +133,7 @@
 
 UPD_INSTROOT=$BUILDINSTDIR/upd-instroot
 MK_IMAGES=$BUILDINSTDIR/mk-images
+MK_TREEINFO=$BUILDINSTDIR/maketreeinfo.py
 MK_STAMP=$BUILDINSTDIR/makestamp.py
 BUILDINSTALL=$BUILDINSTDIR/buildinstall
 
@@ -142,6 +149,9 @@
     PYTHONPATH=$TREEDIR/instimage/usr/lib/anaconda $TREEDIR/instimage/usr/lib/anaconda-runtime/pkgorder $p $BUILDARCH $PRODUCTPATH > $PKGORDER
 fi
 
+echo "Writing .treeinfo file..."
+$MK_TREEINFO --family="$PRODUCTSTR" ${VARIANT:+--variant="$VARIANT"} --version=$VERSION --arch=$BUILDARCH --packagedir=${PKGDIR#$p/} --outfile=$p/.treeinfo
+
 echo "Making images..."
 $MK_IMAGES $DEBUGSTR $NOGRSTR $PKGDIR $p $TREEDIR/image-template $TREEDIR/instimage $BUILDARCH "$PRODUCTSTR" $VERSION $PRODUCTPATH "$BUGURL"
 
diff -Naur --exclude=CVS --exclude='*.swp' --exclude='.#*' anaconda/scripts/Makefile anaconda-ww/scripts/Makefile
--- anaconda/scripts/Makefile	2006-05-16 17:33:48.000000000 -0400
+++ anaconda-ww/scripts/Makefile	2007-02-15 10:47:37.000000000 -0500
@@ -14,6 +14,7 @@
 	install -m 755 pkgorder $(DESTDIR)/$(RUNTIMEDIR)
 	install -m 755 getkeymaps $(DESTDIR)/$(RUNTIMEDIR)
 	install -m 755 makestamp.py $(DESTDIR)/$(RUNTIMEDIR)
+	install -m 755 maketreeinfo.py $(DESTDIR)/$(RUNTIMEDIR)
 	install -m 755 fixmtime.py $(DESTDIR)/$(RUNTIMEDIR)
 	install -m 755 yumcache $(DESTDIR)/$(RUNTIMEDIR)
 	install -m 755 pyrc.py $(DESTDIR)/$(RUNTIMEDIR)
diff -Naur --exclude=CVS --exclude='*.swp' --exclude='.#*' anaconda/scripts/maketreeinfo.py anaconda-ww/scripts/maketreeinfo.py
--- anaconda/scripts/maketreeinfo.py	1969-12-31 19:00:00.000000000 -0500
+++ anaconda-ww/scripts/maketreeinfo.py	2007-02-15 12:29:14.000000000 -0500
@@ -0,0 +1,103 @@
+#!/usr/bin/python
+#
+# makes a .treeinfo file.  if information isn't provided, prompts for it
+#
+# Copyright 2002  Red Hat, Inc.
+#
+# License: GPL
+#
+
+import os,sys,string
+import getopt
+import time
+import ConfigParser
+
+
+def usage():
+    args = ""
+    for key in data:
+        args = "%s [--%s=%s]" %(args, key, key)
+    print "%s: %s" % (sys.argv[0], args)
+    sys.exit(1)
+
+# TODO: add composeid, images, etc.
+# FIXME: take releasestr as an option and break it up into family/variant/version
+data = {"timestamp": None,
+        "family": None,
+        "variant": None,
+        "version": None,
+        "arch": None,
+        "discnum": None,
+        "totaldiscs": None,
+        "packagedir": 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()
+
+# FIXME use defaults here
+
+if data["timestamp"] is None:
+    print >> sys.stderr, "timestamp not specified; using the current time"
+    data["timestamp"] = time.time()
+else:
+    data["timestamp"] = float(data["timestamp"])
+
+if data["family"] is None:
+    print "What should be the OS family name associated with this disc? (e.g. Fedora, Red Hat Enterprise Linux)"
+    data["family"] = sys.stdin.readline()[:-1]
+
+if data["variant"] is None:
+    # variant is optional
+    data["variant"] = ""
+
+if data["version"] is None:
+    print "What should be the release version associated with this disc? (e.g. 4, 6.90)"
+    data["version"] = 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["totaldiscs"] is None and allDiscs is None:
+    print >> sys.stderr, "No disc total specified; assuming 1"
+    data["totaldiscs"] = "1"
+
+if data["packagedir"] is None:
+    print "Where are the packages located?"
+    data["packagedir"] = sys.stdin.readline()[:-1]
+
+
+if data["outfile"] is None:
+    f = sys.stdout
+else:
+    f = open(data["outfile"], "w")
+
+section='general'
+c=ConfigParser.ConfigParser()
+c.add_section(section)
+for k,v in data.items(): 
+    if k != 'outfile':
+        c.set(section,k,v)
+c.write(f)

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux