replacing pldistro-fcdistro-*.lst with a pldistro-*.lst with variants embedded
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 21 Nov 2007 08:22:55 +0000 (08:22 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 21 Nov 2007 08:22:55 +0000 (08:22 +0000)
Makefile
build.common
planetlab-devel.lst [moved from planetlab-fc6-devel.lst with 98% similarity]
vbuild-init-vserver.sh
vbuild-nightly.sh

index 5de6d07..8f7e977 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
 #################### (fedora) distributions
 #
 # (*) as of nov. 2007, myplc-devel is deprecated
-# (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-fc6-devel.lst)
+# (*) instead, we create a fresh vserver that holds required tools (see e.g. planetlab-devel.lst)
 # (*) the build uses the current fedora version as a target for the produced images
 # (*) so you simply need to create a fedora 8 build image for building fedora-8 images 
 #     
index 60ed22d..9fb7f37 100644 (file)
@@ -249,6 +249,40 @@ function pl_fixdirs() {
     done
 }
 
+########## .lst format
+# comments start with a # - this is needed only if you use a keyword in a comment
+# lst_parse keyword fcdistro lst1 .. lstn
+# for a given keyword like 'package' :
+# we support fcdistro-dependant format, for tokens (pkgname) without whitespace
+# you can e.g. use
+# package: pkg1 .. pkgn 
+# package+f8: pkg1 .. pkgn
+# package-f8: pkg1 .. pkgn
+
+function lst_parse () {
+
+    keyword=$1;shift
+    fcdistro=$1; shift
+
+    # grab regular descriptions
+    all=$(grep -v '^#' "$@" | grep --regexp="^${keyword}:" | sed -e "s,${keyword}:,,")
+    # grab additions
+    add=$(grep -v '^#' "$@" | grep --regexp="^${keyword}+${fcdistro}:" | sed -e "s,${keyword}\+${fcdistro}:,,")
+    # grab exclusions
+    sub=$(grep -v '^#' "$@" | grep --regexp="^${keyword}\-${fcdistro}:" | sed -e "s,${keyword}\-${fcdistro}:,,")
+
+    for i in $all $add; do
+       for exclude in $sub; do
+           [ "$i" = "$exclude" ] && continue 2
+       done
+       echo "$i "
+    done
+    return 0
+}
+
+function pl_getPackages2() { fcdistro=$1; shift ; lst_parse package $fcdistro "$@" }
+function pl_getGroups2() { fcdistro=$1; shift ; lst_parse group $fcdistro "$@" }
+
 function pl_getPackages() {
     filename=$1
     packages=$(grep "^package:" $filename | sed -e s,package:,,)
similarity index 98%
rename from planetlab-fc6-devel.lst
rename to planetlab-devel.lst
index be4e297..4a56348 100644 (file)
@@ -23,6 +23,8 @@ package: time
 package: less 
 package: sudo 
 package: openssh
+# for spec2make / rpmlib
+package+f8: popt-devel
 # for vsys
 package: ocaml ocaml-ocamldoc 
 package: expat-devel
index fd34982..54a33b6 100755 (executable)
@@ -3,6 +3,9 @@
 
 COMMAND=$(basename $0)
 
+# lst parsing utilities
+PATH=$(dirname $0):$PATH . build.common
+
 function failure () {
     echo "$COMMAND : Bailing out"
     exit 1
@@ -94,7 +97,7 @@ function devel_tools () {
     personality=$1; shift
 
     # check for .lst file based on pldistro
-    lst=${pldistro}-${fcdistro}-devel.lst
+    lst=${pldistro}-devel.lst
     if [ -f $lst ] ; then
        echo "$COMMAND: Using $lst"
     else
@@ -103,8 +106,8 @@ function devel_tools () {
     fi
 
     # install individual packages, then groups
-    packages=$(grep "^package:" $lst | sed -e s,package:,,)
-    groups=$(grep "^group:" $lst | sed -e s,group:,,)
+    packages=$(pl_getPackages2 ${fcdistro} $lst)
+    groups=$(pl_getGroups2 ${fcdistro} $lst)
 
     [ -n "$packages" ] && $personality vserver $vserver exec yum -y install $packages
     [ -n "$groups" ] && $personality vserver $vserver exec yum -y groupinstall $groups
index c8ab6e2..d1aecfd 100755 (executable)
@@ -278,7 +278,7 @@ function main () {
            ### extract vbuild-init-vserver.sh and run it
            svn cat $SVNPATH/vbuild-init-vserver.sh > /tmp/vbuild-init-vserver-$$.sh
            # get .lst 
-           lst=${PLDISTRO}-${FCDISTRO}-devel.lst
+           lst=${PLDISTRO}-devel.lst
            svn cat $SVNPATH/$lst > /tmp/$lst 
 
             # Create vserver
@@ -289,7 +289,7 @@ function main () {
            rm -f /tmp/vbuild-init-vserver-$$.sh /tmp/$lst
            cd -
            # Extract build
-           vserver ${BASE} exec svn checkout ${SVNPATH} /build
+           vserver ${BASE} exec svn export ${SVNPATH} /build
        fi
        echo "XXXXXXXXXX $COMMAND: preparation of vserver $BASE done" $(date)