From: Thierry Parmentelat Date: Thu, 13 Dec 2007 15:27:13 +0000 (+0000) Subject: (*) generate as many groups in yumgroups as we have pkgs X-Git-Tag: 4.2-rc2~338 X-Git-Url: http://git.onelab.eu/?p=build.git;a=commitdiff_plain;h=f9051cb50e3287839684763a7515d83cd895e592 (*) generate as many groups in yumgroups as we have pkgs (*) uses groupname: and groupdesc: in .pkgs for that purpose (*) could be used for additional stuf, like alpha / beta if needed (*) not tested yet - might break the build --- diff --git a/Makefile b/Makefile index 58d0fc66..38086ea6 100644 --- a/Makefile +++ b/Makefile @@ -180,10 +180,10 @@ all: repo endif endif -### yumgroups.xml : compute from bootstrapfs.pkgs +### yumgroups.xml : compute from all known .pkgs files RPMS/yumgroups.xml: mkdir -p RPMS - yumgroups.sh $(PLDISTRO) bootstrapfs.pkgs > $@ + yumgroups.sh $(PLDISTRO) > $@ createrepo = createrepo --quiet -g yumgroups.xml RPMS/ diff --git a/build.common b/build.common index ae938c30..9d5afa0e 100644 --- a/build.common +++ b/build.common @@ -658,6 +658,14 @@ function pl_fixdirs() { ########## .pkgs format # comments start with a # - this is needed only if you use a keyword in a comment + +function pl_getPkgsAttribute () { + keyword=$1; shift + file=$1; shift + grep -v '^#' $file | grep --regexp="^${keyword}:" | sed -e "s,${keyword}:,," +} + + # for a given keyword like 'package' : # we support fcdistro-dependant format, for tokens (pkgname) without whitespace # you can e.g. use @@ -720,22 +728,32 @@ function pl_locateDistroFile () { # experimental function yumgroups_from_pkgs () { - groupname=$1; shift - groupdesc=$1; shift - pkgsfile=$1; shift - fcdistro=$pl_DISTRO_NAME - [[ -n "$@" ]] && fcdistro=$1; shift - if [[ -n "$@" ]] ; then - echo "yumgroups_from_pkgs : wrong signature" - return 1 - fi - - packages=$(pl_getPackages $fcdistro $pkgsfile) + builddir=$1; shift + pldistro=$1; shift + fcdistro=$1; shift + pkgsnames=$@ + +sedargs="-e s,@FCDISTRO@,$fcdistro,g" cat <<__header +__header + + for pkgsname in $pkgsnames; do + pkgsfile=$(pl_locateDistroFile $builddir $pldistro $pkgsname) + packages=$(pl_getPackages $fcdistro $pkgsfile) + + groupname=$(pl_getPkgsAttribute groupname $pkgsfile | sed $sedargs) + groupdesc=$(pl_getPkgsAttribute groupdesc $pkgsfile | sed $sedargs) + + if [ -z "$groupname" -o -z "$groupdesc" ] ; then + echo "Cannot find groupname: and groupdesc: in $pkgsfile -- skipped" 1>&2 + continue + fi + + cat << __group_header $(echo $groupname|tr A-Z a-z) $groupname @@ -743,24 +761,18 @@ function yumgroups_from_pkgs () { $groupdesc false -__header - - for package in $packages; do - echo "$package" - done - -cat <<__footer +__group_header + for package in $packages; do + echo "$package" + done + cat << __group_footer +__group_footer + done +cat <<__footer __footer } -function toplevel_yumgroups () { - pldistro=$1; shift - pkgsname=$1; shift - builddir=$(dirname $0) - pkgsfile=$(pl_locateDistroFile $builddir $pldistro $pkgsname) - yumgroups_from_pkgs 'PlanetLab' 'PlanetLab Node Root' $pkgsfile -} diff --git a/config.planetlab/bootcd.pkgs b/config.planetlab/bootcd.pkgs index f5147148..3a0c9709 100644 --- a/config.planetlab/bootcd.pkgs +++ b/config.planetlab/bootcd.pkgs @@ -1,3 +1,5 @@ +groupname: PlanetLabBootcd +groupdesc: PlanetLab BootCD # from prep.sh, was hardwired as packagelist package: filesystem package: udev diff --git a/config.planetlab/bootstrapfs-production.pkgs b/config.planetlab/bootstrapfs-production.pkgs index df0ed887..e04994d5 100644 --- a/config.planetlab/bootstrapfs-production.pkgs +++ b/config.planetlab/bootstrapfs-production.pkgs @@ -1,3 +1,6 @@ +groupname: BootstrapfsProduction +groupdesc: PlanetLab Production Node + # Install the "PlanetLab" group. This requires that the # build system install the appropriate yumgroups.xml file # -- currently build/groups/.xml -- diff --git a/config.planetlab/bootstrapfs.pkgs b/config.planetlab/bootstrapfs.pkgs index 351648c4..1ea5f6be 100644 --- a/config.planetlab/bootstrapfs.pkgs +++ b/config.planetlab/bootstrapfs.pkgs @@ -1,3 +1,7 @@ +# Keeping the old name as it might be referenced elsewhere (node update..) +# groupname: Bootstrapfs +groupname: PlanetLab +groupdesc: PlanetLab Node Root package: kernel package: kernel-smp package: udev diff --git a/config.planetlab/devel.pkgs b/config.planetlab/devel.pkgs index d1a616e7..4900f384 100644 --- a/config.planetlab/devel.pkgs +++ b/config.planetlab/devel.pkgs @@ -1,3 +1,5 @@ +groupname: PlanetLabDevel +groupdesc: Building PlanetLab # general utilities package: sendmail sendmail-cf mailx package: make install diff --git a/config.planetlab/myplc.pkgs b/config.planetlab/myplc.pkgs index cdfa0c28..17e606f0 100644 --- a/config.planetlab/myplc.pkgs +++ b/config.planetlab/myplc.pkgs @@ -1,4 +1,5 @@ -# first draft, extracted from plc_config.xml with --packages +groupname: Myplc +groupdesc: PlanetLab ServerSide Contents @FCDISTRO@ #### # kernel-vserver is intended for the vserver-reference, but # serves the same useful purpose for MyPLC, namely, to diff --git a/config.planetlab/native-shell.pkgs b/config.planetlab/native-shell.pkgs index 5ab79569..45ea7325 100644 --- a/config.planetlab/native-shell.pkgs +++ b/config.planetlab/native-shell.pkgs @@ -1,3 +1,5 @@ +groupname: PlanetLabNative +groupdesc: Test Vserver for MyPlc Native package: openssh-clients curl package: emacs package: bind-utils diff --git a/config.planetlab/vserver-planetflow.pkgs b/config.planetlab/vserver-planetflow.pkgs index 6f7b3ada..c304af8d 100644 --- a/config.planetlab/vserver-planetflow.pkgs +++ b/config.planetlab/vserver-planetflow.pkgs @@ -1 +1,3 @@ +groupname: PlanetFlowReference +groupdesc: PlanetFlow Reference Image package: netflow diff --git a/config.planetlab/vserver.pkgs b/config.planetlab/vserver.pkgs index 5f90b72c..35770a2f 100644 --- a/config.planetlab/vserver.pkgs +++ b/config.planetlab/vserver.pkgs @@ -1,3 +1,5 @@ +groupname: PlanetLabSlice +groupdesc: PlanetLab Slice Reference Image # define packages package: bash package: coreutils diff --git a/yumgroups.sh b/yumgroups.sh index 28f9c492..1e8f506e 100755 --- a/yumgroups.sh +++ b/yumgroups.sh @@ -7,8 +7,11 @@ function usage () { exit 1 } -[ "$#" = 2 ] || usage +[ "$#" = 1 ] || usage pldistro=$1; shift -pkgsname=$1; shift -toplevel_yumgroups $pldistro $pkgsname +# gather all known pkgs files +here=$(pwd) +all_pkgs=$( (cd $here/config.planetlab ; ls -1 *.pkgs ; cd $here/config.$pldistro; ls *.pkgs) | sort -u) + +yumgroups_from_pkgs $(dirname $0) $pldistro $pl_DISTRO_NAME $all_pkgs