Compare commits

..

89 Commits

Author SHA1 Message Date
ec6b60b45d Release 0.9.5 2013-02-02 16:37:38 +01:00
54379b55d4 autodist-cgi: support buildlogdir for 'autodist' user in chroot mode 2013-02-02 14:55:06 +01:00
ccf4cda924 webbuild: support for special 'autodist' user path in chroot mode 2013-02-02 14:22:14 +01:00
f43a210165 Makefile: fix after cron file renaming 2013-02-02 14:20:22 +01:00
5aa631ff10 config: updated configuration for distdb.*, legacy and unstaged packages 2013-02-02 14:10:10 +01:00
c1285c09cf autodist-upstream-updates: skip unstable updates 2013-02-02 14:05:36 +01:00
8235cba011 webbuild-function, autodist-cgi: also fix buildlogdir for autodist user in chroot mode 2013-01-21 02:37:04 +01:00
0a7f28e6e3 webbuild-function: support for autodist user special case in chroot mode 2013-01-19 21:06:45 +01:00
1df35a2641 autodist-update cron: fix x86_64 check 2013-01-19 20:37:31 +01:00
e0ee0726c8 60-autodist-update: start using autoport sysconfig configuration for update cron also
- file renamed from 60-autodist-autobuild
2013-01-19 17:46:30 +01:00
625c2b3ed2 webbuild: update to current production version providing some fixes and new features 2013-01-19 16:24:26 +01:00
a0314b874b autodist-cgi: various fixes 2013-01-19 16:22:21 +01:00
95c366a940 autodist: sync to current /etc/autodist files 2013-01-19 16:18:12 +01:00
ec39f8f7cb autodist-upstream-updates: use package repository from distromatic files in html output 2013-01-19 16:15:23 +01:00
6d278e3a20 autodist: sync with current production changes:
- fix support for multiple words arg passed to autospec (--changelog)
- yet some logs path and cleaning fixes
- temporary workaround: hardcoded skipping of java-*, apache-*, jakarta-*, compiz* packages (TODO: make this configurable)
2013-01-19 16:12:37 +01:00
24afa0b07b autodist-upstream-updates: fixed command line options for showing not up-to-date only packages 2012-12-02 00:03:56 +01:00
03a198fec4 webbuild: small fixes and code organization 2012-12-01 23:36:43 +01:00
432f79fa29 autoport: use $DATADIR instead of /var/autoport to also work in user mode 2012-12-01 23:33:14 +01:00
4b8773011b autodist-upstream-updates: added -u option to only output packages that are not up-to-date 2012-12-01 23:31:16 +01:00
0168057f06 Makefile: install cron file added in previous commit 2012-12-01 23:29:06 +01:00
84d27d1f44 Added 60-autodist-autobuild hourly cron script 2012-12-01 17:20:54 +01:00
6cf3e9f99f Added script autodust-upstream-updates with daily cron script 2012-12-01 17:18:36 +01:00
878663f2f0 autodist: sync configuration files with current status 2012-11-20 00:10:29 +01:00
25f1c4bb8c autoport cron: silent a couple of debugging messages 2012-11-20 00:08:05 +01:00
87a184e585 autodist cgi: lots of changes following webbuild development 2012-11-20 00:04:33 +01:00
2f6984ed3b autoport: added rebuild with changelog support throgh new -u option 2012-11-20 00:00:51 +01:00
aabe20a9ad autodist: reduce progress logging lines in autobuild mode and some other small fixes 2012-11-19 23:58:03 +01:00
9f98345aad webbuild: added another ton of changes; added webbuild-functions-private external include 2012-11-19 23:52:30 +01:00
d3705b31c7 autoport: generate an operation state file for better parsing by autodist cgi 2012-10-18 00:57:43 +02:00
76032ddcb4 autodist-tool: makepatch: support for patch type autodetection 2012-10-18 00:55:22 +02:00
12b3759777 autodist: create an operation state file for better parsing from cgi; return the number of faild operations as exit code 2012-10-18 00:52:41 +02:00
0e1067c930 webbuild: sync with current running sources (tons of changes again) 2012-10-18 00:49:13 +02:00
12d8eafdc4 webbuild: added server side javascript includes and css styles 2012-09-21 13:03:27 +02:00
0601482f54 webbuild: sync with current alpha development with lots of changes and improvements 2012-09-21 12:57:19 +02:00
4021d4f7a1 distdb.i586: updated 2012-09-21 12:55:55 +02:00
9a8b1355f7 autoport cron: split autoport cron script into two files to parallelize native and chroot port jobs 2012-09-21 12:53:08 +02:00
1514f95b2b autodist cgi: other logfile names and display fixes 2012-09-21 12:51:11 +02:00
1f088616ad autodist: added --list-pkg option and fix for jobs starting with a number (54321) 2012-09-21 12:48:14 +02:00
eebf7f263d autoport cron: fix some log paths with the ones used by current autodist/autoport 2012-09-10 17:51:11 +02:00
ffff0b1c10 webbuild: lots of not better detailed changes; added webbuild-functions import script in /usr/share/autodist 2012-09-10 17:48:21 +02:00
e66061e4c3 distdb: moved kernel jobs from distdb to distdb.i586 2012-09-10 17:43:44 +02:00
298ad4d73c autodist,autoport: support for sending status to webbuild social log 2012-09-10 17:41:15 +02:00
71fec6c77a webbuild-sudo: fix getting specfile version 2012-09-06 18:56:32 +02:00
dcff130bdf webbuild-cgi: support for public social box and other fixes and improvements 2012-09-06 18:55:33 +02:00
5170d2815a autodist-cgi: move icecream builds outside the repositories loop 2012-09-06 18:54:25 +02:00
455ca50f06 autodist: added option --list-jobs for webdist to know all available jobs 2012-09-06 18:52:58 +02:00
0d02eac831 autoport: log naming using timestamp, fix detection of install requirements
- name logfiles using timestamp (TODO: a logfile cleaner)
- if both -np and -r were given send to PORT_REPOSITORY instead of pkg_repository
- fix detection of install requirements
2012-09-06 18:10:35 +02:00
dd53d60b85 webbuild: added maintainer mode; URI-encode package names to fix packages with '+' characters; other fixes 2012-09-04 13:05:57 +02:00
c1ed68dd78 autodist-cgi: complete support for multiple defined repositories in AUTOPORT_REPOSITORIES[] 2012-09-04 13:04:11 +02:00
17c9e4d33a Sync with current autodist configuration and cron files on server 2012-09-02 13:24:26 +02:00
a518dbe02a autodist-cgi: add packages links to webbuild page 2012-09-02 13:21:18 +02:00
b36a8a552e webbuild: add backend-side files 2012-09-02 13:18:52 +02:00
b9803712a2 Release 0.9.4 2012-08-16 12:19:51 +02:00
b3e82e19b4 update-specfile: sync to current 2012-08-16 12:13:07 +02:00
e6f4f990e4 Makefile: install legacy file and apply new cron files names 2012-08-16 12:10:13 +02:00
13c5359c92 cron files: distribution agnostic cron files rename 2012-08-16 12:05:18 +02:00
b37324962c autoport: replace AUTOPORT_CGI_SECONDARY with AUTOPORT_CGI_HOST in default configuration template 2012-08-16 11:58:40 +02:00
79e63cd2a3 autodist-tool: remove forgotten debugging code 2012-08-16 11:51:02 +02:00
f842044af6 autodist: configuration update for all archs 2012-08-16 11:49:11 +02:00
1e2ba88e57 autodist: improved management of skipped packages, delayed repository and other small fixes 2012-08-16 11:41:10 +02:00
61a6f72850 autodist-cgi: support for multiple packages jobs with link available for each operation performed (prepare,update,build,install) 2012-08-16 11:38:14 +02:00
cd1132a916 autodist-cgi: implement support for multiple secondary hosts; use AS_HOST=# (0 for root host)
autodist-cgi: implement distributed builds monitoring page using icecream-monitor script
2012-08-01 11:48:43 +02:00
a36d759531 autoport cron: check for autoport pid, not autodist 2012-07-29 10:58:07 +02:00
2ee18817c4 autodist-cgi: add available log files table for build target in SHOWLOG and implement security checks on passed urls 2012-07-29 10:56:54 +02:00
00adf496ba autospec-conf: remove -C option rejected by curl 7.27.0; also remove '--limit-rate 400k -Y 1' 2012-07-29 10:53:20 +02:00
a5f3beda83 distdb: rename xorg_drv_video target to xorg_drv_video_all to allow autoupgrading single package 2012-07-11 22:38:55 +02:00
0be3a1fc97 autodist cgi: lots of improvements in interface output and other fixes 2012-07-11 22:36:11 +02:00
005fe6a6f5 autodist cgi: another fix for showlog on secondary host 2012-07-11 20:28:46 +02:00
25cc256ba5 autoport hourly cron: fix to use new log file naming 2012-07-09 18:51:34 +02:00
7f92f0fd95 cleanold daily cron: clean old files in all autoport configured environments 2012-07-09 18:49:52 +02:00
4a281ed9dc autodist-cgi: print location of ok log file in output log
autodist: sync with current minor changes
2012-07-09 18:48:36 +02:00
761ae3b3fb distdb updates for i586 2012-06-10 19:09:38 +02:00
179121211e autoport-cgi: more basic enhancements
autodist,autoport: better loggin location and internal formatting for parsing
2012-06-09 16:35:51 +02:00
c9da095026 autoport cron: remove some empty lines added to log file 2012-05-26 13:29:20 +02:00
6e2a4ded8c autodist-cgi: add support for local autodist update and some parsing improvements 2012-05-26 13:28:28 +02:00
ada79d6f76 autoport: add '^' log prefix also for staging packages 2012-05-24 17:24:33 +02:00
dbaaa43f7f Release 0.9.3 2012-05-24 16:47:53 +02:00
e6556e1063 autodist cgi: rename from autoport-cgi and fix installation 2012-05-24 16:47:14 +02:00
a4ccca0e26 unstage.arm: updated 2012-05-24 16:41:22 +02:00
11951519dc autoport sysconfig: add AUTOPORT_CGI_SECONDARY in default configuration templated 2012-05-24 16:37:45 +02:00
d2b7713cff autoport, autoport cron: provide a prefix to log lines for parsing by autoport-cgi 2012-05-24 16:35:34 +02:00
2a89f70381 autoport-cgi: add initial cgi script for realtime log information through web server 2012-05-24 16:29:41 +02:00
ba9a55182e autoport: - fix error detecting pkg_milestone introduced with previous optimizations
- don't list up to date packages in batch mode unless -v (verbose) is specified
2012-05-15 16:28:01 +02:00
c624adf788 Release 0.9.2 2012-05-14 13:48:41 +02:00
b5f570cc0b autoport cron: reworked for better logfile management; disable service restarts in chroot mode 2012-05-12 13:43:19 +02:00
c49d56bd9e autoport: optimize get_pkg_buildinfo() calls for speed avoiding unnecessary sourcing of input files 2012-05-10 13:42:05 +02:00
465e63d0ef autoport: don't build missing deps in MILESTONE_REBUILD mode 2012-05-10 10:37:10 +02:00
c97abad872 autoport cron: manage AUTOPORT_CHROOT_USER[] and AUTOPORT_DISABLE[] new variables 2012-05-10 10:35:14 +02:00
2cee9628ea autoport-chroot: added new user tool to make entering autoport chroot environment easier 2012-05-10 10:30:38 +02:00
35 changed files with 4792 additions and 515 deletions

View File

