# 5 - package build failed
# 6 - spec file with errors
# 7 - wrong source in /etc/poldek.conf
+# 8 - Failed installing buildrequirements and subrequirements
# Notes (todo):
# - builder -u fetches current version first
GETLOCAL="cp -a"
if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
- RPM="rpm"
- RPMBUILD="rpm"
+ RPM="rpm"
+ RPMBUILD="rpm"
else
- RPM="rpm"
- RPMBUILD="rpmbuild"
+ RPM="rpm"
+ RPMBUILD="rpmbuild"
fi
POLDEK_INDEX_DIR="`$RPM --eval %_rpmdir`/"
POLDEK_SOURCE="cvs"
+POLDEK_CMD="/usr/bin/poldek"
-# Here we load saved user environment used to
+# Here we load saved user environment used to
# predefine options set above, or passed to builder
# in command line.
# This one reads global system environment settings:
if [ -f ~/etc/builderrc ]; then
- . ~/etc/builderrc
+ . ~/etc/builderrc
fi
# And this one cascades settings using user personal
# builder settings.
USER_CFG=~/.builderrc
fi
-[ -f $USER_CFG ] && . $USER_CFG
+[ -f $USER_CFG ] && . $USER_CFG
+
+run_poldek()
+{
+ RES_FILE=~/tmp/poldek-exit-status.$RANDOM
+ if [ -n "$LOGFILE" ]; then
+ LOG=`eval echo $LOGFILE`
+ if [ -n "$LASTLOG_FILE" ]; then
+ echo "LASTLOG=$LOG" > $LASTLOG_FILE
+ fi
+ (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE})|tee $LOG
+ return $exit_pldk
+ else
+ (nice -n ${DEF_NICE_LEVEL} ${POLDEK_CMD} `while test $# -gt 0; do echo "$1 ";shift;done` ; echo $? > ${RES_FILE}) 1>&2 >/dev/null
+ return `cat ${RES_FILE}`
+ rm -rf ${RES_FILE}
+ fi
+}
# Example grep cvs /etc/poldek.conf:
# source = cvs /home/users/yoshi/rpm/RPMS/
if [ "$UPDATE_POLDEK_INDEXES" = "yes" ]; then
- poldek -l -n ${POLDEK_SOURCE} >/dev/null
- if [ ! "$?" == "0" ]; then
+ run_poldek -l -n ${POLDEK_SOURCE} 1>&2 > /dev/null
+ if [ ! "$?" == "0" ]; then
echo "Using improper source '${POLDEK_SOURCE}' in /etc/poldek.conf"
echo "Fix it and try to continue"
exit 7
[-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
[-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>]
[-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest]
-[-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version]
+[-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version]
[{-Tp|--tag-prefix} <prefix>]
[-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>]
[--with/--without <feature>] [--define <macro> <value>] <package>[.spec]
-a, --as_anon - get files via pserver as cvs@$CVS_SERVER,
-b, -ba, --build - get all files from CVS repo or HTTP/FTP and build package
from <package>.spec,
--bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
+-bb, --build-binary - get all files from CVS repo or HTTP/FTP and build binary
only package from <package>.spec,
--bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
+-bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
them into src.rpm,
-bp, --build-prep - execute the %prep phase of <package>.spec,
-B, --branch - add branch
--c, --clean - clean all temporarily created files (in BUILD, SOURCES,
+-c, --clean - clean all temporarily created files (in BUILD, SOURCES,
SPECS and \$RPM_BUILD_ROOT),
-d <cvsroot>, --cvsroot <cvsroot>
- setup \$CVSROOT,
--http - use http instead of ftp,
-l <logfile>, --logtofile <logfile>
- log all to file,
--m, --mr-proper - only remove all files related to spec file and all work
+-m, --mr-proper - only remove all files related to spec file and all work
resources,
-nc, --no-cvs - don't download sources from CVS, if source URL is given,
-ncs, --no-cvs-specs
-un, --try-upgrade-with-float-version
- as above, but allow float version
-U, --update - refetch sources, don't use distfiles, and update md5 comments
--Upi, --update-poldek-indexes
+-Upi, --update-poldek-indexes
- refresh or make poldek package index files.
--with/--without <feature>
- conditional build package depending on %_with_<feature>/
- %_without_<feature> macro switch. You may now use
- --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
+ %_without_<feature> macro switch. You may now use
+ --with feat1 feat2 feat3 --without feat4 feat5 --with feat6
constructions. Set GROUP_BCONDS to yes to make use of it.
"
}
rpm_dump_cache=`
case "$RPMBUILD" in
rpm )
- rpm -bp --nodeps --define 'prep %dump' $BCOND $SPECFILE 2>&1
+ rpm -bp --nodeps --define 'prep %dump' $BCOND $SPECFILE 2>&1
;;
rpmbuild )
- rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $SPECFILE 2>&1
+ rpmbuild --nodigest --nosignature --define 'prep %dump' $BCOND $SPECFILE 2>&1
;;
esac`
}
PATCHES="`rpm_dump | awk '/PATCHURL[0-9]+/ {print $3}'`"
ICONS="`awk '/^Icon:/ {print $2}' ${SPECFILE}`"
- PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`"
- PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -1`"
- PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -1`"
+ PACKAGE_NAME="`$RPM -q --qf '%{NAME}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
+ PACKAGE_VERSION="`$RPM -q --qf '%{VERSION}\n' --specfile ${SPECFILE} 2> /dev/null| head -n 1`"
+ PACKAGE_RELEASE="`$RPM -q --qf '%{RELEASE}\n' --specfile ${SPECFILE} 2> /dev/null | head -n 1`"
if [ -n "$BE_VERBOSE" ]; then
echo "- Sources : `nourl $SOURCES`"
rpm_dump | \
grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
sed -e 's/.*SOURCEURL\([0-9][0-9]*\).*/\1/' | \
- head -1 | xargs
+ head -n 1 | xargs
}
src_md5 ()
cd $SPECS_DIR
spec_rev=$(grep $SPECFILE CVS/Entries | sed -e s:/$SPECFILE/:: -e s:/.*::)
if [ -z "$spec_rev" ]; then
- spec_rev="$(head -1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
+ spec_rev="$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')"
fi
spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
md5=$(grep -s -v '^#' additional-md5sums | \
if [ $(echo "$md5" | wc -l) != 1 ] ; then
echo "$SPECFILE: more then one entry in additional-md5sums for $1" 1>&2
fi
- echo "$md5" | tail -1
+ echo "$md5" | tail -n 1
fi
}
echo "$PROTOCOL$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
}
+distfiles_attic_url ()
+{
+ echo "$PROTOCOL$DISTFILES_SERVER/Attic/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
+}
+
good_md5 ()
{
md5=$(src_md5 "$1")
fi
target=$(nourl "$i")
url=$(distfiles_url "$i")
+ url_attic=$(distfiles_attic_url "$i")
+ FROM_DISTFILES=1
if [ `echo $url | grep -E '^(\.|/)'` ]; then
${GETLOCAL} $url $target
else
- FROM_DISTFILES=1
if [ -z "$NOMIRRORS" ]; then
url="`find_mirror "$url"`"
fi
if [ `echo $url | grep -E 'ftp://'` ]; then
${GETURI2} -O "$target" "$url"
fi
- if ! test -s "$target"; then
- rm -f "$target"
- FROM_DISTFILES=0
+ fi
+ if ! test -s "$target"; then
+ rm -f "$target"
+ if [ `echo $url_attic | grep -E '^(\.|/)'` ]; then
+ ${GETLOCAL} $url_attic $target
+ else
+ if [ -z "$NOMIRRORS" ]; then
+ url_attic="`find_mirror "$url_attic"`"
+ fi
+ ${GETURI} -O "$target" "$url_attic" || \
+ if [ `echo $url_attic | grep -E 'ftp://'` ]; then
+ ${GETURI2} -O "$target" "$url_attic"
+ fi
fi
fi
+ if ! test -s "$target"; then
+ rm -f "$target"
+ FROM_DISTFILES=0
+ fi
elif [ -z "$(src_md5 "$i")" -a "$NOCVS" != "yes" ]; then
# ( echo $i | grep -qvE '(ftp|http|https)://' ); -- if CVS should be used, but URLs preferred
result=1
fi
done
fi
-
+
if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then
if [ -z "$NOMIRRORS" ]; then
im="`find_mirror "$i"`"
im="$i"
fi
${GETURI} "$im" || \
- if [ `echo $im | grep -E 'ftp://'` ]; then
+ if [ `echo $im | grep -E 'ftp://'` ]; then
${GETURI2} "$im"
fi
fi
-
fi
srcno=$(src_no $i)
if [ ! -f "`nourl $i`" -a "$FAIL_IF_NO_SOURCES" != "no" ]; then
md5=$(md5sum `nourl $i` | cut -f1 -d' ')
perl -i -ne '
print unless /^\s*#\s*Source'$srcno'-md5\s*:/i;
- print "# Source'$srcno'-md5:\t'$md5'\n"
+ print "# Source'$srcno'-md5:\t'$md5'\n"
if /^Source'$srcno'\s*:\s+/;
' \
$SPECS_DIR/$SPECFILE
if [ `echo $url | grep -E 'ftp://'` ]; then
${GETURI2} -O "$target" "$url"
fi
+ if ! test -s "$target"; then
+ rm -f "$target"
+ ${GETURI} -O "$target" "$url_attic" || \
+ if [ `echo $url_attic | grep -E 'ftp://'` ]; then
+ ${GETURI2} -O "$target" "$url_attic"
+ fi
+ fi
test -s "$target" || rm -f "$target"
fi
cd $SOURCE_DIR
for i in $TAG_FILES
do
- # don't tag non cvs files (ie. stored on distfiles)
- [ "`nourl $i`" != "$i" ] && continue
+ # don't tag files stored on distfiles
+ [ -n "`src_md5 $i`" ] && continue
if [ -f "`nourl $i`" ]; then
if [ "$TAG_VERSION" = "yes" ]; then
cvs $OPTIONS $TAGVER `nourl $i`
echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
}
+
install_required_packages()
{
- poldek -vi $1
+ run_poldek -vi $1
return $?
}
;;
_with)
cond_type="with"
- ;;
+ ;;
*)
case "$cond_type" in
with)
#
# Update: Poprawi³em parê rzeczy i zaczê³o generowaæ pakiety spoza zadanej listy.
# Jednym s³owem budowanie niespoldkowanych zale¿no¶ci dzia³a w paru przypadkach.
- #
+ #
#
# y0shi.
# Istnieje taki spec? ${package}.spec
- if [ -f "${POLDEK_INDEX_DIR}/../SPECS/${package}.spec" ]; then
+ if [ -f "${SPECS_DIR}${package}.spec" ]; then
parent_spec_name=${package}.spec
- elif [ -f "${POLDEK_INDEX_DIR}/../SPECS/`echo ${package_name}|sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
+ elif [ -f "${SPECS_DIR}`echo ${package_name}|sed -e s,-devel.*,,g -e s,-static,,g`.spec" ]; then
parent_spec_name="`echo ${package_name}|sed -e s,-devel.*,,g -e s,-static,,g`.spec"
else
- for provides_line in `grep ^Provides:.*$package ${POLDEK_INDEX_DIR}/../SPECS/ -R`
+ for provides_line in `grep ^Provides:.*$package ${SPECS_DIR} -R`
do
echo $provides_line
done
if [ "${UPDATE_POLDEK_INDEXES}" == "yes" ]; then
sub_builder_opts="${sub_builder_opts} -Upi"
fi
- cd "${POLDEK_INDEX_DIR}/../SPECS"
+ cd "${SPECS_DIR}"
./builder ${sub_builder_opts} ${parent_spec_name}
fi
NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
if [ "$INSTALLED_PACKAGES" != "" ]; then
case "$REMOVE_BUILD_REQUIRES" in
"force")
- poldek --noask -ve $INSTALLED_PACKAGES
+ run_poldek --noask -ve $INSTALLED_PACKAGES
;;
"nice")
- poldek --ask -ve $INSTALLED_PACKAGES
+ run_poldek --ask -ve $INSTALLED_PACKAGES
;;
*)
echo You may want to manually remove following BuildRequires fetched:
fi
fi
RESULT="${COND_STATE}-${COND_ARGV}"
- case "$RESULT" in
+ case "$RESULT" in
"with-wout" | "wout-with" )
GO=""
;;
if [ "$GO" = "yes" ]; then
if [ "`rpm -q $package|sed -e "s/$package.*/$package/g"`" != "$package" ]; then
echo "Testing if $package has subrequirements..."
- poldek -t -i $package --dumpn=".$package-req.txt"
+ run_poldek -t -i $package --dumpn=".$package-req.txt"
if [ -f ".$package-req.txt" ]; then
for package_name in `cat ".$package-req.txt"|grep -v ^#`
- do
+ do
if [ "$package_name" = "$package" ]; then
echo -ne "Installing BuildRequired package:\t$package_name\n"
export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}: Installing BuildRequired package: ${package_name}\007"`
;;
*)
echo "Attempting to run spawn sub - builder..."
- run_sub_builder $package_name
+ run_sub_builder $package_name
if [ $? -eq 0 ]; then
install_required_packages $package_name;
case $? in
*)
NOT_INSTALLED_PACKAGES="$package_name $NOT_INSTALLED_PACKAGES"
;;
- esac
- fi
+ esac
+ fi
fi
else
echo "Package $package is already installed. BuildRequirement satisfied."
echo $pkg
done
remove_build_requires
- exit 1
+ exit 8
fi
fi
}
RPMOPTS="${RPMOPTS} --nodeps"
;;
* )
- SPECFILE="`basename ${1} .spec`.spec";
+ SPECFILE="`basename ${1} .spec`.spec";
export PROMPT_COMMAND=`echo -ne "\033]0;${SPECFILE}\007"`
shift ;;
esac
get_files "$SOURCES $PATCHES";
build_package;
if [ "$UPDATE_POLDEK_INDEXES" = "yes" ]; then
- poldek --sn ${POLDEK_SOURCE} --mkidx="${POLDEK_INDEX_DIR}/packages.dir.gz"
- poldek --sn ${POLDEK_SOURCE} --up
+ run_poldek --sn ${POLDEK_SOURCE} --mkidx="${POLDEK_INDEX_DIR}/packages.dir.gz"
+ run_poldek --sn ${POLDEK_SOURCE} --up
fi
remove_build_requires;
else
fi
;;
"tag" )
+ NOURLS=1
+ NODIST=1
init_builder;
if [ -n "$SPECFILE" ]; then
get_spec;
new_SOURCES=""
for file in $SOURCES
do
- [ "`nourl $file`" != "$file" ] && continue
+ [ -n "`src_md5 $file`" ] && continue
new_SOURCES="$new_SOURCES $file"
done
SOURCES="$new_SOURCES"
test -f `pwd`/.${SPECFILE}_INSTALLED_PACKAGES && rm `pwd`/.${SPECFILE}_INSTALLED_PACKAGES
cd "$__PWD"
-# vi:syntax=sh:tw=80:ts=3:sw=4
+# vi:syntax=sh:ts=3:sw=4