From b83f8d6435295a0e56bb1b110c3d39e93fd332e3 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Mon, 13 Jan 2003 07:01:40 +0000 Subject: productname and productversion are now defined by passing args to buildinstall so that we don't have them hard coded in the package. they end up in /.buildstamp along with the timestamp for the image. add support for substituting @RHL@ and @RHLVER@ in the help with the product name or version to avoid having to change the help unless its needed --- Makefile | 5 +---- constants.py | 1 + gui.py | 2 ++ product.py | 28 ++++++++++++++++++++++++++++ product.py.in | 13 ------------- scripts/buildinstall | 14 +++++++++++--- scripts/mk-images | 28 +++++++++++++++++----------- scripts/upd-instroot | 2 +- text.py | 3 +++ 9 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 product.py delete mode 100644 product.py.in diff --git a/Makefile b/Makefile index 2a9755281..740067f4c 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,7 @@ CATALOGS = po/anaconda.pot PYFILES = $(wildcard *.py) -all: subdirs mini-wm _xkb.so xmouse.so xutils.so $(CATALOGS) lang-table lang-names product.py locale-list - -product.py: product.py.in Makefile.inc - sed -e 's/@@PRODUCTNAME@@/$(PRODUCTNAME)/g' < product.py.in > product.py +all: subdirs mini-wm _xkb.so xmouse.so xutils.so $(CATALOGS) lang-table lang-names locale-list lang-names: lang-table PYTHONPATH="." $(PYTHON) scripts/getlangnames.py > lang-names diff --git a/constants.py b/constants.py index 8e5642610..8365de134 100644 --- a/constants.py +++ b/constants.py @@ -60,6 +60,7 @@ FIRSTBOOT_RECONFIG = 2 # common string needs to be easy to change import product productName = product.productName +productVersion = product.productVersion exceptionText = N_("An unhandled exception has occurred. This " "is most likely a bug. Please copy the " diff --git a/gui.py b/gui.py index a7e50d41e..737fb3fb5 100755 --- a/gui.py +++ b/gui.py @@ -1427,6 +1427,8 @@ class InstallControlState: break if text: + text = text.replace("@RHL@", productName) + text = text.replace("@RHLVER@", productVersion) return text print "Unable to read %s help text" % (file,) diff --git a/product.py b/product.py new file mode 100644 index 000000000..9287d03c7 --- /dev/null +++ b/product.py @@ -0,0 +1,28 @@ +# +# product.py: product identification string +# +# Copyright 2003 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# library public license. +# +# You should have received a copy of the GNU Library Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +import os + +if not os.access("/.buildstamp", os.R_OK): + productName = "anaconda" + productVersion = "blueskyb" +else: + f = open("/.buildstamp", "r") + lines = f.readlines() + if len(lines) < 3: + productName = "anaconda" + productVersion = "bluesky" + else: + productName = lines[1][:-1] + productVersion = lines[2][:-1] + + diff --git a/product.py.in b/product.py.in deleted file mode 100644 index 7d6a38c21..000000000 --- a/product.py.in +++ /dev/null @@ -1,13 +0,0 @@ -# -# product.py: product identification string -# -# Copyright 2002 Red Hat, Inc. -# -# This software may be freely redistributed under the terms of the GNU -# library public license. -# -# You should have received a copy of the GNU Library Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -productName = @@PRODUCTNAME@@ diff --git a/scripts/buildinstall b/scripts/buildinstall index 2206629ed..d7c1677a2 100755 --- a/scripts/buildinstall +++ b/scripts/buildinstall @@ -25,6 +25,10 @@ while [ $# -gt 0 ]; do RELEASESTR=$2 shift; shift ;; + --product) + PRODUCTSTR=$2 + shift; shift + ;; *) if [ -n "$DIR" -o ! -d $1/RedHat/RPMS ]; then usage @@ -35,8 +39,12 @@ while [ $# -gt 0 ]; do esac done +if [ -z "$PRODUCTSTR" ]; then + usage +fi + if [ -z "$VERSION" ]; then - VERSION=7.1 + usage fi if [ -z "$DIR" ]; then @@ -98,9 +106,9 @@ if [ -n "$PKGORDER" -a -x $p/RedHat/instimage/usr/lib/anaconda-runtime/pkgorder fi if [ -x /usr/bin/runroot ]; then - runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $p/RedHat/RPMS $p $p/image-template $BUILDARCH $VERSION" + runroot $COMPNAME --onlyone --arch $BUILDARCH "cd $BUILDINSTDIR\; ./mk-images $p/RedHat/RPMS $p $p/image-template $BUILDARCH '\"$PRODUCTSTR\"' $VERSION" else - $MK_IMAGES $p/RedHat/RPMS $p $p/image-template $BUILDARCH $VERSION + $MK_IMAGES $p/RedHat/RPMS $p $p/image-template $BUILDARCH "$PRODUCTSTR" $VERSION fi MK_STAMP=./makestamp.py diff --git a/scripts/mk-images b/scripts/mk-images index 15ff89adc..47e7672d8 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -4,13 +4,14 @@ PATH=$PATH:/sbin:/usr/sbin IMAGEUUID=$(date +%Y%m%d%H%M) usage () { - echo "usage: mk-images