@ -12,11 +12,14 @@ sbindir = ${exec_prefix}/sbin
bindir = ${exec_prefix}/bin
datadir = ${prefix}/share
initrddir = ${sysconfdir}/rc.d/init.d
libexecdir = ${prefix}/libexec
mandir = ${prefix}/usr/share/man
sysconfigdir= ${sysconfdir}/sysconfig
configdir = ${sysconfdir}/autodist
localstatedir= /var
piddir= ${localstatedir}/run/autodist
cgidir = ${localstatedir}/www/cgi-bin
htmldir = ${localstatedir}/www/html
srcdir = .
DESTDIR =
@ -27,7 +30,8 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_DIR = ${INSTALL} -d -m 755
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
pck_datadir = $(localstatedir)/$(PACKAGE)
pck_datadir = $(datadir)/$(PACKAGE)
pck_statedir = $(localstatedir)/$(PACKAGE)
pck_logdir = $(localstatedir)/$(PACKAGE)/log
distdir = $(PACKAGE)-$(VERSION)
@ -44,23 +48,37 @@ install-dirs:
@$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/cron.daily
@$(INSTALL_DIR) $(DESTDIR)$(sysconfdir)/sysconfig
@$(INSTALL_DIR) $(DESTDIR)$(bindir)
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
@$(INSTALL_DIR) $(DESTDIR)$(cgidir)
@$(INSTALL_DIR) $(DESTDIR)$(htmldir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)/template/autoupdate/spec-patches-build/old
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)/template/autoupdate/spec-patches-update/old
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)/template/autoupdate/spec-patches-build/old
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)/template/autoupdate/spec-patches-update/old
@$(INSTALL_DIR) $(DESTDIR)$(pck_logdir)/prepare/{ok,failed}
@$(INSTALL_DIR) $(DESTDIR)$(pck_logdir)/update/{ok,failed}
@$(INSTALL_DIR) $(DESTDIR)$(pck_logdir)/build/{ok,failed}
@$(INSTALL_DIR) $(DESTDIR)$(pck_logdir)/install/{ok,failed}
@$(INSTALL_DIR) $(DESTDIR)$(pck_logdir)/send/{ok,failed}
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)/RPM/{SPECS,SRPMS,BUILD,SOURCES,RPMS/{noarch,i586,ppc,x86_64,arm}}
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)/RPM/{SPECS,SRPMS,BUILD,SOURCES,RPMS/{noarch,i586,ppc,x86_64,arm}}
@$(INSTALL_DIR) $(DESTDIR)$(piddir)
@$(INSTALL_DIR) $(DESTDIR)$(libexecdir)
install-programs:
@$(INSTALL_SCRIPT) autodist $(DESTDIR)$(bindir)/autodist
@$(INSTALL_SCRIPT) autodist-tool $(DESTDIR)$(bindir)/autodist-tool
@$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot
@$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(sbindir)/autodist-upstream-updates
@$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment
@$(INSTALL_SCRIPT) etc/autodist/scripts/* $(DESTDIR)$(configdir)/scripts/
@$(INSTALL_SCRIPT) autodist-cgi $(DESTDIR)$(cgidir)/autodist
@$(INSTALL_SCRIPT) webbuild/webbuild-cgi $(DESTDIR)$(cgidir)/webbuild
@$(INSTALL_SCRIPT) webbuild/webbuild-sudo $(DESTDIR)$(libexecdir)/webbuild-sudo
@$(INSTALL_SCRIPT) webbuild/webbuild-checkpassword $(DESTDIR)$(libexecdir)/webbuild-checkpassword
@$(INSTALL_SCRIPT) webbuild/webbuild-functions $(DESTDIR)$(pck_datadir)/webbuild-functions
@$(INSTALL_SCRIPT) webbuild/webbuild-functions-private $(DESTDIR)$(pck_datadir)/webbuild-functions-private
@cp -a webbuild/html/* $(DESTDIR)$(htmldir)
install-data:
@$(INSTALL_DATA) etc/autodist/config $(DESTDIR)$(configdir)/config
@ -69,6 +87,7 @@ install-data:
@$(INSTALL_DATA) etc/autodist/distdb.arm $(DESTDIR)$(configdir)/distdb.arm
@$(INSTALL_DATA) etc/autodist/distdb.x86_64 $(DESTDIR)$(configdir)/distdb.x86_64
@$(INSTALL_DATA) etc/autodist/distdb.ppc $(DESTDIR)$(configdir)/distdb.ppc
@$(INSTALL_DATA) etc/autodist/legacy $(DESTDIR)$(configdir)/legacy
@$(INSTALL_DATA) etc/autodist/unstage $(DESTDIR)$(configdir)/unstage
@$(INSTALL_DATA) etc/autodist/unstage.i586 $(DESTDIR)$(configdir)/unstage.i586
@$(INSTALL_DATA) etc/autodist/unstage.arm $(DESTDIR)$(configdir)/unstage.arm
@ -78,12 +97,16 @@ install-data:
@$(INSTALL_DATA) etc/autodist/blacklist $(DESTDIR)$(configdir)/blacklist
@$(INSTALL_DATA) etc/autodist/distdb.d/* $(DESTDIR)$(configdir)/distdb.d/
@$(INSTALL_DATA) etc/sudoers.d/autoport $(DESTDIR)$(sysconfdir)/sudoers.d/autoport
@$(INSTALL_DATA) webbuild/webbuild-sudoers $(DESTDIR)$(sysconfdir)/sudoers.d/webbuild
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
@$(INSTALL_SCRIPT) etc/cron.hourly/65-openmamba-autobuild-autoport $(DESTDIR)$(sysconfdir)/cron.hourly/
@$(INSTALL_SCRIPT) etc/cron.daily/40-openmamba-autodist-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/
@$(INSTALL_DATA) autospec-conf $(DESTDIR)$(pck_datadir)/.autospec
@touch $(DESTDIR)$(pck_datadir)/template/autoupdate/auto.success
@touch $(DESTDIR)$(pck_datadir)/template/autoupdate/auto.skip
@$(INSTALL_SCRIPT) etc/cron.hourly/60-autodist-update $(DESTDIR)$(sysconfdir)/cron.hourly/
@$(INSTALL_SCRIPT) etc/cron.hourly/65-autoport-native $(DESTDIR)$(sysconfdir)/cron.hourly/
@$(INSTALL_SCRIPT) etc/cron.hourly/66-autoport-chroot $(DESTDIR)$(sysconfdir)/cron.hourly/
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-cleanold $(DESTDIR)$(sysconfdir)/cron.daily/
@$(INSTALL_SCRIPT) etc/cron.daily/40-autodist-upstream-updates $(DESTDIR)$(sysconfdir)/cron.daily/
@$(INSTALL_DATA) autospec-conf $(DESTDIR)$(pck_statedir)/.autospec
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.success
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.skip
install: \
install-dirs \

View File

@ -1 +1 @@
VERSION = 0.9.1
VERSION = 0.9.5

342
autodist
View File

@ -1,11 +1,11 @@
#!/bin/bash
#
# Autodist -- batch build tool for RPM based distributions
# Copyright (C) 2006-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2006-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.1
VERSION=0.9.5
me=(${0##*/} $VERSION "Sat Aug 20 2010")
exec 3>`readlink /proc/self/fd/0`
@ -27,6 +27,8 @@ ${me[0]} ${me[1]}
-b,--build "$"Build packages""
-i,--install "$"Install packages on local system""
-s,--send "$"Send packages to repository""
--list-jobs "$"List configured jobs""
--list-pkgs job "$"List packages for specified job""
"$"Options"":
-c,--cleanlogs "$"Clean all logs before starting""
@ -85,13 +87,6 @@ SEND_SERVER=
[ -r $CONFIGFILE ] && . $CONFIGFILE
eval `autospec -q --eval="srpms_dir"`
eval `autospec -q --eval="rpms_dir"`
eval `autospec -q --eval="spec_dir"`
eval `autospec -q --eval="source_dir"`
eval `autospec -q --eval="tmppath_dir"`
# init environment especially to have a full PATH when executed by crond with
# system init PATH
. /etc/profile
@ -132,6 +127,15 @@ for ((i=1; i<=$#; i++)); do
-t|--test) simulate=1 ;;
-q|--quiet) quiet=1 ;;
-v|--verbose) verbose=1 ;;
--list-jobs) do_listjobs=1 ;;
--list-pkgs) do_listpkgs=1
let i+=1
[ "${!i}" ] || {
echo "Error: job parameter not given, aborting."
exit 1
}
LISTPKGSJOB="${!i}"
;;
--force) SEND_FORCE="--force"
SEND_FORCE_BUILD="--force-build"
;;
@ -176,7 +180,12 @@ for ((i=1; i<=$#; i++)); do
JOBNAME[${#JOBNAME[@]}]="${!i/\#*}"
[ "${!i/*\#}" != "${!i}" ] && JOBVER[${#JOBNAME[@]}]="+${!i/*\#}"
else
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
if [ "${!i/ }" != "${!i}" ]; then
# pass multiple word arguments inside quotation marks
AUTOSPEC_ARGS="$AUTOSPEC_ARGS \"${!i}\""
else
AUTOSPEC_ARGS="$AUTOSPEC_ARGS ${!i}"
fi
fi
;;
esac
@ -187,6 +196,7 @@ done
SEND_SERVER_CMD="--server $SEND_SERVER"
AUTOUPDATEDIR=${LOCAL_REPS_BASE_DIR}/$AUTODIST_REPOSITORY/autoupdate/
[ -r $AUTOUPDATEDIR ] || {
AUTOUPDATEDIR=$USERCONFDIR/$AUTODIST_REPOSITORY/autoupdate
mkdir -p $AUTOUPDATEDIR
@ -250,12 +260,23 @@ esac
# exit 1
#}
. $DISTDB
[ -e $DISTDB.$TARGETARCH ] && . $DISTDB.$TARGETARCH
[ -d $DISTDBDIR ] && \
for f in `ls $DISTDBDIR/*.db`; do
. $f
done
# for webbuild message
function cgi_encodevar() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
function tempfile() {
local tmpfile
@ -321,19 +342,19 @@ function version_find_bigger()
return 0
}
#for target in ${TARGET[*]}; do
# echo ${target[*]}
#done
#exit 1
function tail_file() {
local elapsedtime elapsedstring elapsedcount phase lastprinttime newtime begintime lines c
local elapsedtime elapsedstring elapsedcount phase lastprinttime newtime begintime lines c difftimestep
c=0
lines=0
begintime=`LANG=C date +%s`
lastlinetime=$begintime
lastprinttime=0
if [ "$do_autobuild" ]; then
difftimestep=1800
else
difftimestep=1
fi
while read line; do
echo "$line" >> $1
let lines+=1
@ -343,8 +364,7 @@ function tail_file() {
case $verbose in
1) echo "$line"
;;
*)
if [ $difftime -gt 1 ]; then
*) if [ $difftime -gt $difftimestep ]; then
let c+=1
lastprinttime=$newtime
let elapsedtime=$newtime-$begintime
@ -362,21 +382,24 @@ function tail_file() {
[ $elapsedcount -gt 0 ] && elapsedstring="`expr $elapsedcount % 60`m $elapsedstring"
elapsedcount=`expr $elapsedcount / 60`
[ $elapsedcount -gt 0 ] && elapsedstring="${elapsedcount}h $elapsedstring"
echo -n -e "\r$2 $phase ($lines lines, $elapsedstring, $speed l/s)"
[ ! "$do_autobuild" ] && echo -n -e "\r"
echo -n "$2 $phase ($lines lines, $elapsedstring, $speed l/s)"
fi
;;
esac
#echo -n -e "\rTailing...$phase (sleeped $diffdate seconds, $lines output lines) "
#savedate=newdate
done
}
get_job_vector() {
# note: if JOB_NAME contains a "-" translate it to "_"
# note: if JOB_NAME contains a "-" or "." translate it to "_"
local JTARGET=${1/\/*}
local JPKG=
[ "$JTARGET" != "$1" ] && JPKG="${1/*\/}"
local JNAME=`echo $JTARGET | tr - _`
local JNAME=`echo $JTARGET | tr - _ | tr . _`
if [[ ${JNAME:0:1} =~ [0-9] ]]; then
# prepend a underscore to job names starting with a number (e.g. 54321)
JNAME="_$JNAME"
fi
# resolve JOB_NAME from distdb
local jobtmpfile=`tempfile`
@ -394,15 +417,30 @@ get_job_vector() {
JOB=(${JOB[*]} "" "")
elif [ "${JPKG}" ]; then
TMPJOB=($JPKG)
for i in `seq 4 ${#JOB[*]}`; do
for i in `seq 1 ${#JOB[*]}`; do
TMPJOB=(${TMPJOB[*]} "${JOB[$i]}")
done
JOB=${TMPJOB[*]}
JOB=(${TMPJOB[*]})
fi
JOB_PKGS=(${JOB[0]//,/ })
JOB_VARNAMES=(${JOB[1]//,/ })
}
function autobuild_log() {
local pkg=$1
local operation=$2
local result=$3
local job=$4
local logfile=$5
[ "$pkg" -a "$operation" -a "$result" ] || return
if [ "$job" -a "$job" != "$pkg" ]; then
echo "$job/$pkg $operation $result $logfile" >> $LOGBASEDIR/autoupdate-current
else
echo "$pkg $operation $result $logfile" >> $LOGBASEDIR/autoupdate-current
fi
}
function launch_pkgs_loop() {
# This function iterates the passed operation for each package (column) in job
#
@ -487,12 +525,30 @@ function launch_pkgs_loop() {
# launch loop for each package
for pkg in ${JOB_PKGS[*]}; do
unset LOGFILE_SUFFIX
for a in ${JOB_VALUES[*]}; do
tr_job=`echo $a | tr / _`
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
done
LOGFILE_SUFFIX=$LOGFILE_SUFFIX.$TARGETARCH
[ "$JOB_NAME" = "${pkg}" ] &&
LOGFILE_PKG_NAME=${pkg}${LOGFILE_SUFFIX} ||
LOGFILE_PKG_NAME=${JOB_NAME}_${pkg}${LOGFILE_SUFFIX}
LOGFILE_PKG=${LOGDIR}/${LOGFILE_PKG_NAME}
# clean previous logs for this package
[ -e ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
rm -f ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX}
[ -e ${LOGDIR}/failed/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
rm -f ${LOGDIR}/failed/${LOGFILE_PKG_NAME}-${LOGFILE_SUFFIX}
case $operation in
autoupdate|update|build|buildinstall)
[ -e $spec_dir/$pkg.spec ] || {
case $SEVERITY in
0) ;;
1) echo "!! Error: spec filename must be the same as package name or invalid job name; skipping $pkg package."
[ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
continue ;;
*) echo "!! Error: spec filename must be the same as package name or invalid job name; aborting."
exit 1 ;;
@ -504,11 +560,12 @@ function launch_pkgs_loop() {
if [ $JOB_IDX -eq 0 -a "$do_autobuild" ]; then
# preserve specfile modification date
if [ -e $AUTOUPDATEDIR/spec-patches-$patch_operation/$pkg.spec.patch ]; then
echo -n "== "
echo -n "?= "
patch -p1 $spec_dir/$pkg.spec $AUTOUPDATEDIR/spec-patches-$patch_operation/$pkg.spec.patch || {
case $SEVERITY in
0) ;;
1) echo "%! Error: could not apply patch to specfile; skipping $pkg package."
[ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
ret=1
continue ;;
*) echo "!! Error: could not apply patch to specfile; aborting."
@ -528,26 +585,32 @@ function launch_pkgs_loop() {
SPEC_RELEASE=`grep "Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"`
}
unset LOGFILE_SUFFIX
for a in ${JOB_VALUES[*]}; do
tr_job=`echo $a | tr / _`
LOGFILE_SUFFIX=${LOGFILE_SUFFIX}__$tr_job
done
LOGFILE_SUFFIX=$LOGFILE_SUFFIX.$TARGETARCH
[ "$JOB_NAME" = "${pkg}" ] &&
LOGFILE_PKG_NAME=${pkg}${LOGFILE_SUFFIX} ||
LOGFILE_PKG_NAME=${JOB_NAME}_${pkg}${LOGFILE_SUFFIX}
LOGFILE_PKG=${LOGDIR}/${LOGFILE_PKG_NAME}
# clean previous logs for this package
[ -e ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
rm -f ${LOGDIR}/ok/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX}
[ -e ${LOGDIR}/failed/${LOGFILE_PKG_NAME}${LOGFILE_SUFFIX} ] &&
rm -f ${LOGDIR}/failed/${LOGFILE_PKG_NAME}-${LOGFILE_SUFFIX}
[ -e "$SRCPKGLIST" ] && PKGLINE=`grep "^${pkg} " $SRCPKGLIST` || PKGLINE=
[ -e "$SRCPKGLIST_DELAYED" ] && PKGLINE_DELAYED=`grep "^${pkg} " $SRCPKGLIST_DELAYED` || PKGLINE_DELAYED=
if [ "$PKGLINE_DELAYED" -a "$do_autobuild" ]; then
set -- $PKGLINE
_ver1=$2
_rel1=$6
set -- $PKGLINE_DELAYED
_ver2=$2
_rel2=$6
version_find_bigger ${_ver1} ${_ver2}
if [ $? -eq 2 ]; then
PKGLINE=$PKGLINE_DELAYED
echo "!! Warning: using package from delayed repository (${_ver2} > ${_ver1})"
elif [ $? -eq 0 ]; then
version_find_bigger ${_rel1} ${_rel2}
if [ $? -eq 0 ]; then
echo "!! Warning: package with same version (${_ver1}-${_rel1}) exists in delayed repository"
elif [ $? -eq 2 ]; then
echo "!! Warning: using package from delayed repository (${_ver2}-${_rel2} > ${_ver1}-${_rel1})"
PKGLINE=$PKGLINE_DELAYED
fi
fi
fi
case $operation in
prepare)
command_opts="-a1"
@ -557,10 +620,10 @@ function launch_pkgs_loop() {
if [ "$REPNAME" ]; then
command_opts="$command_opts --server ${REPNAME}"
else
echo "Warning: undefined repository $4 in srcpkglist, check AUTODIST_REPOSITORIES in configuration file"
echo "!! Warning: undefined repository $4 in srcpkglist, check AUTODIST_REPOSITORIES in configuration file"
fi
else
echo "Warning: package $pkg is missing in srcpkglist file"
echo "!! Warning: package $pkg is missing in srcpkglist file"
fi
;;
rebuild) command_opts="-a4 --rebuild" ;;
@ -570,10 +633,13 @@ function launch_pkgs_loop() {
if [ "$PKGLINE" ]; then
set -- $PKGLINE
pkglinever=$2
# warning: assuming version is passed first
# warning: asasuming version is passed first
version_find_bigger "${passed_arguments/ *}" "$pkglinever"
[ $? -eq 1 ] || {
echo "Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})."
echo "!! Warning: skipping ${pkg} package already up to date ($pkglinever >= ${passed_arguments/ *})."
echo "%% Adding ${pkg} job to skipped list."
echo "${pkg} $DATE_NOW 255" >> $SKIPPEDLISTDIR/auto.skip
[ "$do_autobuild" ] && autobuild_log $pkg $operation skipped $JOB_NAME
continue
}
fi
@ -583,7 +649,10 @@ function launch_pkgs_loop() {
if [ "$PKGLINE_DELAYED" -a "$do_autobuild" ]; then
set -- $PKGLINE_DELAYED
if [ "$SPEC_VERSION-$SPEC_RELEASE" = "$2-$6" ]; then
echo "Warning: skipping ${pkg} package build because already present in delayed repository."
echo "!! Warning: skipping ${pkg} package build because already present in delayed repository."
echo "%% Adding ${pkg} job to skipped list."
echo "${pkg} $DATE_NOW 254" >> $SKIPPEDLISTDIR/auto.skip
[ "$do_autobuild" ] && autobuild_log $pkg $operation skipped $JOB_NAME
continue
fi
fi
@ -599,7 +668,7 @@ function launch_pkgs_loop() {
[ $? -eq 0 ] && {
version_find_bigger "$SPEC_RELEASE" "$pkglinerel"
if [ $? -ne 1 ]; then
echo "Warning: skipping ${pkg} package already up to date ($SPEC_VERSION-$SPEC_RELEASE >= $pkglinever-$pkglinerel)."
echo "!! Warning: skipping ${pkg} package already up to date ($SPEC_VERSION-$SPEC_RELEASE >= $pkglinever-$pkglinerel)."
continue
fi
}
@ -608,7 +677,7 @@ function launch_pkgs_loop() {
if [ "$PKGLINE_DELAYED" -a "$do_autobuild" ]; then
set -- $PKGLINE_DELAYED
if [ "$SPEC_VERSION-$SPEC_RELEASE" = "$2-$6" ]; then
echo "Warning: skipping ${pkg} package build because already present in delayed repository."
echo "!! Warning: skipping ${pkg} package build because already present in delayed repository."
continue
fi
fi
@ -624,7 +693,7 @@ function launch_pkgs_loop() {
[ $? -eq 0 ] && {
version_find_bigger "$SPEC_RELEASE" "$pkglinerel"
if [ $? -ne 1 ]; then
echo "Warning: skipping ${pkg} package already up to date ($SPEC_VERSION-$SPEC_RELEASE >= $pkglinever-$pkglinerel)."
echo "!! Warning: skipping ${pkg} package already up to date ($SPEC_VERSION-$SPEC_RELEASE >= $pkglinever-$pkglinerel)."
continue
fi
}
@ -633,7 +702,7 @@ function launch_pkgs_loop() {
if [ "$PKGLINE_DELAYED" -a "$do_autobuild" ]; then
set -- $PKGLINE_DELAYED
if [ "$SPEC_VERSION-$SPEC_RELEASE" = "$2-$6" ]; then
echo "Warning: skipping ${pkg} package send because already present in delayed repository."
echo "!! Warning: skipping ${pkg} package send because already present in delayed repository."
continue
fi
fi
@ -647,7 +716,8 @@ function launch_pkgs_loop() {
command="$AUTOSPEC_CMD -u $pkg $command_opts $passed_arguments $JOB_ARGS"
tmpfile=`tempfile`
tmpfile=${LOGBASEDIR}/current.$$
> $tmpfile
tmpfile1=`tempfile`
echo -n "== "`log_date`" $JOB_NAME with args: $JOB_ARGS..." >> $LOGFILE
echo "
@ -672,7 +742,7 @@ function launch_pkgs_loop() {
if [ $ret -gt 0 ]; then
echo " FAILED (ret=$ret)"
echo " FAILED (ret=$ret)" >> $LOGFILE
[ "$quiet" ] || {
[ ! "$quiet" -a ! "$verbose" ] && {
echo "=> $command"
echo
echo " == begin of output log =="
@ -684,6 +754,7 @@ function launch_pkgs_loop() {
}
mv $LOGFILE_PKG $LOGDIR/failed/
echo "?= See $LOGDIR/failed/${LOGFILE_PKG_NAME}"
[ "$do_autobuild" ] && autobuild_log $pkg $operation failed $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
case $operation in
autoupdate|update)
;;
@ -706,9 +777,13 @@ function launch_pkgs_loop() {
echo
echo " OK" >> $LOGFILE
mv $LOGFILE_PKG $LOGDIR/ok/
echo "?= See $LOGDIR/ok/${LOGFILE_PKG_NAME}"
[ "$do_autobuild" ] && autobuild_log $pkg $operation ok $JOB_NAME $LOGDIR/ok/${LOGFILE_PKG_NAME}
case $operation in
prepare)
[ -e $spec_dir/.$pkg.spec.autodist.prebuild ] && \
rm -f $spec_dir/.$pkg.spec.autodist.prebuild
cp $spec_dir/$pkg.spec $spec_dir/.$pkg.spec.autodist.preupdate
;;
rebuild)
@ -716,12 +791,12 @@ function launch_pkgs_loop() {
;;
update|autoupdate)
cp $spec_dir/$pkg.spec $spec_dir/.$pkg.spec.autodist.prebuild
SPEC_EPOCH=`grep "Epoch:" $spec_dir/$pkg.spec | sed "s|Epoch:[[:space:]]*||"`
SPEC_VERSION=`grep "Version:" $spec_dir/$pkg.spec | sed "s|Version:[[:space:]]*||"`
SPEC_RELEASE=`grep "Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"`
SPEC_EPOCH=`grep -m1 "^Epoch:" $spec_dir/$pkg.spec | sed "s|Epoch:[[:space:]]*||"`
SPEC_VERSION=`grep -m1 "^Version:" $spec_dir/$pkg.spec | sed "s|Version:[[:space:]]*||"`
SPEC_RELEASE=`grep -m1 "^Release:" $spec_dir/$pkg.spec | sed "s|Release:[[:space:]]*||"`
if [ "$PKGLINE" ]; then
set -- $PKGLINE
echo "== Specfile updated from version $2-$6 to $SPEC_VERSION-$SPEC_RELEASE"
echo "?= Specfile updated from version $2-$6 to $SPEC_VERSION-$SPEC_RELEASE"
if [ "`echo $SPEC_VERSION | grep -i alpha`" -o \
"`echo $SPEC_VERSION | grep -i beta`" -o \
"`echo $SPEC_VERSION | grep -i rc`" -o \
@ -755,6 +830,12 @@ function launch_pkgs_loop() {
[ -e $SOURCESDIR/$p ] && rm -f $SOURCESDIR/$p
done
fi
if [ "$operation" = "buildinstall" -o "${passed_arguments/--norpm}" != "${passed_arguments}" ]; then
# send operation: check for --norpm (source send) to avoid sending notification twice
[ "$WEBBUILD_URL" -a "$WEBBUILD_USER" ] && \
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
MESSAGE=`cgi_encodevar \"sent <b>$pkg</b> to <b>$SEND_SERVER</b>\"`" >/dev/null
fi
;;
esac
fi
@ -779,6 +860,44 @@ function log_date() {
echo -n `LANG=C date +%Y%m%d@%H%M%S`
}
DISTDBFILES="$DISTDB"
[ -e $DISTDB.$TARGETARCH ] && DISTDBFILES="$DISTDBFILES $DISTDB.$TARGETARCH"
[ -e ~/.autodist/distdb ] && DISTDBFILES="$DISTDBFILES ~/.autodist/distdb"
[ -e ~/.autodist/distdb.$TARGETARCH ] && DISTDBFILES="$DISTDBFILES ~/.autodist/distdb.$TARGETARCH"
if [ "$do_listjobs" ]; then
for f in $DISTDBFILES; do
for j in `grep -v "^#" $f | grep ".*=(" | sed "s|\(.*\)=(.*|\1|"`; do
echo $j
done
done
exit 0
fi
# include global distdb files
for f in $DISTDBFILES; do
. $f
done
if [ "$do_listpkgs" ]; then
get_job_vector $LISTPKGSJOB
for p in ${JOB_PKGS[*]}; do
echo $p
done
exit 0
fi
# FIXME: DISTDBDIR contains private jobs we don't want to publish on webbuild
for f in $DISTDBDIR/*.db; do
. $f
done
eval `autospec -q --eval="srpms_dir"`
eval `autospec -q --eval="rpms_dir"`
eval `autospec -q --eval="spec_dir"`
eval `autospec -q --eval="source_dir"`
eval `autospec -q --eval="tmppath_dir"`
for a in $LOGBASEDIR/{,prepare/{,ok,failed},update/{,ok,failed},build/{,ok,failed},install/{,ok,failed},send/{,ok,failed}}; do
[ ! -w $a ] && {
@ -803,6 +922,7 @@ if [ "$do_autobuild" = "1" ]; then
exit 1
}
srctmpfile=`tempfile`
cat $AUTOUPDATEDIR/*.in > $srctmpfile
cat $SRCPKGLIST | sort --key=3 >> $srctmpfile
@ -839,10 +959,33 @@ if [ "$do_autobuild" = "1" ]; then
# check blacklist
awk '{ print $1 }' $BLACKLIST | grep "^$PKGNAME$" >/dev/null && {
BLACKLISTCOUNT=`expr $BLACKLISTCOUNT + 1`
#echo "?= Job $PKGNAME is in the blacklist; skipping"
# echo "?= Job $PKGNAME is in the blacklist; skipping"
continue
}
# check skippedlist
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
if [ "$SKIPPEDLINE" ]; then
set -- $SKIPPEDLINE
SKIPPEDTIME=$2
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
# echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
continue
else
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
fi
fi
# check legacylist
awk '{ print $1 }' $LEGACYLIST | grep "^$PKGNAME$" >/dev/null && {
echo "?= Job $PKGNAME is in the legacy list; skipping automatic update"
echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip
continue
}
# manually or from lists scheduled jobs
if [ "${VERSION:0:1}" == "+" -a "$VERSION" != "+0" ]; then
TRVER=`echo ${VERSION:1} | tr - .`
get_job_vector $PKGNAME
@ -863,7 +1006,6 @@ if [ "$do_autobuild" = "1" ]; then
continue
fi
elif [ "$VERSION" != "+0" ]; then
# check successlist
SUCCESSLINE=`awk '{ print $1" "$2 }' $SUCCESSLISTDIR/*.success | grep -m1 "^$PKGNAME "`
if [ "$SUCCESSLINE" ]; then
@ -879,40 +1021,21 @@ if [ "$do_autobuild" = "1" ]; then
sed -i "/^$PKGNAME /d" $SUCCESSLISTDIR/*.success
fi
fi
# check skippedlist
SKIPPEDLINE=`awk '{ print $1" "$2 }' $SKIPPEDLISTDIR/*.skip | grep -m1 "^$PKGNAME "`
if [ "$SKIPPEDLINE" ]; then
set -- $SKIPPEDLINE
SKIPPEDTIME=$2
SKIPPEDDAYS=`expr \( $DATE_NOW - $SKIPPEDTIME \) / 86400`
if [ "$SKIPPEDDAYS" -le "$AUTOBUILD_SKIP_DAYS" ]; then
SKIPPEDCOUNT=`expr $SKIPPEDCOUNT + 1`
# echo "?= Package $PKGNAME has been in the skippedlist for $SKIPPEDDAYS days; skipping"
continue
else
sed -i "/^$PKGNAME /d" $SKIPPEDLISTDIR/*.skip
fi
fi
# check legacylist
awk '{ print $1 }' $LEGACYLIST | grep "^$PKGNAME$" >/dev/null && {
echo "?= Job $PKGNAME is in the legacy list; skipping automatic update"
echo "$PKGNAME $DATE_NOW 100" >> $SKIPPEDLISTDIR/auto.skip
continue
}
fi
if [ $AUTOBUILD_NUMADDED -ge $AUTOBUILD_MAXNUM ]; then
break
elif [ $BUILDDATE -ge $AUTOBUILD_DATEFROM -o $BUILDDATE -eq 0 ]; then
[ $AUTOBUILD_NUMADDED -ge $AUTOBUILD_MAXNUM ] && break
# FIXME: hardcoded skipped packages
[ "${PKGNAME:0:5}" = "java-" -o "${PKGNAME:0:7}" = "apache-" -o \
"${PKGNAME:0:8}" = "jakarta-" -o "${PKGNAME:0:6}" = "compiz" ] && continue
if [ $BUILDDATE -ge $AUTOBUILD_DATEFROM -o $BUILDDATE -eq 0 ]; then
AUTOBUILD_NUMADDED=`expr $AUTOBUILD_NUMADDED + 1`
echo "$PKGNAME $VERSION" >> $pkgtmpfile
fi
done < $srctmpfile
echo "%% Total pkgs: $PKGCOUNT, skipped list: $SKIPPEDCOUNT, blacklist: $BLACKLISTCOUNT, success list: $SUCCESSLISTCOUNT"
echo "%% Total pkgs: $PKGCOUNT, skipped list: $SKIPPEDCOUNT, blacklist: $BLACKLISTCOUNT, success list: $SUCCESSLISTCOUNT, last build date: $BUILDDATE"
while read line; do
set -- $line
PKGNAME=${1}
@ -927,8 +1050,12 @@ if [ "$do_autobuild" = "1" ]; then
done
echo
rm -f $pkgtmpfile $srctmpfile
[ -e $LOGBASEDIR/autoupdate-current ] && mv $LOGBASEDIR/autoupdate-current $LOGBASEDIR/autoupdate-last
fi
OPERATION_ERRORS=0
echo "%% ${#JOBNAME[*]} job(s) scheduled"
echo "%% Starting main jobs loop"
for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
@ -940,8 +1067,7 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
get_job_vector $JOB_NAME
JOB_NAME=${JOB_NAME/*\/}
[ "$quiet" ] || echo "
== =======================$JOB_NAME============================="
[ "$quiet" ] || echo "== =======================$JOB_NAME============================="
echo -n "%% Doing $JOB_NAME (VER=$JOB_VER"
for k in ${JOB_VARNAMES[*]}; do
echo -n " %${k}"
@ -968,9 +1094,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during package prepare; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during package prepare; aborting."
exit 1 ;;
exit 255 ;;
esac
}
if [ ! "$do_update" -a "$do_autobuild" = "1" ]; then
@ -980,9 +1107,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during package update for rebuild; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during package update for rebuild; aborting."
exit 1 ;;
exit 255 ;;
esac
}
fi
@ -1011,14 +1139,15 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
if [ ! "$rebuild_packages" -a "${JOB_VER}" != "+0" ]; then
[ $ret -ge 2 -a "$do_autobuild" ] && {
echo "%% Adding $JOB_NAME job to skipped list."
echo "$JOB_NAME $DATE_NOW $?" >> $SKIPPEDLISTDIR/auto.skip
echo "$JOB_NAME $DATE_NOW $ret" >> $SKIPPEDLISTDIR/auto.skip
}
case $SEVERITY in
0) ;;
1) echo "%! Error during package update; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during package update; aborting."
exit 1 ;;
exit 255 ;;
esac
else
echo "%% Rebuilding package(s)"
@ -1028,9 +1157,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during package update for rebuild; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during package update for rebuild; aborting."
exit 1 ;;
exit 255 ;;
esac
}
fi
@ -1052,9 +1182,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during update; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during update; aborting."
exit 1 ;;
exit 255 ;;
esac
else
[ "${AUTOSPEC_ARGS/--changelog}" = "${AUTOSPEC_ARGS}" ] &&
@ -1063,9 +1194,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during package update for rebuild; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during package update for rebuild; aborting."
exit 1 ;;
exit 255 ;;
esac
}
fi
@ -1082,9 +1214,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during build; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during build; aborting."
exit 1 ;;
exit 255 ;;
esac
}
fi
@ -1099,9 +1232,10 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
case $SEVERITY in
0) ;;
1) echo "%! Error during installation; skipping $JOB_NAME job."
OPERATION_ERRORS=`expr $OPERATION_ERRORS + 1`
continue ;;
*) echo "!! Error during installation; aborting."
exit 1 ;;
exit 255 ;;
esac
}
fi
@ -1150,4 +1284,6 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
}
done
[ "$do_autobuild" = "1" ] && rm -f $PIDFILE
echo "%! $OPERATION_ERRORS error(s)"
echo "%% All jobs done @ `LANG=C date`"
exit $OPERATION_ERRORS

360
autodist-cgi Executable file
View File

@ -0,0 +1,360 @@
#!/bin/bash
. /etc/sysconfig/autoport
. /usr/share/autodist/webbuild-functions
NUM=`echo "$QUERY_STRING" | sed -n 's/^.*NUM=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
HOST=`echo "$QUERY_STRING" | sed -n 's/^.*HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
AS_HOST=`echo "$QUERY_STRING" | sed -n 's/^.*AS_HOST=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
SHOWINDEX=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWINDEX=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
LINES=`echo "$QUERY_STRING" | sed -n 's/^.*LINES=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
FORMAT=`echo "$QUERY_STRING" | sed -n 's/^.*FORMAT=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
function resolve_logname() {
local l=$1
local jobname=$2
unset SUBJOBNAME OPERATIONNAME OPERATIONSTATUS
SUBJOBNAME=`echo $l | sed "s|.*/${jobname}_\(.*\)\..*|\1|"`
[ "${SUBJOBNAME:0:1}" = "_" ] && SUBJOBNAME=$l
[ "$SUBJOBNAME" = "$l" ] && SUBJOBNAME=`echo $l | sed "s|.*/\(.*\)\..*|\1|"`
SUBJOBNAME=${SUBJOBNAME/__*}
[ "${BUILDOPERATION[$b]}" ] && \
OPERATIONNAME=${BUILDOPERATION[$b]} || OPERATIONNAME=`echo $l | sed "s|\(.*\)/.*/.*|\1|"`
[ "${BUILDOPERATIONSTATUS[$b]}" ] && \
OPERATIONSTATUS=${BUILDOPERATIONSTATUS[$b]} || OPERATIONSTATUS=`echo $l | sed "s|.*/\(.*\)/.*|\1|"`
}
[ ! "$FORMAT" ] && FORMAT=html
[ "$LINES" ] || LINES=5
[ "$HOST" ] || HOST=0
[ "$AS_HOST" ] || AS_HOST=0
[ "$AS_HOST" -a "$HOST" != "0" ] && HOST_ADD="&HOST=$HOST"
if [ "$AS_HOST" = "0" -a "$FORMAT" = "xml" ]; then
echo -e "Content-type: text/xml\nPragma: no-cache\n"
echo -n "<autodist><output><![CDATA["
RELOADTIME=3600000
else
echo -e "Content-type: text/html; charset=UTF-8\n"
fi
if [ "$SHOWINDEX" ]; then
echo "Host $AS_HOST:"
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_ARCH[$i]})</a>&nbsp;"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo "<a href=\"?NUM=$i$HOST_ADD\">$r(${AUTOPORT_CROSS[$i]};${AUTOPORT_ARCH[$i]})</a>&nbsp;"
fi
done
done
echo "<br>"
exit 0
elif [ "$AS_HOST" = "0" ]; then
echo "Show: [<a href=\"?NUM=\">All hosts</a>] [<a href=\"?SHOWLOG=monitor\">Build hosts monitor</a>]<br>"
for h in `seq 0 ${#AUTOPORT_CGI_HOST[*]}`; do
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&SHOWINDEX=1" 2>/dev/null
done
echo "<hr>"
fi
[ ! "$SHOWLOG" -a "$HOST" = "$AS_HOST" ] && echo "<h2>Host: `hostname -s` (`uname -m`, kernel `uname -r`)</h2>"
if [ "$SHOWLOG" -a "$HOST" != "$AS_HOST" ]; then
curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&LOG=$LOG" 2>/dev/null
else
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
if [ "$SHOWLOG" = "monitor" ]; then
echo "<h2>Build hosts monitor</h2>"
icecream-monitor localhost listcs | \
while read line; do
[ "${line:0:8}" = "200 done" ] && printon=
if [ "$printon" ]; then
set -- $line
case $2 in
\(*) echo "<b>$line</b><br>" ;;
*) echo "$line<br>" ;;
esac
fi
[ "${line:0:6}" = "listcs" ] && printon=1
done
echo "<br>"
RELOADTIME=15000
break
fi
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
LOGDIR=`environment_logdir $i`
AUTOPORTLOGDIR=`environment_autoport_logdir $i`
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
LOGFILE="$LOGDIR/autodist.log"
LASTLOGFILE="$LOGDIR/autodist-last.log"
STATEFILE="$LOGDIR/autoupdate-current"
LASTSTATEFILE="$LOGDIR/autoupdate-last"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="$LOGDIR/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="$LOGDIR/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
AUTODISTLOGFILE="$AUTOPORTLOGDIR/${AUTOPORT_ARCH[$i]}/$r-current.log"
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
LOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
LASTLOGFILE="$LOGDIR/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
else
continue
fi
if [ "$SHOWLOG" ]; then
if [ "$HOST" = "$AS_HOST" -a "$NUM" = "$i" ]; then
echo -n "<h2>$SHOWLOG log in "
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo -n "update"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo -n "${AUTOPORT_CHROOT[i]} chroot"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo -n "native"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo -n "cross"
fi
echo " environment for ${AUTOPORT_ARCH[$i]}"
[ "${SHOWLOG}" = "current" -o "${SHOWLOG}" = "last" -a ! "${AUTOPORT_UPDATE[$i]}" ] && echo -n " ($r)"
echo -n ":</h2>"
cat << _EOF
<div class=downloadbox align=center>
<div class=output align=left style="height:550px;width:850px;">
<!--overflow:auto;font-size:8pt;border:1px solid #2b6600;margin:4px;padding:2px;color:lightgray;background-color:black;"-->
_EOF
echo -n "<pre><code>"
if [ "$SHOWLOG" = "current" ]; then
RELOADTIME=3600000
cat $LOGFILE | parse_build_output
elif [ "$SHOWLOG" = "last" ]; then
cat $LASTLOGFILE | parse_build_output
else
# Security check
[ "${SHOWLOG/\/\.}" != "${SHOWLOG}" ] && continue
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "autodist" ]; then
BUILDLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/log/"
else
BUILDLOGDIR="/var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autodist/log/"
fi
elif [ "${AUTOPORT_NATIVE[$i]}" -o "${AUTOPORT_UPDATE[$i]}" ]; then
BUILDLOGDIR="/var/autodist/log/"
fi
if [ "${SHOWLOG/\/ok\/}" != "${SHOWLOG}" -o "${SHOWLOG/\failed\/}" != "${SHOWLOG}" ]; then
SHOWLOGPKG=${SHOWLOG/*\/}
[ "${SHOWLOGPKG}" ] || continue
echo "<table style=\"color:black\"><tr><td colspan=3>Last ${SHOWLOGPKG} logs:</td>"
for t in prepare update build install send; do
echo -n "<tr><td>$t:</td><td>"
[ -e ${BUILDLOGDIR}${t}/ok/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i$HOST_ADD&SHOWLOG=${t}/ok/${SHOWLOGPKG}\">OK</a></td>" || echo "<td></td>"
[ -e ${BUILDLOGDIR}${t}/failed/${SHOWLOGPKG} ] && echo -n "<td><a style=\"color:green;text-decoration:none\" target=_autodist href=\"?NUM=$i$HOST_ADD&SHOWLOG=${t}/failed/${SHOWLOGPKG}\">FAILED</a></td>" || echo "<td></td>"
echo "</tr>"
done
echo "</table>"
fi
if [ -r ${BUILDLOGDIR}${SHOWLOG} ]; then
LOGFILESIZE=`stat -c %s ${BUILDLOGDIR}${SHOWLOG}`
if [ $LOGFILESIZE -lt 131072 ]; then
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
else
head -c 65535 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
echo "<br><font style=\"background-color:yellow;color:black\">&lt;------ CUT (long file) ------&gt;</font>"
tail -c 65535 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
fi
fi
fi
echo -n "</pre></code>"
echo -n "</div></div>"
break
fi
[ "${AUTOPORT_UPDATE[$i]}" ] && break
elif [ ! "$SHOWLOG" ]; then
RELOADTIME=60000
[[ "$NUM" && "$NUM" != "$i" ]] && continue
[[ "$HOST" = "$AS_HOST" ]] || continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:autodist update)"
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:chroot autoport</a> chroot:${AUTOPORT_CHROOT[$i]})"
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">$r</a>(${AUTOPORT_ARCH[$i]}) (type:native autoport)"
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">log</a> <a target=_autodist href=\"?SHOWLOG=last&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
if [ "${AUTOPORT_CROSS[$i]}" ]; then
echo "<b>* <a target=_autodist href=\"?NUM=$i&HOST=$AS_HOST\">cross-platform</a> autoport (arch:${AUTOPORT_CROSS[$i]})</b>"
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i$HOST_ADD\">last</a> ]</b>"
fi
cat << _EOF
<div class=downloadbox align=center>
<div align=left style="background-color: white; height: 250px; width: 850px; overflow: auto; font-size: 8pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0;">
_EOF
echo "<pre>"
unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
BUILDNOWIDX=0
STARTTIME=`head $LOGFILE | grep "%% Autodist started" | sed "s|.* @ ||"`
AUTODIST_PID=`head $LOGFILE | grep "%% Autodist started" | sed "s|.*PID \([0-9]*\) .*|\1|"`
SCHEDULED=`head $LOGFILE | grep "%% autoupdate jobs:" | sed "s|.*autoupdate jobs: ||"`
ENDTIME=`tail $LOGFILE | grep "%% All jobs done @" | sed "s|.*@ ||"`
while read line; do
set -- $line
for c in `seq 0 ${#BUILDNOW[*]}`; do
if [ "${BUILDNOW[c]}" = "$1" ]; then
BUILDNOWIDX=$c
break
else
BUILDNOWIDX=$c
fi
done
BUILDNOW[$BUILDNOWIDX]="$1"
[ "$4" ] && BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} `echo $4 | sed "s|.*autodist/log/||"`"
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
BUILDNOWSTATUS[$BUILDNOWIDX]=
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
done < $STATEFILE
else
STARTTIME=`head $LOGFILE | grep "^+ .*start at " | sed "s|.*start at ||"`
# AUTODIST_PID=`head $LOGFILE | grep "%% Autodist started" | sed "s|.*PID \([0-9]*\) .*|\1|"`
SCHEDULED=`head -n 40 $LOGFILE | grep -m 1 "^> .*Scheduled jobs: " | sed "s|.*Scheduled jobs: ||"`
ENDTIME=`tail $LOGFILE | grep "^- .*end at " | sed "s|.*end at ||"`
if [ -e "$AUTODISTSTATEFILE" ]; then
while read line; do
set -- $line
for c in `seq 0 ${#BUILDNOW[*]}`; do
if [ "${BUILDNOW[c]}" = "$1" ]; then
BUILDNOWIDX=$c
break
else
BUILDNOWIDX=$c
fi
done
BUILDNOW[$BUILDNOWIDX]="$1"
if [ "$2" = "port" ]; then
CURRLOGFILE=build/$3/$1.${AUTOPORT_ARCH[$i]}
else
CURRLOGFILE=$2/$3/$1.${AUTOPORT_ARCH[$i]}
fi
BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $CURRLOGFILE"
# BUILDLOG[$BUILDNOWIDX]="${BUILDLOG[$BUILDNOWIDX]} $2/$3/$1.i586"
BUILDNOWSTATUS[$BUILDNOWIDX]=
BUILDNOWIDX=`expr $BUILDNOWIDX + 1`
done < $AUTODISTSTATEFILE
for p in `dirname $LOGFILE`/current.*; do
CURRENT_FILE=`basename $p`
AUTODIST_PID=${p/*.}
grep "autodist" /proc/$AUTODIST_PID/status &>/dev/null && break
AUTODIST_PID=
done
fi
fi
[ "$STARTTIME" ] && echo "<b>Start:</b> $STARTTIME"
[ "$SCHEDULED" ] && echo "<b>Scheduled jobs:</b> $SCHEDULED"
LASTJOBNAME=
for b in `seq 0 ${#BUILDNOW[*]}`; do
# set -- ${BUILDNOW[$b]}
JOBNAME=${BUILDNOW[$b]}
[ "$JOBNAME" ] || continue
if [ "$JOBNAME" != "$LASTJOBNAME" ]; then
[ "$LASTJOBNAME" -a "$JOBNAME" ] && echo
if [ "${BUILDLOG[$b]}" ]; then
resolve_logname ${BUILDLOG[$b]/* } $JOBNAME
if [ "${OPERATIONSTATUS}" = "ok" ]; then
WEBBUILD_APPEND="&LOGSTATUSOK=true"
else
WEBBUILD_APPEND="&LOGSTATUSOK=false"
fi
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?REQUEST=autobuildedit&ENVIRONMENT=$i&PACKAGE=$JOBNAME&LOGTYPE=$OPERATIONNAME${WEBBUILD_APPEND}\"><b>$JOBNAME</b></a>: "
else
echo -n "<a target=_webbuild href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$JOBNAME\"><b>$JOBNAME</b></a>: "
fi
fi
rowcnt=0
if [ "${BUILDLOG[$b]}" ]; then
for l in ${BUILDLOG[$b]}; do
resolve_logname $l $JOBNAME
# if [ $rowcnt -ge 4 ]; then
# echo
# rowcnt=0
# fi
case $OPERATIONNAME-$OPERATIONSTATUS in
build-ok|send-ok|install-ok|retryinstall-ok)
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\">$OPERATIONNAME:$OPERATIONSTATUS</a>"
;;
*-failed)
echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=red>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
;;
*) echo -n "<a target=_autodist href=\"?SHOWLOG=$l&NUM=$i$HOST_ADD\"><font color=black>$OPERATIONNAME:$OPERATIONSTATUS</font></a>"
;;
esac
# [ "$SUBJOBNAME" != "$JOBNAME" ] && echo -en "(<a href=\"/distribution/webbuild.php?ENVIRONMENT=$i&PACKAGE=$SUBJOBNAME\" target=\"webbuild\">$SUBJOBNAME</a>)"
echo -n " "
rowcnt=`expr $rowcnt + 1`
done
fi
if [[ $b -eq $BUILDNOWIDX-1 && ! "$ENDTIME" ]]; then
echo -n "<font color=green>${BUILDOPERATION[$b]}(in progress...)</font>"
fi
[ "${BUILDNOWSTATUS[$b]}" ] && echo -n "<i>(${BUILDNOWSTATUS[$b]})</i>"
LASTJOBNAME=$JOBNAME
done
[ "$LASTJOBNAME" ] && echo
if [ "$ENDTIME" ]; then
echo "<b>End:</b> $ENDTIME"
elif [ "$AUTODIST_PID" ]; then
echo "<b>End: <a target=_autodist href=\"?SHOWLOG=current.$AUTODIST_PID&NUM=$i$HOST_ADD\">in progress</a></b>"
fi
echo
# grep -v "^=" $LOGFILE | tail -n "$LINES" | sed "s|.*\r||"
# echo
echo "</pre></div></div>"
fi
done
done
# only root host (0) calls other hosts
if [ "$AS_HOST" = "0" -a ! "$SHOWLOG" ]; then
for h in `seq 1 ${#AUTOPORT_CGI_HOST[*]}`; do
if [ "$NUM" -a "$HOST" = "$h" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES&NUM=$NUM&HOST=$HOST" 2>/dev/null
elif [ ! "$NUM" ]; then
curl "${AUTOPORT_CGI_HOST[$h]}?AS_HOST=$h&LINES=$LINES" 2>/dev/null
fi
done
fi
fi
if [ "$AS_HOST" = "0" ]; then
echo "<p><i>Generated by autodist CGI interface. Last update: `date`</i>"
if [ "$FORMAT" = "xml" ]; then
echo -n "]]></output>"
[ "$RELOADTIME" ] && echo -n "<reloadtime>$RELOADTIME</reloadtime>"
echo "</autodist>"
fi
fi

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# autodist-tool
# Copyright (c) 2008-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
me=(${0##*/} $VERSION "Tue Oct 28 2008")
@ -30,10 +30,10 @@ ${me[0]} ${me[1]}
echo "
"$"Usage"":
$me makepatch package [build|update|remove]
$me schedule job_regexp
$me unschedule job_regexp
$me skip job_regexp
$me makepatch package [auto|build|update|remove]
$me schedule job_regexp..
$me unschedule job_regexp..
$me skip job_regexp..
"
}
@ -83,10 +83,29 @@ if [ "$COMMAND" = "makepatch" ]; then
rm -f $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch
echo
exit 0
elif [ "$OPERATION" = "auto" ]; then
if [ -e $spec_dir/.$JOB.spec.autodist.prebuild -a ! -e $AUTOUPDATEDIR/spec-patches-update/$JOB.spec.patch ]; then
OPERATION=build
elif [ -e $spec_dir/.$JOB.spec.autodist.preupdate -a ! -e $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch ]; then
OPERATION=update
else
echo "Error: unable to autodetect patch type."
exit 1
fi
fi
echo diff $spec_dir/.$JOB.spec.autodist.pre$OPERATION $spec_dir/$JOB.spec > \
$AUTOUPDATEDIR/spec-patches-$OPERATION/$JOB.spec.patch
if [ ! -e $spec_dir/.$JOB.spec.autodist.pre$OPERATION ]; then
echo "Error: pre$OPERATION specfile missing; make sure you prepare and update the package using autodist."
exit 1
fi
if [ "$OPERATION" = "build" -a -e $AUTOUPDATEDIR/spec-patches-update/$JOB.spec.patch ]; then
echo "Error: trying to make a build patch when an update patch already exists! Remove or create a update patch instead."
exit 1
elif [ "$OPERATION" = "update" -a -e $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch ]; then
echo "Error: trying to make an update patch when a build patch already exists! Remove or create a build patch instead."
exit 1
fi
diff $spec_dir/.$JOB.spec.autodist.pre$OPERATION $spec_dir/$JOB.spec > \
$AUTOUPDATEDIR/spec-patches-$OPERATION/$JOB.spec.patch

335
autodist-upstream-updates Executable file
View File

@ -0,0 +1,335 @@
#!/bin/bash
#
# autodist upstream updates - find upstream packages updates from different internet resources
# Copyright (c) 2004-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#[ -r /etc/sysconfig/openmamba-central ] || {
# echo "Error: this program must be run as root; aborting." >&2
# exit 1
#}
. /etc/autodist/config
DISTROMATIC_PREFIX=/distribution/distromatic.html?
DISTROMATIC_REPOSITORY=devel
DISTDB=/etc/autodist/distdb
DISTDBDIR=/etc/autodist/distdb.d
XORG_RELEASE=current
[ -r $DISTDB ] && {
. $DISTDB
[ -d $DISTDBDIR ] && \
for f in `ls $DISTDBDIR/*.db`; do
. $f
done
}
[ -r $PKGLIST_FILE ] || {
echo "Error: file $PKGLIST_FILE cannot be read; aborting." >&2
exit 1
}
[ -r $ALIASES_DB ] || {
echo "Error: file $ALIASES_DB cannot be read; aborting." >&2
exit 1
}
function usage()
{
echo "openmamba-upstream-updates - finds upstream packages updates from different internet resources"
echo
echo "Usage:"
echo "openmamba-upstream-updates [-h|-m][-r repository][-o output_repository]"
echo
echo " -h: generate distromatic HTML output"
echo " -m: report missing packages only"
echo " -u: output not up-to-date packages only"
echo " -q: produces quite output"
echo " -r repository: specify the repository (default: devel)"
echo " -o repository: specify the repository for output data (default: same as base repository)"
echo
}
get_job_vector() {
local JNAME=$1
# resolve JOB_NAME from distdb
# note: if JOB_NAME contains a "-" it can't be a distdb JOB, so skip it
if [ "${JNAME/-/}" = "${JNAME}" ]; then
local jobtmpfile=`tempfile`
# hack to get an array variable named as $j assigned to the JOB array
echo "echo \${$JNAME[*]}" > $jobtmpfile
JOB=(`. $jobtmpfile`)
rm -f $jobtmpfile
else
JOB=()
fi
if [ ${#JOB[*]} -eq 0 ]; then
# create a default job with given JOB_NAME
JOB=($JNAME "" "")
elif [ ${#JOB[*]} -eq 1 ]; then
# no variables defined, add an empty job
JOB=(${JOB[*]} "" "")
fi
JOB_PKGS=(${JOB[0]//,/ })
JOB_VARNAMES=(${JOB[1]//,/ })
}
function version_compare()
{
local A B
A=$1
B=$2
if [[ ${1} =~ "^[0-9]+$" && ${2} =~ "^[0-9]+$" ]]; then
if [ ${A/[a-zA-Z_]*} -gt ${B/[a-zA-Z_]*} ]; then
return 1
elif [ ${A/[a-zA-Z_]*} -lt ${B/[a-zA-Z_]*} ]; then
return 2
fi
else
if [[ "$A" > "$B" ]]; then
return 1
elif [[ "$A" < "$B" ]]; then
return 2
fi
fi
return 0
}
function version_find_bigger()
{
local VER1 VER2 FPOS CUTVER1 CUTVER2
VER1=$1
VER2=$2
FPOS=1
while true; do
CUTVER1=`echo $VER1. | cut -d. -f $FPOS`
CUTVER2=`echo $VER2. | cut -d. -f $FPOS`
if [ "$CUTVER1" -a ! "$CUTVER2" ]; then
return 1
elif [ "$CUTVER2" -a ! "$CUTVER1" ]; then
return 2
elif [ ! "$CUTVER1" -a "$CUTVER2" ]; then
return 0
else
version_compare $CUTVER1 $CUTVER2
case $? in
1) return 1 ;;
2) return 2 ;;
esac
fi
FPOS=`expr $FPOS + 1`
done
return 0
}
while [ "$1" ]; do
case $1 in
-h) distromatic_html=1 ;;
-m) if [ "$distromatic_html" ]; then
echo "Error: options -h and -m cannot be used together."
usage
exit 1
else
missing_only=1
fi ;;
-u) needupdate_only=1 ;;
-r) [ "$2" ] || {
echo "Error: option -r requires repository name as parameter"
usage
exit 1
}
DISTROMATIC_REPOSITORY=$2
shift
;;
-o) [ "$2" ] || {
echo "Error: option -o requires repository name as parameter"
usage
exit 1
}
OUTPUT_REPOSITORY=$2
shift
;;
-q) quiet=1 ;;
*) echo "Error: invalid option $1."; usage; exit 1 ;;
esac
shift
done
[ "$OUTPUT_REPOSITORY" ] || OUTPUT_REPOSITORY=$DISTROMATIC_REPOSITORY
CACHE_DIR=${LOCAL_REPS_BASE_DIR}/$OUTPUT_REPOSITORY/autoupdate/
PKGLIST_FILE=${LOCAL_REPS_BASE_DIR}/$DISTROMATIC_REPOSITORY/srcpkglist
BUILDS_FILE=${LOCAL_REPS_BASE_DIR}/distromatic/$DISTROMATIC_REPOSITORY/builds-i586
BUILDLIST_FILE=$CACHE_DIR/upstream-updates.in
CONFIG_DIR=$CACHE_DIR
UPDATES_DB=$CACHE_DIR/upstream-updates
ALIASES_DB=$CACHE_DIR/aliases
MANUALVER_DB=$CACHE_DIR/manualver
tmpfile=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
buildstmp=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
tail -n+2 $BUILDS_FILE > $buildstmp
# parse Arch Linux package list
[ "$quiet" ] || echo "Parsing Arch Linux packages list..." >&2
curl -s "https://www.archlinux.org/packages/?sort=-last_update&arch=i686&q=&maintainer=&last_update=&flagged=&limit=all" | \
grep "View package details" | \
while read line; do
line=`echo $line | html2text -nobs`
set -- $line
pkg=$3
ver=${4/-*}
ver=${ver/*:}
alias=`grep "^$pkg" $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkg=$alias
line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp`
# grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp
if [ "$line" ]; then
pkg=${line/:*}
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
done
rm -f $buildstmp
# parse X.org stable packages list
[ "$quiet" ] || echo "Parsing X.org release ftp directory..." >&2
curl -s ftp://ftp.x.org/pub/$XORG_RELEASE/src/everything/ -l | sed "s|\.tar\..*||" | sort -u |
while read line; do
if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"`
pkg="${line/-$ver}"
alias=`grep "^$pkg " $ALIASES_DB`
if [ ! "$alias" -a "${pkg:0:5}" == "xf86-" ]; then
alias="$pkg xorg-drv-${pkg/xf86-}"
else
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
fi
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
done
# parse Gnome stable packages list
[ "$quiet" ] || echo "Parsing GNOME stable versions file..." >&2
for f in versions-stable versions-stable-extras; do
curl -s http://people.gnome.org/~vuntz/tmp/versions/$f | grep -v "^#" |
while read line; do
if [ "$line" ]; then
IFS=":"
set -- $line
pkg="$2"
ver="$3"
alias=`grep "^$pkg " $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$pkg" -a "$ver" ] && echo "$pkg $ver ${alias/* /}" >> $tmpfile
fi
done
done
# parse distrowatch.com packages list
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
lynx -width 300 -dump http://distrowatch.com/packages.php |
while read line; do
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1
[ "`echo $line | grep "____________________"`" ] && unset start_print
[ "$start_print" ] && {
set -- $line
pkg="${1/\[*\]/}"
ver="${2/\[*\]/}"
alias=`grep "^$pkg " $ALIASES_DB`
[ "$pkg" != "chromium" ] && \
echo "$pkg $ver ${alias/* /}" >> $tmpfile
}
done
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
rm -f $tmpfile
> $UPDATES_DB
unset lastpkg
while read pkg ver alias; do
# skip updates to unstable versions
unset found_beta
for b in alpha beta rc "~"; do
[ "${ver/$b}" != "${ver}" ] && found_beta=1
done
[ "$found_beta" ] && continue
if [ "$pkg" = "$lastpkg" ]; then
# echo "Warning: duplicate found: $pkg lastver: $lastver ver: $ver" >&2
version_find_bigger $lastver $ver
vercmp=$?
if [ $vercmp -eq 2 ]; then
sed -i "/^$lastpkg $lastver /d" $UPDATES_DB
echo "$pkg $ver $alias" >> $UPDATES_DB
fi
else
echo "$pkg $ver $alias" >> $UPDATES_DB
fi
lastpkg=$pkg
lastver=$ver
done < $UPDATES_DB.tmp
rm -f $UPDATES_DB.tmp
> $UPDATES_DB.missing
> $BUILDLIST_FILE
while read pkg ver alias; do
unset pkgline
unset found_manual
unset found_alias
pkgline=`grep "^$pkg " $MANUALVER_DB` && found_manual=1
if [ ! "$found_manual" ]; then
if [ "$alias" ]; then
get_job_vector $alias
lastjob=${#JOB_PKGS[*]}
pkgline=`grep "^${JOB_PKGS[$lastjob-1]} " $PKGLIST_FILE` && found_alias=1
else
get_job_vector $pkg
lastjob=${#JOB_PKGS[*]}
pkgline=`grep "^${JOB_PKGS[$lastjob-1]} " $PKGLIST_FILE`
[ "$pkgline" ] || {
get_job_vector lib${pkg}
lastjob=${#JOB_PKGS[*]}
pkgline=`grep "^${JOB_PKGS[$lastjob-1]} " $PKGLIST_FILE` && {
found_alias=1
alias=lib${pkg}
}
}
fi
fi
if [ "$pkgline" -a ! "$missing_only" ]; then
set -- $pkgline
pkgname=$1
pkgver=$2
pkgrep=$4
version_find_bigger $pkgver ${ver/-/.}
vercmp=$?
[ "${vercmp}" != "2" -a "$needupdate_only" ] && continue
[ "$found_manual" ] && pkgname=$3
[ "$found_alias" -o "$found_manual" ] && nameadd="$pkg" || unset nameadd
unset veradd
[ ${vercmp} = 2 ] && veradd="<font color=red>$ver</font>"
[ ${vercmp} = 1 ] && veradd="$ver"
[ "$veradd" -o "$nameadd" ] && {
[ "$veradd" -a "$nameadd" ] && \
verappend="($nameadd;$veradd)" ||
verappend="(${nameadd}${veradd})"
} || unset verappend
if [ "$distromatic_html" = "1" ]; then
echo "<a href=\"${DISTROMATIC_PREFIX}tag=${pkgrep}&pkg=${JOB_PKGS[0]}.source\">${JOB_PKGS[0]} $pkgver</a> $verappend<br>"
else
echo "$pkg $pkgver ($ver)"
fi
[ $vercmp = 2 ] && {
if [ "$found_alias" ]; then
echo "$alias +$ver 0" >> $BUILDLIST_FILE
else
echo "$pkg +$ver 0" >> $BUILDLIST_FILE
fi
}
elif [ ! "$pkgline" ]; then
echo "$pkg ($ver)" >> $UPDATES_DB.missing
fi
done < $UPDATES_DB

180
autoport
View File

@ -4,7 +4,7 @@
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.1
VERSION=0.9.5
BASE_ARCH=i586
BASE_REPOSITORY=devel
PORT_REPOSITORY=devel
@ -33,9 +33,10 @@ ${me[0]} ${me[1]}
--fix "$"Fix .la files for cross linking and exit
-r "$"Work on given repository (default: $PORT_REPOSITORY)
-d "$"Release packages to given repository (default: $PORT_REPOSITORY)
-x "$"Operate in cross build mode
-h "$"Show this help and exit
-u changelog "$"Rebuild packages with given changelog
-v "$"More verbose output
-x "$"Operate in cross build mode
arch "$"Target architecture
job "$"Job specification for autodist""
@ -43,6 +44,34 @@ ${me[0]} ${me[1]}
}
function autoport_log() {
local pkg=$1
local operation=$2
local result=$3
local logfile=$4
[ "$pkg" -a "$operation" -a "$result" -a "$BATCH_MODE" ] || return
echo "$pkg $operation $result $logfile" >> $DATADIR/autoport-$PORT_REPOSITORY-current
}
# for webbuild message
function cgi_encodevar() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
# get_pkg_buildinfo - uses distromatic generated build file for
# getting information on the repository
#
@ -64,6 +93,7 @@ function get_pkg_buildinfo() {
pkg_archs=();
for a in ${archs[*]}; do
[ "$a" = "${local_arch}" ] && continue
pkg_header=();
DISTROMATIC_BUILD_FILE=$local_distromatic/builds-$a.sh
[ -e $DISTROMATIC_BUILD_FILE ] && . $DISTROMATIC_BUILD_FILE
@ -77,6 +107,7 @@ function get_pkg_buildinfo() {
DISTROMATIC_BUILD_FILE=$local_distromatic/builds-${local_arch}.sh
[ -e $DISTROMATIC_BUILD_FILE ] && . $DISTROMATIC_BUILD_FILE
[ ${pkg_header[0]} ] && pkg_archs=(${pkg_archs[*]} ${local_arch})
# {
# echo "Error: missing distromatic generated file $DISTROMATIC_BUILD_FILE; aborting."
@ -102,7 +133,6 @@ function get_pkg_buildinfo() {
return 0
fi
done
unset pkg_name pkg_arch pkg_version pkg_release \
pkg_group pkg_license pkg_size pkg_buildtime pkg_altrep pkg_repository
@ -189,6 +219,14 @@ for ((i=1; i<=$#; i++)); do
-b) BATCH_MODE=1 ;;
-f) FORCE_MODE=1 ;;
-v) VERBOSE_MODE=1 ;;
-u) REBUILD_MODE=1
shift
REBUILD_CHANGELOG="${!i}"
[ "$REBUILD_CHANGELOG" ] || {
echo "ERROR: changelog not given as -u option parameter; aborting."
exit 1
}
;;
-npa) DONT_PREPARE_ANY=1
DONT_PREPARE=1 ;;
-np) DONT_PREPARE=1 ;;
@ -244,9 +282,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ -d $DATADIR/$BASE_REPOSITORY ] || mkdir -p $DATADIR/$BASE_REPOSITORY
[ -d $DATADIR/$PORT_REPOSITORY ] || mkdir -p $DATADIR/$PORT_REPOSITORY
logfile=$DATAARCHDIR/log
[ -e $logfile ] && mv -f $logfile $DATAARCHDIR/loglast
logdate=`date +"%F@%T"`
logfile=$DATAARCHDIR/$logdate.log
[ -e $DATAARCHDIR/$PORT_REPOSITORY-current.log ] && mv $DATAARCHDIR/$PORT_REPOSITORY-current.log $DATAARCHDIR/$PORT_REPOSITORY-last.log
> $logfile
ln -sf $logdate.log $DATAARCHDIR/$PORT_REPOSITORY-current.log
BUILD_PLATFORM=`rpm --target $TARGET_ARCH --eval %{_build}`
BUILD_CPU=`echo $BUILD_PLATFORM | cut -d- -f1`
@ -279,10 +319,16 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "Error: unable to fetch $BASE_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh"
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $BASE_ARCH
port_pkg_list=${pkg_list[*]}
for p in ${port_pkg_list}; do
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $TARGET_ARCH $p || get_pkg_buildinfo $DATADIR/$BASE_REPOSITORY $TARGET_ARCH $p
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $TARGET_ARCH $p
target_pkg_name=$pkg_name
target_pkg_ver=$pkg_version
target_pkg_rel=$pkg_release
[ "$pkg_name" ] || get_pkg_buildinfo $DATADIR/$BASE_REPOSITORY $TARGET_ARCH $p
if [ "$pkg_name" ]; then
base_pkg_ver=$pkg_version
base_pkg_rel=$pkg_release
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $BASE_ARCH $p
[ "$pkg_name" ] || {
@ -292,27 +338,28 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
port_pkg_ver=$pkg_version
port_pkg_rel=$pkg_release
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $TARGET_ARCH $p
if [ "$pkg_name" ]; then
pkg_milestone=`echo $pkg_release | sed "s|[0-9.]*\(.*\)|\1|"`
if [ "$pkg_version" != "$port_pkg_ver" ]; then
echo "Package $pkg_name#${port_pkg_ver}($TARGET_ARCH) differs from $pkg_name#${pkg_version}($BASE_ARCH); port needed."
if [ "$target_pkg_name" ]; then
pkg_milestone=`echo $target_pkg_rel | sed "s|[0-9.]*\(.*\)|\1|"`
if [ "$target_pkg_ver" != "$port_pkg_ver" ]; then
echo "Package $pkg_name#${port_pkg_ver}-${port_pkg_rel}($TARGET_ARCH) differs from $pkg_name#${target_pkg_ver}-${target_pkg_rel}($BASE_ARCH); port needed."
JOB=(${JOB[*]} $p)
elif [ "$pkg_release" != "$port_pkg_rel" ]; then
echo "Package $pkg_name#${port_pkg_ver}-${port_pkg_rel}($TARGET_ARCH) differs from $pkg_name#${pkg_version}-${pkg_release}($BASE_ARCH); port needed."
elif [ "$target_pkg_rel" != "$port_pkg_rel" ]; then
echo "Package $pkg_name#${port_pkg_ver}-${port_pkg_rel}($TARGET_ARCH) differs from $pkg_name#${target_pkg_ver}-${target_pkg_rel}($BASE_ARCH); port needed."
JOB=(${JOB[*]} $p)
elif [ "$REBUILD_MILESTONE" -a "$pkg_milestone" != "$REBUILD_MILESTONE" ]; then
echo "Package $pkg_name($TARGET_ARCH) was not built for '$REBUILD_MILESTONE' milestone; rebuild needed."
JOB=(${JOB[*]} $p)
else
echo "Package $pkg_name#${port_pkg_ver}($TARGET_ARCH) is up to date."
[ "$VERBOSE_MODE" ] && echo "Package $pkg_name#${port_pkg_ver}-${port_pkg_rel}($TARGET_ARCH) is up to date."
fi
else
echo "$p#${port_pkg_ver}($BASE_ARCH) is in port repository but $p#${base_pkg_ver}($TARGET_ARCH) is in base repository; port needed."
echo "$p#${port_pkg_ver}-${port_pkg_rel}($BASE_ARCH) is in port repository but $p#${base_pkg_ver}-${base_pkg_rel}($TARGET_ARCH) is in base repository; port needed."
JOB=(${JOB[*]} $p)
fi
fi
done
[ -e $DATADIR/autoport-$PORT_REPOSITORY-current ] && \
mv $DATADIR/autoport-$PORT_REPOSITORY-current $DATADIR/autoport-$PORT_REPOSITORY-last
fi
step=0
@ -320,12 +367,12 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
tmpfile1=`mktemp`
[ -e $DATAARCHDIR/sentjobs ] || > $DATAARCHDIR/sentjobs
find $DATAARCHDIR/sentjobs -cmin 120 && {
find $DATAARCHDIR/sentjobs -cmin 120 >/dev/null && {
> $DATAARCHDIR/sentjobs
}
[ -e $DATAARCHDIR/preparedjobs ] || > $DATAARCHDIR/preparedjobs
find $DATAARCHDIR/preparedjobs -ctime 1 && {
find $DATAARCHDIR/preparedjobs -ctime 1 >/dev/null && {
> $DATAARCHDIR/preparedjobs
}
@ -342,8 +389,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
break
}
echo "=========="
echo "Step $step"
echo "Scheduled jobs: ${JOB[*]}"
echo "# Step $step"
echo "> Scheduled jobs: ${JOB[*]}"
echo
JOB_MISSINGREQ_OLD=(${JOB_MISSINGREQ[*]})
JOB_MISSINGREQ=()
@ -355,26 +402,26 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_CURRENT=${JOB[$JOB_NUM-1]}
if [ "`grep "^${JOB_CURRENT}$" /etc/autodist/unstage 2>/dev/null`" -o \
"`grep "^${JOB_CURRENT}$" /etc/autodist/unstage.${TARGET_ARCH} 2>/dev/null`" ]; then
echo -n "$JOB_CURRENT: "
echo -n "^ $JOB_CURRENT: "
STAGEOPTS=
else
echo -n "$JOB_CURRENT(staging): "
echo -n "^ $JOB_CURRENT(staging): "
STAGEOPTS="$AUTOPORT_STAGEVARS"
fi
if [ "$CROSS_MODE" -a "${JOB_CURRENT:0:5}" == "perl-" ]; then
echo " (SKIPPED) [unable to cross-build perl modules]"
echo "< (SKIPPED) [unable to cross-build perl modules]"
JOB_SKIPPED=(${JOB_SKIPPED[*]} $JOB_CURRENT)
continue
fi
[ "`grep ^$JOB_CURRENT\$ $DATAARCHDIR/sentjobs`" -a ! "$FORCE_MODE" ] && {
echo " (SKIPPED) [already sent]"
echo "< (SKIPPED) [already sent]"
JOB_SKIPPED=(${JOB_SKIPPED[*]} $JOB_CURRENT)
continue
}
if [ "${JOB_MAYBEINSTALLED_NEW[*]}" = "" -a \
"${JOB_MISSINGREQ_OLD[*]}" != "" -a \
"`echo "( ${JOB_FAILED_OLD[*]} )"| grep " $JOB_CURRENT "`" ]; then
echo " (FAILED) [nothing new since previous attempt]"
echo "< (FAILED) [nothing new since previous attempt]"
JOB_FAILED=(${JOB_FAILED[*]} $JOB_CURRENT)
continue
fi
@ -408,20 +455,37 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "(FAILED) "
fi
JOB_CANTPREPARE=(${JOB_CANTPREPARE[*]} $JOB_CURRENT)
autoport_log ${JOB_CURRENT} prepare failed
continue
} || {
echo $JOB_CURRENT >> $DATAARCHDIR/preparedjobs
echo -n "(OK) "
autoport_log ${JOB_CURRENT} prepare ok
}
if [ "$PORT_REPOSITORY" != "$DEST_REPOSITORY" ]; then
if [ "$REBUILD_MODE" = "1" ]; then
echo -n "update"
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\""
LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" &>>$logfile
[ $? -gt 0 ] && {
echo "(FAILED) "
autoport_log ${JOB_CURRENT} update failed
continue
} || {
autoport_log ${JOB_CURRENT} update ok
echo -n "(OK) "
}
elif [ "$PORT_REPOSITORY" != "$DEST_REPOSITORY" ]; then
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\" &>>$logfile
[ $? -gt 0 ] && {
echo "(FAILED) "
autoport_log ${JOB_CURRENT} update failed
continue
} || {
autoport_log ${JOB_CURRENT} update ok
echo -n "(OK) "
}
elif [ "$REBUILD_MILESTONE" -a "$pkg_milestone" != "$REBUILD_MILESTONE" ]; then
@ -436,10 +500,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -447,28 +511,35 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "(FAILED)"
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile
autoport_log ${JOB_CURRENT} update failed
continue
} || {
cat $tmpfile >> $logfile
echo -n "(OK) "
autoport_log ${JOB_CURRENT} update ok
}
fi
}
echo -n "port"
[ "$pkg_repository" ] || {
if [ ! "$pkg_repository" -a "$DONT_PREPARE_THIS" != "1" ]; then
echo "(FAILED) [can't get repository information for this package]"
autoport_log ${JOB_CURRENT} port failed
continue
}
fi
if [ "$DONT_PREPARE_THIS" = "1" -a "$pkg_repository" != "$PORT_REPOSITORY" ]; then
# if both -np and -r were given send to PORT_REPOSITORY instead of pkg_repository
pkg_repository=$PORT_REPOSITORY
fi
[ "$PORT_REPOSITORY" != "$DEST_REPOSITORY" ] && pkg_repository="$DEST_REPOSITORY"
[ ! "$DONT_PREPARE_THIS" -a "$PORT_REPOSITORY" = "$DEST_REPOSITORY" -a ! "$REBUILD_MILESTONE" ] && NOSRPM_OPTS="--nosrpm" || NOSRPM_OPTS="--force"
LANG=C LC_ALL=C autodist -b -s ${JOB_CURRENT} --arch $TARGET_ARCH --server $pkg_repository --repository $PORT_REPOSITORY --severity 2 $FORCE_FLAG -- $STAGEOPTS $NOSRPM_OPTS &>$tmpfile
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -476,24 +547,30 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "(FAILED)"
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile
find_requirements $JOB_LOG
[ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG
autoport_log ${JOB_CURRENT} port failed
continue
} || {
cat $tmpfile >> $logfile
JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT)
echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs
echo -n "(OK) "
autoport_log ${JOB_CURRENT} port ok
if [ "$BATCH_MODE" -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$pkg_repository</b>\"`" >/dev/null
fi
}
echo -n "install"
LANG=C LC_ALL=C autodist -i ${JOB_CURRENT} --arch $TARGET_ARCH --force --severity 2 -- $STAGEOPTS &>>$tmpfile
LANG=C LC_ALL=C autodist -i ${JOB_CURRENT} --arch $TARGET_ARCH --force --severity 2 -- $STAGEOPTS &>$tmpfile
# --server $DEST_REPOSITORY --repository $PORT_REPOSITORY
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -506,7 +583,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT)
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile
find_requirements $JOB_LOG
[ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG
autoport_log ${JOB_CURRENT} install failed
continue
} || {
cat $tmpfile >> $logfile
@ -514,6 +592,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT)
JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT)
echo -n "(OK)"
autoport_log ${JOB_CURRENT} install ok
}
echo
done
@ -536,10 +615,10 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
echo "Failed output:"
echo "=============="
echo "= Failed output:"
echo "================"
cat $tmpfile
echo "=============="
echo "================"
echo
fi
cat $tmpfile >> $logfile
@ -560,22 +639,23 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT)
JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT)
echo -n "(OK)"
autoport_log ${JOB_CURRENT} retryinstall ok
}
echo
done
fi
echo "Skipped jobs: ${JOB_SKIPPED[*]}"
echo "Unpreparable jobs: ${JOB_CANTPREPARE[*]}"
echo "Missing requirements: ${JOB_MISSINGREQ[*]}"
echo "Completed jobs: ${JOB_COMPLETED[*]}"
echo "Installation error for: ${JOB_CANTINSTALL[*]}"
echo "Failed jobs: ${JOB_FAILED[*]}"
echo "| Skipped jobs: ${JOB_SKIPPED[*]}"
echo "| Unpreparable jobs: ${JOB_CANTPREPARE[*]}"
echo "| Missing requirements: ${JOB_MISSINGREQ[*]}"
echo "| Completed jobs: ${JOB_COMPLETED[*]}"
echo "| Installation error for: ${JOB_CANTINSTALL[*]}"
echo "| Failed jobs: ${JOB_FAILED[*]}"
write_last_file
[ "${JOB[*]}" == "${JOB_FAILED[*]}" -a \
"${JOB_MISSINGREQ[*]}" == "" -a \
"${JOB_CANTINSTALL_OLD[*]}" == "${JOB_CANTINSTALL[*]}" ] && {
echo "Loop detected. Finishing. See $logfile for details."
echo "! Loop detected. Finishing. See $logfile for details."
rm -f $tmpfile $tmpfile1
exit 1
}
@ -584,5 +664,5 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
done
rm -f $tmpfile $tmpfile1
done
echo "All jobs completed. See $logfile for details."
echo "* All jobs completed. See $logfile for details."
exit 0

44
autoport-chroot Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# autoport-chroot
# (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/sysconfig/autoport
CHROOT_TARGET=$1
function usage() {
echo "\
$0
"$"Copyright (C) 2012 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Enters autoport chroot environment.""
"$"Usage"":
$me chroot_target
"
}
[ "$CHROOT_TARGET" ] || {
usage
exit 1
}
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_CHROOT[$i]}" = "$CHROOT_TARGET" ] || continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
echo "Entering ${AUTOPORT_CHROOT[$i]} autoport chroot environment"
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]}
exit 0
done
echo "$CHROOT_TARGET: undefined chroot target"
exit 1

View File

@ -3,7 +3,7 @@
DISTRO="openmamba"
VENDOR="openmamba"
curl_opts_netlink="--connect-timeout 15 --retry 3 --limit-rate 400k -Y 1 -C -s"
curl_opts_netlink="--connect-timeout 15 --retry 3 -s"
packager_fullname="Automatic Build System"
packager_email="autodist@mambasoft.it"

View File

@ -18,3 +18,4 @@ libqt
distromatic
u-boot
openmamba-distro-compat
xorg-apps

View File

@ -3,14 +3,19 @@
REPS_BASE_URL=http://www.openmamba.org/pub/openmamba
LOCAL_REPS_BASE_DIR=/var/ftp/pub/openmamba
SEND_SERVER=devel-autodist
GNOME_VER=2.32.0
AUTOBUILD_MAXNUM=150
GNOME_VER=3.4
#WEBBUILD_URL=http://localhost/cgi-bin/webbuild.cgi
#WEBBUILD_USER=
#WEBBUILD_EMAIL=
#WEBBUILD_SECRET=
WEBBUILD_STATEDIR=/var/webbuild
AUTOBUILD_MAXNUM=200
AUTOBUILD_DATEFROM=20060601
AUTOBUILD_SKIP_DAYS=7
AUTOBUILD_SKIP_DAYS=28
AUTOBUILD_SUCCESS_DAYS=3
AUTODIST_REPOSITORY=devel-autodist
AUTODIST_DELAYED_REPOSITORY=devel-future
AUTODIST_REPOSITORIES=(devel devel-games devel-makedist devel-kernel devel-xorg devel-kde4 devel-autodist)
AUTOPORT_STAGEVARS="--define stage1=1"
AUTOPORT_MAX_STEPS=15
AUTOPORT_MAX_STEPS=10
#RPMDIR=/usr/src/RPM

View File

@ -4,186 +4,26 @@
# Released under the terms of the GNU GPL version 3 license
#
kernel=(
kernel
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
arm,mamba-arm
x86_64,mamba-x86_64
)
kernel_64GB=(
kernel
target,KERNEL_TARGET
i586,mamba-64GB
)
kernel_x86_64=(
kernel
target,KERNEL_TARGET
x86_64,mamba-x86_64
)
kernel_hannspad=(
kernel-hannspad
target
arm
)
kernel_iconia=(
kernel-iconia
target
arm
)
#ppc,mamba
#x86_64,mamba
kernel_extramodules=(
kernel-extramodules
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
kernel_packages_old=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,lirc,ndiswrapper,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,VirtualBox,\
broadcom-sta,atheros-81,drbd,rtl8192se
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.0
i586,mamba-64GB,3.0
)
kernel_packages=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,lirc,ndiswrapper,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,VirtualBox,\
broadcom-sta,stk11xx,cm2020,rtl8192se
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,-
i586,mamba-64GB,-
)
kernel_packages_new=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,lirc,ndiswrapper,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,VirtualBox,\
broadcom-sta,stk11xx,cm2020
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.2
i586,mamba-64GB,3.2
)
#rtl8192se
#ppc,mamba
#x86_64,mamba
NVIDIA_all=(
NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,-
i586,mamba-64GB,-
)
alsa_driver=(
alsa-driver
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
ati_driver=(
ati-driver
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
#x86_64,mamba-x86_64
broadcom_sta=(
broadcom-sta
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
kernel_wireless_backport=(
kernel-wireless-backport
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
lirc=(
lirc
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
ndiswrapper=(
ndiswrapper
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
NVIDIA=(
NVIDIA
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
VirtualBox=(
VirtualBox
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
compat_wireless=(
compat-wireless
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
broadcom_sta=(
broadcom-sta
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
atheros_81=(
atheros-sta
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
drbd=(
drbd
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
)
xorg_drv_video=(
xorg-drv-video,xorg-drv-video-apm,xorg-drv-video-ark,xorg-drv-video-ast,xorg-drv-video-ati,\
xorg_drv_video_all=(
xorg-drv-video-apm,xorg-drv-video-ark,xorg-drv-video-ast,xorg-drv-video-ati,\
xorg-drv-video-chips,xorg-drv-video-cirrus,xorg-drv-video-dummy,xorg-drv-video-fbdev,\
xorg-drv-video-geode,xorg-drv-video-glint,xorg-drv-video-i128,xorg-drv-video-i740,\
xorg-drv-video-intel,xorg-drv-video-mach64,xorg-drv-video-mga,xorg-drv-video-neomagic,\
xorg-drv-video-newport,xorg-drv-video-nouveau,xorg-drv-video-nv,xorg-drv-video-openchrome,\
xorg-drv-video-r128,xorg-drv-video-radeonhd,xorg-drv-video-rendition,xorg-drv-video-s3,\
xorg-drv-video-s3virge,xorg-drv-video-savage,xorg-drv-video-siliconmotion,xorg-drv-video-sis,\
xorg-drv-video-sisusb,xorg-drv-video-trident,xorg-drv-video-tseng,xorg-drv-video-v4l,\
xorg-drv-video-vesa,xorg-drv-video-vmware,xorg-drv-video-voodoo,xorg-drv-video-xgixp
xorg-drv-video-trident,xorg-drv-video-tseng,xorg-drv-video-v4l,\
xorg-drv-video-vesa,xorg-drv-video-vmware,xorg-drv-video-voodoo,xorg-drv-video-xgixp,\
xorg-drv-video
)
#xorg-drv-video-sisusb,
xorg_drv_input=(
xorg-drv-input,xorg-drv-input-acecad,xorg-drv-input-aiptek,xorg-drv-input-elographics,\
xorg-drv-input-acecad,xorg-drv-input-aiptek,xorg-drv-input-elographics,\
xorg-drv-input-evdev,xorg-drv-input-fpit,xorg-drv-input-hyperpen,xorg-drv-input-joystick,\
xorg-drv-input-keyboard,xorg-drv-input-mouse,xorg-drv-input-mutouch,xorg-drv-input-penmount,\
xorg-drv-input-synaptics,xorg-drv-input-tslib,xorg-drv-input-vmmouse,xorg-drv-input-void
xorg-drv-input-synaptics,xorg-drv-input-tslib,xorg-drv-input-vmmouse,xorg-drv-input-void,\
xorg-drv-input
)
abiword=(
@ -239,24 +79,47 @@ kdesdk,kdetoys,kdebindings,kdewebdev,kdeedu,kdeartwork,kde-i18n
)
kde4=(
kdelibs,kdepimlibs,oxygen-icons,kde-runtime,kde-workspace,kde-wallpapers,kde-baseapps,kdepim4,\
kdelibs,kdepimlibs,oxygen-icons,nepomuk-core,kde-runtime,kactivities,kde-workspace,kde-wallpapers,kde-baseapps,kdepim4,\
kdepim-runtime,kdeadmin,kdenetwork4,kdegames,kdetoys,kdesdk,libkdcraw,libkexiv2,kdeartwork,marble,\
kdeplasma-addons,kde-l10n,blinken,cantor,libkipi,gwenview,libkdeedu,analitza,kalgebra,kalzium,kamera,\
kanagram,kate,kbruch,kcolorchooser,kdegraphics-strigi-analyzer,kgamma,kgeography,khangman,kig,kiten,\
klettres,kmplot,kolourpaint,konsole,kruler,ksnapshot,kstars,libksane,\
okular,smokegen,smokeqt,smokekde,svgpart,rocs,kwordquiz,kturtle,ktouch,qtruby,korundum,\
kross-interpreters,PyKDE4,perl-Qt4,perl-KDE,kdegraphics-thumbnailers,ksaneplugin,parley,step,\
ark,filelight,kcalc,kcharselect,kdf,kfloppy,kgpg,kremotecontrol,ktimer,kwallet,sweeper,\
jovie,kmousetool,kmouth,qyoto,kaccessible,printer-applet,kdegraphics-mobipocket,\
libkcddb,libkcompactdisc,audiocd-kio,kscd,dragon,kmix,juk
%build_and_install
1
)
#kdemultimedia, ksecrets
kde48=(
kdelibs,kdepimlibs,oxygen-icons,kde-runtime,kactivities,kde-workspace,kde-wallpapers,kde-baseapps,kdepim4,\
kdepim-runtime,kdeadmin,kdemultimedia,kdenetwork4,kdeartwork,kdegames,kdetoys,kdesdk,marble,\
kdeplasma-addons,kde-l10n,blinken,cantor,gwenview,libkdeedu,libanalitza,kalgebra,kalzium,kamera,\
kdeplasma-addons,kde-l10n,blinken,cantor,gwenview,libkdeedu,kalgebra,kalzium,kamera,\
kanagram,kate,kbruch,kcolorchooser,kdegraphics-strigi-analyzer,kgamma,kgeography,khangman,kig,kiten,\
klettres,kmplot,kolourpaint,konsole,kruler,ksnapshot,kstars,libkdcraw,libkexiv2,libkipi,libksane,\
okular,smokegen,smokeqt,smokekde,svgpart,rocs,kwordquiz,kturtle,ktouch,qtruby,korundum,\
kross-interpreters,perl-Qt4,perl-KDE,kdegraphics-thumbnailers,ksaneplugin,parley,step,\
ark,filelight,kcalc,kcharselect,kdf,kfloppy,kgpg,kremotecontrol,ktimer,kwallet,sweeper
kross-interpreters,PyKDE4,perl-Qt4,perl-KDE,kdegraphics-thumbnailers,ksaneplugin,parley,step,\
ark,filelight,kcalc,kcharselect,kdf,kfloppy,kgpg,kremotecontrol,ktimer,kwallet,sweeper,\
analitza,jovie,kmousetool,kmouth,qyoto,kaccessible,ksecrets,printer-applet,kdegraphics-mobipocket
%build_and_install
1
)
xfce4=(
libxfce4util,libxfce4ui,xfce4-appfinder,xfce4-dev-tools,xfce4-panel,xfce4-session,xfce4-settings,xfconf,xfdesktop,xfwm4
%build_and_install
1
)
#kdeaccessibility4,kdeutils
alsa=(
libalsa,libalsa-plugins,alsa-utils,alsa-driver,alsa-tools
libalsa,libalsa-plugins,alsa-utils,alsa-tools,python-alsa
%build_and_install
1
)
#,alsa-driver
apache_tomcat=(
apache-tomcat-dbcp,apache-tomcat

View File

@ -20,7 +20,7 @@ avr,avr
glibc=(
glibc
cross_target_cpu,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER,build_doc,build_profile,build_selinux
arm,-,-,mamba-arm,-,0,0,0
arm,-,-,mamba-arm,3.2,0,0,0
)
kernel=(
@ -32,7 +32,7 @@ arm,mamba-arm
linux_firmware=(
linux-firmware
target,KERNEL_TARGET,KERNEL_VER
arm,mamba-arm,3.2
arm,mamba-arm,-
)
pam=(
@ -53,17 +53,11 @@ KERNEL_VER
2.6.33mamba-arm
)
emacs=(
emacs
bootstrap
1
)
gcc=(
gcc
cross_target_cpu,_target_platform,disable_java,disable_gjdoc
arm,arm-openmamba-linux-gnueabi,-,1
avr,avr,1,-
arm,arm-openmamba-linux-gnueabi,1,1
)
udev=(

View File

@ -75,30 +75,60 @@ avr,avr,1
#
glibc=(
glibc
cross_target_cpu,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
i586,i586-openmamba-linux-gnu,-,-,mamba,-
x86_64,x86_64-openmamba-linux-gnu,-,-,mamba-x86_64,2.6.33
arm,arm-openmamba-linux-gnueabi,-,-,mamba-arm,-
ppc,ppc-openmamba-linux-gnu,-,-,mamba-ppc,2.6.33
target,cross_target_cpu,multilib,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
-,i586,-,i586-openmamba-linux-gnu,-,-,mamba,-
-,x86_64,-,x86_64-openmamba-linux-gnu,-,-,mamba-x86_64,-
-,arm,-,arm-openmamba-linux-gnueabi,-,-,mamba-arm,-
-,ppc,-,ppc-openmamba-linux-gnu,-,-,mamba-ppc,2.6.33
x86_64,i586,1,i586-openmamba-linux-gnu,-,-,mamba-x86_64,-
)
# XTC 7
cross_environment=(
cross-environment
cross_target_cpu,autodist_crossonly,_target_platform
avr,1,avr
i586,1,i586-openmamba-linux-gnu
arm,1,arm-openmamba-linux-gnueabi
ppc,1,ppc-openmamba-linux-gnu
x86_64,1,x86_64-openmamba-linux-gnu
)
glibc_arm=(
glibc
cross_target_cpu,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
arm,-,-,mamba-arm,-
)
glibc_multilib=(
glibc
target,cross_target_cpu,multilib,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
x86_64,i586,1,x86_64-openmamba-linux-gnu,-,-,mamba-x86_64,-
)
glibc_cross_multilib=(
glibc
target,cross_target_cpu,multilib,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
-,i586,1,x86_64-openmamba-linux-gnu,-,-,mamba-x86_64,-
)
gcc_cross=(
gcc
cross_target_cpu,_target_platform,disable_java
x86_64,x86_64-openmamba-linux-gnu,1
arm,arm-openmamba-linux-gnueabi,1
ppc,ppc-openmamba-linux-gnu,1
avr,avr,1
)
glibc_cross=(
glibc
target,cross_target_cpu,multilib,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
-,x86_64,-,x86_64-openmamba-linux-gnu,-,-,mamba-x86_64,-
-,arm,-,arm-openmamba-linux-gnueabi,-,-,mamba-arm,-
-,ppc,-,ppc-openmamba-linux-gnu,-,-,mamba-ppc,2.6.33
x86_64,i586,1,i586-openmamba-linux-gnu,-,-,mamba-x86_64,-
)
pkg_config=(
pkg-config
cross_target_cpu,_target_platform
@ -137,11 +167,6 @@ x86_64,x86_64-openmamba-linux-gnu,2.6.33mamba-x86_64
arm,arm-openmamba-linux-gnueabi,2.6.33mamba-arm
)
glibc_arm=(
glibc
cross_target_cpu,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
arm,-,-,mamba-arm,-
)
#
# ppc cross toolchain
@ -181,3 +206,161 @@ glibc
cross_target_cpu,_target_platform,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
ppc,ppc-openmamba-linux-gnu,-,-,mamba-ppc,2.6.33
)
#
# KERNEL
#
kernel=(
kernel
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
arm,mamba-arm
arm,mamba-arm-kirkwood
x86_64,mamba-x86_64
)
#i586,mamba-rt
#i586,mamba-64GB-rt
kernel_34=(
kernel
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
arm,mamba-arm
arm,mamba-arm-kirkwood
x86_64,mamba-x86_64
i586,mamba-rt
i586,mamba-64GB-rt
)
kernel_arm_kirkwood=(
kernel
target,KERNEL_TARGET
arm,mamba-arm-kirkwood
)
kernel_milestone2=(
kernel
target,KERNEL_TARGET
i586,mamba
i586,mamba-64GB
arm,mamba-arm
)
kernel_rt=(
kernel
target,KERNEL_TARGET
i586,mamba-rt
)
kernel_64GB=(
kernel
target,KERNEL_TARGET
i586,mamba-64GB
)
kernel_64GB_rt=(
kernel
target,KERNEL_TARGET
i586,mamba-64GB-rt
)
kernel_x86_64=(
kernel
target,KERNEL_TARGET
x86_64,mamba-x86_64
)
kernel_packages=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,ndiswrapper,NVIDIA,VirtualBox-kernel,\
broadcom-sta,stk11xx,cm2020,r8101
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,-
i586,mamba-64GB,-
i586,mamba-rt,-
i586,mamba-64GB-rt,-
)
#lirc
kernel_packages_37=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,ndiswrapper,NVIDIA,VirtualBox-kernel,\
broadcom-sta,stk11xx,cm2020,r8101
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.7
i586,mamba-64GB,3.7
)
#i586,mamba-rt,3.7
#i586,mamba-64GB-rt,3.7
kernel_packages_36=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,ndiswrapper,NVIDIA,VirtualBox-kernel,\
broadcom-sta,stk11xx,cm2020,r8101
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.6
i586,mamba-64GB,3.6
i586,mamba-rt,3.6
i586,mamba-64GB-rt,3.6
)
#lirc
kernel_packages_34=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,ndiswrapper,NVIDIA,VirtualBox-kernel,\
broadcom-sta,stk11xx,cm2020,r8101
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.4
i586,mamba-64GB,3.4
i586,mamba-rt,3.4
i586,mamba-64GB-rt,3.4
)
#lirc
kernel_packages_32=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,lirc,ndiswrapper,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,VirtualBox-kernel,\
broadcom-sta,stk11xx,cm2020,r8101
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.2
i586,mamba-64GB,3.2
)
kernel_packages_30=(
hsfmodem,slmodem,compat-wireless,alsa-driver,ati-driver,lirc,ndiswrapper,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,VirtualBox,\
broadcom-sta,atheros-81,drbd,rtl8192se
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.0
i586,mamba-64GB,3.0
)
kernel_hannspad=(
kernel-hannspad
target
arm
)
kernel_iconia=(
kernel-iconia
target
arm
)
kernel_iconia_altgcc=(
kernel-iconia
target,_target_platform
arm,arm-none-linux-gnueabi
)
linux_firmware=(
linux-firmware
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,3.6
)
NVIDIA=(
NVIDIA
target,KERNEL_TARGET,KERNEL_VER
i586,mamba,-
i586,mamba-64GB,-
i586,mamba-rt
i586,mamba-64GB-rt
)

View File

@ -111,6 +111,9 @@ i586
ppc
)
#
# KERNEL
#
kernel=(
kernel
target,KERNEL_TARGET
@ -118,6 +121,12 @@ x86_64,mamba-x86_64
)
#x86_64,mamba-xen
linux_firmware=(
linux-firmware
target,KERNEL_TARGET,KERNEL_VER
x86_64,mamba-x86_64,-
)
kernel_extra=(
kernel-extramodules
target,KERNEL_TARGET
@ -126,93 +135,100 @@ x86_64,mamba-x86_64
#x86_64,mamba-xen
kernel_packages=(
hsfmodem,compat-wireless,ati-driver,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,broadcom-sta
VirtualBox-kernel
target,KERNEL_TARGET,KERNEL_VER
x86_64,mamba-x86_64,-
)
#hsfmodem,compat-wireless,ati-driver,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,broadcom-sta
# slmodem, alsa-driver, lirc,VirtualBox, ndiswrapper, alsa-driver
kernel_packages_new=(
hsfmodem,compat-wireless,ati-driver,NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx,broadcom-sta
kernel_packages_36=(
VirtualBox-kernel,NVIDIA
target,KERNEL_TARGET,KERNEL_VER
x86_64,mamba-x86_64,2.6.33
x86_64,mamba-x86_64,3.6
)
kernelxen_packages=(
alsa-driver,hsfmodem,compat-wireless,ati-driver,ndiswrapper,broadcom-sta
kernel_packages_34=(
VirtualBox-kernel,NVIDIA
target,KERNEL_TARGET,KERNEL_VER
x86_64,mamba-xen,-
x86_64,mamba-x86_64,3.4
)
NVIDIA_all=(
NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx
target,KERNEL_TARGET,KERNEL_VER
x86_64,mamba-x86_64
)
#x86_64,mamba-xen
#kernelxen_packages=(
#alsa-driver,hsfmodem,compat-wireless,ati-driver,ndiswrapper,broadcom-sta
#target,KERNEL_TARGET,KERNEL_VER
#x86_64,mamba-xen,-
#)
#NVIDIA_all=(
#NVIDIA,NVIDIA_71xx,NVIDIA_96xx,NVIDIA_173xx
#target,KERNEL_TARGET,KERNEL_VER
#x86_64,mamba-x86_64
#)
##x86_64,mamba-xen
alsa_driver=(
alsa-driver
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
ati_driver=(
ati-driver
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
broadcom_sta=(
broadcom-sta
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
kernel_extramodules=(
kernel-extramodules
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
kernel_nongpl=(
kernel-nongpl
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
kernel_wireless_backport=(
kernel-wireless-backport
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
broadcom_sta=(
broadcom-sta
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
lirc=(
lirc
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
ndiswrapper=(
ndiswrapper
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
NVIDIA=(
NVIDIA
@ -221,23 +237,17 @@ x86_64,mamba-x86_64
)
#x86_64,mamba-xen
VirtualBox=(
VirtualBox
VirtualBox_kernel=(
VirtualBox-kernel
target,KERNEL_TARGET
x86_64,mamba-x86_64
x86_64,mamba-xen
)
#x86_64,mamba-xen
glibc=(
glibc
cross_target_cpu,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER
x86_64,-,-,mamba-x86_64,-
)
gcc=(
gcc
cross_target_cpu
x86_64
cross_target_cpu,bigendian,softfloat,KERNEL_TARGET,KERNEL_VER,multilib
x86_64,-,-,mamba-x86_64,-,-
)
binutils=(
@ -258,12 +268,6 @@ bootstrap
1
)
emacs=(
emacs
bootstrap
1
)
gcc=(
gcc
cross_target_cpu,_target_platform,disable_jack,disable_gjdoc,disable_java

View File

@ -81,3 +81,40 @@ libwpg01
libwps01
libwpd08
db52
glade-3
goocanvas
libnl1
moagg
apache-commons-digester18
x264-116
libcdio12
udev173
libtiff3
libpcre0
libcdio12
libpoppler12
libaudiofile0
libxcb-util1
parted2
libguile1
libgnutls2
libgdbm3
farstream1
gst-plugins-base010
gst-plugins-good010
gst-plugins-bad010
gst-plugins-ugly010
gstreamer010
lua51
libwebkit-gtk
libgraphite2_11
goocanvas
libdirectfb5
libtasn1_3
kdelibs3
goocanvas
libraptor
python
liblcms
libpng14
xmlgraphics-commons14

View File

@ -1,6 +1,6 @@
# Autodist script for updating specfiles
#
# Copyright (c) 2007-2009 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2007-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Released with the same license as autodist
#
@ -24,5 +24,6 @@ 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
exit 0

View File

@ -15,3 +15,24 @@ gcc
libtiff
libtiff3
libcairo
gtk-doc
libpoppler
libpoppler12
gettext
libXext
gnokii
kdegames
soprano
autoconf
libidn
libcanberra
libxml2
libcaca
libproxy
libphonon
xmms2
libalsa-plugins
gutenprint
gpm
emacs
groff

View File

@ -2,3 +2,17 @@ tcltk
libxml2
libpango
libatk
gettext
libnfsidmap
libXext
libidn
libtiff
liblcms
python
glib
libcanberra
avahi
gpm
emacs
groff
soprano

View File

@ -0,0 +1,33 @@
#!/bin/bash
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
function clean() {
dir=$1
arch=$2
find $dir/RPM/RPMS/$arch/ -maxdepth 1 -ctime +30 -exec rm -rf {} \;
find $dir/RPM/RPMS/noarch/ -maxdepth 1 -ctime +30 -exec rm -rf {} \;
find $dir/RPM/BUILD/ -maxdepth 1 -ctime +30 -exec rm -rf {} \;
find $dir/RPM/SOURCES/ -maxdepth 1 -ctime +120 -exec rm -rf {} \;
find $dir/RPM/SRPMS/ -maxdepth 1 -ctime +90 -exec rm -rf {} \;
}
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]}
clean /var/autoport/$a/usr/src ${AUTOPORT_ARCH[$i]}
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/$arch ] && \
clean /var/autoport/$a/var/autodist ${AUTOPORT_ARCH[$i]}
[ -e /var/autoport/$a/var/tmp/autodist ] && \
find /var/autoport/$a/var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
find /var/autoport/$a/tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
clean /var/autodist ${AUTOPORT_ARCH[$i]}
find /var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
if [ -e $WORKINGHOME ]; then
clean $WORKINGHOME ${AUTOPORT_ARCH[$i]}
fi
find /var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
fi
done

View File

@ -0,0 +1,16 @@
#!/bin/bash
#
# autodist-upstream-updates daily cron script
# (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
REPOSITORY=devel
/usr/sbin/autodist-upstream-updates -q -h -u -r $REPOSITORY > $LOCAL_REPS_BASE_DIR/distromatic/$REPOSITORY/_popular.html
REPOSITORY=milestone1-1.1
/usr/sbin/autodist-upstream-updates -q -h -u -r $REPOSITORY > $LOCAL_REPS_BASE_DIR/distromatic/$REPOSITORY/_popular.html
REPOSITORY=milestone2
/usr/sbin/autodist-upstream-updates -q -h -u -r $REPOSITORY > $LOCAL_REPS_BASE_DIR/distromatic/$REPOSITORY/_popular.html
exit 0

View File

@ -1,7 +0,0 @@
#!/bin/bash
find /var/autodist/RPM/RPMS/i586/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
find /var/autodist/RPM/RPMS/noarch/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
find /var/autodist/RPM/BUILD/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
find /var/autodist/RPM/SOURCES/ -maxdepth 1 -ctime +120 -exec rm -rf {} \;
find /var/autodist/RPM/SRPMS/ -maxdepth 1 -ctime +90 -exec rm -rf {} \;
find /var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;

View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# autodist autoupdate hourly cron script
# (c) 2008-2013 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
. /etc/sysconfig/autoport
ME=`basename $0`
[ "$$" == "`pidof -x $ME`" -o "$$" == "`pidof -x 60-autodist-update`" ] || {
echo "Warning: $ME script already running; exiting."
exit 0
}
PIDFILE=/var/run/autodist/autodist.pid
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function pid_check() {
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "Error: an autodist process is already running; exiting for safety."
exit 0
}
}
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
# TODO: parametrize DISTROMATIC_REPOSITORY and following log files
DISTROMATIC_REPOSITORY=devel-future
LOGFILE=/var/autodist/log/autodist.log
LASTLOGFILE=/var/autodist/log/autodist-last.log
REPLOGFILE=$LOCAL_REPS_BASE_DIR/$r/autodist.log
REPLASTLOGFILE=$LOCAL_REPS_BASE_DIR/$r/autodist-last.log
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
pid_check
distromatic -q -t $DISTROMATIC_REPOSITORY --gensrcpkglist > $LOCAL_REPS_BASE_DIR/$DISTROMATIC_REPOSITORY/srcpkglist
pid_check
autodist-upstream-updates -q -h -u -r $DISTROMATIC_REPOSITORY -o $r \
> $LOCAL_REPS_BASE_DIR/distromatic/$r/_popular.html
pid_check
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
su -l autodist -c "$CMD_PREFIX autodist -a --server $r" > $LOGFILE
[ -e $REPLOGFILE ] && mv $REPLOGFILE $REPLASTLOGFILE
cp $LOGFILE $REPLOGFILE
fi
done
done

View File

@ -0,0 +1,96 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#. /etc/sysconfig/openmamba-central
. /etc/sysconfig/autoport
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
ME=`basename $0`
[ "$$" == "`pidof -x $ME`" ] || {
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
exit 0
}
PIDFILE=/var/run/autodist/autoport.pid
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function pid_check() {
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "Error: an autodist process is already running; exiting for safety."
exit 0
}
}
pid_check
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
else
continue
fi
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
# if [ "${AUTOPORT_CHROOT[$i]}" ]; then
# a=${AUTOPORT_CHROOT[$i]}
# # sudo mount -o bind /proc /var/autoport/$a/proc
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
# echo "= Updating packages in $a chroot environment..." >> $LOGFILE
# LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
# LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
# echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
# # disable service restarts
# mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
# ln -s /bin/true /var/autoport/$a/sbin/service
# $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
# mv /var/autoport/$a/sbin/service.autoport /var/autoport/$a/sbin/service
# cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
# fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
a=${AUTOPORT_ARCH[$i]}
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
echo "= Updating packages in $a native environment..." >> $LOGFILE
LANG=C smart update > /dev/null
LANG=C smart upgrade -y >> $LOGFILE
echo "= Working on $r($a) in native mode" >> $LOGFILE
su -l autodist -c "autoport -b -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
fi
# if [ "${AUTOPORT_CROSS[$i]}" ]; then
# a=${AUTOPORT_CROSS[$i]}
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
# echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
# su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
# fi
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
done
done

View File

@ -1,98 +0,0 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#. /etc/sysconfig/openmamba-central
. /etc/sysconfig/autoport
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
ME=`basename $0`
[ "$$" == "`pidof -x $ME`" ] || {
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
exit 0
}
PIDFILE=/var/run/autodist/autodist.pid
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function pid_check() {
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "Error: an autodist process is already running; exiting for safety."
exit 0
}
}
pid_check
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
echo "ARCH=${AUTOPORT_ARCH[$i]} CHROOT=${AUTOPORT_CHROOT[$i]} \
CROSS=${AUTOPORT_CROSS[$i]} NATIVE=${AUTOPORT_NATIVE[$i]} \
REPOSITORIES=${AUTOPORT_REPOSITORIES[$i]} CMD_PREFIX=$CMD_PREFIX"
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Autoport start at `date`" > /var/autodist/log/autoport-$r.log
echo "========================" >> /var/autodist/log/autoport-$r.log
done
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]}
# sudo mount -o bind /proc /var/autoport/$a/proc
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
echo "Updating packages in $a chroot environment..." >> /var/autodist/log/autoport-chroot-$a.log
LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> /var/autodist/log/autoport-chroot-$a.log
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Working on $r($a) in chroot mode..." >> /var/autodist/log/autoport-$r.log
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" > $local_ftp/$r/autoport-$a.log
$CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l sdk -c "autoport -b -r $r" >> $local_ftp/$r/autoport-$a.log
cat /var/autoport/$a/home/sdk/.autoport/${AUTOPORT_ARCH[$i]}/log >> $local_ftp/$r/autoport-$a.log
echo >> $local_ftp/$r/autoport-$a.log
done
fi
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
a=${AUTOPORT_ARCH[$i]}
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
echo "Updating packages in $a native environment..." >> /var/autodist/log/autoport-native-$a.log
LANG=C smart update > /dev/null
LANG=C smart upgrade -y >> /var/log/autoupgrade
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
echo "Working on $r($a) in native mode" >> /var/autodist/log/autoport-$r.log
su -l autodist -c "autoport -b -r $r" >> /var/autodist/log/autoport-$r.log
cat /var/autodist/.autoport/$a/log >> /var/autodist/log/autoport-$r.log
echo >> /var/autodist/log/autoport-$r.log
done
fi
if [ "${AUTOPORT_CROSS[$i]}" ]; then
a=${AUTOPORT_CROSS[$i]}
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
echo "Working on $r($a) in cross-platform mode" >> /var/autodist/log/autoport-$r.log
su -l autodist -c "autoport -b -x $a -r $r" > $local_ftp/$r/autoport-$a.log
cat /var/autodist/.autoport/$a/log >> $local_ftp/$r/autoport-$a.log
echo >> $local_ftp/$r/autoport-$a.log
done
fi
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ -e /var/autodist/log/autoport-$r.log ] && \
cp /var/autodist/log/autoport-$r.log /var/autodist/log/autoport-$r-last.log
done
done

View File

@ -0,0 +1,101 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#. /etc/sysconfig/openmamba-central
. /etc/sysconfig/autoport
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
ME=`basename $0`
[ "$$" == "`pidof -x $ME`" ] || {
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Warning: $ME script already running; exiting."
exit 0
}
PIDFILE=/var/run/autodist/autoport.pid
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function pid_check() {
[ -e $PIDFILE ] && PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "Error: an autodist process is already running; exiting for safety."
exit 0
}
}
pid_check
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-chroot-$r-${AUTOPORT_CHROOT[$i]}-last.log"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-cross-$r-${AUTOPORT_CROSS[$i]}-last.log"
else
continue
fi
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
a=${AUTOPORT_CHROOT[$i]}
# sudo mount -o bind /proc /var/autoport/$a/proc
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a chroot environment"
echo "= Updating packages in $a chroot environment..." >> $LOGFILE
LANG=C /usr/sbin/chroot /var/autoport/$a smart update --quiet > /dev/null
LANG=C /usr/sbin/chroot /var/autoport/$a smart upgrade -y >> $LOGFILE
echo "= Working on $r($a) in chroot mode..." >> $LOGFILE
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in chroot mode" >> $LOGFILE
# disable service restarts
mv /var/autoport/$a/sbin/service /var/autoport/$a/sbin/service.autoport
ln -s /bin/true /var/autoport/$a/sbin/service
#echo "DEBUG: $CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c \"autoport -b -r $r\"" >> $LOGFILE
$CMD_PREFIX /usr/sbin/chroot /var/autoport/$a su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
mv /var/autoport/$a/sbin/service.autoport /var/autoport/$a/sbin/service
cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
#echo "DEBUG: cat /var/autoport/$a/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log" >> $LOGFILE
fi
# if [ "${AUTOPORT_NATIVE[$i]}" ]; then
# a=${AUTOPORT_ARCH[$i]}
# [[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in $a native environment"
# echo "= Updating packages in $a native environment..." >> $LOGFILE
# LANG=C smart update > /dev/null
# LANG=C smart upgrade -y >> $LOGFILE
# echo "= Working on $r($a) in native mode" >> $LOGFILE
# su -l autodist -c "autoport -b -r $r" >> $LOGFILE
# cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
# fi
if [ "${AUTOPORT_CROSS[$i]}" ]; then
a=${AUTOPORT_CROSS[$i]}
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r($a) in cross-platform mode"
echo "= Working on $r($a) in cross-platform mode" >> $LOGFILE
su -l autodist -c "autoport -b -x $a -r $r" >> $LOGFILE
cat /var/autodist/.autoport/$a/$r-current.log >> $LOGFILE
fi
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
done
done

View File

@ -3,15 +3,21 @@
#
local_ftp=/var/ftp/pub/openmamba/
#AUTOPORT_ENABLE=1
#AUTOPORT_CGI_HOST=(http://localhost/cgi-bin/autodist http://arm-sdk/cgi-bin/autodist)
#AUTOPORT_ARCH[0]=x86_64
#AUTOPORT_DISABLE[0]=
#AUTOPORT_CHROOT[0]=devel-x86_64
#AUTOPORT_CHROOT_USER[0]=sdk
#AUTOPORT_CROSS[0]=
#AUTOPORT_NATIVE[0]=
#AUTOPORT_REPOSITORIES[0]="devel-makedist"
#AUTOPORT_ARCH[1]=i586
#AUTOPORT_DISABLE[1]=
#AUTOPORT_CHROOT[1]=milestone2-i586
#AUTOPORT_CHROOT_USER[1]=sdk
#AUTOPORT_CROSS[1]=
#AUTOPORT_NATIVE[1]=
#AUTOPORT_REPOSITORIES[1]="milestone2-makedist"
AUTOPORT_CGI_HOST=(http://localhost/cgi-bin/autodist http://192.168.0.100/cgi-bin/autodist)

View File

@ -0,0 +1,85 @@
var url = "/cgi-bin/webbuild.cgi"
function socialbox_refresh_times() {
var times = document.getElementsByName("socialtime");
var datenow = new Date();
var utcnow = parseInt(Date.UTC(datenow.getUTCFullYear(), datenow.getUTCMonth(), datenow.getUTCDate(),
datenow.getUTCHours(), datenow.getUTCMinutes(), datenow.getUTCSeconds()) / 1000);
for (var i = 0; i < times.length; i++) {
if (times[i].attributes[0].name == "time") {
var socialtime = times[i].attributes[0].value;
} else {
var socialtime = times[i].attributes[1].value;
}
var timeago = utcnow - socialtime;
var daysago = parseInt(timeago / 86400);
var hoursago = parseInt(timeago / 3600 % 24);
var minutesago = parseInt(timeago / 60 % 60);
var secondsago = parseInt(timeago % 60);
times[i].innerHTML = "(";
if (daysago > 1) times[i].innerHTML += daysago + " days";
else if (daysago == 1) times[i].innerHTML += "1 day, " + hoursago + " hours";
else if (hoursago > 1) times[i].innerHTML += hoursago + " hours";
else if (hoursago == 1) times[i].innerHTML += "1 hour, " + minutesago + " minutes";
else if (minutesago > 1) times[i].innerHTML += minutesago + " minutes";
else if (minutesago == 1) times[i].innerHTML += "1 minute, " + secondsago + " seconds";
else times[i].innerHTML += secondsago + " seconds";
times[i].innerHTML += " ago) ";
}
}
var socialbox_interval = null;
var socialbox_reloadtime = 15000;
function ajax_getvalues_refresh(request,user,user_email,secret) {
var fromid = 0;
//alert("refresh");
if (socialbox_interval != null) {
clearInterval(socialbox_interval);
}
if (document.getElementsByName("social").length > 0) {
if (document.getElementsByName("social")[0].attributes[0].name == "sid") {
fromid = parseInt(document.getElementsByName("social")[0].attributes[0].value) + 1;
} else {
fromid = parseInt(document.getElementsByName("social")[0].attributes[1].value) + 1;
}
}
if (request != "")
request=request+"&REQUEST=refresh&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+secret+"&FROMID="+fromid;
else
request="REQUEST=refresh&USER="+user+"&USER_EMAIL="+user_email+"&SECRET="+secret+"&FROMID="+fromid;
if (window.XMLHttpRequest)
xmlhttp1 = new XMLHttpRequest();
else if (window.ActiveXObject)
xmlhttp1 = new ActiveXObject("Microsoft.XMLHTTP");
else
return;
xmlhttp1.onreadystatechange = function() {
if (xmlhttp1.readyState != 4)
return;
if (xmlhttp1.responseXML == undefined) {
return;
}
var xmldoc = xmlhttp1.responseXML.documentElement;
var nodes = xmldoc.getElementsByTagName("socialbox")[0].childNodes;
for (var i = 0; i < nodes.length; i++) {
id = nodes[i].attributes[0].value;
document.getElementById("socialbox").innerHTML =
"<span name=social sid=\""+ id + "\">" + nodes[i].childNodes[0].nodeValue + "</span>" +
document.getElementById("socialbox").innerHTML;
}
if (xmldoc.getElementsByTagName("processes")[0] != undefined)
document.getElementById("processes").innerHTML = xmldoc.getElementsByTagName("processes")[0].childNodes[0].nodeValue;
$(function() { $('.scroll-pane').jScrollPane({scrollbarWidth:10}); });
// lastupdate = (+new Date());
socialbox_refresh_times();
//alert("refreshed_times");
}
xmlhttp1.open("POST", url, true);
xmlhttp1.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp1.send(request);
socialbox_interval = setInterval("ajax_getvalues_refresh(\"\",\""+user+"\",\""+user_email+"\",\""+secret+"\")",socialbox_reloadtime);
}

View File

@ -0,0 +1,46 @@
function getCheckedValuesByName(checkboxname) {
var e=document.getElementsByName(checkboxname);
var p="";
for (var j=0;j<e.length;j++) {
if (e[j].checked) p+=e[j].value+" ";
};
return p;
}
function checkAllBoxes(checkboxname,checked) {
var e=document.getElementsByName(checkboxname);
for (var j=0;j<e.length;j++) {
e[j].checked=checked;
};
}
function getSelectedValueById(selectname,idx) {
if (idx == undefined) idx = 0;
var i=document.getElementById(selectname).selectedIndex;
return document.getElementById(selectname).options[i+idx].value;
}
function checkEnter(event) {
event=event || window.event;
getEvent=event.keyCode;
if (getEvent == "13") {
return true;
}
return false;
}
function replaceHTML(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/*@cc_on // Pure innerHTML is slightly faster in IE
oldEl.innerHTML = html;
return oldEl;
@*/
var newEl = oldEl.cloneNode(false);
newEl.innerHTML = html;
oldEl.parentNode.replaceChild(newEl, oldEl);
/* Since we just removed the old element from the DOM, return a reference
to the new element, which can be used to restore variable references. */
return newEl;
};

