VERSION="v0.23/$rev"
VERSIONSTRING="\
Build package utility from PLD Linux CVS repository
-$VERSION (C) 1999-2008 Free Penguins".
+$VERSION (C) 1999-2009 Free Penguins".
PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
POLDEK_INDEX_DIR="$($RPM --eval %_rpmdir)/"
POLDEK_CMD="$SU_SUDO /usr/bin/poldek --noask"
-run_poldek()
-{
+run_poldek() {
RES_FILE=$(mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM)
if [ -n "$LOGFILE" ]; then
LOG=`eval echo $LOGFILE`
#---------------------------------------------
# functions
-usage()
-{
+usage() {
if [ -n "$DEBUG" ]; then set -xv; fi
echo "\
Usage: builder [-D|--debug] [-V|--version] [--short-version] [-a|--as_anon] [-b|-ba|--build]
echo "$rpm_dump_cache"
}
-get_icons()
-{
+get_icons() {
update_shell_title "get icons"
ICONS=$(awk '/^Icon:/ {print $2}' ${ASSUMED_NAME}/${SPECFILE})
if [ -z "$ICONS" ]; then
rpm_dump_cache="kalasaba" NODIST="yes" get_files $ICONS
}
-parse_spec()
-{
+parse_spec() {
update_shell_title "parsing specfile"
if [ -n "$DEBUG" ]; then
set -x
update_shell_title "parse_spec: OK!"
}
-Exit_error()
-{
+Exit_error() {
if [ -n "$DEBUG" ]; then
set -x
set -v
exit 100
}
-init_builder()
-{
+init_builder() {
if [ -n "$DEBUG" ]; then
set -x
set -v
__PWD=$(pwd)
}
-get_spec()
-{
+get_spec() {
update_shell_title "get_spec"
set_spec_target
}
-find_mirror()
-{
+find_mirror() {
cd "$REPO_DIR"
local url="$1"
if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
}
# Warning: unpredictable results if same URL used twice
-src_no ()
-{
+src_no() {
cd $PACKAGE_DIR
rpm_dump | \
grep "SOURCEURL[0-9]*[ ]*$1""[ ]*$" | \
head -n 1 | xargs
}
-src_md5()
-{
+src_md5() {
[ "$NO5" = "yes" ] && return
no=$(src_no "$1")
[ -z "$no" ] && return
fi
}
-distfiles_path ()
-{
+distfiles_path() {
echo "by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
}
-distfiles_url ()
-{
+distfiles_url() {
echo "$PROTOCOL$DISTFILES_SERVER/distfiles/$(distfiles_path "$1")"
}
-distfiles_attic_url ()
-{
+distfiles_attic_url() {
echo "$PROTOCOL$ATTICDISTFILES_SERVER/distfiles/Attic/$(distfiles_path "$1")"
}
-good_md5 ()
-{
+good_md5() {
md5=$(src_md5 "$1")
[ "$md5" = "" ] || \
[ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
}
-good_size ()
-{
+good_size() {
size=$(find $(nourl "$1") -printf "%s" 2>/dev/null)
[ -n "$size" -a "$size" -gt 0 ]
}
-cvsignore_df ()
-{
+cvsignore_df() {
if [ "$CVSIGNORE_DF" != "yes" ]; then
return
fi
fi
}
-cvsup()
-{
+cvsup() {
update_shell_title "cvsup"
local OPTIONS="up "
}
# returns true if "$1" is ftp, http or https protocol url
-is_url()
-{
+is_url() {
case "$1" in
ftp://*|http://*|https://*)
return 0
return 1
}
-update_md5()
-{
+update_md5() {
if [ $# -eq 0 ]; then
return
fi
done
}
-check_md5()
-{
+check_md5() {
[ "$NO5" = "yes" ] && return
update_shell_title "check md5"
done
}
-get_files()
-{
+get_files() {
update_shell_title "get_files"
if [ -n "$DEBUG" ]; then
return $?
}
-tag_files()
-{
+tag_files() {
TAG_FILES="$@"
if [ -n "$DEBUG" ]; then
fi
}
-branch_files()
-{
+branch_files() {
TAG=$1
echo "CVS branch tag: $TAG"
shift
fi
}
-
-build_package()
-{
+build_package() {
update_shell_title "build_package"
if [ -n "$DEBUG" ]; then
set -x
unset BUILD_SWITCH
}
-nourl()
-{
+nourl() {
echo "$@" | sed 's#\<\(ftp\|http\|https\|cvs\|svn\)://[^ ]*/##g'
}
-install_required_packages()
-{
+install_required_packages() {
run_poldek -vi $1
return $?
}
-find_spec_bcond() {
- # originally from /usr/lib/rpm/find-spec-bcond
+find_spec_bcond() { # originally from /usr/lib/rpm/find-spec-bcond
local SPEC="$1"
awk -F"\n" '
/^%changelog/ { exit }
done
}
-run_sub_builder()
-{
+run_sub_builder() {
package_name="${1}"
update_shell_title "run_sub_builder $package_name"
#
NOT_INSTALLED_PACKAGES="$NOT_INSTALLED_PACKAGES $package_name"
}
-spawn_sub_builder()
-{
+spawn_sub_builder() {
package_name="${1}"
update_shell_title "spawn_sub_builder $package_name"
./builder ${sub_builder_opts} "$@"
}
-remove_build_requires()
-{
+remove_build_requires() {
if [ "$INSTALLED_PACKAGES" != "" ]; then
case "$REMOVE_BUILD_REQUIRES" in
"force")
fi
}
-display_bconds()
-{
+display_bconds() {
if [ "$AVAIL_BCONDS_WITH" -o "$AVAIL_BCONDS_WITHOUT" ]; then
if [ "$BCOND" ]; then
echo -ne "\nBuilding $SPECFILE with the following conditional flags:\n"
fi
}
-display_branches()
-{
+display_branches() {
if [ "$NOCVSSPEC" != "yes" ]; then
echo -ne "Available branches: "
$CVS_COMMAND status -v "${SPECFILE}" | awk '!/Sticky Tag:/ && /\(branch:/ { print $1 } ' | xargs
# checks a given list of packages/files/provides agains current rpmdb.
# outputs all dependencies which current rpmdb doesn't satisfy.
# input can be either STDIN or parameters
-_rpm_prov_check()
-{
+_rpm_prov_check() {
local DEPS
if [ $# -gt 0 ]; then
# checks if given package/files/provides exists in rpmdb.
# input can be either stdin or parameters
# returns packages which are present in the rpmdb
-_rpm_cnfl_check()
-{
+_rpm_cnfl_check() {
local DEPS
if [ $# -gt 0 ]; then
echo "Initialising rpm directories to $TOP_DIR from $CVSROOT"
mkdir -p $TOP_DIR/{RPMS,BUILD,SRPMS}
cd $TOP_DIR
- $CVS_COMMAND -d $CVSROOT co packages/{.cvsignore,dropin,mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
+ $CVS_COMMAND -d $CVSROOT co packages/{.cvsignore,rpm.groups,dropin,mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh}
init_builder