CHMOD_MODE="0444"
RPMOPTS=""
BCOND=""
+GROUP_BCONDS="no"
PATCHES=""
SOURCES=""
# Example grep cvs /etc/poldek.conf:
# source = cvs /home/users/yoshi/rpm/RPMS/
-if [ "$UPDATE_POLDEK_INDEXES" == "yes" ]; then
+if [ "$UPDATE_POLDEK_INDEXES" = "yes" ]; then
POLDEK_SOURCE_VALIDITY="`grep ${POLDEK_SOURCE} /etc/poldek.conf|grep -v ^#`"
- if [ "${POLDEK_SOURCE_VALIDITY}" == "" ]; then
+ if [ "${POLDEK_SOURCE_VALIDITY}" = "" ]; then
echo "Using improper source '${POLDEK_SOURCE}' in /etc/poldek.conf"
echo "Fix it and try to contiune"
exit 7
tag,
-R, --fetch-build-requires
- fetch what is BuildRequired,
+ -RB, --remove-build-requires
+ - remove all you fetched with -R or --fetch-build-requires
+ remember, this option requires confirmation,
+ -FRB, --force-remove-build-requires
+ - remove all you fetched with -R or --fetch-build-requires
+ remember, this option works without confirmation,
-T <cvstag> , --tag <cvstag>
- add cvs tag <cvstag> for files,
-Tvs, --tag-version-stable
case "$1" in
"err_no_spec_in_cmdl" )
+ remove_build_requires
echo "ERROR: spec file name not specified.";
exit 2 ;;
"err_no_spec_in_repo" )
+ remove_build_requires
echo "Error: spec file not stored in CVS repo.";
exit 3 ;;
"err_no_source_in_repo" )
+ remove_build_requires
echo "Error: some source, patch or icon files not stored in CVS repo. ($2)";
exit 4 ;;
"err_build_fail" )
+ remove_build_requires
echo "Error: package build failed. (${2:-no more info})";
exit 5 ;;
esac
done
}
+remove_build_requires()
+{
+ if [ "$INSTALLED_PACKAGES" != "" ]; then
+ case "$REMOVE_BUILD_REQUIRES" in
+ "force")
+ poldek --noask -e $INSTALLED_PACKAGES
+ ;;
+ "nice")
+ poldek --ask -e $INSTALLED_PACKAGES
+ ;;
+ *)
+ echo You may want to manually remove following BuildRequires fetched:
+ echo $INSTALLED_PACKAGES
+ echo Try poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`
+ ;;
+ esac
+ fi
+}
+
display_bconds()
{
if [ "$AVAIL_BCONDS_WITH" != "" ] || [ "$AVAIL_BCONDS_WITHOUT" != "" ]; then
- echo -ne "We are going to build $SPECFILE with the following confitional flags:\n"
+ echo -ne "We are going to build $SPECFILE with the following conditional flags:\n"
if [ "$BCOND" != "" ]; then
echo -ne "$BCOND"
else
fetch_build_requires()
{
-if [ "$FETCH_BUILD_REQUIRES" == "yes" ]; then
+if [ "$FETCH_BUILD_REQUIRES" = "yes" ]; then
+ echo -ne "\nAll packages installed by fetch_build_requires() are written to:\n"
+ echo -ne "`pwd`/.${SPECFILE}_INSTALLED_PACKAGES\n"
+ echo -ne "\nIf anything fails, you may get rid of them by executing:\n"
+ echo "poldek -e \`cat `pwd`/.${SPECFILE}_INSTALLED_PACKAGES\`\n\n"
+ 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,\(.*\),,g -e s,%{,,g`
do
package_item=`echo $package_item|sed -e s,rpmbuild,rpm-build,g`
fi
- if [ "$GO" == "yes" ]; then
+ if [ "$GO" = "yes" ]; then
if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
- echo "Package $package is not installed. Attempting to install..."
- poldek -i $package
- case $? in
- 1)
- echo "Unable to install $package package! Still trying to fetch rest..."
- NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package"
- ;;
- 0)
- INSTALLED_PACKAGES="$package $INSTALLED_PACKAGES"
- ;;
- esac
+ echo "Testing if $package has subrequirements..."
+ poldek -t -i $package --dumpn=".$package-req.txt"
+ for package_name in `cat ".$package-req.txt"|grep -v ^#`
+ do
+ if [ "$package_name" = "$package" ]; then
+ echo -ne "Installing BuildRequired package:\t$package_name\n"
+ poldek -i $package_name
+ else
+ echo -ne "Installing (sub)Required package:\t$package_name\n"
+ poldek -i $package_name
+ fi
+ case $? in
+ 1)
+ echo -ne "Package installation failed:\t$package_name\n"
+ #
+ # No i tutaj bym chcia³ zrobiæ sztuczn± inteligencjê, która spróbuje tego
+ # pakieta zbudowaæ.
+ #
+ NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
+ ;;
+ 0)
+ INSTALLED_PACKAGES="$package_name $INSTALLED_PACKAGES"
+ echo $package_name >> `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
+ ;;
+ esac
+ done
+ rm ".$package-req.txt"
else
echo "Package $package is already installed. BuildRequirement satisfied."
fi
do
echo $pkg
done
+ remove_build_requires
exit 1
fi
fi
--opts )
shift; RPMOPTS="${1}"; shift ;;
--with | --without )
- COND=${1}
- shift
- while [ "`echo ${1}|grep ^-`" == "" ] && [ "`echo ${1}|grep spec`" == "" ]
- do
- BCOND="$BCOND $COND $1"
- shift
- done;;
+ case $GROUP_BCONDS in
+ "yes")
+ COND=${1}
+ shift
+ while [ "`echo ${1}|grep ^-`" = "" ] && [ "`echo ${1}|grep spec`" = "" ]
+ do
+ BCOND="$BCOND $COND $1"
+ shift
+ done;;
+ "no")
+ BCOND="$BCOND $1 $2" ; shift 2 ;;
+ esac
+ ;;
-q | --quiet )
QUIET="--quiet"; shift ;;
--date )
#UPDATE_POLDEK_INDEXES="yes"
NOT_INSTALLED_PACKAGES=
shift ;;
+ -RB | --remove-build-requires)
+ REMOVE_BUILD_REQUIRES="nice"
+ shift ;;
+ -FRB | --force-remove-build-requires)
+ REMOVE_BUILD_REQUIRES="force"
+ shift ;;
-Tvs | --tag-version-stable )
COMMAND="tag";
TAG="STABLE"
fi
get_files "$SOURCES $PATCHES";
build_package;
- if [ $? -eq 0 ] && [ "$UPDATE_POLDEK_INDEXES" == "yes" ]; then
+ if [ "$UPDATE_POLDEK_INDEXES" = "yes" ]; then
poldek --sn ${POLDEK_SOURCE} --mkidx="${POLDEK_INDEX_DIR}/packages.dir.gz"
poldek --sn ${POLDEK_SOURCE} --up
fi
+ remove_build_requires;
else
Exit_error err_no_spec_in_cmdl;
fi
"version" )
echo "$VERSION";;
esac
-
cd $__PWD