reviewed options:
[build.git] / build.common
index 40de70f..c08d7ee 100644 (file)
@@ -60,17 +60,22 @@ case $pl_DISTRO in
        else
            pl_DISTRO_NAME=f$pl_DISTRO_RELEASE
        fi ;;
+    [Cc]entOS*)
+       if [ "$pl_DISTRO_RELEASE" = "4.5" ] ; then
+           # centos 4.5 is just centos4 + enhancements
+           pl_DISTRO_NAME=centos4
+       else
+           pl_DISTRO_NAME=centos$pl_DISTRO_RELEASE
+       fi ;;
     *)
-       echo "build.common: WARNING - pl_DISTRO_NAME not set for distro=$pl_DISTRO" ;;
+       pl_DISTRO_NAME="unknown-name-for-${pl_DISTRO}-please-edit-build.common"
+       echo 1>&2 "build.common: WARNING - pl_DISTRO_NAME not set for distro=$pl_DISTRO" 
+       ;;
 esac
 
 # get patch to appropriate yumgroups.xml file
-# XXX This path should be relative to PLDISTRO, as defined in
-# build/Makefile
-pl_YUMGROUPSXML="../build/groups/v4_yumgroups.xml"
 # Thierry: quick & dirty improvement 
-# this is updated by the toplevel build, from the appropriate pldistro-dep file
-# use another var for now for safety
+# this file is updated by the toplevel build, from groups/pldistro>.xml
 pl_DISTRO_YUMGROUPS="../../../RPMS/yumgroups.xml"
 
 function pl_process_fedora_options () {
@@ -242,27 +247,40 @@ function pl_fixdirs() {
     done
 }
 
-function pl_getPackages() {
-    filename=$1
-    packages=$(grep "^package:" $filename | sed -e s,package:,,)
-    echo "$packages"
+########## .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 "$@" ; }
 # add -p before each package for mkfedora
-function pl_getPackagesOptions() {
-    pl_getPackages "$@" | awk '{for (i=1;i<=NF;i++) {print "-p " $i}}'
-}
-
-function pl_getGroups() {
-    filename=$1
-    groups=$(grep "^group:" $filename | sed -e s,group:,,)
-    echo "$groups"
-    return 0
-}
-
+function pl_getPackagesOptions2 () { pl_getPackages2 "$@" | awk '{for (i=1;i<=NF;i++) {print "-p " $i}}' ; }
 # add -g before each group for mkfedora
-function pl_getGroupsOptions() {
-    pl_getGroups "$@" | awk '{for (i=1;i<=NF;i++) {print "-g " $i}}'
-}
-
+function pl_getGroupsOptions2 () { pl_getGroups2 "$@" | awk '{for (i=1;i<=NF;i++) {print "-g " $i}}' ; }