rename variable path -> repopath
[build.git] / build.common
index 60ed22d..4828f2c 100644 (file)
@@ -72,12 +72,8 @@ case $pl_DISTRO in
 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 () {
@@ -249,27 +245,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}}' ; }