}
# inserts git log instead of %changelog
-# outputs name of modified file created by tempfile
+# @output directory containing modified specfile
insert_gitlog() {
local SPECFILE=$1 specdir=$(tempdir) gitlog=$(tempfile) speclog=$(tempfile)
}
update_shell_title() {
- [ -t 1 ] || return
+ [ -t 2 ] || return
local len=${COLUMNS:-80}
local msg="$(echo "$*" | cut -c-$len)"
%remove_etc_shells(p) %{p:<lua>}
%lua_add_etc_shells() %{nil}
%lua_remove_etc_shells() %{nil}
-%required_jdk %{nil}
+%required_jdk jdk
%buildrequires_jdk %{nil}
%pear_package_print_optionalpackages %{nil}
EOF
set_spec_target
}
+# find mirrors in this order. first match wins:
+# - package dir (~/rpm/packages/foo)
+# - repository dir (~/rpm/packages)
+# - tools dir dir (~/rpm/packages/rpm-build-tools)
find_mirror() {
- cd "$REPO_DIR"
local url="$1"
- if [ ! -f "mirrors" ] ; then
- ln -s ../rpm-build-tools/mirrors .
- fi
- IFS="|"
+ update_shell_title "find_mirror[$url][$REPO_DIR]"
+
+ # NOTE: as while loop runs in subshell,
+ # we use exit 2 to indicate that the match was found
+ # otherwise we end up outputing mirror url and origin url.
+
local origin mirror name rest ol prefix
+ IFS="|"
+ cat "$PACKAGE_DIR/mirrors" "$REPO_DIR/mirrors" "$REPO_DIR/../rpm-build-tools/mirrors" /dev/null 2>/dev/null | \
while read origin mirror name rest; do
# skip comments and empty lines
if [ -z "$origin" ] || [ "${origin#\#}" != "$origin" ]; then
if [ "$prefix" = "$origin" ] ; then
suffix=$(echo "$url" | cut -b $((ol+1))-)
echo -n "$mirror$suffix"
- return 0
+ exit 2
fi
- done < mirrors
- echo "$url"
+ done && echo "$url"
}
# Warning: unpredictable results if same URL used twice
# this requires following sudo rules:
# - poldek --noask --caplookup -uG
poldek_install() {
- LANG=C $POLDEK_CMD --noask --caplookup -uG "$@"
+ LANG=C $POLDEK_CMD --noask --caplookup --uniq -uG "$@"
}
# install packages
# outputs all dependencies which current rpmdb doesn't satisfy.
# input can be either STDIN or parameters
_rpm_prov_check() {
- local DEPS
+ local deps out
if [ $# -gt 0 ]; then
- DEPS="$@"
+ deps="$@"
else
- DEPS=$(cat)
+ deps=$(cat)
fi
- DEPS=$(LANG=C rpm -q --whatprovides $DEPS 2>&1 | awk '/^(error:|no package provides)/ { print }')
+ out=$(LC_ALL=C rpm -q --whatprovides $deps 2>&1)
# packages
- echo "$DEPS" | awk '/^no package provides/ { print $NF }'
+ echo "$out" | awk '/^no package provides/ { print $NF }'
# other deps (files)
- echo "$DEPS" | awk -F: '/^error:.*No such file/{o = $2; gsub("^ file ", "", o); print o}'
+ echo "$out" | sed -rne 's/file (.*): No such file or directory/\1/p'
}
# checks if given package/files/provides exists in rpmdb.
fi
if [ -n "$CNFL" ]; then
- echo "Uninstall conflicting packages ($CNFL):"
+ echo "Uninstall conflicting packages: $CNFL"
uninstall_packages $CNFL
fi
if [ -n "$DEPS" ]; then
- echo "Install dependencies ($DEPS):"
+ echo "Install dependencies: $DEPS"
install_packages $DEPS
fi
}
exit 1
fi
+# stuff global $BUILDER_OPTS from env as args
+if [ "$BUILDER_OPTS" ]; then
+ set -- "$BUILDER_OPTS" "$@"
+fi
+
while [ $# -gt 0 ]; do
case "${1}" in
-4|-6)
;;
--alt_kernel)
shift
- RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\""
+ RPMOPTS="${RPMOPTS} --define \"alt_kernel $1\" --define \"build_kernels $1\""
shift
;;
--short-circuit)