url=
no_depend=no
verbose=no
-autotag=no
+pkgrevision=no
requester_override=
relup=no
req = urllib2.Request(url, data)
f = urllib2.urlopen(req)
f.close()
-except Exception, e:
+except Exception as e:
print >> sys.stderr, "Problem while sending request via HTTP: %s: %s" % (url, e)
sys.exit(1)
print >> sys.stdout, "Request queued via HTTP."
# htmlspecialchars: escape <, > and &
hsc() {
local input=$1
- echo -E "$input" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g'
+ printf "%s\n" "$input" | sed -e 's,&,\&,g;s,<,\<,g;s,>,\>,g'
}
# simple df_fetcher, based on packages/fetchsrc_request
done
}
-# autotag from rpm-build-macros
-# displays latest used tag for a specfile
-autotag() {
- local out s
- for s in "$@"; do
- # strip branches
- s=${s%:*}
- # ensure package ends with .spec
- s=${s%.spec}.spec
- git fetch --tags
- out=$(git for-each-ref --count=1 --sort=-authordate refs/tags/auto/$dist \
- --format='%(refname:short)')
- echo "$s:$out"
- done
-}
-
-# get autotag for specs
-# WARNING: This may checkout some files from VCS
-get_autotag() {
- local atag pkg spec rpmdir
+# get package revision for specs
+get_pkgrevision() {
+ local pkgrev pkg spec rpmdir
rpmdir=$(rpm -E %_topdir)
for pkg in "$@"; do
# strip .spec extension
pkg=${pkg%.spec}
wget http://pkgrevs.tld-linux.org/list/$pkg -O /tmp/$pkg.tags 1>/dev/null 2>&1
- atag=$(head -n 1 /tmp/$pkg.tags)
+ pkgrev=$(head -n 1 /tmp/$pkg.tags)
rm -f /tmp/$pkg.tags
- if [ "x$atag" = "x" ]; then
+ if [ "x$pkgrev" = "x" ]; then
echo "$pkg.spec"
else
- echo "$pkg.spec:$atag"
+ echo "$pkg.spec:$pkgrev"
fi
done
}
;;
-a)
- autotag=yes
+ pkgrevision=yes
;;
-m)
relup ${message:+-m "$message"} $specs
fi
-if [ "$autotag" = "yes" ]; then
- msg "Auto autotag build enabled"
- specs=$(get_autotag $specs)
+if [ "$pkgrevision" = "yes" ]; then
+ msg "Package revision build enabled"
+ specs=$(get_pkgrevision $specs)
fi
if [ "$df_fetch" = "yes" ]; then
if [ "$command" ]; then
bid=$(uuidgen)
- echo -E >&2 "* Command: $command"
+ printf "%s\n" "* Command: $command" >&2
echo " <batch id='$bid' depends-on=''>"
echo " <command flags='$command_flags'>"
hsc "$command"
if [ "$no_depend" = yes ]; then
depend=
fi
- echo -E >&2 "* Post-Command: $post_command"
+ printf "%s\n" "* Post-Command: $post_command" >&2
echo " <batch id='$bid' depends-on='$depend'>"
echo " <command flags='$command_flags'>"
hsc "$post_command"