1919
webbuild/webbuild-cgi Executable file

File diff suppressed because it is too large Load Diff

266
webbuild/webbuild-checkpassword Executable file
View File

@ -0,0 +1,266 @@
#!/usr/bin/php
<?php
// Last sync [WP11537]
/**
* Portable PHP password hashing framework.
* @package phpass
* @since 2.5
* @version 0.1
* @link http://www.openwall.com/phpass/
*/
#
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
# the public domain.
#
# There's absolutely no warranty.
#
# Please be sure to update the Version line if you edit this file in any way.
# It is suggested that you leave the main version number intact, but indicate
# your project name (after the slash) and add your own revision information.
#
# Please do not change the "private" password hashing method implemented in
# here, thereby making your hashes incompatible. However, if you must, please
# change the hash type identifier (the "$P$") to something different.
#
# Obviously, since this code is in the public domain, the above are not
# requirements (there can be none), but merely suggestions.
#
/**
* Portable PHP password hashing framework.
*
* @package phpass
* @version 0.1 / genuine
* @link http://www.openwall.com/phpass/
* @since 2.5
*/
class PasswordHash {
var $itoa64;
var $iteration_count_log2;
var $portable_hashes;
var $random_state;
function PasswordHash($iteration_count_log2, $portable_hashes)
{
$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
$iteration_count_log2 = 8;
$this->iteration_count_log2 = $iteration_count_log2;
$this->portable_hashes = $portable_hashes;
$this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);
}
function get_random_bytes($count)
{
$output = '';
if (($fh = @fopen('/dev/urandom', 'rb'))) {
$output = fread($fh, $count);
fclose($fh);
}
if (strlen($output) < $count) {
$output = '';
for ($i = 0; $i < $count; $i += 16) {
$this->random_state =
md5(microtime() . $this->random_state);
$output .=
pack('H*', md5($this->random_state));
}
$output = substr($output, 0, $count);
}
return $output;
}
function encode64($input, $count)
{
$output = '';
$i = 0;
do {
$value = ord($input[$i++]);
$output .= $this->itoa64[$value & 0x3f];
if ($i < $count)
$value |= ord($input[$i]) << 8;
$output .= $this->itoa64[($value >> 6) & 0x3f];
if ($i++ >= $count)
break;
if ($i < $count)
$value |= ord($input[$i]) << 16;
$output .= $this->itoa64[($value >> 12) & 0x3f];
if ($i++ >= $count)
break;
$output .= $this->itoa64[($value >> 18) & 0x3f];
} while ($i < $count);
return $output;
}
function gensalt_private($input)
{
$output = '$P$';
$output .= $this->itoa64[min($this->iteration_count_log2 +
((PHP_VERSION >= '5') ? 5 : 3), 30)];
$output .= $this->encode64($input, 6);
return $output;
}
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
if (substr($setting, 0, 3) != '$P$')
return $output;
$count_log2 = strpos($this->itoa64, $setting[3]);
if ($count_log2 < 7 || $count_log2 > 30)
return $output;
$count = 1 << $count_log2;
$salt = substr($setting, 4, 8);
if (strlen($salt) != 8)
return $output;
# We're kind of forced to use MD5 here since it's the only
# cryptographic primitive available in all versions of PHP
# currently in use. To implement our own low-level crypto
# in PHP would result in much worse performance and
# consequently in lower iteration counts and hashes that are
# quicker to crack (by non-PHP code).
if (PHP_VERSION >= '5') {
$hash = md5($salt . $password, TRUE);
do {
$hash = md5($hash . $password, TRUE);
} while (--$count);
} else {
$hash = pack('H*', md5($salt . $password));
do {
$hash = pack('H*', md5($hash . $password));
} while (--$count);
}
$output = substr($setting, 0, 12);
$output .= $this->encode64($hash, 16);
return $output;
}
function gensalt_extended($input)
{
$count_log2 = min($this->iteration_count_log2 + 8, 24);
# This should be odd to not reveal weak DES keys, and the
# maximum valid value is (2**24 - 1) which is odd anyway.
$count = (1 << $count_log2) - 1;
$output = '_';
$output .= $this->itoa64[$count & 0x3f];
$output .= $this->itoa64[($count >> 6) & 0x3f];
$output .= $this->itoa64[($count >> 12) & 0x3f];
$output .= $this->itoa64[($count >> 18) & 0x3f];
$output .= $this->encode64($input, 3);
return $output;
}
function gensalt_blowfish($input)
{
# This one needs to use a different order of characters and a
# different encoding scheme from the one in encode64() above.
# We care because the last character in our encoded string will
# only represent 2 bits. While two known implementations of
# bcrypt will happily accept and correct a salt string which
# has the 4 unused bits set to non-zero, we do not want to take
# chances and we also do not want to waste an additional byte
# of entropy.
$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
$output = '$2a$';
$output .= chr(ord('0') + $this->iteration_count_log2 / 10);
$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
$output .= '$';
$i = 0;
do {
$c1 = ord($input[$i++]);
$output .= $itoa64[$c1 >> 2];
$c1 = ($c1 & 0x03) << 4;
if ($i >= 16) {
$output .= $itoa64[$c1];
break;
}
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 4;
$output .= $itoa64[$c1];
$c1 = ($c2 & 0x0f) << 2;
$c2 = ord($input[$i++]);
$c1 |= $c2 >> 6;
$output .= $itoa64[$c1];
$output .= $itoa64[$c2 & 0x3f];
} while (1);
return $output;
}
function HashPassword($password)
{
$random = '';
if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) {
$random = $this->get_random_bytes(16);
$hash =
crypt($password, $this->gensalt_blowfish($random));
if (strlen($hash) == 60)
return $hash;
}
if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) {
if (strlen($random) < 3)
$random = $this->get_random_bytes(3);
$hash =
crypt($password, $this->gensalt_extended($random));
if (strlen($hash) == 20)
return $hash;
}
if (strlen($random) < 6)
$random = $this->get_random_bytes(6);
$hash =
$this->crypt_private($password,
$this->gensalt_private($random));
if (strlen($hash) == 34)
return $hash;
# Returning '*' on error is safe here, but would _not_ be safe
# in a crypt(3)-like function used _both_ for generating new
# hashes and for validating passwords against existing hashes.
return '*';
}
function CheckPassword($password, $stored_hash)
{
$hash = $this->crypt_private($password, $stored_hash);
if ($hash[0] == '*')
$hash = crypt($password, $stored_hash);
return $hash == $stored_hash;
}
}
$wp_hasher = new PasswordHash(8, TRUE);
if ($wp_hasher->CheckPassword($argv[1], $argv[2]) == "1")
exit(0);
else
exit(1);

