}' $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:
# ---
# 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)
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