Compare commits

..

9 Commits

8 changed files with 150 additions and 41 deletions

View File

@ -1 +1 @@
VERSION = 0.9.14
VERSION = 0.9.16

View File

@ -5,20 +5,20 @@
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.14
VERSION=0.9.16
me=(${0##*/} $VERSION "Sat Aug 20 2010")
exec 3>`readlink /proc/self/fd/0`
function usage() {
echo "\
${me[0]} ${me[1]}
"$"Copyright (C) 2006-2012 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Copyright (C) 2006-2014 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Batch build tool for bulding a whole distribution and much more.""
"$"Usage"":
$me [operations ...] [options ...] [job ...] [-- autospec_args]
$me [operations ...] [options ...] [job ...] [-- autospec_args] [--- script_args]
"$"Operations"":
-a,--autobuild "$"Start batch build operations (implies -p -u -b -s --severity 1)""
@ -53,6 +53,7 @@ ${me[0]} ${me[1]}
kernel-extra
kernel-packages/lirc""
autospec_args "$"Send specified arguments to autospec""
script_args "$"Send specified arguments to update-specfile script""
"
}
@ -91,6 +92,7 @@ BUILDARCH=`rpm --eval %{_build_cpu}`
TARGETARCH=$BUILDARCH
CONFIGFILE=$SYSCONFDIR/config
SCRIPT_UPDATE_SPECFILE=$SCRIPTDIR/update-specfile
SCRIPT_UPDATE_SPECFILE_CUSTOM=$SCRIPTDIR/update-specfile-custom
AUTOSPEC_CMD="/usr/bin/autospec"
PIDFILE="/var/run/autodist/autodist.pid"
@ -190,23 +192,37 @@ for ((i=1; i<=$#; i++)); do
;;
-*) if [ "${!i}" = "--" ]; then
AUTOSPEC_ARGS_MODE=1
SCRIPT_ARGS_MODE=
elif [ "${!i}" = "---" ]; then
SCRIPT_ARGS_MODE=1
AUTOSPEC_ARGS_MODE=
elif [ "$AUTOSPEC_ARGS_MODE" ]; then
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
elif [ "$SCRIPT_ARGS_MODE" ]; then
SCRIPT_ARGS="$SCRIPT_ARGS ${!i}"
else
echo "ERROR: invalid option \`${!i}'; aborting."
exit 1
fi
;;
*) if [ "$AUTOSPEC_ARGS_MODE" != "1" ]; then
JOBNAME[${#JOBNAME[@]}]="${!i/\#*}"
[ "${!i/*\#}" != "${!i}" ] && JOBVER[${#JOBNAME[@]}]="+${!i/*\#}"
else
*) if [ "$AUTOSPEC_ARGS_MODE" ]; then
if [ "${!i/ }" != "${!i}" ]; then
# pass multiple word arguments inside quotation marks
AUTOSPEC_ARGS="$AUTOSPEC_ARGS \"${!i}\""
else
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
fi
elif [ "$SCRIPT_ARGS_MODE" ]; then
if [ "${!i/ }" != "${!i}" ]; then
# pass multiple word arguments inside quotation marks
SCRIPT_ARGS="$SCRIPT_ARGS \"${!i}\""
else
SCRIPT_ARGS="$SCRIPT_ARGS ${!i}"
fi
else
JOBIDX=${#JOBNAME[@]}
JOBNAME[$JOBIDX]="${!i/\#*}"
[ "${!i/*\#}" != "${!i}" ] && JOBVER[$JOBIDX]="+${!i/*\#}"
fi
;;
esac
@ -494,7 +510,7 @@ function launch_pkgs_loop() {
# launch loop for each package
for pkg in ${JOB_PKGS[*]}; do
unset LOGFILE_SUFFIX
unset LOGFILE_SUFFIX AUTOUPDATE_SCRIPT_ALREADY_RUN
for a in ${JOB_VALUES[*]}; do
tr_job=`echo $a | tr / _`
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
@ -544,8 +560,31 @@ function launch_pkgs_loop() {
[ "$operation" = "update" -o "$operation" = "autoupdate" ] && continue
fi
fi
$SCRIPT_UPDATE_SPECFILE $spec_dir/$pkg.spec
;;
if [ -x $SCRIPT_UPDATE_SPECFILE ]; then
$SCRIPT_UPDATE_SPECFILE $spec_dir/$pkg.spec $SCRIPT_ARGS || {
case $SEVERITY in
0) ;;
1) echo "%! Error: update-specfile script returned $?; skipping $pkg package."
ret=1
continue ;;
*) echo "!! Error: update-specfile script returned $?; aborting."
exit 1 ;;
esac
}
fi
if [ -x $SCRIPT_UPDATE_SPECFILE_CUSTOM ]; then
$SCRIPT_UPDATE_SPECFILE_CUSTOM $spec_dir/$pkg.spec $SCRIPT_ARGS || {
case $SEVERITY in
0) ;;
1) echo "%! Error: update-specfile-custom script returned $?; skipping $pkg package."
ret=1
continue ;;
*) echo "!! Error: update-specfile-custom script returned $?; aborting."
exit 1 ;;
esac
}
fi
;;
esac
[ -e $spec_dir/$pkg.spec ] && {
@ -604,7 +643,7 @@ function launch_pkgs_loop() {
if [ "$PKGLINE" ]; then
set -- $PKGLINE
pkglinever=$2
# warning: asasuming version is passed first
# warning: assuming version is passed first
version_find_bigger "${passed_arguments/ *}" "$pkglinever"
[ $? -eq 1 ] || {
echo "!! Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})."
@ -614,6 +653,11 @@ function launch_pkgs_loop() {
continue
}
fi
if [ -e $source_dir/$pkg-autoupdate ]; then
echo "?= Running $pkg-autoupdate script with version ${passed_arguments/ *}"
(cd $source_dir; sh ./$pkg-autoupdate ${passed_arguments/ *} >/dev/null)
AUTOUPDATE_SCRIPT_ALREADY_RUN=1
fi
command_opts="-a3:4" ;;
build)
# skip package in job if it is in the delayed repository
@ -785,9 +829,10 @@ function launch_pkgs_loop() {
}
fi
fi
if [ "$2" != "$SPEC_VERSION" -a -e $source_dir/$pkg-autoupdate ]; then
echo "?= Running autoupdate script with version $SPEC_VERSION"
sh $source_dir/$pkg-autoupdate $SPEC_VERSION
if [ "$2" != "$SPEC_VERSION" -a -e $source_dir/$pkg-autoupdate -a ! "$AUTOUPDATE_SCRIPT_ALREADY_RUN" ]; then
echo "?= Running $pkg-autoupdate script with version ${passed_arguments/ *}"
(cd $source_dir; sh ./$pkg-autoupdate ${passed_arguments/ *} >/dev/null)
AUTOUPDATE_SCRIPT_ALREADY_RUN=1
fi
fi
;;

View File

@ -4,7 +4,7 @@
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.14
VERSION=0.9.16
BASE_ARCH=i586
BASE_REPOSITORY=devel
@ -23,7 +23,7 @@ ${me[0]} ${me[1]}
"$"Batch port and cross-build tool based on autodist.""
"$"Usage"":
$me [-a][-f][-x arch1[,arch2],..][-r repository][-d release_repository]{--fix|job ...}
$me [-a][-f][-x arch1[,arch2],..][-r repository][-d release_repository][-s \"script_args\"]{--fix|job ...}
-a "$"Automatic mode (use cache)
-b "$"Batch port all packages in port repository to sync with base repository
@ -35,6 +35,7 @@ ${me[0]} ${me[1]}
-r "$"Work on given repository (default: $PORT_REPOSITORY)
-d "$"Release packages to given repository (default: $PORT_REPOSITORY)
-h "$"Show this help and exit
-s \"script_args\" "$"Send script_args as arguments for autodist update-specfile script
-u changelog "$"Rebuild packages with given changelog
-v "$"More verbose output
-x "$"Operate in cross build mode
@ -285,6 +286,9 @@ for ((i=1; i<=$#; i++)); do
-r) shift
PORT_REPOSITORY="${!i}"
;;
-s) shift
SCRIPT_ARGS="${!i}"
;;
-d) shift
DEST_REPOSITORY="${!i}"
;;
@ -520,8 +524,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
if [ "$REBUILD_MODE" = "1" ]; then
echo -n "update"
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\""
LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" &>$tmpfile
%% COMMAND: LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" --- \"$SCRIPT_ARGS\""
LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" --- $SCRIPT_ARGS &>$tmpfile
[ $? -gt 0 ] && {
echo "(FAILED) "
autoport_log ${JOB_CURRENT} update failed $tmpfile
@ -534,7 +538,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo -n "update"
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"automatic port from $PORT_REPOSITORY\""
LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"automatic port from $PORT_REPOSITORY\" &>$tmpfile
LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"automatic port from $PORT_REPOSITORY\" --- $SCRIPT_ARGS &>$tmpfile
cat $tmpfile >> $logfile
[ $? -gt 0 ] && {
echo "(FAILED) "

View File

@ -1,29 +1,79 @@
#!/bin/bash
#
# Autodist script for updating specfiles
#
# Copyright (c) 2007-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2007-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Released with the same license as autodist
#
[ "$1" ] || {
echo "Error: update-specfile: specfile not given; aborting."
SPECFILE=
BUILDREQNUM=0
for ((i=1; i<=$#; i++)); do
case ${!i} in
--buildreq) let i+=1
if [ ! "${!i}" ]; then
echo "ERROR: --buildreq requires at least an argument; aborting."
exit 1
fi
let BUILDREQNUM+=1
BUILDREQ[$BUILDREQNUM]=${!i}
if [ "${!i+1}" -a "${!i+1:0:1}" != "-" ]; then
let i+=1
BUILDREQREL[$BUILDREQNUM]=${!i}
if [ ! "${!i+1}" -o "${!i+1:0:1}" = "-" ]; then
echo "ERROR: update-specfile: --buildreq requires one or three arguments; aborting."
exit 1
fi
let i+=1
BUILDREQVER[$BUILDREQNUM]=${!i}
fi
;;
*) if [ ! "$SPECFILE" ]; then
SPECFILE=${!i}
else
echo "ERROR: update-specfile: unrecognized script option: '${!i}'; aborting."
exit 1
fi
esac
done
[ "$SPECFILE" ] || {
echo "ERROR: update-specfile: specfile not given; aborting."
exit 1
}
[ -e $1 ] || {
[ -e $SPECFILE ] || {
echo "Error: update-specfile: file $1 does not exist; aborting."
exit 1
}
sed -i "s|^Vendor:.*|Vendor: openmamba|" $1
sed -i "s|^Distribution:.*|Distribution: openmamba|" $1
sed -i "s|silvan\.calarco@qilinux\.it|silvan.calarco@mambasoft.it|" $1
sed -i "/BuildRequires:[[:space:]]*libffmpeg-devel/d" $1
sed -i "s|\(BuildRequires:[[:space:]]*\)libmysql-devel|\1libmysql5-devel|" $1
sed -i "s|\(BuildRequires:[[:space:]]*\)libdb42-devel|\1libdb47-devel|" $1
sed -i "s|\(BuildRequires:[[:space:]]*\)firefox-devel|\1xulrunner-devel|" $1
sed -i "s|^PreReq:[[:space:]]*/sbin/install-info|Requires(post):%{__install_info}|" $1
sed -i "s|^PreReq:[[:space:]]*%{__install_info}|Requires(post):%{__install_info}|" $1
sed -i "s|^PreReq:[[:space:]]*|Requires(pre): |" $1
sed -i "s|http://.*.dl\.sourceforge\.net/|http://downloads.sourceforge.net/|" $1
#sed -i "s|^\(Source.*:[[:space:]]*ftp://ftp.kde.org/pub/kde/stable/.*.tar.\)bz2|\1xz|" $1
# Distribution global changes
sed -i "s|^Vendor:.*|Vendor: openmamba|;
s|^Distribution:.*|Distribution: openmamba|;
/BuildRequires:[[:space:]]*libffmpeg-devel/d;
s|\(BuildRequires:[[:space:]]*\)libmysql-devel|\1libmysql5-devel|;
s|\(BuildRequires:[[:space:]]*\)libdb42-devel|\1libdb47-devel|;
s|\(BuildRequires:[[:space:]]*\)firefox-devel|\1xulrunner-devel|;
s|^PreReq:[[:space:]]*/sbin/install-info|Requires(post):%{__install_info}|;
s|^PreReq:[[:space:]]*%{__install_info}|Requires(post):%{__install_info}|;
s|^PreReq:[[:space:]]*|Requires(pre): |;
s|http://.*.dl\.sourceforge\.net/|http://downloads.sourceforge.net/|" $SPECFILE
#sed -i "s|^\(Source.*:[[:space:]]*ftp://ftp.kde.org/pub/kde/stable/.*.tar.\)bz2|\1xz|" $SPECFILE
if [ $BUILDREQNUM -gt 0 ]; then
grep "^## AUTOBUILDREQ-END" $SPECFILE > /dev/null || {
echo "ERROR: update-specfile: missing AUTOBUILDREQ block; aborting."
exit 1
}
for b in `seq 1 $BUILDREQNUM`; do
line=${BUILDREQ[$b]}
if [ "${BUILDREQREL[$b]}" ]; then
line="$line ${BUILDREQREL[$b]} ${BUILDREQVER[$b]}"
fi
sed -i "/^## AUTOBUILDREQ-END/,9999{/BuildRequires:[[:space:]]*${BUILDREQ[$b]}$/d}" $SPECFILE
sed -i "/^## AUTOBUILDREQ-END/,9999{/BuildRequires:[[:space:]]*${BUILDREQ[$b]}[[:space:]]/d}" $SPECFILE
sed -i "/^## AUTOBUILDREQ-END/a BuildRequires: $line" $SPECFILE
done
fi
exit 0

View File

@ -1042,6 +1042,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
--changelog \"package created using the webbuild interface\""
RET=$?
[ $RET -eq 0 ] && {
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
social_log "SUSER=$USER SEMAIL=$USER_EMAIL STARGET=developers STEXT=\"is working on <b>$PACKAGE</b> new package in <b>`print_environment_descr $ENVIRONMENT`</b> environment\" STIME=`date +%s`"
# prepare
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "rpmbuild -bp $PACKAGE.spec --nodeps --define=\"_topdir $SPECVAR_WORKINGHOME/RPM\""
@ -1408,7 +1409,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<br>"
fi
# automatic port
if [ ! "${AUTOPORT_DISABLE[$ENVIRONMENT]}" -a ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
if [ "${AUTOPORT_PORT_REPOSITORY[$ENVIRONMENT]}" ]; then
echo -n "Automatic port:"
echo -n "<input type=button id=autoportnp value=\"port\" onclick="
echo -n "p=getSelectedValueById('sendrepository');"
@ -2253,5 +2254,5 @@ else
echo -n ")"
fi
echo -n " :: openmamba webbuild</title>"
echo -n " :: openmamba webbuild @`hostname`</title>"
echo "</webbuild>"

View File

@ -96,9 +96,9 @@ function cgi_get_POST_vars()
cgi_get_POST_upload "${CONTENT_TYPE/*boundary=}"
return
fi
[ "${CONTENT_TYPE:0:33}" != "application/x-www-form-urlencoded" ] && \
echo "Warning: you should probably use MIME type "\
"application/x-www-form-urlencoded instead of ${CONTENT_TYPE}!" 1>&2
#[ "${CONTENT_TYPE:0:33}" != "application/x-www-form-urlencoded" ] && \
# echo "Warning: you should probably use MIME type "\
# "application/x-www-form-urlencoded instead of ${CONTENT_TYPE}!" 1>&2
# save POST variables (only first time this is called)
[ -z "$QUERY_STRING_POST" \
-a "$REQUEST_METHOD" = "POST" -a ! -z "$CONTENT_LENGTH" ] &&

View File

@ -84,6 +84,7 @@ function showlog() {
function showEnvironmentPanel() {
echo -n "Build host: <b>`hostname`</b><br>"
echo -n "Environment: <b>"
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} - "

View File

@ -0,0 +1,8 @@
<Directory /var/www/html>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
DirectoryIndex webbuild.html index.html index.php
# SSILegacyExprParser on
</Directory>
Timeout 600