290
webbuild/webbuild-functions Normal file
View File

@ -0,0 +1,290 @@
#!/bin/bash
#
# webbuild functions
# Copyright (c) 2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
SUDO_WRAPPER="sudo /usr/libexec/webbuild-sudo"
#STATEDIR=$WEBBUILD_STATEDIR
LOG=$WEBBUILD_STATEDIR/access_log
DEFAULT_ENVIRONMENT=0
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
function set_user_state_var() {
local statevar=$1
local statevalue=$2
local stateuser=$3
[ ! "$stateuser" ] && stateuser=$USER
[ "$1" ] || return
[ -e $WEBBUILD_STATEDIR/users/$stateuser.state ] || touch $WEBBUILD_STATEDIR/users/$stateuser.state
sed -i "/^$statevar=/d" $WEBBUILD_STATEDIR/users/$stateuser.state
[ "$statevalue" ] && echo "$statevar=$statevalue" >> $WEBBUILD_STATEDIR/users/$stateuser.state
}
function social_log() {
local line=$1
[ "$line" ] || return
if [ ! "$STATE_FAKEUSER" ]; then
STATE_SOCIALLOG_ID=0
. $WEBBUILD_STATEDIR/users/webbuild.state
STATE_SOCIALLOG_ID=`expr $STATE_SOCIALLOG_ID + 1`
set_user_state_var STATE_SOCIALLOG_ID $STATE_SOCIALLOG_ID webbuild
echo "SID=$STATE_SOCIALLOG_ID SPRIVACY=$STATE_PRIVACYMODE $line" >> $WEBBUILD_STATEDIR/social_log
fi
}
function cgi_encodevar() {
local string="${1}"
local strlen=${#string}
local encoded=""
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo -n "${encoded}" # You can either set a return variable (FASTER)
# REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
#This code for getting code from post data is from http://oinkzwurgl.org/bash_cgi and
#was written by Phillippe Kehi <phkehi@gmx.net> and flipflip industries
# (internal) routine to store POST data
function cgi_get_POST_vars()
{
# check content type
# FIXME: not sure if we could handle uploads with this..
[ "${CONTENT_TYPE}" != "application/x-www-form-urlencoded" ] && \
echo "Warning: you should probably use MIME type "\
"application/x-www-form-urlencoded!" 1>&2
# save POST variables (only first time this is called)
[ -z "$QUERY_STRING_POST" \
-a "$REQUEST_METHOD" = "POST" -a ! -z "$CONTENT_LENGTH" ] &&
read -n $CONTENT_LENGTH QUERY_STRING_POST
return
}
# (internal) routine to decode urlencoded strings
function cgi_decodevar()
{
[ $# -ne 1 ] && return
local v t h
# replace all + with whitespace and append %%
t="${1//+/ }%%"
while [ ${#t} -gt 0 -a "${t}" != "%" ]; do
v="${v}${t%%\%*}" # digest up to the first %
t="${t#*%}" # remove digested part
# decode if there is anything to decode and if not at end of string
if [ ${#t} -gt 0 -a "${t}" != "%" ]; then
h=${t:0:2} # save first two chars
t="${t:2}" # remove these
if [ "${h}" = "22" ]; then
v="${v}\\\""
elif [ "${h}" = "0A" ]; then
v="${v}\\\n"
elif [ "${h}" = "24" ]; then
v="${v}\\\$"
elif [ "${h}" = "60" ]; then
v="${v}\\\`"
else
v="${v}"`echo -e \\\\x${h}` # convert hex to special char
fi
fi
done
# return decoded string
echo "${v}"
return
}
# routine to get variables from http requests
# usage: cgi_getvars method varname1 [.. varnameN]
# method is either GET or POST or BOTH
# the magic varible name ALL gets everything
function cgi_getvars()
{
[ $# -lt 2 ] && return
local q p k v s
# get query
case $1 in
GET)
[ ! -z "${QUERY_STRING}" ] && q="${QUERY_STRING}&"
;;
POST)
cgi_get_POST_vars
[ ! -z "${QUERY_STRING_POST}" ] && q="${QUERY_STRING_POST}&"
;;
BOTH)
[ ! -z "${QUERY_STRING}" ] && q="${QUERY_STRING}&"
cgi_get_POST_vars
[ ! -z "${QUERY_STRING_POST}" ] && q="${q}${QUERY_STRING_POST}&"
;;
esac
shift
s=" $* "
# parse the query data
while [ ! -z "$q" ]; do
p=`echo $q | sed "s|&.*||"`
q=`echo $q | sed "s|[^&]*&||"`
k="${p%%=*}" # get the key (variable name) from it
v="${p#*=}" # get the value from it
# decode and evaluate var if requested
if [ "$k" != "SPECTEXT" ]; then
v=`cgi_decodevar "$v"`
fi
eval "$k=\"$v\""
done
return
}
function kill_tree() {
local killpid=$1
[ $1 ] || return
kill `pstree -p $killpid | sed 's/(/\n(/g' | grep '(' | sed 's/(\(.*\)).*/\1/' | tr "\n" " "`
return $?
}
function parse_search_output() {
local SEARCHARCH=$1
echo -n "<style type=\"text/css\">\
.searchlink a:link { text-decoration:none; color:inherit; }\
.searchlink a:hover { text-decoration:underline; }\
.searchlink a:visited { text-decoration:underline; color:inherit; }\
</style><span class=searchlink>"
while read line; do
[ "$line" ] || continue
set -- $line
local REPOSITORY=${1/(*}
local ARCH=`echo $1 | sed "s|.*(\(.*\)):|\1|"`
local PKG=`echo $2 | sed "s|\(.*\)-[^-]*-[^-]*|\1|"`
if [ "$ARCH" = "source" ]; then
echo -n "<font color=lightgreen>"
elif [ "$ARCH" = "$SEARCHARCH" ]; then
echo -n "<font color=white>"
else
echo -n "<font color=gray>"
fi
echo -n "<a class=searchlink href=\"/distribution/distromatic.html?tag=$REPOSITORY\" target=_new>$REPOSITORY</a>($ARCH): "
echo -n "<a class=searchlink href=\"/distribution/distromatic.html?tag=$REPOSITORY&pkg=$PKG.$ARCH\" target=_new>$2</a><br>"
echo -n "</font>"
# if [ "$ARCH" ]
# $SUDO_WRAPPER 0 local "$USER" "" "openmamba-repository search -i $REPSEARCHTEXT" | \
# sed "s|\(.*(source).*\)|<font color=white><b>\1</b></font>|;
# s|\(.*(${AUTOPORT_ARCH[$ENVIRONMENT]}).*\)|<font color=lightgreen>\1</font>|"
done
echo -n "</span>"
}
function parse_patch_output() {
local PATCH_STARTED SAVE_IFS=$IFS
IFS=''
echo -n "<font color=gray>"
while read line; do
[ "${line:0:3}" = "+++" ] && echo -n "</font>"
echo "$line" | sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|^\(+++.*\)|<font color=white style=\"background-color:gray\"><b>\1</b></font>|;
s|^\(---.*\)|<font color=white style=\"background-color:gray\"><b>\1</b></font>|;
s|^\(-.*\)|<font color=red>\1</font>|;
s|^\(+.*\)|<font color=lightgreen>\1</font>|;
s|^ |\&nbsp;|;"
done
IFS=$SAVE_IFS
}
function parse_build_output() {
sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|&lt;font|<font|g;
s|&lt;/font|</font|g;
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|<font style=\"background-color:red;color:white\">\1<a %SRCURL%\2%SRCURLEND%>\2</a></font>|i;
s|^\(== =.*\)|<font style=\"background-color:green;color:white\">\1</font>|;
s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|<font style=\"color:gold\">\1</font>|;
s|[[:cntrl:]]||g;" | google_search $1
}
function parse_generic_output() {
sed "s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s|&lt;font|<font|g;
s|&lt;/font|</font|g;
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;" | google_search $1
}
function google_search() {
while read line; do
local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|"`
if [ "$SEARCH_STRING" = "$line" ]; then
echo "$line"
else
SEARCH_STRING=`echo $SEARCH_STRING | sed "s|\&lt;|<|"`
local SEARCH_STRING_ENCODED=`cgi_encodevar "$1 $SEARCH_STRING"`
echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"http://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g"
fi
done
}
function print_environment_descr() {
local i=$1
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo -n "${AUTOPORT_CHROOT[$i]} - "
elif [ "${AUTOPORT_CHROOT_USER[$i]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$i]} - "
else
echo -n "autodist - "
fi
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
echo -n "update"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo -n "chroot"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo -n "native"
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
echo -n "cross"
else
echo -n "unknown type"
fi
echo -n " for ${AUTOPORT_ARCH[$i]}"
# (${AUTOPORT_BASE_REPOSITORY[$i]} based)"
}
function environment_autoport_logdir() {
local env=$1
if [ "${AUTOPORT_CHROOT[$env]}" ]; then
echo "/var/autoport/${AUTOPORT_CHROOT[$env]}/home/${AUTOPORT_CHROOT_USER[$env]}/.autoport/"
elif [ "${AUTOPORT_NATIVE[$env]}" ]; then
local envhome=`eval echo ~${AUTOPORT_CHROOT_USER[$env]}`
echo "$envhome/.autoport"
fi
}
function environment_logdir() {
local env=$1
if [ "${AUTOPORT_CHROOT[$env]}" ]; then
echo "/var/autoport/${AUTOPORT_CHROOT[$env]}/home/${AUTOPORT_CHROOT_USER[$env]}/.autodist/log/"
elif [ "${AUTOPORT_NATIVE[$env]}" ]; then
local envhome=`eval echo ~${AUTOPORT_CHROOT_USER[$env]}`
if [ "${AUTOPORT_CHROOT_USER[$env]}" = "autodist" ]; then
echo "$envhome/log"
else
echo "$envhome/.autodist/log/"
fi
else
echo "/var/autodist/log/"
fi
}

View File

@ -0,0 +1,171 @@
function showlog() {
local LOGDIR LOGFILES LOGFILE1 LOGFILE2 LOGFILE3 LOGFILE4
if [ "$LOGTYPE" = "processoutput" -o "$LOGTYPE" = "processtail" ]; then
LOGFILES=$LOGFILE
LOGOUTPUTID=outputbottom
else
LOGOUTPUTID=outputbottom
case $LOGTYPE in
autoupdate) LOGFILE=update; ;;
buildinstall|rebuild) LOGFILE=build ;;
*) LOGFILE=$LOGTYPE ;;
esac
if [ "$LOGSTATUSOK" = "true" ]; then
LOGFILE=$LOGFILE/ok
LOGSTATUSAPPEND=" ok"
else
LOGFILE=$LOGFILE/failed
LOGSTATUSAPPEND=" failed"
fi
LOGFILE1=$LOGFILE/${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]}
LOGFILE2=$LOGFILE/${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]}
LOGFILE3=$LOGFILE/*_${PACKAGE/\//_}__*.${AUTOPORT_ARCH[$ENVIRONMENT]}
LOGFILE4=$LOGFILE/*_${PACKAGE/\//_}.${AUTOPORT_ARCH[$ENVIRONMENT]}
LOGDIR=`environment_logdir $ENVIRONMENT`
LOGFILES="$LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "$i" = "$ENVIRONMENT" ] && continue
[ "${AUTOPORT_ARCH[$i]}" = "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] || continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
LOGDIR="/var/autodist/log"
LOGFILES="$LOGFILES $LOGDIR/$LOGFILE1 $LOGDIR/$LOGFILE2 $LOGDIR/$LOGFILE3 $LOGDIR/$LOGFILE4"
fi
done
fi
echo -n "<output><![CDATA[<hr><b>Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):</b>"
echo "<div align=left class=output id=$LOGOUTPUTID>"
for f in $LOGFILES; do
if [ -r $f ]; then
LOGFILESIZE=`stat -c %s $f`
LOGDATE=`stat -c %y $f`
else
LOGFILESIZE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %s $f"`
LOGDATE=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "stat -c %y $f"`
[ $? -eq 0 ] || continue
fi
echo -n "<b>`basename $f` ($LOGDATE; $LOGFILESIZE):</b>"
echo -n "<pre>"
if [ "$LOGTYPE" = "processtail" ]; then
echo -n "<!-- SCROLL -->"
tail -n +0 -f $f --pid $PROCESSPID | sed "s|<|\&lt;|g"
echo -n "<!-- ENDSCROLL -->"
else
if [ $LOGFILESIZE -lt 524288 ]; then
if [ -r $f ]; then
cat $f | parse_build_output $PACKAGE
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "cat $f" | parse_build_output $PACKAGE
fi
else
if [ -r $f ]; then
head -c 262144 $f | parse_build_output $PACKAGE
echo "<br><font style=\"background-color:yellow;color:black\">&lt;------ CUT (long file) -------&gt;</font>"
tail -c 262144 $f | parse_build_output $PACKAGE
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "head -c 262144 $f" | parse_build_output $PACKAGE
echo "<br><font style=\"background-color:yellow;color:black\">&lt;------ CUT (long file) -------&gt;</font>"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "tail -c 262144 $f" | parse_build_output $PACKAGE
fi
fi
fi
echo -n "</pre>"
done
echo -n "</div>]]></output>"
}
function showEnvironmentPanel() {
echo -n "Environment: <b>"
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} - "
else
echo -n "autodist - "
fi
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "update"
elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
echo -n "chroot"
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
echo -n "native"
elif [ "${AUTOPORT_CROSS[$ENVIRONMENT]}" ]; then
echo -n "cross"
else
echo -n "unknown type"
fi
echo -n " (${AUTOPORT_ARCH[$ENVIRONMENT]})</b>"
#echo "<br>Base repository: <b>${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]}</b>"
# toolchain
echo -n "<br>"
local toolchain_output=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "LANGUAGE=C gcc --version | head -n1; LANGUAGE=C ld -v"`
local gcc_ver=`echo $toolchain_output | sed "s|.*(GCC) \([0-9.]*\) .*|\1|"`
local binutils_ver=`echo $toolchain_output | sed "s|.*GNU \(.*\) (GNU Binutils.*)\(.*\)|\1 \2|"`
echo "Toolchain: gcc $gcc_ver, $binutils_ver"
# smart upgrade
echo -n "<br><input type=button id=smartupgrade value=\"system upgrade\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=smartupgrade\""
echo -n ",\"`cgi_encodevar "Upgrade current environment to latest updates now?"`\"); class=redbutton>"
## run ldconfig
#echo -n "<input type=button id=runldconfig value=\"run ldconfig\" onclick="
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
#echo -n "REQUEST=runldconfig\");>"
# environment search
echo -n "<br>Provides:<input type=text size=23 style=\"align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=environmentsearch&ENVSEARCHTEXT=\"+encodeURIComponent(getElementById('environmentsearch').value));>"
}
function print_editorcontrols() {
echo -n "<editcontrols><![CDATA["
# specfile save
echo -n "<input type=button id=savebutton value=\"save\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=savespec&SPECTEXT=\"+encodeURIComponent(editor.getValue()));"
echo -n "this.disabled=true; disabled=disabled class=redbutton>"
# specfile reload
echo -n "<input type=button id=updatespecbutton value=\"reload\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=reloadspec\""
echo -n ",\"`cgi_encodevar "Reload <b>$PACKAGE.spec</b>?<br><br>Warning: current unsaved .spec file changes will be lost."`\");>"
# specfile rename
echo -n "<input type=button id=updatespecbutton value=\"rename to:\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&RENAMESPECFROM=$PACKAGE&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=renamespec&PACKAGE=\"+encodeURIComponent(getElementById('specnewname').value));>"
echo -n "<input type=text id=specnewname value=\"\" size=\"10\">.spec"
# specfile delete
echo -n "<input type=button id=updatespecbutton value=\"delete\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=deletespec\",\"`cgi_encodevar "Really delete <b>$PACKAGE.spec</b>?"`\")>"
# add a note
echo -n "<input type=button id=addpkgnote value=\"add a note:\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "REQUEST=addpkgnote&PKGNOTE=\"+encodeURIComponent(getElementById('pkgnote').value));>"
echo -n "<input type=text id=pkgnote value=\"\" size=\"50\">"
# specfile update
echo -n "<br><input type=button id=updatespecbutton value=\"update\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&"
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
echo -n "REBUILDSPECCHANGELOG=\"+encodeURIComponent(getElementById('rebuildspecchangelog').value)+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
echo -n " (specify new version:<input type=text id=updatespecversion value=\"\" size=\"12\">"
echo -n " or new release changelog:<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" size=\"45\">)"
# close tag
echo -n "]]></editcontrols>"
}

167
webbuild/webbuild-sudo Executable file
View File

@ -0,0 +1,167 @@
#!/bin/bash
. /usr/share/autodist/webbuild-functions
. /etc/sysconfig/autoport
MODE=$1
ENVIRONMENT=$2
USER=$3
PACKAGE=$4
COMMAND=$5
TMPFILE=$6
echo "REQUEST: $@" >> $WEBBUILD_STATEDIR/commands_log
if [ "$MODE" = "killtree" ]; then
KILLPID=$2
[ $KILLPID -gt 1 ] && {
echo "COMMAND: kill_tree $KILLPID" >> $WEBBUILD_STATEDIR/commands_log
kill_tree $KILLPID
}
exit $?
elif [ "$MODE" = "finishprocess" ]; then
PROCESSPID=$2
PROCESSLOG=$4
if [ -e $PROCESSLOG ]; then
RETCODE=`tail -n1 $PROCESSLOG | grep "^# WEBBUILD_EXITCODE=" | sed "s|^# WEBBUILD_EXITCODE=||"`
[ "$RETCODE" ] || RETCODE=257
else
RETCODE=0
fi
sed -i "s|\(^$PROCESSPID [^[:space:]]* [^[:space:]]* [^[:space:]]* [^[:space:]]* \)[^[:space:]]*|\1$RETCODE|" $WEBBUILD_STATEDIR/processes
exit $RETCODE
elif [ "$ENVIRONMENT" = "local" ]; then
echo "COMMAND: $COMMAND" >> $WEBBUILD_STATEDIR/commands_log
$COMMAND 2>&1 | sed "s|<|\&lt;|g"
exit 0
fi
if [ "$ENVIRONMENT" = "local" ]; then
ENVPREFIX=
ENVUSER=root
WORKINGHOME=
SUCMDPREFIX=
elif [ "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
ENVPREFIX="/var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}"
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" = "autodist" ]; then
WORKINGHOME="/var/autodist/"
RPMBUILDROOT="/var/tmp/autodist/"
else
WORKINGHOME="/usr/src/"
RPMBUILDROOT="/var/tmp/"
fi
SUCMDPREFIX="chroot $ENVPREFIX su -l ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} -c"
[ "$TMPFILE" ] && {
cp $TMPFILE /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
chmod 755 /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
}
elif [ "${AUTOPORT_NATIVE[$ENVIRONMENT]}" ]; then
ENVPREFIX=
ENVUSER=${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} | cut -d: -f6`
SUCMDPREFIX="su -l ${AUTOPORT_CHROOT_USER[$ENVIRONMENT]} -c"
else
ENVPREFIX=
ENVUSER=autodist
WORKINGHOME="/var/autodist"
SUCMDPREFIX="su -l autodist -c"
RPMBUILDROOT="/var/tmp/autodist"
# [ "$TMPFILE" ] && chown autodist $TMPFILE
fi
if [ "$MODE" = "specinfo" ]; then
eval `$SUCMDPREFIX "autospec --eval=tmppath_dir|grep -v '^#'"`
RPMBUILDROOT=$tmppath_dir
SPECFILE=${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
if [ "$PACKAGE" -a -r "$SPECFILE" ]; then
rm -f $SPECFILE.tmp
while read line; do
case "$line" in
"## AUTOBUILDREQ-BEGIN"*) AUTOBUILDREQ_BEGIN=1 ;;
"## AUTOBUILDREQ-END"*) AUTOBUILDREQ_END=1 ;;
"## note: run "*" to get the list of build requirements") AUTOBUILDREQ_UNDONE=1 ;;
esac
done < ${ENVPREFIX}${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec
[ "$AUTOBUILDREQ_BEGIN" -a "$AUTOBUILDREQ_END" -a ! "$AUTOBUILDREQ_UNDONE" ] || \
echo "SPECVAR_CHECK_NOAUTOBUILDREQ=1"
$SUCMDPREFIX "rpm -q --specfile ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --specedit > ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec.tmp 2>/dev/null"
if [ -e $SPECFILE.tmp ]; then
echo "SPECVAR_Specfile=\"$SPECFILE\""
BUILDDIR=`grep -m1 "^%setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
while read line; do
set -- $line
[ "$1" = "%package" -o "$1" = "%description" ] && break
if [[ "$1" =~ ^[a-zA-Z]*[0-9]*:.* ]]; then
line="$(echo ${line/$1})"
specvar="SPECVAR_${1/:*}"
specvar="${specvar/[0-9]*}"
[ "$specvar" = "$lastspecvar" ] && varidx=`expr $varidx + 1` || varidx=0
echo "$specvar[$varidx]=\"${line}\""
[ "$specvar" = "SPECVAR_Version" -a ! "$BUILDDIR" ] && BUILDDIR="$PACKAGE-${line}"
fi
lastspecvar=$specvar
done < $SPECFILE.tmp
rm -f $SPECFILE.tmp
echo "SPECVAR_BUILDDIR=\"$BUILDDIR\""
echo "SPECVAR_BUILDROOT=\"$PACKAGE-root\""
echo "SPECVAR_RPMBUILDDIR=\"${WORKINGHOME}/RPM/BUILD\""
echo "SPECVAR_RPMSOURCESDIR=\"${WORKINGHOME}/RPM/SOURCES\""
echo "SPECVAR_RPMBUILDROOT=\"$RPMBUILDROOT\""
echo "SPECVAR_WORKINGHOME=\"$WORKINGHOME\""
exit 0
fi
else
exit 1
fi
fi
echo "COMMAND: $COMMAND" >> $WEBBUILD_STATEDIR/commands_log
cmdtmpfile=`mktemp --suffix=.webbuildcmd`
[ "$PACKAGE" ] || PACKAGE=nopackage
if [ "$MODE" = "background" ]; then
if [ "$WORKINGHOME" ]; then
[ "$DEBUG" ] && echo "=> . /etc/profile;cd $WORKINGHOME/RPM/SPECS;$SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | tr -d '\f' > $cmdtmpfile &
#sed "s|<|\&lt;|g" |
else
[ "$DEBUG" ] && echo "=> $SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX "$COMMAND;echo \"# WEBBUILD_EXITCODE=\$?\"" 2>&1 | sed "s|<|\&lt;|g" | tr -d '\f' > $cmdtmpfile &
fi
echo "$! $USER $ENVIRONMENT $PACKAGE $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
echo "Started background command: $COMMAND"
echo
echo "You may watch command live output and result in the <b>Webbuild jobs</b> box above."
RET=0
else
echo "$$ $USER $ENVIRONMENT $PACKAGE $cmdtmpfile 256 $COMMAND" >> $WEBBUILD_STATEDIR/processes
rettmpfile=`$SUCMDPREFIX "mktemp --suffix=.webbuildret"`
if [ "$WORKINGHOME" ]; then
[ "$DEBUG" ] && echo "=> . /etc/profile;cd $WORKINGHOME/RPM/SPECS;$SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX ". /etc/profile;cd $WORKINGHOME/RPM/SPECS;$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
# sed "s|<|\&lt;|g" |
else
[ "$DEBUG" ] && echo "=> $SUCMDPREFIX \"$COMMAND\""
$SUCMDPREFIX "$COMMAND;echo \$? > $rettmpfile" 2>&1 | tr -d '\f' | tee $cmdtmpfile
# sed "s|<|\&lt;|g" |
fi
RET=`cat $ENVPREFIX/$rettmpfile`
[ "$RET" ] || RET=254
$SUCMDPREFIX "rm -f $rettmpfile"
sed -i "/^$$ $USER/d" $WEBBUILD_STATEDIR/processes
if [ "$MODE" != "keeplog" ]; then
rm -f $cmdtmpfile
else
echo "$$ $USER $ENVIRONMENT $PACKAGE $cmdtmpfile $RET $COMMAND" >> $WEBBUILD_STATEDIR/processes
fi
fi
if [ "$ENVIRONMENT" != "local" ]; then
if [ "$TMPFILE" -a "${AUTOPORT_CHROOT[$ENVIRONMENT]}" ]; then
rm -f /var/autoport/${AUTOPORT_CHROOT[$ENVIRONMENT]}/$TMPFILE
fi
fi
if [ -e $cmdtmpfile ]; then
chmod 666 $cmdtmpfile
chown apache.nobody $cmdtmpfile
fi
exit $RET

View File

@ -0,0 +1,2 @@
apache ALL = NOPASSWD: /usr/libexec/webbuild-sudo