- # XXX is this ugliest code written in human history still needed?
- echo "All packages installed by fetch_build_requires() are written to:"
- echo "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES"
- echo ""
- echo "If anything fails, you may get rid of them by executing:"
- echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`"
- echo ""
- echo > `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
- for package_item in $(cat $SPECFILE | grep -B100000 ^%changelog|grep -v ^#|grep BuildRequires|grep -v ^-|sed -e "s/^.*BuildRequires://g"|awk '{print $1}'|sed -e s,perl\(,perl-,g -e s,::,-,g -e s,\(.*\),,g -e s,%{,,g -e s,},,g|grep -v OpenGL-devel|sed -e s,sh-utils,coreutils,g -e s,fileutils,coreutils,g -e s,textutils,coreutils,g -e s,kgcc_package,gcc,g -e s,\),,g)
- do
- package_item=$(echo $package_item|sed -e s,rpmbuild,rpm-build,g |sed -e s,__perl,perl,g |sed -e s,gasp,binutils-gasp,g -e s,binutils-binutils,binutils,g -e s,apxs,apache,g|sed -e s,apache\(EAPI\)-devel,apache-devel,g -e s,kernel-headers\(netfilter\),kernel-headers,g -e s,awk,mawk,g -e s,mmawk,mawk,g -e s,motif,openmotif,g -e s,openopenmotif,openmotif,g)
- GO="yes"
- package=$(basename "$package_item"|sed -e "s/}$//g")
- COND_ARCH_TST=$(cat $SPECFILE|grep -B1 BuildRequires|grep -B1 $package|grep ifarch|sed -e "s/^.*ifarch//g")
- mach=$(uname -m)
-
- COND_TST=`cat $SPECFILE|grep BuildRequires|grep "$package"`
- if `echo $COND_TST|grep -q '^BuildRequires:'`; then
- if [ "$COND_ARCH_TST" != "" ] && [ "`echo $COND_ARCH_TST|sed -e "s/i.86/ix86/g"`" != "`echo $mach|sed -e "s/i.86/ix86/g"`" ]; then
- GO="yes"
- fi
- # bcond:
- else
- COND_NAME=`echo $COND_TST|sed -e s,:BuildRequires:.*$,,g`
- GO=""
- # %{without}
- if `echo $COND_TST|grep -q 'without_'`; then
- COND_NAME=`echo $COND_NAME|sed -e s,^.*without_,,g`
- if `echo $COND_TST|grep -q !`; then
- COND_STATE="with"
- else
- COND_STATE="wout"
- fi
- COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
- COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
- if [ -n "$COND_WITHOUT" ] || [ -z "$COND_WITH" ]; then
- COND_ARGV="wout"
- else
- COND_ARGV="with"
- fi
- # %{with}
- elif `echo $COND_TST|grep -q 'with_'`; then
- COND_NAME=`echo $COND_NAME|sed -e s,^.*with_,,g`
- if `echo $COND_TST|grep -q !`; then
- COND_STATE="wout"
- else
- COND_STATE="with"
- fi
- COND_WITH=`echo $AVAIL_BCONDS_WITH|grep "<$COND_NAME>"`
- COND_WITHOUT=`echo $AVAIL_BCONDS_WITHOUT|grep "<$COND_NAME>"`
- if [ -n "$COND_WITH" ] || [ -z "$COND_WITHOUT" ]; then
- COND_ARGV="with"
- else
- COND_ARGV="wout"
- fi
- fi
- RESULT="${COND_STATE}-${COND_ARGV}"
- case "$RESULT" in
- "with-wout" | "wout-with" )
- GO=""
- ;;
- "wout-wout" | "with-with" )
- GO="yes"
- ;;
- * )
- echo "Action '$RESULT' was not defined for package '$package_item'"
- GO="yes"
- ;;
- esac
- fi