scripts/F14-buildinstall | 261 +++++++++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.am | 3 2 files changed, 263 insertions(+), 1 deletion(-)
New commits: commit 6718f79b0286d7eb0ed1244ecd701db0276aaa6b Author: Jeroen van Meeuwen (Ergo Project) jeroen.van.meeuwen@ergo-project.org Date: Thu Jan 27 10:56:49 2011 -0700
Add F14-buildinstall to the distribution
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 97cda8f..09eb731 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,8 +1,8 @@ scriptdir = $(prefix)/lib/revisor/scripts
script_SCRIPTS = \ - F12-buildinstall \ F13-buildinstall \ + F14-buildinstall \ DEVEL-buildinstall
EXTRA_DIST= \ @@ -12,4 +12,5 @@ EXTRA_DIST= \ F9-buildinstall \ F10-buildinstall \ F11-buildinstall \ + F12-buildinstall \ RHEL5-buildinstall
commit a53395cfc886322561ebea36fa4406670334dfe3 Author: Jeroen van Meeuwen (Ergo Project) jeroen.van.meeuwen@ergo-project.org Date: Thu Jan 27 10:55:58 2011 -0700
Make buildinstall for F14 compatible with Revisor's requirements
diff --git a/scripts/F14-buildinstall b/scripts/F14-buildinstall index 36bb32c..c0815b1 100755 --- a/scripts/F14-buildinstall +++ b/scripts/F14-buildinstall @@ -89,6 +89,11 @@ while [ $# -gt 0 ]; do shift; shift ;;
+ --yumconf) + yumconf="$2" + shift; shift + ;; + *) if [ -z "$REPO" ]; then REPO=$1 @@ -143,8 +148,9 @@ BUILDINSTDIR=$(mktemp -d ${TMPDIR:-/tmp}/buildinstall.tree.XXXXXX) TREEDIR=$(mktemp -d ${TMPDIR:-/tmp}/treedir.XXXXXX) CACHEDIR=$(mktemp -d ${TMPDIR:-/tmp}/yumcache.XXXXXX)
-yumconf=$(mktemp ${TMPDIR:-/tmp}/yum.conf.XXXXXX) -cat > $yumconf <<EOF +if [ -z "$yumconf" ]; then + yumconf=$(mktemp ${TMPDIR:-/tmp}/yum.conf.XXXXXX) + cat > $yumconf <<EOF [main] cachedir=$CACHEDIR keepcache=0 @@ -159,32 +165,37 @@ baseurl=$REPO enabled=1 EOF
-n=1 -for r in $EXTRA_REPOS; do - if [[ $r =~ ^/ ]]; then - r="file://$r" - fi - cat >> $yumconf <<EOF + n=1 + for r in $EXTRA_REPOS; do + if [[ $r =~ ^/ ]]; then + r="file://$r" + fi + cat >> $yumconf <<EOF
[anaconda-extrarepo-$n] name=anaconda extra repo $n baseurl=$r enabled=1 EOF - let n++ -done + let n++ + done
-n=1 -for l in $MIRRORLIST; do - cat >> $yumconf <<EOF + n=1 + for l in $MIRRORLIST; do + cat >> $yumconf <<EOF
[anaconda-mirrorlistrepo-$n] name=anaconda mirrorlist repo $n mirrorlist=$l enabled=1 EOF - let n++ -done + let n++ + done +else + newyumconf=$(mktemp ${TMPDIR:-/tmp}/yum.conf.XXXXXX) + cp $yumconf $newyumconf + yumconf=$newyumconf +fi
echo "Running buildinstall..."
commit fe04df34fe25877d46fed7d92476cfc60359589f Author: Jeroen van Meeuwen (Ergo Project) jeroen.van.meeuwen@ergo-project.org Date: Thu Jan 27 10:54:20 2011 -0700
Add F14-buildinstall
diff --git a/scripts/F14-buildinstall b/scripts/F14-buildinstall new file mode 100755 index 0000000..36bb32c --- /dev/null +++ b/scripts/F14-buildinstall @@ -0,0 +1,250 @@ +#!/bin/bash +# +# buildinstall +# +# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# + +die() { + [ -n "$TREEDIR" ] && rm -rf $TREEDIR + [ -n "$BUILDINSTDIR" ] && rm -rf $BUILDINSTDIR + [ -n "$yumconf" ] && rm -rf $yumconf + echo "Aborting buildinstall" + echo "$@" + exit 1 +} + +usage() { + echo "Usage: buildinstall --version <version> --brand <brand> --product <product> --release <comment> [--output outputdir] [--discs <discstring>] <root>" >&2 + exit 1 +} + +CWD="$(pwd)" +PRODUCTPATH="anaconda" + +while [ $# -gt 0 ]; do + case $1 in + # general options affecting how we build things + --nogr) + NOGRSTR="--nogr" + shift + ;; + --debug) + DEBUGSTR="--debug" + shift + ;; + --localscripts) + LOCALSCRIPTS="yes" + shift + ;; + + # release information + --version) + VERSION=$2 + shift; shift + ;; + --release) + RELEASESTR=$2 + shift; shift + ;; + --product) + PRODUCTSTR=$2 + shift; shift + ;; + --brand) + BRANDSTR=$2 + shift; shift + ;; + --variant) + VARIANT=$2 + shift; shift + ;; + --bugurl) + BUGURL=$2 + shift; shift + ;; + --output) + OUTPUT=$2 + shift; shift + ;; + --updates) + UPDATES=$2 + shift; shift + ;; + --mirrorlist) + MIRRORLIST="$MIRRORLIST $2" + shift; shift + ;; + + *) + if [ -z "$REPO" ]; then + REPO=$1 + else + EXTRA_REPOS="$EXTRA_REPOS $1" + fi + shift + ;; + esac +done + +if [ -z "$PRODUCTSTR" ]; then + usage +fi + +if [ -z "$VERSION" ]; then + usage +fi + +if [ -z "$REPO" ]; then + usage +fi + +if [ -z "$RELEASESTR" ]; then + usage +fi + +if [ -z "$BUGURL" ]; then + BUGURL="your distribution provided bug reporting tool." +fi + +if [[ "$REPO" =~ ^/ ]]; then + [ -n "$OUTPUT" ] || OUTPUT=$REPO + REPO="file://$REPO" +fi + +if [ -z "$OUTPUT" ]; then + usage +fi + +if [ ! -d "$OUTPUT" ]; then + mkdir -p $OUTPUT +fi + +# The first -release and -logos package we are going to look for is the lowercase +if [ -z "$BRANDSTR" ]; then + BRANDSTR="`echo $PRODUCTSTR | tr '[:upper:]' '[:lower:]'`" +fi +export brandpkgname="$BRANDSTR" + +BUILDINSTDIR=$(mktemp -d ${TMPDIR:-/tmp}/buildinstall.tree.XXXXXX) +TREEDIR=$(mktemp -d ${TMPDIR:-/tmp}/treedir.XXXXXX) +CACHEDIR=$(mktemp -d ${TMPDIR:-/tmp}/yumcache.XXXXXX) + +yumconf=$(mktemp ${TMPDIR:-/tmp}/yum.conf.XXXXXX) +cat > $yumconf <<EOF +[main] +cachedir=$CACHEDIR +keepcache=0 +gpgcheck=0 +plugins=0 +reposdir= +tsflags=nodocs + +[anacondarepo] +name=anaconda repo +baseurl=$REPO +enabled=1 +EOF + +n=1 +for r in $EXTRA_REPOS; do + if [[ $r =~ ^/ ]]; then + r="file://$r" + fi + cat >> $yumconf <<EOF + +[anaconda-extrarepo-$n] +name=anaconda extra repo $n +baseurl=$r +enabled=1 +EOF + let n++ +done + +n=1 +for l in $MIRRORLIST; do + cat >> $yumconf <<EOF + +[anaconda-mirrorlistrepo-$n] +name=anaconda mirrorlist repo $n +mirrorlist=$l +enabled=1 +EOF + let n++ +done + +echo "Running buildinstall..." + +if [ "$LOCALSCRIPTS" = "yes" ]; then + UPD_INSTROOT="$CWD/upd-instroot" + MK_IMAGES="$CWD/mk-images" + MK_TREEINFO="$CWD/maketreeinfo.py" + MK_STAMP="$CWD/makestamp.py" + BUILDINSTALL="$CWD/buildinstall" +else + pushd $BUILDINSTDIR + BUILDARCH=`repoquery -c $yumconf --qf "%{ARCH}\n" anaconda` + # lets use rpmutils to make sure we have the canonical basearch + # BUILDARCH != BASEARCH (e.g. i586 != i386, sparcv9 != sparc) + BASEARCH=`python -c "import rpmUtils.arch; \ + print rpmUtils.arch.getBaseArch(myarch=rpmUtils.arch.getCanonArch(skipRpmPlatform = True));"` + yumdownloader -c $yumconf anaconda || exit 1 + rpm2cpio anaconda*rpm | cpio --quiet -iumd './usr*' + rm -f anaconda*rpm + popd + + 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 $MK_TREEINFO $BUILDINSTALL; do + if [ -n "$UPDATES" -a -f $UPDATES/usr/libexec/anaconda/$f ]; then + cp -a $UPDATES/usr/libexec/anaconda/$f* $BUILDINSTDIR/ + elif [ ! -f $f ]; then + cp -a $BUILDINSTDIR/usr/libexec/anaconda/$f* $BUILDINSTDIR/ + else + cp -a $f* $BUILDINSTDIR/ + fi + done + + UPD_INSTROOT=$BUILDINSTDIR/upd-instroot + MK_IMAGES=$BUILDINSTDIR/mk-images + MK_TREEINFO=$BUILDINSTDIR/maketreeinfo.py + MK_STAMP=$BUILDINSTDIR/makestamp.py + BUILDINSTALL=$BUILDINSTDIR/buildinstall +fi + +if [ -n "$UPDATES" ]; then UPDATES="--updates $UPDATES"; fi + +echo "Building images..." +$UPD_INSTROOT $DEBUGSTR $NOGRSTR --arch $BUILDARCH $UPDATES --imgdir $TREEDIR/install $yumconf || die "upd-instroot failed" + +echo "Writing .treeinfo file..." +# NOTE --arch must match MK_IMAGES or the resulting treeinfo will be invalid +$MK_TREEINFO --family="$PRODUCTSTR" ${VARIANT:+--variant="$VARIANT"} --version=$VERSION --arch=$BASEARCH --outfile=$OUTPUT/.treeinfo + +# FIXME: need to update mk-images to take the yumconf +echo "Making images: $PWD" +echo $MK_IMAGES $DEBUGSTR $NOGRSTR --imgdir $TREEDIR/install --arch $BASEARCH --product "$PRODUCTSTR" --version $VERSION --bugurl "$BUGURL" --output $OUTPUT $yumconf +$MK_IMAGES $DEBUGSTR $NOGRSTR --imgdir $TREEDIR/install --arch $BASEARCH --product "$PRODUCTSTR" --version $VERSION --bugurl "$BUGURL" --output $OUTPUT $yumconf || die "image creation failed" + +echo "Writing .discinfo file" +$MK_STAMP --releasestr="$RELEASESTR" --arch=$BASEARCH --discNum="ALL" --outfile=$OUTPUT/.discinfo + +rm -rf $TREEDIR $BUILDINSTDIR +rm -f $yumconf
revisor-devel@lists.fedorahosted.org