]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
- make --show-bconds output parseable (to be passed to other programs)
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 23 Oct 2006 19:54:22 +0000 (19:54 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    builder.sh -> 1.459

builder.sh

index 153abce3a6f9c5aa92bc6ae956699b1664043699..8b7902539733a5248781453a346bd519380da9b1 100644 (file)
@@ -1244,22 +1244,7 @@ find_spec_bcond() {
        }' $SPEC | LC_ALL=C sort -u
 }
 
-set_bconds_values()
-{
-       update_shell_title "set bcond values"
-
-       AVAIL_BCONDS_WITHOUT=""
-       AVAIL_BCONDS_WITH=""
-       if `grep -q ^%bcond ${SPECFILE}`; then
-               BCOND_VERSION="NEW"
-       elif `egrep -q ^#\ *_with ${SPECFILE}`; then
-               BCOND_VERSION="OLD"
-       else
-               return
-       fi
-
-       local bcond_avail=$(find_spec_bcond $SPECFILE)
-
+process_bcondrc() {
        # expand bconds from ~/.bcondrc
        # The file structure is like gentoo's package.use:
        # ---
@@ -1269,38 +1254,62 @@ set_bconds_values()
        # php +mysqli
        # ---
        if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
-               SN=${SPECFILE%%\.spec}
+               :
+       else
+               return
+       fi
 
-               local bcondrc=$HOME/.bcondrc
-               [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
+       SN=${SPECFILE%%\.spec}
 
-               while read pkg flags; do
-                       # ignore comments
-                       [[ "$pkg" == \#* ]] && continue
+       local bcondrc=$HOME/.bcondrc
+       [ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ] && bcondrc=$HOME_ETC/.bcondrc
 
-                       # any package or current package?
-                       if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
-                               for flag in $flags; do
-                                       local opt=${flag#[+-]}
+       local bcond_avail=$(find_spec_bcond $SPECFILE)
 
-                                       # use only flags which are in this package.
-                                       if [[ $bcond_avail = *${opt}* ]]; then
-                                               if [[ $flag = -* ]]; then
-                                                       if [[ $BCOND != *--with?${opt}* ]]; then
-                                                               BCOND="$BCOND --without $opt"
-                                                       fi
-                                               else
-                                                       if [[ $BCOND != *--without?${opt}* ]]; then
-                                                               BCOND="$BCOND --with $opt"
-                                                       fi
+       while read pkg flags; do
+               # ignore comments
+               [[ "$pkg" == \#* ]] && continue
+
+               # any package or current package?
+               if [ "$pkg" = "*" ] || [ "$pkg" = "$PACKAGE_NAME" ] || [ "$pkg" = "$SN" ]; then
+                       for flag in $flags; do
+                               local opt=${flag#[+-]}
+
+                               # use only flags which are in this package.
+                               if [[ $bcond_avail = *${opt}* ]]; then
+                                       if [[ $flag = -* ]]; then
+                                               if [[ $BCOND != *--with?${opt}* ]]; then
+                                                       BCOND="$BCOND --without $opt"
+                                               fi
+                                       else
+                                               if [[ $BCOND != *--without?${opt}* ]]; then
+                                                       BCOND="$BCOND --with $opt"
                                                fi
                                        fi
-                               done
-                       fi
-               done < $bcondrc
-               update_shell_title "parse ~/.bcondrc: DONE!"
+                               fi
+                       done
+               fi
+       done < $bcondrc
+       update_shell_title "parse ~/.bcondrc: DONE!"
+}
+
+set_bconds_values()
+{
+       update_shell_title "set bcond values"
+
+       AVAIL_BCONDS_WITHOUT=""
+       AVAIL_BCONDS_WITH=""
+       if `grep -q ^%bcond ${SPECFILE}`; then
+               BCOND_VERSION="NEW"
+       elif `egrep -q ^#\ *_with ${SPECFILE}`; then
+               BCOND_VERSION="OLD"
+       else
+               return
        fi
 
+       local bcond_avail=$(find_spec_bcond $SPECFILE)
+       process_bcondrc "$SPECFILE"
+
        update_shell_title "parse bconds"
        case "${BCOND_VERSION}" in
                NONE)
@@ -1985,16 +1994,24 @@ fi
 
 update_shell_title "$COMMAND"
 case "$COMMAND" in
+       "show_bconds")
+               init_builder
+               if [ -n "$SPECFILE" ]; then
+                       get_spec > /dev/null
+                       parse_spec
+                       set_bconds_values
+                       echo "$BCOND"
+               fi
+               ;;
        "build" | "build-binary" | "build-source" | "build-prep" )
-               init_builder;
+               init_builder
                if [ -n "$SPECFILE" ]; then
-                       get_spec;
-                       parse_spec;
-                       set_bconds_values;
-                       display_bconds;
-                       display_branches;
-                       [ X"$SHOW_BCONDS" = X"yes" ] && exit 0
-                       fetch_build_requires;
+                       get_spec
+                       parse_spec
+                       set_bconds_values
+                       display_bconds
+                       display_branches
+                       fetch_build_requires
                        if [ "$INTEGER_RELEASE" = "yes" ]; then
                                echo "Checking release $PACKAGE_RELEASE..."
                                if echo $PACKAGE_RELEASE | grep -q '^[^.]*\.[^.]*$' 2>/dev/null ; then
This page took 0.31492 seconds and 4 git commands to generate.