Compare commits

..

116 Commits

Author SHA1 Message Date
c46535f109 Release 1.4.3 2024-04-13 14:41:23 +02:00
5e4081a335 autodist-cgi: increase default size of build output and support for full output 2024-04-13 14:10:42 +02:00
cebe696e6e autodist,update-specfile: support for update version as argument; cleanups
autodist-inspect: update repositories list
2024-04-13 14:08:06 +02:00
6144945c31 Release 1.4.2 2024-02-08 17:11:01 +01:00
ea5c285270 repology-openmamba.py: switch from ignore to a more generic update-conf.json file to parse with ignore and more information 2024-02-08 17:08:30 +01:00
9d218a005a webbuild-sudo: fix parsing SPECFILE_BUILDDIR since rpmspec started expanding %setup macro 2024-02-08 17:06:19 +01:00
5354160b25 webbuild-cgi: fix getting processes pid with more than one '+' sign appended 2024-02-08 17:05:34 +01:00
4d29a63a34 Release 1.4.1 2024-01-06 14:12:19 +01:00
e01964e86a 40-autodist-upstream-updates: remove obsolete nightly autodist-upstream-updates cron launcher 2024-01-06 13:08:58 +01:00
cafa354501 45-autodist-git-sync: added daily cron file for autodist-git repository sync 2024-01-06 13:07:48 +01:00
07285b0cc7 autospec-conf: update sample autospec configuration 2024-01-06 13:03:33 +01:00
fe984b1da2 autoport: no longer search and reschedule other providing packages on prepare failed 2024-01-06 12:46:20 +01:00
e8ae210c2d autodist-repository: integration with autodist-git for import and release functionalities 2024-01-06 12:42:38 +01:00
e629f9561c autodist-git: many improvements to reach working repository and package sync functionality 2024-01-06 12:40:32 +01:00
7f1ecb9f41 Release 1.4.0 2024-01-02 20:28:27 +01:00
fcdbff1da2 autodist-git: new tool for syncing rpm repository with new git server at src.openmamba.org 2024-01-02 20:18:19 +01:00
5bac010c6d autodist-inspect,40-autodist-cleanold: commit minor changes done in production 2024-01-02 20:14:46 +01:00
d0b8d56db4 Release 1.3.3 2023-10-09 19:56:57 +02:00
0bc98d2bf8 autodist-inpsect: new tool added 2023-10-09 19:56:45 +02:00
10e566b640 update-specfile: sync with current build server changes 2023-10-09 19:54:26 +02:00
8b6c1367f0 Release 1.3.2 2023-09-19 15:42:55 +02:00
8be0311320 Makefile: install forgotten autodist-launcher 2023-09-19 15:42:37 +02:00
aecf691938 autoport: rebuild dependant mode: do not add empty epoch value if empty 2023-08-20 13:13:55 +02:00
fcc2302ac9 Release 1.3.1 2023-08-17 11:33:36 +02:00
096b6d6f69 autoport: fetch repfiles for all archs but only if local files are older than 60 minutes 2023-08-17 11:30:12 +02:00
0d5bc034b1 Release 1.3 2023-08-16 18:41:00 +02:00
92246206dc Update repository from devel to base and other changes for devel to rolling distribution 2023-08-16 18:38:48 +02:00
519f8d5656 Release 1.2 2023-08-11 10:55:44 +02:00
cafae574a8 40-autodist-cleanold: minor fix for chroot environments 2023-08-11 10:49:49 +02:00
88643910fb autoport: update with current production changes 2023-08-11 10:35:50 +02:00
ceea7ef522 autodist-repository: change default destination repository from devel to base 2023-08-11 10:32:33 +02:00
d85e5aae68 telegram/openmamba_bot.py: update repositories list 2022-10-08 13:01:52 +02:00
e4fcd8d6cf openmambabot: update service and add requirements to run in virtualenv (/var/autodist/env) 2022-10-02 14:56:26 +02:00
ac040bff56 Release 1.1 2022-10-02 13:15:47 +02:00
af92aad66e 65-autoport: minor changes 2022-10-02 13:05:28 +02:00
702d3cfe09 autodist-launcher: move code in 60-autodist-update to /usr/bin script 2022-10-02 13:02:40 +02:00
8794727a6a 40-autodist-cleanold: sync with current build server 2022-10-02 12:57:49 +02:00
78c85dcc7d etc/autodist/blacklist: update to current production build server 2022-10-02 12:53:11 +02:00
6b784c66d3 update-specfile: update to current production 2022-10-02 12:51:43 +02:00
4902ab352f autodist, autoport: update to current production code 2022-10-02 12:47:45 +02:00
193a41413a repology-openmamba.py: update to current production code 2022-10-02 12:43:26 +02:00
e9c5cbbdbf Makefile: update systemd unitdir path 2022-10-02 12:41:04 +02:00
3013fcd2d1 autoport: fix check for -devel suffix in rebuild dependant mode 2022-06-25 14:28:23 +02:00
5bbf2f8715 webbuild-cgi: check for zero length cache files (disk full); add -b descriptive argument to patches 2022-06-11 11:03:08 +02:00
5c9a10871d autoport: added epoch support for added BuildRequirements in rebuild mode 2022-06-08 15:40:24 +02:00
de810c1bd7 automaint: update to current build server usage 2022-01-25 14:28:23 +01:00
f32788002f telegram/openmamba_bot: added support for arch aarch64 2022-01-25 14:27:38 +01:00
a7cbefbe18 autoport-launcher, 65-autoport: new launcher and single cron script to improve background processes launch with systemd 2021-12-19 15:00:23 +01:00
f852838441 automaint: update with changes from current operating version 2021-09-04 14:56:26 +02:00
33c3a3ca36 webbuild/webbuild-functions: pipe iconv to build outputs to fix invalid UTF-8 characters 2021-06-05 10:57:06 +02:00
70def57d53 Merge branch 'master' of ssh://gitlab.mambasoft.it:4424/openmamba/autodist 2021-05-15 13:42:29 +02:00
b451ee800b repology-openmamba.py: support for ignore json list; autodist-upstream-updates: replace usage of obsolete tempfile with mktemp 2021-05-15 13:41:26 +02:00
f97c3c4598 webbuild-cgi: add free space information from any chroot environment 2021-05-08 22:42:42 +02:00
acd4178c8b webbuild-cgi: filter out invalid characters from some responses 2021-05-08 22:40:25 +02:00
b6d3b83d1e autodist-upstream-updates: add support to fetch updates from repology API (repology.org) 2021-03-14 11:55:11 +01:00
9d003905df autodist, webbuild-cgi: add -b to autospec command to update build requrements in specfiles; other fixes to webbuild-cgi 2021-03-14 11:51:42 +01:00
27d32d110e autoport: add safety check that .spec version matches srcpkglist to fix packages sent in wrong repositories when the latter file is not up to date 2021-02-20 17:28:14 +01:00
7dcd16b2ca autoport: use all archs as base arch to find packages to port 2020-12-16 20:40:35 +01:00
dab56b358f webbuild-cgi: fix for lost messages in social log 2020-12-16 20:39:46 +01:00
51a0c3a449 More aarch64 support 2020-11-26 19:09:06 +01:00
b95cb79e69 aarch64 support 2020-11-25 19:18:24 +01:00
d4241631f2 autoport: fix after uname change: use uname -m instead of uname -i 2020-11-25 19:18:02 +01:00
8fda5d4d82 telegram: update to Telegram Bot api v.13.0 2020-11-19 14:43:39 +01:00
a69962724a telegram: switch to python3 2020-11-19 12:34:53 +01:00
64394b8110 Release 1.0.3 2020-09-27 18:02:04 +02:00
9ad95404ec Other old fixes on server applied 2020-09-27 15:59:08 +02:00
ac8340c0d6 Switch from using smart to dnf and integrate other old changes 2020-09-27 15:56:38 +02:00
f23570f228 Release 1.2 (formerly released) 2020-09-27 15:49:51 +02:00
79af8764e1 webbuild-cgi: css fixes 2019-07-30 19:39:22 +02:00
94f1ffcf9a webbuild: more css support for output boxes 2019-07-28 21:57:52 +02:00
1c15fcfb25 webbuild: fixes for sociallog from webbuild.db 2019-07-28 20:40:09 +02:00
5a0fa63a96 webbuild-sudo: switch to using rpmspec from rpm4 instead of rpm --specedit 2019-07-21 11:37:20 +02:00
bbcfce5260 Release 1.0.1 2019-07-15 17:54:01 +02:00
db0354041e webbuild: minor updates synced from running build server 2019-07-15 17:42:52 +02:00
c7d8a76d80 autodist: minor updates synced from running server installation 2019-07-15 17:39:27 +02:00
058a0baa7e Added openmamba bot for telegram 2017-12-30 23:14:48 +01:00
38c75eea33 autoport-fix-environment: fix a syntax error in sed 2017-07-04 19:04:08 +02:00
4cee459385 Release 1.0.0 2017-06-19 15:18:07 +02:00
f47b80b1cc autodist-update: disable icecc to workaround some problems 2017-06-19 14:49:40 +02:00
092e90e004 autoport-native: only upgrade native packages on first loop cycle 2017-06-19 14:49:12 +02:00
e53a62198a automaint: minor fixes 2017-06-19 14:48:35 +02:00
68bacbc599 autodist-upstream-updates: added support for blacklisting 2017-06-19 14:48:01 +02:00
681b2e5ec7 autodist: added --rebuild-srpms 2017-06-19 14:47:30 +02:00
a6d6fd03e4 webbuild: login fix for problem when password is changed on main site 2017-06-19 14:39:08 +02:00
c3cbf7c0e8 webbuild: switch social_log to sqlite3 db; display status also when there are no processes to display 2016-10-30 13:41:46 +01:00
ced497545e webbuild: support for different archs in downloads and some fixes 2016-10-17 12:57:27 +02:00
ee1a94af6f webbuild-functions: some optimizations of sed parsing functions 2016-07-04 21:39:40 +02:00
2c09744bbd Webbuild: support for running a console command from web interface input 2016-05-29 00:23:38 +02:00
7d21e2fa60 webbuild-cgi: red color for Updating indicator in jobs panel 2016-05-04 15:51:41 +02:00
7e78d60c90 webbuild-cgi: fix for files upload and minor cosmetic changes to rebuild deps function 2016-03-11 14:46:59 +01:00
537b80a4c4 update-specfile: remove Requires: kde-workspace from many kde4->kde5 packages and fix kde download url 2016-02-21 14:41:58 +01:00
db8fa88b9b autoport: apply strict repository check at first step only
This means check is applied to command-line passed packages only
2016-02-19 12:06:41 +01:00
f93a093134 40-autodist-cleanold: refresh with currently in use modifications 2016-02-16 13:45:18 +01:00
a49c4ec447 autodist: add --repository-string to limit autoport of pacakges from specified repository
autoport: update accordingly
2016-02-15 08:07:58 +01:00
1c8a7cbbdf webbuild-cgi: add icon button to refresh spec list 2016-01-10 17:10:57 +01:00
73f032afda webbuild-cgi: use https for gravatar 2015-12-08 14:59:48 +01:00
8b9ee4a7b2 webbuild-cgi: alway exit early on refreshsocial request 2015-09-19 23:15:48 +02:00
c3c5a9009e webbuild: fully div based layout and responsive support 2015-08-23 15:59:13 +02:00
4fba9537b5 webbuild: split css adding webbuild-standalone.css and webbuild-post.css 2015-08-22 18:44:38 +02:00
a191ef0eb3 webbuild: fixes to matching autodist jobs with package name and other small fixes 2015-08-22 17:58:14 +02:00
5f2e54f58a webbuild-cgi: small refining of rpmbuild processes detection 2015-05-16 14:28:02 +02:00
90a0d85269 webbuild-cgi: display live server stats in first line of jobs window 2015-05-14 17:13:34 +02:00
6e6d92d5a2 webbuild: redesign of operation panel in maintainance mode 2015-05-07 00:14:06 +02:00
8f2eb49563 webbuild.css: float maintainer panel to the left 2015-05-04 20:46:37 +02:00
4ee59fdbd2 Sync with current server files before releasing 2015-04-18 16:33:42 +02:00
d1493a2edf webbuild: create uploads directory 2015-04-18 15:56:38 +02:00
c6db4b05c9 autodist-cgi: fix showing last log file 2015-04-14 22:08:31 +02:00
3f8d3fb9b2 webbuild: change error background color from red to darkred 2015-04-13 23:16:34 +02:00
77ecc7566d webbuild: implement a var2html function to filter for security variable to html
Currently used in chat messages
2015-04-04 18:49:49 +02:00
aca1323856 webbuild-cgi: fixes for rpm manager install/upgrade from repositories 2015-01-30 11:11:23 +01:00
a6b14a1aa9 autoport: port packages also in milestone rebuild mode and display fetched files in verbose mode (-v) 2015-01-04 10:58:10 +01:00
2e6f2dd33e autoport: don't increment first release number in REBUILD_MILESTONE mode 2014-12-31 14:52:23 +01:00
fe8a60addd Release 0.9.22 2014-12-04 14:42:44 +01:00
ef649ef1c4 webbuild-cgi: some more milestone3 support 2014-12-04 14:41:33 +01:00
a044057f9f webbuild-cgi: fix for distroquery usage while searching for already existing package 2014-11-24 12:48:02 +01:00
8623f8bfd8 autodist-cgi: small changes after wordpress integration 2014-11-23 22:18:37 +01:00
40 changed files with 1950 additions and 917 deletions

View File

@ -1,34 +1,34 @@
# Makefile for autodist
# Copyright (C) 2006-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2006-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
PACKAGE = autodist
include VERSION
prefix = /usr
exec_prefix = ${prefix}
sysconfdir = /etc
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= /run/autodist
cgidir = ${localstatedir}/www/cgi-bin
htmldir = ${localstatedir}/www/html
prefix := /usr
exec_prefix := ${prefix}
sysconfdir := /etc
sbindir := ${exec_prefix}/sbin
bindir := ${exec_prefix}/bin
datadir := ${prefix}/share
unitdir := ${prefix}/lib/systemd/system
libexecdir := ${prefix}/libexec
mandir := ${prefix}/usr/share/man
sysconfigdir := ${sysconfdir}/sysconfig
configdir := ${sysconfdir}/autodist
localstatedir := /var
piddir := /run/autodist
cgidir := ${localstatedir}/www/cgi-bin
htmldir := ${localstatedir}/www/html
srcdir = .
DESTDIR =
INSTALL = /usr/bin/install
INSTALL_PROGRAM = ${INSTALL} -m 755
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_DIR = ${INSTALL} -d -m 755
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
INSTALL := /usr/bin/install
INSTALL_PROGRAM := ${INSTALL} -m 755
INSTALL_DATA := ${INSTALL} -m 644
INSTALL_DIR := ${INSTALL} -d -m 755
INSTALL_SCRIPT := ${INSTALL_PROGRAM}
pck_datadir = $(datadir)/$(PACKAGE)
pck_statedir = $(localstatedir)/$(PACKAGE)
@ -52,6 +52,7 @@ install-dirs:
@$(INSTALL_DIR) $(DESTDIR)$(sbindir)
@$(INSTALL_DIR) $(DESTDIR)$(cgidir)
@$(INSTALL_DIR) $(DESTDIR)$(htmldir)
@$(INSTALL_DIR) $(DESTDIR)$(unitdir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_datadir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)
@$(INSTALL_DIR) $(DESTDIR)$(pck_statedir)/template/autoupdate/spec-patches-build/old
@ -61,20 +62,24 @@ install-dirs:
@$(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_statedir)/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,x86_64,arm,aarch64}}
@$(INSTALL_DIR) $(DESTDIR)$(libexecdir)
@$(INSTALL_DIR) $(DESTDIR)$(localstatedir)/webbuild/{cache,home,notes,tmp,users}
@$(INSTALL_DIR) $(DESTDIR)$(localstatedir)/webbuild/{cache,home,notes,tmp,users,uploads}
@$(INSTALL_DIR) $(DESTDIR)$(prefix)/lib/tmpfiles.d/
install-programs:
@$(INSTALL_SCRIPT) autodist $(DESTDIR)$(bindir)/autodist
@$(INSTALL_SCRIPT) autodist-git $(DESTDIR)$(bindir)/autodist-git
@$(INSTALL_SCRIPT) autodist-inspect $(DESTDIR)$(bindir)/autodist-inspect
@$(INSTALL_SCRIPT) autodist-launcher $(DESTDIR)$(bindir)/autodist-launcher
@$(INSTALL_SCRIPT) autodist-repository $(DESTDIR)$(bindir)/autodist-repository
@$(INSTALL_SCRIPT) autodist-tool $(DESTDIR)$(bindir)/autodist-tool
@$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(bindir)/autodist-upstream-updates
@$(INSTALL_SCRIPT) autoport $(DESTDIR)$(bindir)/autoport
@$(INSTALL_SCRIPT) automaint $(DESTDIR)$(sbindir)/automaint
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(sbindir)/autoport-chroot
@$(INSTALL_SCRIPT) autodist-repository $(DESTDIR)$(sbindir)/autodist-repository
@$(INSTALL_SCRIPT) autodist-upstream-updates $(DESTDIR)$(sbindir)/autodist-upstream-updates
@$(INSTALL_SCRIPT) autoport-chroot $(DESTDIR)$(bindir)/autoport-chroot
@$(INSTALL_SCRIPT) autoport-fix-environment $(DESTDIR)$(bindir)/autoport-fix-environment
@$(INSTALL_SCRIPT) autoport-launcher $(DESTDIR)$(bindir)/autoport-launcher
@$(INSTALL_SCRIPT) automaint $(DESTDIR)$(bindir)/automaint
@$(INSTALL_SCRIPT) etc/autodist/scripts/* $(DESTDIR)$(configdir)/scripts/
@$(INSTALL_SCRIPT) autodist-cgi $(DESTDIR)$(cgidir)/autodist
@$(INSTALL_SCRIPT) webbuild/webbuild-cgi $(DESTDIR)$(cgidir)/webbuild
@ -82,10 +87,14 @@ install-programs:
@$(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
@$(INSTALL_SCRIPT) telegram/openmamba_bot.py $(DESTDIR)$(pck_datadir)/openmamba_bot.py
@$(INSTALL_SCRIPT) telegram/requirements.txt $(DESTDIR)$(pck_datadir)/requirements.txt
@$(INSTALL_SCRIPT) repology-openmamba.py $(DESTDIR)$(pck_datadir)/repology-openmamba.py
@cp -a webbuild/html/* $(DESTDIR)$(htmldir)
install-data:
@$(INSTALL_DATA) etc/autodist/config $(DESTDIR)$(configdir)/config
@$(INSTALL_DATA) etc/autodist/config-git $(DESTDIR)$(configdir)/config-git
@$(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
@ -93,15 +102,15 @@ install-data:
@$(INSTALL_DATA) webbuild/webbuild-admin $(DESTDIR)$(localstatedir)/webbuild/users/admin.conf
@$(INSTALL_SCRIPT) etc/sysconfig/autoport $(DESTDIR)$(sysconfdir)/sysconfig/autoport
@$(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.hourly/65-autoport $(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_SCRIPT) etc/cron.daily/45-autodist-git-sync $(DESTDIR)$(sysconfdir)/cron.daily/
@$(INSTALL_SCRIPT) etc/logrotate.d/webbuild $(DESTDIR)$(sysconfdir)/logrotate.d/webbuild
@$(INSTALL_DATA) autospec-conf $(DESTDIR)$(pck_statedir)/.autospec
@$(INSTALL_DATA) autodist-bashrc $(DESTDIR)$(pck_statedir)/.bashrc
@$(INSTALL_DATA) autodist-bash_profile $(DESTDIR)$(pck_statedir)/.bash_profile
@$(INSTALL_DATA) autodist-tmpfilesd $(DESTDIR)$(prefix)/lib/tmpfiles.d/autodist.conf
@$(INSTALL_DATA) telegram/openmambabot.service $(DESTDIR)$(unitdir)/openmambabot.service
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.success
@touch $(DESTDIR)$(pck_statedir)/template/autoupdate/auto.skip

View File

@ -1 +1 @@
VERSION = 0.9.21
VERSION = 1.4.3

View File

@ -1,18 +1,18 @@
#!/bin/bash
#
# Autodist -- batch build tool for RPM based distributions
# Copyright (C) 2006-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2006-2016 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.21
me=(${0##*/} $VERSION "Sat Aug 20 2010")
VERSION=1.4.3
me=(${0##*/} $VERSION "Tue Jan 26 2016")
exec 3>`readlink /proc/self/fd/0`
function usage() {
echo "\
${me[0]} ${me[1]}
"$"Copyright (C) 2006-2014 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Copyright (C) 2006-2016 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Batch build tool for bulding a whole distribution and much more.""
@ -40,13 +40,15 @@ ${me[0]} ${me[1]}
-v,--verbose "$"Be verbose""
--force "$"Pass force parameter to autospec""
--repository "$"Pass given repository as base for operations""
--repository-strict "$"Only prepare packages from base repository specified with --repository""
--server num "$"Pass given server number to autospec for send operation""
--severity num "$"Error handling level:
0: don't stop (default)
1: skip current job on error
0: don't stop
1: skip current job on error (default)
2: abort on error""
--arch "$"Build packages for specified target architecture""
--user user "$"Pass calling user name for Webbuild social messages""
--rebuild-srpms "$"Rebuild SRPMs when sending""
job "$"Job specification in the form pkg#version, job#version, job/pkg#version, examples:
glibc#2.11.1
@ -121,13 +123,6 @@ for ((i=1; i<=$#; i++)); do
do_build=1;
do_send=1;
SEVERITY=1
[ -e $PIDFILE ] && {
PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK -a ! "$DISABLE_PID_CHECK" ] && {
echo "Error: autodist -a already running with PID=$PIDCHECK.Aborting."
exit 1
}
}
;;
-c|--cleanlogs) do_cleanlogs=1 ;;
-h|--help) usage
@ -169,6 +164,9 @@ for ((i=1; i<=$#; i++)); do
}
AUTODIST_REPOSITORY="${!i}"
;;
--repository-strict)
REPOSITORY_STRICT=1
;;
--severity) let i+=1
[ "${!i}" ] || {
echo "Error: --severity parameter not given, aborting."
@ -190,6 +188,9 @@ for ((i=1; i<=$#; i++)); do
}
WEBBUILD_USER_CMDLINE="${!i}"
;;
--rebuild-srpms)
REBUILD_SRPMS=1
;;
-*) if [ "${!i}" = "--" ]; then
AUTOSPEC_ARGS_MODE=1
SCRIPT_ARGS_MODE=
@ -228,6 +229,16 @@ for ((i=1; i<=$#; i++)); do
esac
done
if [ "$do_autobuild" ]; then
if [ -e $PIDFILE ]; then
PIDCHECK=`cat $PIDFILE`
if [ "$PIDCHECK" -a -e /proc/$PIDCHECK -a ! "$DISABLE_PID_CHECK" ]; then
echo "Error: autodist -a already running with PID=$PIDCHECK.Aborting."
exit 0
fi
fi
fi
[ "$AUTODIST_REPOSITORY" ] || AUTODIST_REPOSITORY=devel-autodist
[ "$SEND_SERVER" ] || SEND_SERVER=$AUTODIST_REPOSITORY
@ -561,7 +572,7 @@ function launch_pkgs_loop() {
fi
fi
if [ -x $SCRIPT_UPDATE_SPECFILE ]; then
$SCRIPT_UPDATE_SPECFILE $spec_dir/$pkg.spec $SCRIPT_ARGS || {
$SCRIPT_UPDATE_SPECFILE $spec_dir/$pkg.spec ${passed_arguments/ *} $SCRIPT_ARGS || {
case $SEVERITY in
0) ;;
1) echo "%! Error: update-specfile script returned $?; skipping $pkg package."
@ -573,7 +584,7 @@ function launch_pkgs_loop() {
}
fi
if [ -x $SCRIPT_UPDATE_SPECFILE_CUSTOM ]; then
$SCRIPT_UPDATE_SPECFILE_CUSTOM $spec_dir/$pkg.spec $SCRIPT_ARGS || {
$SCRIPT_UPDATE_SPECFILE_CUSTOM $spec_dir/$pkg.spec ${passed_arguments/ *} $SCRIPT_ARGS || {
case $SEVERITY in
0) ;;
1) echo "%! Error: update-specfile-custom script returned $?; skipping $pkg package."
@ -627,6 +638,15 @@ function launch_pkgs_loop() {
if [ "$PKGLINE" ]; then
set -- $PKGLINE
[[ $4 =~ "^[0-9]+$" ]] && REPNAME=${AUTODIST_REPOSITORIES[$4]} || REPNAME="$4"
if [ "$REPNAME" != "$AUTODIST_REPOSITORY" -a "$REPOSITORY_STRICT" ]; then
case $SEVERITY in
0) echo "!! Warning: package comes from $REPNAME instead of $AUTODIST_REPOSITORY" ;;
1) echo "!! Error: package comes from $REPNAME instead of $AUTODIST_REPOSITORY; skipping $pkg package."
continue ;;
*) echo "!! Error: package comes from $REPNAME instead of $AUTODIST_REPOSITORY; aborting."
exit 1 ;;
esac
fi
if [ "$REPNAME" ]; then
command_opts="$command_opts --server ${REPNAME}"
else
@ -671,7 +691,9 @@ function launch_pkgs_loop() {
continue
fi
fi
command_opts="-a5:6" ;;
command_opts="-a5:6 -b" ;;
buildsrpm)
command_opts="-a5:6 --norpm" ;;
buildinstall)
# skip package in job if up to date
if [ "$PKGLINE" -a "$BUILDSLINE" ]; then
@ -744,7 +766,7 @@ function launch_pkgs_loop() {
echo "Command: $command"
else
# eval "$command 2>&1 && echo '0'>$tmpfile1 || echo '1'>$tmpfile1" | tail_file $tmpfile "== $pkg (${JOB_VALUES[*]})..."
(export LANG=C; $command 2>&1; echo $? >$tmpfile1) | tail_file $tmpfile "== $pkg (${JOB_VALUES[*]})..."
(export LANG=en_US.UTF-8; $command 2>&1; echo $? >$tmpfile1) | tail_file $tmpfile "== $pkg (${JOB_VALUES[*]})..."
if [ -e $tmpfile1 ]; then
ret=`cat $tmpfile1`
rm -f $tmpfile1
@ -770,20 +792,6 @@ function launch_pkgs_loop() {
mv $LOGFILE_PKG $LOGDIR/failed/
echo "?= See $LOGDIR/failed/${LOGFILE_PKG_NAME}"
[ "$do_autobuild" ] && autobuild_log $pkg $operation $ret $JOB_NAME $LOGDIR/failed/${LOGFILE_PKG_NAME}
case $operation in
autoupdate|update)
;;
build|buildinstall)
# copy new patches to sourcesdir for sharing
[ "$do_autobuild" ] && {
PATCHES=`diff $spec_dir/$pkg.spec $spec_dir/.$pkg.spec.autodist.preupdate | grep "> Patch" | sed "s|.*[[:space:]]\([^[:space:]]*\)|\1|"`
for p in $PATCHES; do
echo "== Copying patch $p to public dir"
[ -e $source_dir/$p ] && cp $source_dir/$p $SOURCESDIR/
done
}
;;
esac
[ $SEVERITY -gt 0 -a ! "$continue_on_error" ] && {
rm -f $tmpfile
return $ret
@ -1114,8 +1122,8 @@ if [ "$do_autobuild" = "1" ]; 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
#[ "${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`
@ -1345,7 +1353,12 @@ for JOB_NUM in `seq 1 ${#JOBNAME[*]}`; do
}
# avoid calling autospec with --nosrpm --norpm (not working as expected and not useful)
if [ "${AUTOSPEC_ARGS/--nosrpm}" = "$AUTOSPEC_ARGS" ]; then
echo "== sending source rpms"
if [ $REBUILD_SRPMS ]; then
echo "== rebuilding and sending source rpms"
launch_pkgs_loop buildsrpm "$AUTOSPEC_ARGS --norpm"
else
echo "== sending source rpms"
fi
launch_pkgs_loop send "$AUTOSPEC_ARGS --norpm $SEND_SERVER_CMD"
if [ $? -gt 0 ]; then
case $SEVERITY in

View File

@ -10,6 +10,7 @@ SHOWLOG=`echo "$QUERY_STRING" | sed -n 's/^.*SHOWLOG=\([^&]*\).*$/\1/p' | sed "s
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"`
FULL=`echo "$QUERY_STRING" | sed -n 's/^.*FULL=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
function resolve_logname() {
local l=$1
@ -77,7 +78,7 @@ 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&REP=$REP&LOG=$LOG" 2>/dev/null
curl "${AUTOPORT_CGI_HOST[$HOST]}?AS_HOST=$HOST&SHOWLOG=$SHOWLOG&NUM=$NUM&REP=$REP&LOG=$LOG&FULL=$FULL" 2>/dev/null
else
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
@ -120,7 +121,7 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
AUTODISTSTATEFILE="$AUTOPORTLOGDIR/autoport-$r-current"
elif [ "${AUTOPORT_NATIVE[$i]}" ]; then
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
LASTLOGFILE="/var/autodist/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
@ -145,9 +146,8 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ "${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;"-->
<div class="downloadbox" align="center">
<div class="output outputbox">
_EOF
echo -n "<pre><code>"
if [ "$SHOWLOG" = "current" ]; then
@ -164,7 +164,7 @@ _EOF
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>"
echo "<table style=\"color:black;width:auto;\"><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&REP=$RNUM$HOST_ADD&SHOWLOG=${t}/ok/${SHOWLOGPKG}\">OK</a></td>" || echo "<td></td>"
@ -177,12 +177,12 @@ _EOF
LOGFILESIZE=`stat -c %s ${BUILDLOGDIR}${SHOWLOG}`
LOGDATE=`stat -c %y ${BUILDLOGDIR}${SHOWLOG}`
echo -n "<b>${SHOWLOG} ($LOGDATE; $LOGFILESIZE):</b>"
if [ $LOGFILESIZE -lt 131072 ]; then
if [ $LOGFILESIZE -lt 2097152 -o "$FULL" != "" ]; then
cat ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
else
head -c 65535 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
head -c 1048576 ${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
tail -c 1048576 ${BUILDLOGDIR}${SHOWLOG} | parse_build_output
fi
fi
fi
@ -192,7 +192,7 @@ _EOF
fi
[ "${AUTOPORT_UPDATE[$i]}" ] && break
elif [ ! "$SHOWLOG" ]; then
RELOADTIME=60000
RELOADTIME=600000
[[ "$NUM" && "$NUM" != "$i" ]] && continue
[[ "$HOST" = "$AS_HOST" ]] || continue
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
@ -215,10 +215,10 @@ _EOF
echo " [ <a target=_autodist href=\"?SHOWLOG=current&NUM=$i&REP=$RNUM$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;">
<div class="downloadbox" align="center">
<div align="left" class="showlogbox">
_EOF
echo -n "<pre style='margin:1px'>"
echo -n "<pre style='margin:1px;word-wrap:normal;white-space:pre;'>"
unset BUILDNOWIDX BUILDLOG BUILDNOW BUILDNOWSTATUS SCHEDULED STARTTIME AUTODIST_PID ENDTIME
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
BUILDNOWIDX=0

365
autodist-git Executable file
View File

@ -0,0 +1,365 @@
#!/usr/bin/python3
import argparse
import glob
import os
import re
import rpm
import subprocess
import tempfile
from shutil import copyfile
from pyrpm.spec import Spec, replace_macros
from gitea import *
from git import Repo
from functools import cmp_to_key
from configobj import ConfigObj
cfg = ConfigObj(infile='/etc/autodist/config-git')
gitea = Gitea(cfg["GITEA_URL"], cfg["GITEA_TOKEN"])
org = Organization.request(gitea, cfg["GITEA_ORGANIZATION"])
# argparse options
options = None
def comparePkgInfo(item1, item2):
return rpm.labelCompare(
(str(item1['e']), item1['v'], item1['r']),
(str(item2['e']), item2['v'], item2['r']))
def giteaGetRepoTags(repo_name):
try:
path = f'/repos/{cfg["GITEA_ORGANIZATION"]}/{repo_name}/tags'
return gitea.requests_get(path)
except NotFoundException:
return None
def giteaGetRepository(repo_name):
try:
path = f'/repos/{cfg["GITEA_ORGANIZATION"]}/{repo_name}'
result = gitea.requests_get(path)
return Repository.parse_response(gitea, result)
except NotFoundException:
return None
def findOrCreateRepo(pkg_name, pkg_description=None, create=True):
# Replace '+' for repository name as it is not allowed
repo_name = pkg_name.replace('+','Plus')
# Get gitea repository instance
gitea_repo = giteaGetRepository(repo_name)
if gitea_repo is not None:
return gitea_repo
# Return None if requested to not create
if not create:
return None
# Repository does not exist -> create
org.create_repo(
repoName=repo_name,
description=pkg_description,
private=False,
autoInit=True,
gitignores=None,
# license=spec.license,
# readme=spec.description,
issue_labels=None,
default_branch="main",
)
gitea_repo = giteaGetRepository(repo_name)
return gitea_repo
def commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir):
global options
src_dir = pkg_info["src"]
if src_dir.endswith(".src.rpm"):
# src is a SRPM, use autospec to extract in a temporary folder
#print(f'Extracting {pkg_info["name"]} release {pkg_info["v"]}-{pkg_info["r"]} from {pkg_info["src"]}...')
src_temp_dir = tempfile.TemporaryDirectory()
src_dir = src_temp_dir.name
subprocess.run(["autospec", "-x", pkg_info["src"], f'--destdir={src_dir}'],
stdout=subprocess.PIPE)
# Delete binary source archives
for pattern in [
'*.zip','*.tar.bz2','*.tar.xz','*.tar.gz','*.tgz','*.txz','*.iso',
'*.run','*.dll','*.bin','*.jar','*.msi']:
for filename in glob.glob(f'{src_dir}/{pattern}'):
os.remove(filename)
# Parse spec file
spec = Spec.from_file(f'{src_dir}/{pkg_info["name"]}.spec')
#specfiletemp_dir = tempfile.TemporaryDirectory()
#spec = Specfile(f'{src_dir}/{pkg_info["name"]}.spec',
# sourcedir=specfiletemp_dir.name)
# Get used information from specfile
commit_text = ""
header_split = []
commit_user = cfg["COMMITTER_USER"]
commit_email = cfg["COMMITTER_EMAIL"]
for c in spec.changelog.split('\n'):
if c == "":
break
if c[0:2] == "* ":
header_split = c.split(" ")
# Get committer name end email from changelog
commit_user = " ".join(header_split[5:len(header_split)-2])
commit_email = header_split[-2][1:-1]
else:
if commit_text != "":
commit_text += "\n"
if c[0:2] == "- ":
commit_text += c[2:]
else:
commit_text += c
commit_text = f'{commit_text} [release {header_split[-1]};' + \
f'{header_split[1]} {header_split[2]} {header_split[3]} {header_split[4]}]'
# Remove commented sections following spec description
spec_description = ""
if spec.description is not None:
for line in spec.description.split("\n"):
if line.startswith("#"):
break
if spec_description != "":
spec_description += '\n'
spec_description += line
spec_description = replace_macros(spec_description, spec)
# Set/update gitea repository description and website url
spec_url = replace_macros(spec.url, spec)
spec_summary = replace_macros(spec.summary, spec)
if gitea_repo.description != spec_summary or gitea_repo.website != spec_url:
gitea_repo.description = spec_summary
gitea_repo.website = spec_url
gitea_repo.commit()
# Check if tag already exists
new_tag = f'{pkg_info["v"]}-{pkg_info["r"]}'.replace('~','+')
if new_tag in repo.tags:
if options.verbose:
print(f'Skipping {pkg_info["name"]} release '
f'{pkg_info["e"]}:{pkg_info["v"]}-{pkg_info["r"]}: tag {new_tag} already exists')
return
# Create/update README.md
with open(f'{temp_dir.name}/README.md', "w") as readme_file:
readme_file.write(f"# {pkg_info['name']}\n\n{spec_description}")
repo.index.add(['README.md'])
# Update files
dir_list = os.listdir(src_dir)
for dir_file in dir_list:
copyfile(f'{src_dir}/{dir_file}',
f'{temp_dir.name}/{dir_file}')
# Add/modify files
repo.index.add([dir_file])
# Remove deleted files
temp_dir_list = os.listdir(temp_dir.name)
for temp_dir_file in temp_dir_list:
if temp_dir_file == ".git" or temp_dir_file == "README.md":
continue
if not temp_dir_file in dir_list:
repo.index.remove([temp_dir_file], working_tree = True)
# Set committer user and email
repo.config_writer().set_value("user", "name", commit_user).release()
repo.config_writer().set_value("user", "email", commit_email).release()
# Commit
print(f'Committing {pkg_info["name"]} release {new_tag}...')
repo.index.commit(commit_text)
#origin = repo.remote(name='origin')
#origin.push()
# Create and commit tag
repo.create_tag(new_tag, message=f'Release {new_tag}')
#origin.push(new_tag)
def findAndCommitPackageReleases(pkgname, pkgvr):
global options
print(f'Processing package {pkgname} on {cfg["GITEA_URL"]}...')
pkgs_info = []
# Find from archive dir
pkgnamere = pkgname.replace('+','\+')
dirs = [f for f in os.listdir(f'{cfg["ARCHIVE_DIR"]}/{pkgname[0:1]}') if re.match(f'{pkgnamere}-[^-]*-[^-]*$', f)]
for dir in dirs:
pkg_dir = f'{cfg["ARCHIVE_DIR"]}/{pkgname[0:1]}/{dir}'
spec = Spec.from_file(f'{pkg_dir}/{pkgname}.spec')
parts = re.split(f'{pkgnamere}-([^-]*)-([^-]*)$', dir)
epoch = 0 if spec.epoch is None else int(spec.epoch)
version = parts[1]
release = parts[2]
pkgs_info.append(
{'name': pkgname, 'e': epoch, 'v': version, 'r': release, 'src': pkg_dir})
# Find from OLD_DIR
dirs = [f for f in os.listdir(f'{cfg["OLD_DIR"]}') if re.match(f'{pkgnamere}_[0-9]*.[0-9]*$', f)]
for dir in dirs:
srpms_list = glob.glob(f'{cfg["OLD_DIR"]}/{dir}/{pkgname}-*.src.rpm')
for srpm in srpms_list:
parts = re.split('.*-([^-]*)-([^-]*).src.rpm$', srpm)
epoch = subprocess.run(['rpm', '-q', '--queryformat=%{epoch}', '-p', srpm],
stdout=subprocess.PIPE).stdout.decode('utf-8')
# result is "(none)" if no Epoch is set
if len(epoch) > 2:
epoch = "0"
version = parts[1]
release = parts[2]
pkgs_info.append(
{'name': pkgname, 'e': epoch, 'v': version, 'r': release, 'src': srpm})
# Find from SRPMS_DIR
srpms_list = [f for f in os.listdir(cfg["SRPMS_DIR"]) if re.match(f'{pkgnamere}-[^-]*-[^-]*$', f)]
for srpm in srpms_list:
src_path = f'{cfg["SRPMS_DIR"]}/{srpm}'
parts = re.split('.*-([^-]*)-([^-]*).src.rpm$', srpm)
epoch = subprocess.run(['rpm', '-q', '--queryformat=%{epoch}', '-p', src_path],
stdout=subprocess.PIPE).stdout.decode('utf-8')
# result is "(none)" if no Epoch is set
if len(epoch) > 2:
epoch = "0"
version = parts[1]
release = parts[2]
pkgs_info.append(
{'name': pkgname, 'e': epoch, 'v': version, 'r': release, 'src': src_path })
# Sort releases
pkgs_info.sort(key=cmp_to_key(comparePkgInfo))
# Find or create and get repository instance
gitea_repo = findOrCreateRepo(pkgname)
# Clone repository to temporary folder
repo_url = f'{cfg["GITEA_SSH_URL"]}{gitea_repo.name}.git'
temp_dir = tempfile.TemporaryDirectory()
repo = Repo.clone_from(repo_url, temp_dir.name)
# Set to push annotated tags with commits
repo.config_writer().set_value('push', 'followTags', 'true').release()
new_commits = False
for pkg_info in pkgs_info:
vr = f'{pkg_info["v"]}-{pkg_info["r"]}'
if pkgvr is not None and pkgvr != vr:
continue
# Check if tag already exists
new_tag = f'{vr}'.replace('~','+')
if new_tag in repo.tags:
if options.verbose:
print(f'Skipping {pkgname} release '
f'{pkg_info["e"]}:{vr}: tag {new_tag} already exists')
continue
#for line in sys.stdin:
# line = line.rstrip()
# break
#exit(1)
#pkg_dir = f'{cfg["ARCHIVE_DIR"]}/{pkgname[0:1]}/{pkgname}-{vr}'
commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir)
new_commits = True
if new_commits:
print(f"Pushing commits and tags for {pkgname}...")
origin = repo.remote(name='origin')
origin.push()
else:
print(f"No new commits for {pkgname}.")
temp_dir.cleanup()
def main():
global options
parser = argparse.ArgumentParser(prog='autodist-git',
description='RPM repository sync and management with git service.',
epilog="Copyright (c) 2023-2024 by Silvan Calarco <silvan.calarco@mambasoft.it> - GPL v3 License")
subparsers = parser.add_subparsers(help='sub-command help', dest='mode')
parser.add_argument('-v', '--verbose', help="verbose output", action='store_true')
parser_syncpkg = subparsers.add_parser('syncpkg', help="sync a specified package")
parser_syncpkg.add_argument('pkgname', help="name of package")
parser_syncpkg.add_argument('pkgver', help="version of package", nargs='?')
parser_syncpkg.add_argument('-d', '--delete', action='store_true', help="delete and recreate existing repository",
required=False)
parser_syncrepo = subparsers.add_parser('syncrepo', help="sync base repository with git server")
parser_syncrepo.add_argument('--from', dest='frompkg', help="from package name", required=False)
parser_syncrepo.add_argument('--to', dest='topkg', help="to package name", required=False)
parser_syncrepo.add_argument('-d', '--delete', action='store_true', help="delete and recreate existing repositories",
required=False)
try:
options = parser.parse_args()
except:
exit(1)
if options.mode == 'syncpkg':
if options.delete:
if options.pkgver is not None:
print("ERROR: specifying pkgver is not allowed with -d option")
exit(1)
repo_name = options.pkgname.replace('+','Plus')
gitea_repo = giteaGetRepository(repo_name)
if gitea_repo is not None:
print(f'Deleting repository for {options.pkgname}...')
gitea_repo.delete()
findAndCommitPackageReleases(options.pkgname, options.pkgver)
elif options.mode == 'syncrepo':
dir_list = sorted(filter(os.path.isfile, glob.glob(f'{cfg["SRPMS_DIR"]}/*.src.rpm')))
for dir_file in dir_list:
parts = re.split('.*/([^/]*)-([^-]*)-([^-]*).src.rpm$', dir_file)
pkg_name = parts[1]
if options.topkg is not None and pkg_name > options.topkg:
break
if options.frompkg is not None and pkg_name < options.frompkg:
continue
pkg_item = { 'e': 0, 'v': parts[2].replace('~','+'), 'r': parts[3]}
pkg_vr = f'{parts[2]}-{parts[3]}'
# Replace '+' for repository name as it is not allowed
repo_name = pkg_name.replace('+','Plus')
if options.delete:
gitea_repo = giteaGetRepository(repo_name)
if gitea_repo is not None:
print(f'Deleting repository for {pkg_name}...')
gitea_repo.delete()
repo_tags = giteaGetRepoTags(repo_name)
found_equal = False
found_newer = False
found_older = False
if repo_tags is None:
found_newer = True
else:
for repo_tag in repo_tags:
parts = re.split(f'([^-]*)-([^-]*)$', repo_tag["name"])
tag_item = { 'e':0, 'v': parts[1], 'r': parts[2]}
compare = comparePkgInfo(pkg_item, tag_item)
if compare == 0:
found_equal = True
elif compare > 0:
found_older = True
elif compare < 0:
found_newer = True
if not found_equal:
if repo_tags is not None:
print(f'{pkg_name} ({pkg_vr}): needs update')
findAndCommitPackageReleases(pkg_name, None)
if found_newer:
if options.verbose:
print(f'{pkg_name} ({pkg_vr}): found_equal={found_equal} found_newer={found_newer} found_older={found_older}')
else:
parser.print_help()
main()

35
autodist-inspect Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
[ -e /etc/autodist/config ] || {
echo "ERROR: missing configuration file /etc/autodist/config."
exit 1
}
. /etc/autodist/config
shopt -s nocaseglob
checkpkg=$1
if [ ! "$checkpkg" ]; then
echo "Usage:
$0 query"
exit 1
fi
[ "$LOCAL_REPS_BASE_DIR" -a -e "$LOCAL_REPS_BASE_DIR" ] || {
echo "ERROR: LOCAL_REPS_BASE_DIR needs to be defined and local repositories to exists."
exit 1
}
echo "=== distromatic sources: ==="
head -n2 ${LOCAL_REPS_BASE_DIR}/distromatic/base/sources
grep -i $checkpkg ${LOCAL_REPS_BASE_DIR}/distromatic/base/sources
#tail -n+2 ${PREFIX}/distromatic/base/deps-* | grep -i $checkpkg
echo -e "\n=== distdb: ==="
grep -i $checkpkg ${LOCAL_REPS_BASE_DIR}/base/distdb
echo -e "\n=== legacy: ==="
grep -i $checkpkg ${LOCAL_REPS_BASE_DIR}/base/legacy
for repo in base devel-makedist devel-autodist devel-misc devel-contrib devel-future; do
echo -e "\n=== ${repo}: ==="
ls ${LOCAL_REPS_BASE_DIR}/${repo}/SRPMS.base/*$checkpkg* 2>/dev/null
ls ${LOCAL_REPS_BASE_DIR}/${repo}/RPMS.*/*$checkpkg* 2>/dev/null
done

77
autodist-launcher Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
#
# autodist launcher
# (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
. /etc/sysconfig/autoport
# Disable icecc
export PATH=/usr/bin:$PATH
i=$1
[ "$i" ] || {
echo "Usage: autodist-launcher autodist_conf"
exit 1
}
PIDFILE=/run/autodist/autodist-launcher-${i}.pid
[ -e $PIDFILE ] && {
PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "autodist-launcher for configuration $i already running; exiting."
exit 0
}
}
echo $$ > $PIDFILE
trap "rm -f $PIDFILE; exit 1" SIGQUIT SIGINT SIGKILL SIGTERM
HOUR=`date +%H`
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
AUTODIST_PIDFILE=/run/autodist/autodist.pid
LOGFILE=/var/autodist/log/autodist.log
LASTLOGFILE=/var/autodist/log/autodist-last.log
if [ -e $AUTODIST_PIDFILE ]; then
PIDCHECK=`cat $AUTODIST_PIDFILE`
if [ "$PIDCHECK" -a -e /proc/$PIDCHECK ]; then
echo "autodist already running; exiting."
exit 0
fi
fi
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
REPLOGFILE=$LOCAL_REPS_BASE_DIR/$r/autodist.log
REPLASTLOGFILE=$LOCAL_REPS_BASE_DIR/$r/autodist-last.log
if [ "${AUTOPORT_UPDATE[$i]}" ]; then
if [ ! "$AUTOPORT_UPDATE_NO_DISTROMATIC" ]; then
distromatic -q -t $DISTROMATIC_REPOSITORY --gensrcpkglist > $LOCAL_REPS_BASE_DIR/$DISTROMATIC_REPOSITORY/srcpkglist 2>/dev/null
fi
#autodist-upstream-updates -q -h -u -r $DISTROMATIC_REPOSITORY -o $r \
# > $LOCAL_REPS_BASE_DIR/distromatic/$r/_popular.html
autodist-upstream-updates -q -u -r $DISTROMATIC_REPOSITORY -o $r
[ -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
rm -f ${PIDFILE}

View File

@ -1,6 +1,6 @@
#
# autodist repositories maintainance script
# Copyright (c) 2007-2014 by Silvan Calarco
# Copyright (c) 2007-2024 by Silvan Calarco
#
. /etc/autodist/config
[ -r /etc/autodist/config-secret ] && . /etc/autodist/config-secret
@ -29,7 +29,7 @@ function usage() {
echo "$me setwarning REPOSITORY {PKG ...} -t \"TEXT\""
echo "$me verify REPOSITORY [PKGS ...]"
echo
echo " -d use given repository as destination (default: devel)"
echo " -d use given repository as destination (default: base)"
echo " -f force operation"
echo " -r match repositories with given regexp"
echo " -s simulate operations to see if it would work"
@ -576,6 +576,9 @@ function import_package() {
}
# fi
# Sync new release with autodist-git
[ "$AUTODIST_GIT_SYNC" != "" ] && autodist-git syncpkg ${import_pkg}
#for i in ${pkg_obsoletes}; do
# PKG_FILENAME="$i-$pkg_version-$pkg_release.$namearch.rpm"
# DEST_URL_ARCH=$DEST_URL/$destrepository/RPMS.$namearch/$PKG_FILENAME
@ -645,7 +648,7 @@ function extract_diffinfo() {
[ $1 ] || { usage; exit 0; }
origrepository=
destrepository=devel
destrepository=base
packages=
command=
simulate=0

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# autodist upstream updates - find upstream packages updates from different internet resources
# Copyright (c) 2004-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2004-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#[ -r /etc/sysconfig/openmamba-central ] || {
@ -10,7 +10,7 @@
#}
. /etc/autodist/config
DISTROMATIC_PREFIX=/distribution/distromatic.html?
DISTROMATIC_REPOSITORY=devel
DISTROMATIC_REPOSITORY=base
DISTDB=/etc/autodist/distdb
BLACKLISTDB=/etc/autodist/blacklist
DISTDBDIR=/etc/autodist/distdb.d
@ -36,7 +36,7 @@ function usage()
echo " -s: skip fetching and parsing upstream updates"
echo " -u: output not up-to-date packages only"
echo " -q: produces quite output"
echo " -r repository: specify the distromatic base (default: devel)"
echo " -r repository: specify the distromatic base (default: base)"
echo " -o repository: specify the repository for output data (default: same as base repository)"
echo
}
@ -46,7 +46,7 @@ get_job_vector() {
local JNAME_ESCAPED=`echo $JNAME | tr - _ | tr . _ | tr @ _`
# resolve JOB_NAME from distdb
local jobtmpfile=`tempfile`
local jobtmpfile=`mktemp`
# hack to get an array variable named as $j assigned to the JOB array
echo "echo \${$JNAME_ESCAPED[*]}" > $jobtmpfile
JOB=(`. $jobtmpfile`)
@ -76,7 +76,7 @@ function version_compare()
return 2
fi
else
if [[ "$A" > "$B" ]]; then
if [[ ${1} =~ ^[0-9]+$ || "$A" > "$B" ]]; then
return 1
elif [[ "$A" < "$B" ]]; then
return 2
@ -88,7 +88,7 @@ function version_compare()
function version_find_bigger()
{
local VER1 VER2 FPOS CUTVER1 CUTVER2
VER1=$1
VER2=$2
FPOS=1
@ -157,6 +157,7 @@ CONFIG_DIR=$CACHE_DIR
UPDATES_DB=$CACHE_DIR/upstream-updates
ALIASES_DB=$CACHE_DIR/aliases
MANUALVER_DB=$CACHE_DIR/manualver
BLACKLIST_DB_PREFIX=$CACHE_DIR/blacklist.
[ -s $PKGLIST_FILE ] || {
echo "Error: file $PKGLIST_FILE is missing or empty; aborting." >&2
@ -174,15 +175,18 @@ parse_arch_linux() {
#for page in `seq 1 45`; do
for rep in core community extra; do
# SOURCEURL="https://www.archlinux.org/packages/?page=$page&sort=-last_update&q=&arch=i686&maintainer=&flagged="
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/i686/"
SOURCEURL="http://lug.mtu.edu/archlinux/$rep/os/x86_64/"
curl -L -s "$SOURCEURL" | \
grep ".pkg." | grep -v ".sig\"" | \
while read line; do
line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"`
pkg=`echo $line | sed "s|\(.*\)-[^-]*-[^-]*-[^-]*|\1|"`
ver=`echo $line | sed "s|.*-\([^-]*\)-[^-]*-[^-]*|\1|;s|.*%3a||"`
ver=`echo $line | sed "s|.*-\([^-]*\)-[^-]*-[^-]*|\1|;s|.*%3a||i;s|%2b.*||i"`
alias=`grep "^$pkg " $ALIASES_DB`
# Skip blackisted
if [ -e ${BLACKLIST_DB_PREFIX}arch ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}arch && continue
fi
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
[ "$alias" ] && pkgalias=${alias/* /} || pkgalias=$pkg
line=`grep -i "^$pkgalias:" $buildstmp || grep -i "^lib$pkgalias:" $buildstmp || grep -i " $pkgalias[^-_A-Za-z0-9]" $buildstmp`
@ -206,6 +210,9 @@ parse_xorg() {
if [ "$line" ]; then
ver=`echo $line | sed "s|.*-||"`
pkg="${line/-$ver}"
if [ -e ${BLACKLIST_DB_PREFIX}xorg ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}xorg && continue
fi
alias=`grep "^$pkg " $ALIASES_DB`
if [ ! "$alias" -a "${pkg:0:5}" == "xf86-" ]; then
alias="$pkg xorg-drv-${pkg/xf86-}"
@ -228,6 +235,9 @@ parse_gnome() {
IFS=":"
set -- $line
pkg="$2"
if [ -e ${BLACKLIST_DB_PREFIX}gnome ]; then
grep -q "^$pkg$" ${BLACKLIST_DB_PREFIX}gnome && continue
fi
ver="$3"
alias=`grep "^$pkg " $ALIASES_DB`
[ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB`
@ -249,7 +259,7 @@ parse_gnome() {
parse_distromatic() {
# parse distrowatch.com packages list
[ "$quiet" ] || echo "Parsing Distrowatch packages list..." >&2
SOURCEURL="http://distrowatch.com/packages.php"
SOURCEURL="https://distrowatch.com/packages.php"
lynx -width 300 -dump $SOURCEURL |
while read line; do
[ "`echo $line | grep "Package Version Note"`" ] && start_print=1
@ -266,41 +276,43 @@ parse_distromatic() {
}
if [ ! "$skip_parsing" ]; then
tmpfile=`mktemp -q -t autodist-upstream-updates.XXXXXXXX`
#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
parse_xorg
parse_gnome
parse_distromatic
#parse_arch_linux
#parse_xorg
#parse_gnome
#parse_distromatic
/usr/share/autodist/repology-openmamba.py > $UPDATES_DB.tmp
if [ $? -eq 0 ]; then
#cat $tmpfile | sort -uf > $UPDATES_DB.tmp
#rm -f $tmpfile
cat $tmpfile | sort -uf > $UPDATES_DB.tmp
rm -f $tmpfile
> $UPDATES_DB
unset lastpkg
while read pkg ver upsource 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
> $UPDATES_DB
unset lastpkg
while read pkg ver upsource 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 $upsource $alias" >> $UPDATES_DB
fi
else
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi
else
echo "$pkg $ver $upsource $alias" >> $UPDATES_DB
fi
lastpkg=$pkg
lastver=$ver
done < $UPDATES_DB.tmp
lastpkg=$pkg
lastver=$ver
done < $UPDATES_DB.tmp
fi
rm -f $UPDATES_DB.tmp
fi

106
automaint
View File

@ -1,13 +1,11 @@
#!/bin/bash
# automaint -- batch automatic maintainance tool of the autodist suite
# Copyright (C) 2013-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2013-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.7
# First in vector is base arch
ARCHS=(i586 arm x86_64)
. /etc/autodist/config
me=(${0##*/} $VERSION "Sat Mar 20 2011")
@ -15,7 +13,7 @@ me=(${0##*/} $VERSION "Sat Mar 20 2011")
function usage() {
echo "\
${me[0]} ${me[1]}
"$"Copyright (C) 2013 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Copyright (C) 2013-2021 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Batch automatic maintainance tool of the autodist suite.""
@ -152,8 +150,8 @@ done
[ "$TESTMODE" ] && echo "** TEST MODE enabled: no changes will be made **"
for a in `seq 1 ${#ARCHS[*]}`; do
. $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY/builds-${ARCHS[$a-1]}.sh
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
. $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY/builds-${AUTODIST_ARCHS[$a-1]}.sh
pkglist[$a-1]="${pkg_list[*]}"
warningslist[$a-1]="${warnings_list[*]}"
needportlist[$a-1]="${needport_list[*]}"
@ -164,7 +162,7 @@ tmpfile=`mktemp -q -t $me.XXXXXXXX` || {
exit 1
}
for a in `seq 1 ${#ARCHS[*]}`; do
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
echo -n "${pkglist[$a-1]} " >> $tmpfile
done
allpkgs="`cat $tmpfile | xargs -n 1 | sort -u | xargs`"
@ -173,46 +171,55 @@ rm -f $tmpfile
for p in ${allpkgs}; do
pkgcontinue=
needsport=
for w in ${warningslist[*]}; do
[ "$p" = "$w" ] && { pkgcontinue=1; break; }
done
[ "$pkgcontinue" ] && continue
for a in `seq 1 ${#ARCHS[*]}`; do
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${ARCHS[$a-1]} $p
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
# Get pkg info from port repository
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$PORT_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
# If not found get info from main repository
if [ ! "$pkg_name" ]; then
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
fi
if [ "$pkg_name" ]; then
spkg_version=$pkg_version
spkg_release=$pkg_release
old_pkg_version=$pkg_version
old_pkg_release=$pkg_release
old_pkg_repository=$pkg_repository
break
fi
done
[ "$pkg_name" ] || {
echo "$p: not present in $DEST_REPOSITORY; skipping."
[ "$VERBOSE" ] && echo "$p: not present in $DEST_REPOSITORY; skipping."
continue
}
[ "$VERBOSE" ] && echo "$p: old release in $DEST_REPOSITORY is $spkg_version-$spkg_release"
[ "$VERBOSE" ] && echo "$p: old release in $DEST_REPOSITORY is $old_pkg_version-$old_pkg_release"
for o in ${needportlist[*]}; do
[ "$p" = "$o" ] && { needsport=1; break; }
done
#[ "$needsport" ] && continue
[ "$needsport" -a ! "$PORT_REPOSITORY" ] && continue
for a in `seq 1 ${#ARCHS[*]}`; do
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY ${ARCHS[$a-1]} $p
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
[ "$pkg_name" ] && break
done
[ "$pkg_name" ] || {
echo "$p: not present in $SOURCE_REPOSITORY; skipping."
[ "$VERBOSE" ] && echo "$p: not present in $SOURCE_REPOSITORY; skipping."
continue
}
[ "$VERBOSE" ] && echo "$p: new release in $SOURCE_REPOSITORY is $pkg_version-$pkg_release"
if [ "$pkg_version" = "$spkg_version" ]; then
if [ "$pkg_release" = "$spkg_release" ]; then
if [ "$pkg_version" = "$old_pkg_version" ]; then
if [ "$pkg_release" = "$old_pkg_release" ]; then
echo "$p: same release as upstream; skipping."
continue
fi
@ -220,7 +227,7 @@ for p in ${allpkgs}; do
else
OIFS=$IFS
IFS='.'
read -ra SVER <<< "$spkg_version"
read -ra SVER <<< "$old_pkg_version"
read -ra VER <<< "$pkg_version"
IFS=$OIFS
dotdiff=`expr ${#VER[*]} - ${#SVER[*]}`
@ -234,40 +241,51 @@ for p in ${allpkgs}; do
continue
fi
update_type="minor"
elif [ $dotdiff -lt 0 ]; then
[ "$VERBOSE" ] && echo "$p: newer version has less dots than older ${#VER[*]} < ${#SVER[*]}; skipping."
continue
elif [ "$i" != "${#SVER[*]}" ]; then
# e.g. SVER=0.11 -> VER=1.0
[ "$VERBOSE" ] && echo "$p: not a minor version update at position $i/${#SVER[*]}: ${SVER[i-1]} != ${VER[i-1]}; skipping."
continue
#elif [ $dotdiff -lt 0 ]; then
# [ "$VERBOSE" ] && echo "$p: newer version has less dots than older ${#VER[*]} < ${#SVER[*]}; skipping."
# continue
#elif [ "$i" != "${#SVER[*]}" ]; then
# # e.g. SVER=0.11 -> VER=1.0
# [ "$VERBOSE" ] && echo "$p: not a minor version update at position $i/${#SVER[*]}: ${SVER[i-1]} != ${VER[i-1]}; skipping."
# continue
elif [ "${SVER[i-1]}" = "${VER[i-1]}" -a $dotdiff -ge 1 ]; then
# e.g. SVER=0.11.2 -> VER=0.11.2.3
update_type="minor"
else
echo "$p: UNEXPECTED CASE - CHECK CODE; skipping."
elif [[ 64#${VER[i-1]} -gt 64#89 && 64#${SVER[i-1]} -lt 64#80 ]]; then
[ "$VERBOSE" ] && echo "$p: dubious beta upgrade from ${SVER[i-1]} to ${VER[i-1]}; skipping."
continue
elif [[ 64#${VER[i-1]} -gt 64#${SVER[i-1]} && $i -gt 1 ]]; then
# e.g. SVER=1.0.2 -> VER=1.0.3.dev1234
update_type="minor"
#else
# [ "$VERBOSE" ] && echo "$p: major version update ${SVER[i-1]} vs ${VER[i-1]}; skipping"
# continue
fi
fi
if [ "$needsport" ]; then
echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release)"
if [ ! "$TESTMODE" ]; then
autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null
if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=${WEBBUILD_SECRET}&USER_EMAIL=$WEBBUILD_EMAIL&\
#if [ ! "${needsport}" ]; then
if [ "$old_pkg_repository" == "$PORT_REPOSITORY" -o "$old_pkg_repository" == "$DEST_REPOSITORY" ]; then
echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($pkg_version-$pkg_release -> $old_pkg_version-$old_pkg_release)"
if [ ! "$TESTMODE" ]; then
autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null
if [ $? -eq 0 -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 \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$PORT_REPOSITORY</b> for porting\"`" >/dev/null
fi
fi
fi
else
echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release; update type: $update_type)"
if [ ! "$TESTMODE" ]; then
autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null
if [ $? -eq 0 -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 \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$DEST_REPOSITORY</b>\"`" >/dev/null
fi
fi
fi
#fi
#elif [ "$old_pkg_repository" == "$DEST_REPOSITORY" ]; then
# echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($pkg_version-$pkg_release -> $old_pkg_version-$old_pkg_release; update type: $update_type)"
# if [ ! "$TESTMODE" ]; then
# autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null
# if [ $? -eq 0 -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 \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$DEST_REPOSITORY</b>\"`" >/dev/null
# fi
# fi
# else
# echo "$p: upstream package repository $pkg_repository does not match with $DEST_REPOSITORY; skipping."
# fi
done
exit 0

154
autoport
View File

@ -1,14 +1,13 @@
#!/bin/bash
# autoport -- batch cross-build tool based on autodist
# Copyright (C) 2011-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2011-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=0.9.21
VERSION=1.4.3
BASE_ARCH=i586
BASE_REPOSITORY=devel
PORT_REPOSITORY=devel
BASE_REPOSITORY=base
PORT_REPOSITORY=base
. /etc/autodist/config
@ -17,7 +16,7 @@ me=(${0##*/} $VERSION "Sat Mar 20 2011")
function usage() {
echo "\
${me[0]} ${me[1]}
"$"Copyright (C) 2011-2014 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Copyright (C) 2011-2023 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license"
echo "
"$"Batch port and cross-build tool based on autodist.""
@ -125,7 +124,7 @@ function get_pkg_buildinfo() {
fi
pkg_archs=();
for a in ${archs[*]}; do
for a in ${AUTODIST_ARCHS[*]}; do
[ "$a" = "${local_arch}" ] && continue
pkg_header=();
DISTROMATIC_BUILD_FILE=$local_distromatic/builds-$a.sh
@ -162,6 +161,7 @@ function get_pkg_buildinfo() {
pkg_buildtime=${pkg_header[7]};
pkg_altrep=${pkg_header[8]};
pkg_repository=${pkg_header[9]};
pkg_epoch=${pkg_header[10]};
return 0
fi
unset pkg_name pkg_arch pkg_version pkg_release \
@ -184,7 +184,7 @@ _EOF
function find_source_by_provide() {
local pkg=`echo $2 | sed "s|(|\\\\\[|g;s|)|\\\\\]|g;s|:|_|g"`
grep "^$pkg:" $DATADIR/$1/sources-{$BASE_ARCH,$TARGET_ARCH} | \
grep "^$pkg:" $DATADIR/$1/sources-* | \
awk '{ $1=""; print $0 }' | \
sed "s|[[:space:]]_| |g"
}
@ -241,30 +241,43 @@ function find_requirements() {
fetch_repfiles() {
local u
curl -f -L -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o $DATADIR/$PORT_REPOSITORY/srcpkglist ||
echo "Warning: unable to fetch ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH -o $DATADIR/$PORT_REPOSITORY/sources-$BASE_ARCH ||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH"
curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-$TARGET_ARCH -o $DATADIR/$PORT_REPOSITORY/sources-$TARGET_ARCH ||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-$TARGET_ARCH"
curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh -o $DATADIR/$PORT_REPOSITORY/builds-$TARGET_ARCH.sh ||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh"
f=${DATADIR}/${PORT_REPOSITORY}/srcpkglist
if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
curl -f -L -s ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist -o ${f} ||
echo "Warning: unable to fetch ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
fi
for a in ${AUTODIST_ARCHS[*]}; do
f=${DATADIR}/${PORT_REPOSITORY}/sources-${a}
if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a}"
curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a} -o ${f} ||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/sources-${a}"
fi
f=${DATADIR}/${PORT_REPOSITORY}/builds-${a}.sh
if [ ! -e ${f} -o "`find ${f} -mmin +60 2>/dev/null`" ]; then
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh"
curl -f -L -s $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh -o ${f} ||
echo "Warning: unable to fetch $PORT_REPOSITORY_DISTROMATIC_URL/builds-${a}.sh"
fi
done
for u in ${AUTOPORT_UNSTAGE_ARCHS}; do
[ "$u" = "$TARGET_ARCH" ] && {
rm -f $DATADIR/$PORT_REPOSITORY/unstage.$TARGET_ARCH
return
}
done
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching ${REPS_BASE_URL}/${PORT_REPOSITORY/-*}/unstage.$TARGET_ARCH"
curl -f -L -s ${REPS_BASE_URL}/${PORT_REPOSITORY/-*}/unstage.$TARGET_ARCH -o $DATADIR/$PORT_REPOSITORY/unstage.$TARGET_ARCH ||
echo "Warning: unable to fetch ${REPS_BASE_URL}/${PORT_REPOSITORY/-*}/unstage.$TARGET_ARCH"
}
[ $# -gt 0 ] || { usage ; exit 1; }
BUILD_ARCH=`uname -i`
[ "$BUILD_ARCH" ] || BUILD_ARCH=`uname -m`
case $BUILD_ARCH in
i386|i486|i686) BUILD_ARCH=i586; BASE_ARCH=x86_64 ;;
i386|i486|i686) BUILD_ARCH=i586 ;;
arm*) BUILD_ARCH=arm ;;
esac
@ -325,14 +338,21 @@ done
[ "$DEST_REPOSITORY" ] || DEST_REPOSITORY=$PORT_REPOSITORY
if [ "$BATCH_MODE" ]; then
PIDFILE="/run/autodist/autoport-${BUILD_ARCH}-${PORT_REPOSITORY}.pid"
[ -e $PIDFILE ] && {
PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK -a ! "$DISABLE_PID_CHECK" ] && {
echo "Error: autoport -b already running with PID=$PIDCHECK.Aborting."
exit 1
}
}
echo $$ > $PIDFILE
trap "rm -f $PIDFILE; exit 1" SIGQUIT SIGINT SIGKILL SIGTERM
fi
for TARGET_ARCH in ${TARGET_ARCHS}; do
[ "$BASE_ARCH" = "$TARGET_ARCH" -a "$PORT_REPOSITRY" = "$DEST_REPOSITORY" ] && {
echo "Error: base and target arch ($BASE_ARCH) are the same as well as port and release repositories ($PORT_REPOSITORY); skipping."
continue
}
archs=($BASE_ARCH $TARGET_ARCH)
JOBS_SKIPPED=()
JOBS_CANTPREPARE=()
JOBS_CANTINSTALL=()
@ -372,10 +392,6 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "Port repository is $PORT_REPOSITORY"
echo "Release repository is $DEST_REPOSITORY"
# old files cleanup
rm -f $DATADIR/$PORT_REPOSITORY/sources-$TARGET_CPU
rm -f $DATADIR/$PORT_REPOSITORY/builds-$BASE_ARCH.sh
fetch_repfiles
[ "$AUTO_MODE" -a -e $DATAARCHDIR/last ] && . $DATAARCHDIR/last
@ -384,10 +400,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $TARGET_ARCH $j
port_pkg_list=${pkg_needrebuild[*]}
port_pkg_builds=" ${pkg_builds[*]} "
port_pkg_epoch=$pkg_epoch
port_pkg_version=$pkg_version
port_pkg_release=$pkg_release
currrebuild=
currjobsscriptargs=
currjobscriptargs=
JOBNUM=0
for p in ${port_pkg_list}; do
if [ "${p/@*}" != "$currrebuild" ]; then
@ -399,10 +416,12 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
let JOBNUM+=1
fi
currprovider=${p/*@}
if [ "$port_pkgbuilds/ $currprovider-devel }" != "$port_pkgbuilds" ]; then
if [ "${currprovider/-devel}" == "$currprovider" ]; then
currprovider=${currprovider}-devel
fi
currjobscriptargs="$currjobscriptargs --buildreq ${currprovider} >= $port_pkg_version-$port_pkg_release "
add_epoch=""
[ "${port_pkg_epoch}" ] && add_epoch="${port_pkg_epoch}:"
currjobscriptargs="$currjobscriptargs --buildreq ${currprovider} >= ${add_epoch}${port_pkg_version}-${port_pkg_release} "
done
[ "$currjobscriptargs" ] && JOB_SCRIPTARGS[$JOBNUM-1]="$currjobscriptargs"
echo "Package dependant from $j to rebuild: ${JOB[*]}"
@ -413,13 +432,13 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
[ "$FIX_MODE" -o "$BATCH_MODE" -o "${JOB[*]}" ] || { echo "Nothing to do."; exit 0; }
if [ "$BATCH_MODE" ]; then
[ "${JOB[*]}" ] && {
echo "Error: no jobs allowed in batch mode; aborting."
exit 1
}
# old files cleanup
rm -f $DATADIR/$BASE_REPOSITORY/builds-$BASE_ARCH.sh
rm -f $DATADIR/$BASE_REPOSITORY/builds-$TARGET_ARCH.sh
rm -f $DATADIR/$BASE_REPOSITORY/builds-*.sh
get_pkg_buildinfo $DATADIR/$PORT_REPOSITORY $TARGET_ARCH
port_pkg_list=${pkg_list[*]}
@ -436,12 +455,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
fi
done
echo "Packages to rebuild: ${JOB[*]}"
else
echo "Packages to port: ${needport_list[*]}"
for p in ${needport_list[*]}; do
JOB=(${JOB[*]} $p)
done
fi
echo "Packages to port: ${needport_list[*]}"
for p in ${needport_list[*]}; do
JOB=(${JOB[*]} $p)
done
[ -e $DATADIR/autoport-$PORT_REPOSITORY-current ] && \
mv $DATADIR/autoport-$PORT_REPOSITORY-current $DATADIR/autoport-$PORT_REPOSITORY-last
@ -461,6 +479,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
> $DATAARCHDIR/preparedjobs
}
[ -e $DATAARCHDIR/updatedjobs ] || > $DATAARCHDIR/updatedjobs
find $DATAARCHDIR/updatedjobs -ctime 1 >/dev/null && {
> $DATAARCHDIR/updatedjobs
}
sudo autoport-fix-environment $TARGET_ARCH
[ "$FIX_MODE" ] && exit 0
@ -532,31 +555,35 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
DONT_PREPARE_THIS=
RELEASE_UPDATED=
grep -q ^$JOB_CURRENT\$ $DATAARCHDIR/preparedjobs && RELEASE_UPDATED=1
for p in ${JOB_CMDLINE[*]}; do
[ "$p" = "${JOB_CURRENT}" -o "$DONT_PREPARE_ANY" ] || continue
[ -e ${SPECDIR}/${JOB_CURRENT}.spec ] && DONT_PREPARE_THIS="$DONT_PREPARE"
done
[ ! "$DONT_PREPARE_THIS" -a ! "`grep ^$JOB_CURRENT\$ $DATAARCHDIR/preparedjobs`" ] && {
echo -n "prepare"
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -p ${JOB_CURRENT} --server $PORT_REPOSITORY --repository $PORT_REPOSITORY --severity 2 -- $STAGEOPTS"
LANG=C LC_ALL=C autodist -p ${JOB_CURRENT} --server $PORT_REPOSITORY --repository $PORT_REPOSITORY --severity 2 -- $STAGEOPTS &>$tmpfile
cat $tmpfile >> $logfile
if [ ! "$REBUILD_DEPENDANT_MODE" -a "$step" = "1" ]; then
REPOSITORY_STRICT_ADD="--repository-strict"
else
REPOSITORY_STRICT_ADD=""
fi
# [ "$VERBOSE_MODE" ] && echo "
#%% COMMAND: LANG=C LC_ALL=C autodist -p ${JOB_CURRENT} --server $PORT_REPOSITORY --repository $PORT_REPOSITORY $REPOSITORY_STRICT_ADD --severity 2 -- $STAGEOPTS"
LANG=C LC_ALL=C autodist -p ${JOB_CURRENT} --server $PORT_REPOSITORY --repository $PORT_REPOSITORY $REPOSITORY_STRICT_ADD --severity 2 -- $STAGEOPTS &>$tmpfile
[ $? -gt 0 ] && {
RES=`find_source_by_provide $PORT_REPOSITORY $JOB_CURRENT`
for j in ${RES}; do
[ "$j" != "$JOB_CURRENT" ] && RESOLVED_JOB="$RESOLVED_JOB $j"
done
if [ "$RESOLVED_JOB" ]; then
echo "(FAILED) [but scheduling $RESOLVED_JOB]"
JOB_FAILED=(${JOB_FAILED[*]} $RESOLVED_JOB)
else
echo "(FAILED) "
fi
echo "(FAILED) "
JOB_CANTPREPARE=(${JOB_CANTPREPARE[*]} $JOB_CURRENT)
autoport_log ${JOB_CURRENT} prepare failed $tmpfile
continue
} || {
spec_version=`grep -m1 "^Version:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
spec_release=`grep -m1 "^Release:" ${SPECDIR}/${JOB_CURRENT}.spec | awk '{ print $2}'`
if [ "${spec_version}-${spec_release}" != "$src_version-$src_release" ]; then
echo "< (FAILED) [wrong version ${src_version}-${src_release} != ${spec_version}-${spec_release}]"
JOB_CANTPREPARE=(${JOB_CANTPREPARE[*]} $JOB_CURRENT)
autoport_log ${JOB_CURRENT} prepare failed $tmpfile
continue
fi
echo $JOB_CURRENT >> $DATAARCHDIR/preparedjobs
echo -n "(OK) "
autoport_log ${JOB_CURRENT} prepare ok $tmpfile
@ -565,11 +592,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo -n "update"
if [ "$REBUILD_DEPENDANT_MODE" ]; then
SCRIPT_ARGS="${JOB_SCRIPTARGS[$JOB_NUM-1]}"
changelogadd="`echo ${SCRIPT_ARGS} | sed "s|--buildreq|,|;s| ||g;s|^,||g"`"
changelogadd="`echo ${SCRIPT_ARGS} | sed "s|--buildreq|,|g;s| ||g;s|^,||g"`"
REBUILD_CHANGELOG="rebuilt by autoport with build requirements: '${changelogadd}'"
fi
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" --- \"$SCRIPT_ARGS\""
# [ "$VERBOSE_MODE" ] && echo "
#%% COMMAND: LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" --- \"$SCRIPT_ARGS\""
LANG=C LC_ALL=C autodist -u --rebuild -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" --- $SCRIPT_ARGS &>$tmpfile
[ $? -gt 0 ] && {
echo "(FAILED) "
@ -579,11 +606,12 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
autoport_log ${JOB_CURRENT} update ok $tmpfile
echo -n "(OK) "
RELEASE_UPDATED=1
echo $JOB_CURRENT >> $DATAARCHDIR/updatedjobs
}
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\""
# [ "$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\" --- $SCRIPT_ARGS &>$tmpfile
cat $tmpfile >> $logfile
[ $? -gt 0 ] && {
@ -601,10 +629,11 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo "(FAILED) [can't get repository information for this package]"
continue
}
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autospec -u ${JOB_CURRENT} -a4 --rebuild --changelog \"$REBUILD_MILESTONE milestone rebuild\""
src_release_num=`echo $src_release | sed "s|\([0-9.]*\).*|\1|"`
# [ "$VERBOSE_MODE" ] && echo "
#%% COMMAND: LANG=C LC_ALL=C autospec -u ${JOB_CURRENT} -a4 --changelog \"$REBUILD_MILESTONE milestone rebuild\" $src_version $src_release_num${REBUILD_MILESTONE}"
# FIXME: should be implemented in autodist
LANG=C LC_ALL=C autospec -u ${JOB_CURRENT} -a4 --rebuild --changelog "$REBUILD_MILESTONE milestone rebuild" &>$tmpfile
LANG=C LC_ALL=C autospec -u ${JOB_CURRENT} -a4 --changelog "$REBUILD_MILESTONE milestone rebuild" $src_version $src_release_num${REBUILD_MILESTONE} &>$tmpfile
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
echo
@ -640,8 +669,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
SEND_REPOSITORY=$src_repository
fi
[ ! "$DONT_PREPARE_THIS" -a ! "$RELEASE_UPDATED" ] && NOSRPM_OPTS="--nosrpm" || NOSRPM_OPTS="--force"
[ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -b -s ${JOB_CURRENT} --arch $TARGET_ARCH --server $SEND_REPOSITORY --repository $PORT_REPOSITORY --severity 2 $FORCE_FLAG -- $STAGEOPTS $NOSRPM_OPTS"
# [ "$VERBOSE_MODE" ] && echo "
#%% COMMAND: LANG=C LC_ALL=C autodist -b -s ${JOB_CURRENT} --arch $TARGET_ARCH --server $SEND_REPOSITORY --repository $PORT_REPOSITORY --severity 2 $FORCE_FLAG -- $STAGEOPTS $NOSRPM_OPTS"
LANG=C LC_ALL=C autodist -b -s ${JOB_CURRENT} --arch $TARGET_ARCH --server $SEND_REPOSITORY --repository $PORT_REPOSITORY --severity 2 $FORCE_FLAG -- $STAGEOPTS $NOSRPM_OPTS &>$tmpfile
[ $? -gt 0 ] && {
if [ "$VERBOSE_MODE" ]; then
@ -780,4 +809,5 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
rm -f $tmpfile $tmpfile1
done
echo "* All jobs completed. See $logfile for details."
[ "$BATCH_MODE" ] && rm -f $PIDFILE
exit ${#JOB_FAILED[*]}

View File

@ -30,7 +30,7 @@ function fix_la_files() {
sed -i "s|libdir='/usr/$TARGET_PLATFORM/${_lib}'|libdir='/usr/${_lib}'|g" /usr/${_lib}/*.la
sed -i "s|libdir='/$TARGET_PLATFORM/${_lib}'|libdir='/usr/${_lib}'|g" /usr/${_lib}/*.la
sed -i "s|/usr/$TARGET_PLATFORM/${_lib}|/usr/${_lib}|g" /usr/${_lib}/*.la
sed -i "s|[:space:]/usr/$TARGET_PLATFORM/${_lib}|[:space:]/usr/${_lib}/lib|g" /usr/${_lib}/*.la
sed -i "s|[[:space:]]/usr/$TARGET_PLATFORM/${_lib}|[[:space:]]/usr/${_lib}/lib|g" /usr/${_lib}/*.la
}
done
}
@ -41,7 +41,7 @@ function fix_la_files_cross() {
sed -i "s|libdir='/usr/${_lib}'|libdir='/usr/$TARGET_PLATFORM/${_lib}'|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
sed -i "s|libdir='/${_lib}'|libdir='/usr/$TARGET_PLATFORM/${_lib}'|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
sed -i "s|/usr/${_lib}|/usr/$TARGET_PLATFORM/${_lib}|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
sed -i "s|[:space:]/lib/${_lib}|[:space:]/usr/$TARGET_PLATFORM/${_lib}/lib|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
sed -i "s|[[:space:]]/lib/${_lib}|[[:space:]]/usr/$TARGET_PLATFORM/${_lib}/lib|g" /usr/$TARGET_PLATFORM/${_lib}/*.la
}
done
}

111
autoport-launcher Executable file
View File

@ -0,0 +1,111 @@
#!/bin/bash
#
# autoport launcher
# (c) 2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#. /etc/sysconfig/openmamba-central
. /etc/sysconfig/autoport
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
i=$1
[ "$i" ] || {
echo "Usage: autoport-launcher autoport_conf"
exit 1
}
[ "`uname -m`" = "x86_64" ] && HOST_IS_X86_64=1
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && exit 0
PIDFILE=/run/autodist/autoport-launcher-${i}.pid
[ -e $PIDFILE ] && {
PIDCHECK=`cat $PIDFILE`
[ "$PIDCHECK" -a -e /proc/$PIDCHECK ] && {
echo "autoport-launcher for configuration $i already running; exiting."
exit 0
}
}
echo $$ > $PIDFILE
trap "rm -f $PIDFILE; exit 1" SIGQUIT SIGINT SIGKILL SIGTERM
if [ "$HOST_IS_X86_64" -a "${AUTOPORT_ARCH[$i]}" != "x86_64" ]; then
CMD_PREFIX=linux32
else
CMD_PREFIX=
fi
UPDATE_DONE=
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
AUTOPORT_PIDFILE="/run/autodist/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
LOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}.log"
LASTLOGFILE="/var/autodist/log/autoport-native-$r-${AUTOPORT_ARCH[$i]}-last.log"
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
AUTOPORT_PIDFILE="/var/autoport/${AUTOPORT_CHROOT[$i]}/run/autodist/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
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
AUTOPORT_PIDFILE="/run/autoport/autoport-${AUTOPORT_ARCH[$i]}-$r.pid"
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
if [ "$UPDATE_DONE" == "" ]; then
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_ARCH[$i]} native environment"
echo "= Updating packages in ${AUTOPORT_ARCH[$i]} native environment..." >> $LOGFILE
LANG=C dnf update -y >> $LOGFILE
UPDATE_DONE=1
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment"
#echo "= Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment..." >> $LOGFILE
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} dnf update -y > /dev/null
#[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream start
UPDATE_DONE=1
fi
fi
if [ -e $AUTOPORT_PIDFILE ]; then
PIDCHECK=`cat $AUTOPORT_PIDFILE`
if [ "$PIDCHECK" -a -e /proc/$PIDCHECK ]; then
echo "autoport for configuration $i already running; continuing."
continue
fi
fi
[ -e $LOGFILE ] && mv $LOGFILE $LASTLOGFILE
echo "+ Autoport start at `date`" > $LOGFILE
echo "============================================" >> $LOGFILE
if [ "${AUTOPORT_NATIVE[$i]}" ]; then
echo "= Working on $r(${AUTOPORT_ARCH[$i]}) in native mode" >> $LOGFILE
su -l ${AUTOPORT_CHROOT_USER[$i]} -c "$CMD_PREFIX autoport -b -r $r" >> $LOGFILE
AUTODIST_HOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
cat $AUTODIST_HOME/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
elif [ "${AUTOPORT_CHROOT[$i]}" ]; then
echo "= Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode..." >> $LOGFILE
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "autodist" ]; then
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
else
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
fi
elif [ "${AUTOPORT_CROSS[$i]}" ]; then
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode"
echo "= Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode" >> $LOGFILE
su -l autodist -c "autoport -b -x ${AUTOPORT_CROSS[$i]} -r $r" >> $LOGFILE
cat /var/autodist/.autoport/${AUTOPORT_CROSS[$i]}/$r-current.log >> $LOGFILE
fi
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
done
rm -f ${PIDFILE}

View File

@ -6,7 +6,7 @@ VENDOR="openmamba"
curl_opts_netlink="--connect-timeout 15 --retry 3 -s"
packager_fullname="Automatic Build System"
packager_email="autodist@mambasoft.it"
packager_email="autodist@openmamba.org"
ftp_rw_server_num_default=0
colorize=0
@ -20,72 +20,58 @@ source_dir="/var/autodist/RPM/SOURCES"
build_dir="/var/autodist/RPM/BUILD"
tmppath_dir="/var/tmp/autodist"
ftp_alias[0]="devel"
ftpurl_ro_rpms[0]="ftp://ftp.openmamba.org/pub/openmamba/devel/RPMS.@arch@"
ftpurl_ro_srpms[0]="ftp://ftp.openmamba.org/pub/openmamba/devel/SRPMS.base"
ftp_rw_server[0]="ftp://ftp.openmamba.org"
ftp_alias[0]="base"
ftpurl_ro_rpms[0]="https://push.openmamba.org/pub/openmamba/base/RPMS.@arch@"
ftpurl_ro_srpms[0]="https://push.openmamba.org/pub/openmamba/base/SRPMS.base"
ftp_rw_server[0]="https://push.openmamba.org/pub/openmamba/base"
ftp_rw_port[0]=
ftp_rw_passive_mode[0]=on
ftp_rw_user[0]=
ftp_rw_passwd[0]=
ftp_rw_rpms_dir[0]="/RPMS.@arch@"
ftp_rw_srpms_dir[0]="/SRPMS.base"
arch_list[0]="i586 ppc arm x86_64"
arch_noarch_upload[0]="${arch_list[0]}"
arch_list[0]="i586 x86_64 aarch64"
arch_noarch_upload[0]="@arch@"
ftpdir_rw_old[0]="/old"
ftp_alias[1]="devel-games"
ftpurl_ro_rpms[1]="ftp://ftp.openmamba.org/pub/openmamba/devel-games/RPMS.@arch@"
ftpurl_ro_srpms[1]="ftp://ftp.openmamba.org/pub/openmamba/devel-games/SRPMS.base"
ftp_rw_server[1]="ftp://ftp.openmamba.org"
ftp_alias[1]="devel-makedist"
ftpurl_ro_rpms[1]="https://push.openmamba.org/pub/openmamba/devel-makedist/RPMS.@arch@"
ftpurl_ro_srpms[1]="https://push.openmamba.org/pub/openmamba/devel-makedist/SRPMS.base"
ftp_rw_server[1]="https://push.openmamba.org/pub/openmamba/devel-makedist"
ftp_rw_port[1]=
ftp_rw_passive_mode[1]=on
ftp_rw_user[1]=
ftp_rw_passwd[1]=
ftp_rw_rpms_dir[1]="/RPMS.@arch@"
ftp_rw_srpms_dir[1]="/SRPMS.base"
arch_list[1]="i586"
arch_noarch_upload[1]="${arch_list[1]}"
arch_list[1]="i586 x86_64 aarch64"
arch_noarch_upload[1]="@arch@"
ftpdir_rw_old[1]="/old"
ftp_alias[2]="devel-makedist"
ftpurl_ro_rpms[2]="ftp://ftp.openmamba.org/pub/openmamba/devel-makedist/RPMS.@arch@"
ftpurl_ro_srpms[2]="ftp://ftp.openmamba.org/pub/openmamba/devel-makedist/SRPMS.base"
ftp_rw_server[2]="ftp://ftp.openmamba.org"
ftp_alias[2]="devel-misc"
ftpurl_ro_rpms[2]="https://push.openmamba.org/pub/openmamba/devel-misc/RPMS.@arch@"
ftpurl_ro_srpms[2]="https://push.openmamba.org/pub/openmamba/devel-misc/SRPMS.base"
ftp_rw_server[2]="https://push.openmamba.org/pub/openmamba/devel-misc"
ftp_rw_port[2]=
ftp_rw_passive_mode[2]=on
ftp_rw_user[2]=
ftp_rw_passwd[2]=
ftp_rw_rpms_dir[2]="/RPMS.@arch@"
ftp_rw_srpms_dir[2]="/SRPMS.base"
arch_list[2]="i586"
arch_noarch_upload[2]="${arch_list[2]}"
arch_list[2]="i586 x86_64 aarch64"
arch_noarch_upload[2]="@arch@"
ftpdir_rw_old[2]="/old"
ftp_alias[3]="devel-autodist"
ftpurl_ro_rpms[3]="ftp://ftp.openmamba.org/pub/openmamba/devel-autodist/RPMS.@arch@"
ftpurl_ro_srpms[3]="ftp://ftp.openmamba.org/pub/openmamba/devel-autodist/SRPMS.base"
ftp_rw_server[3]="ftp://ftp.openmamba.org"
ftpurl_ro_rpms[3]="https://push.openmamba.org/pub/openmamba/devel-autodist/RPMS.@arch@"
ftpurl_ro_srpms[3]="https://push.openmamba.org/pub/openmamba/devel-autodist/SRPMS.base"
ftp_rw_server[3]="https://push.openmamba.org/pub/openmamba/devel-autodist"
ftp_rw_port[3]=
ftp_rw_passive_mode[3]=on
ftp_rw_user[3]=
ftp_rw_passwd[3]=
ftp_rw_rpms_dir[3]="/RPMS.@arch@"
ftp_rw_srpms_dir[3]="/SRPMS.base"
arch_list[3]="i586"
arch_noarch_upload[3]="${arch_list[3]}"
arch_list[3]="i586 x86_64 aarch64"
arch_noarch_upload[3]="@arch@"
ftpdir_rw_old[3]="/old"
ftp_alias[4]="devel-future"
ftpurl_ro_rpms[4]="ftp://ftp.openmamba.org/pub/openmamba/devel-future/RPMS.@arch@"
ftpurl_ro_srpms[4]="ftp://ftp.openmamba.org/pub/openmamba/devel-future/SRPMS.base"
ftp_rw_server[4]="ftp://ftp.openmamba.org"
ftp_rw_port[4]=
ftp_rw_passive_mode[4]=on
ftp_rw_user[4]=
ftp_rw_passwd[4]=
ftp_rw_rpms_dir[4]="/RPMS.@arch@"
ftp_rw_srpms_dir[4]="/SRPMS.base"
arch_list[4]="i586"
arch_noarch_upload[4]="${arch_list[4]}"
ftpdir_rw_old[4]="/old"

View File

@ -4,15 +4,13 @@ openmamba-sound-theme
desktop-base-openmamba
autodist
kernel27
rpm
apt
rootfiles
soundfont-2rock9
livecd-tools
makedist
makedist-openmamba
postplug
grub-theme-openmamba
kdevelop
lxde
distromatic
u-boot

View File

@ -1,7 +1,7 @@
# Global configuration file for autodist
#
AUTODIST_ARCHS=(i586 x86_64 arm)
SITE_BASE_URL=http://www.openmamba.org
AUTODIST_ARCHS=(i586 x86_64 arm aarch64)
SITE_BASE_URL=https:/openmamba.org
REPS_BASE_URL=${SITE_BASE_URL}/pub/openmamba
LOCAL_REPS_BASE_DIR=/var/ftp/pub/openmamba
SEND_SERVER=devel-autodist
@ -11,42 +11,39 @@ SEND_SERVER=devel-autodist
#WEBBUILD_SECRET=
WEBBUILD_STATEDIR=/var/webbuild
WEBBUILD_DISTROQUERY_URL="http://www.openmamba.org/cgi-bin/distroquery"
AUTOBUILD_MAXNUM=200
AUTOBUILD_MAXNUM=500
AUTOBUILD_DATEFROM=20060601
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)
AUTODIST_REPOSITORIES=(base devel-makedist devel-autodist devel-misc)
AUTOPORT_UNSTAGE_ARCHS="i586"
AUTOPORT_STAGEVARS="--define stage1=1"
AUTOPORT_MAX_STEPS=10
#RPMDIR=/usr/src/RPM
AUTODIST_REBUILDOLD_MAX=20
AUTODIST_REBUILDOLD_FROMDATE=20090101
#AUTODIST_GIT_SYNC=1
#
# Set to disable autodist-repository and use local list
#
WEBBUILD_REPOSITORIES=(devel devel-games devel-kernel devel-kde4 devel-xorg devel-gnome devel-makedist \
devel-java devel-misc devel-autodist devel-future devel-past \
WEBBUILD_REPOSITORIES=(base devel-kernel devel-makedist devel-misc devel-autodist devel-future devel-past \
milestone1 milestone1-updates milestone1-games milestone1-1.1 milestone1-makedist \
milestone2 milestone2-games milestone2-updates milestone2-kernel milestone2-kde4 \
milestone2-xorg milestone2-makedist milestone2-java \
devel-contrib devel-silvan devel-stefano devel-aleph0 devel-skiver devel-fabiog devel-gil \
devel-distservers devel-the_packagizers devel-ercolinux \
devel-contrib-java devel-michiamophil milestone1-java milestone1-contrib)
milestone1-java milestone1-contrib)
#
# Set to enable autodist-repository (you also need to disable WEBBUILD_REPOSITORIES above)
#
#AUTODIST_REPOSITORIES_LOCAL_REPS=(devel devel-games devel-kernel devel-kde4 devel-xorg devel-gnome devel-makedist \
# devel-java devel-misc devel-autodist devel-future devel-past devel-embedded devel-silvan \
#AUTODIST_REPOSITORIES_LOCAL_REPS=(base devel-kernel devel-makedist devel-misc devel-autodist \
# devel-future devel-past \
# milestone3 milestone3-games milestone3-updates milestone3-makedist \
# milestone2 milestone2-games milestone2-updates milestone2-kernel milestone2-kde4 \
# milestone2-xorg milestone2-makedist milestone2-java milestone2-kernel-next \
# milestone1 milestone1-updates milestone1-games milestone1-1.1 milestone1-makedist)
#AUTODIST_REPOSITORIES_REMOTE_REPS=(devel-contrib devel-stefano devel-aleph0 devel-skiver devel-fabiog devel-gil \
# devel-distservers devel-the_packagizers devel-ercolinux \
# devel-contrib-java devel-michiamophil milestone1-java milestone1-contrib)
#AUTODIST_REPOSITORIES_REMOTE_REPS=(devel-contrib \
# milestone1-java milestone1-contrib)
#AUTODIST_REPOSITORIES_TRANSITIONAL_REP=devel-makedist
#AUTODIST_REPOSITORIES_REMOTE_FTPUSER=
#AUTODIST_REPOSITORIES_REMOTE_FTPPASS=

12
etc/autodist/config-git Normal file
View File

@ -0,0 +1,12 @@
REPO_DIR = "/var/ftp/pub/openmamba/base"
ARCHIVE_DIR = "%(REPO_DIR)s/archive"
OLD_DIR = "%(REPO_DIR)s/old"
SRPMS_DIR = "%(REPO_DIR)s/SRPMS.base"
GITEA_URL = "https://src.openmamba.org"
GITEA_SSH_URL = "ssh://gitea@src.openmamba.org:3326/rpms/"
GITEA_TOKEN = "<replace with a valid token>"
GITEA_ORGANIZATION = "rpms"
COMMITTER_USER = "autodist"
COMMITTER_EMAIL = "autodist@openmamba.org"

View File

@ -2,11 +2,12 @@
#
# Autodist script for updating specfiles
#
# Copyright (c) 2007-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2007-2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Released with the same license as autodist
#
SPECFILE=
NEWVERSION=
BUILDREQNUM=0
for ((i=1; i<=$#; i++)); do
@ -31,6 +32,8 @@ for ((i=1; i<=$#; i++)); do
;;
*) if [ ! "$SPECFILE" ]; then
SPECFILE=${!i}
elif [ ! "$NEWVERSION" ]; then
NEWVERSION=${!i}
else
echo "ERROR: update-specfile: unrecognized script option: '${!i}'; aborting."
exit 1
@ -52,13 +55,29 @@ done
sed -i "s|^Vendor:.*|Vendor: openmamba|;
s|^Distribution:.*|Distribution: openmamba|;
/BuildRequires:[[:space:]]*libffmpeg-devel/d;
/^BuildRequires:[[:space:]]*libkdegames-devel/d;
/^BuildRequires:[[:space:]]*libkdegames5-devel/d;
/^BuildRequires:[[:space:]]*python3.7dist/d;
/^BuildRoot:[[:space:]]*.*/d;
s|\(BuildRequires:[[:space:]]*\)libmysql-devel|\1libmysql5-devel|;
s|\(BuildRequires:[[:space:]]*\)libdb42-devel|\1libdb47-devel|;
s|\(BuildRequires:[[:space:]]*\)libdb51-devel|\1libdb53-devel|;
s|\(BuildRequires:[[:space:]]*\)firefox-devel|\1xulrunner-devel|;
s|^PreReq:[[:space:]]*/sbin/install-info|Requires(post):%{__install_info}|;
s|^PreReq:[[:space:]]*%{__install_info}|Requires(post):%{__install_info}|;
s|^PreReq:[[:space:]]*|Requires(pre): |;
s|http://.*.dl\.sourceforge\.net/|http://downloads.sourceforge.net/|" $SPECFILE
s|^\(Requires:[[:space:]]*kde-workspace\)$|#\1|;
s|^%patch\([0-9][0-9]*\)|%patch \1|;
s|http://.*.dl\.sourceforge\.net/|https://downloads.sourceforge.net/|;
s|http://ftp.kde.org/stable/|https://download.kde.org/stable/|;
s|ftp://ftp.kde.org/pub/kde/|https://download.kde.org/|;
s|update-mime-database %{|update-mime-database -n %{|;
s|http://download.kde.org/stable/%{version}|https://download.kde.org/stable/applications/%{version}|;
s|http[s]*://pypi.python.org/packages/source/[^/]*/|https://pypi.debian.net/|;
s|http://ftp.gnome.org/pub/GNOME/sources/|https://download.gnome.org/sources/|;
s|ftp://ftp.gnome.org/pub/gnome/sources/|https://download.gnome.org/sources/|" $SPECFILE
# s|;s,.*/man/.*,&.gz,g||;
# s|http.*.cpan.org/.*/\([^/-]*\)\(-.*\)|https://cpan.metacpan.org/modules/by-module/\1/\1\2|;
#sed -i "s|^\(Source.*:[[:space:]]*ftp://ftp.kde.org/pub/kde/stable/.*.tar.\)bz2|\1xz|" $SPECFILE
if [ $BUILDREQNUM -gt 0 ]; then

View File

@ -1,41 +1,64 @@
#!/bin/bash
[ -e /etc/autodist/config ] && . /etc/autodist/config
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
RPMS_CTIME_OLD="+14"
BUILD_CTIME_OLD="+14"
SOURCES_CTIME_OLD="+60"
SRPMS_CTIME_OLD="+30"
RPMS_CTIME_OLD="+3"
BUILD_CTIME_OLD="+3"
SOURCES_CTIME_OLD="+7"
SOURCES_ARCHIVES_CTIME_OLD="+7"
SOURCES_PATCH_CTIME_OLD="+365"
SRPMS_CTIME_OLD="+3"
TMP_CTIME_OLD="+2"
function clean() {
dir=$1
arch=$2
[ "$VERBOSE" ] && echo "Cleaning from base directory $dir..."
[ -e $dir/ ] && find $dir/ -mindepth 1 -maxdepth 1 -name "pipe\:\[*" -exec rm -f {} \;
[ -e $dir/RPM/SPECS/ ] && find $dir/RPM/SPECS/ -mindepth 1 -maxdepth 1 -type f -not -name "*.spec*" -exec rm -f {} \;
[ -e $dir/RPM/RPMS/$arch/ ] && find $dir/RPM/RPMS/$arch/ -mindepth 1 -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
[ -e $dir/RPM/RPMS/noarch/ ] && find $dir/RPM/RPMS/noarch/ -mindepth 1 -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
[ -e $dir/RPM/BUILD/ ] && find $dir/RPM/BUILD/ -mindepth 1 -maxdepth 1 -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
[ -e $dir/RPM/SOURCES/ ] && find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -ctime ${SOURCES_CTIME_OLD} -a ! -name "*.patch" -exec rm -rf {} \;
[ -e $dir/RPM/SRPMS/ ] && find $dir/RPM/SRPMS/ -mindepth 1 -maxdepth 1 -ctime ${SRPMS_CTIME_OLD} -exec rm -f {} \;
for arch in ${AUTODIST_ARCHS[*]}; do
[ -e $dir/RPM/RPMS/$arch/ ] && find $dir/RPM/RPMS/$arch/ -mindepth 1 -maxdepth 1 -type f -mtime ${RPMS_CTIME_OLD} -exec rm -f {} \;
done
[ -e $dir/RPM/RPMS/noarch/ ] && find $dir/RPM/RPMS/noarch/ -mindepth 1 -maxdepth 1 -type f -mtime ${RPMS_CTIME_OLD} -exec rm -f {} \;
if [ -e $dir/RPM/BUILD/ ]; then
find $dir/RPM/BUILD/ -mindepth 1 -maxdepth 1 -type d -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
# delete older package duplicates
find $dir/RPM/BUILD/ -maxdepth 1 | sort -V | \
while read curr; do
if [ "${curr/-[0-9._]*}" = "${last/-[0-9._]*}" -a "${last}" ]; then
rm -rf $last
fi
last=$curr;
done
fi
[ -e $dir/RPM/SOURCES/ ] && {
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_CTIME_OLD} -a ! -name "*.patch" -exec rm -rf {} \;
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_ARCHIVES_CTIME_OLD} -a -name "*.tar.xz" -exec rm -rf {} \;
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_ARCHIVES_CTIME_OLD} -a -name "*.tar.bz2" -exec rm -rf {} \;
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_ARCHIVES_CTIME_OLD} -a -name "*.tar.gz" -exec rm -rf {} \;
find $dir/RPM/SOURCES/ -mindepth 1 -maxdepth 1 -type f -ctime ${SOURCES_PATCH_CTIME_OLD} -a -name "*.patch" -exec rm -rf {} \;
}
[ -e $dir/RPM/SRPMS/ ] && find $dir/RPM/SRPMS/ -mindepth 1 -maxdepth 1 -type f -mtime ${SRPMS_CTIME_OLD} -exec rm -f {} \;
}
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]}
clean /var/autoport/$a/usr/src
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/ ] && \
clean /var/autoport/$a/var/autodist
[ -e /var/autoport/$a/var/tmp/autodist ] && \
find /var/autoport/$a/var/tmp/autodist/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
find /var/autoport/$a/tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
find /var/autoport/$a/var/tmp/autodist/ -mindepth 1 -maxdepth 1 -type f -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
find /var/autoport/$a/tmp/ -mindepth 1 -maxdepth 1 -type f -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
autoport-chroot $a ccache -C
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
clean /var/autodist ${AUTOPORT_ARCH[$i]}
clean /var/autodist
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
sudo -u autodist ccache -C
sudo -u autodist yarn cache clean
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]}
clean $WORKINGHOME
fi
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
fi

View File

@ -1,20 +0,0 @@
#!/bin/bash
#
# autodist-upstream-updates daily cron script
# (c) 2008-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
. /etc/sysconfig/autoport
if [ ! "$AUTOPORT_UPDATE_NO_DISTROMATIC" ]; then
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
fi
exit 0

View File

@ -0,0 +1,12 @@
#!/bin/bash
#
# autodist-git-sync daily cron script
# (c) 2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
if [ "$AUTODIST_GIT_SYNC" == "1" ]; then
autodist-git syncrepo
fi
exit 0

View File

@ -1,72 +1,17 @@
#!/bin/bash
#
# autodist autoupdate hourly cron script
# (c) 2008-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# (c) 2008-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
. /etc/sysconfig/autoport
ME=`basename $0`
# FIXME: parametrize automaint call
if [ ! "$AUTOPORT_UPDATE_NO_AUTOMAINT" ]; then
automaint -s devel-autodist -d devel -p devel-makedist
automaint -s devel-autodist -d base -p devel-makedist
fi
[ "$$" == "`pidof -x $ME`" -o "$$" == "`pidof -x 60-autodist-update`" ] || {
# echo "Warning: $ME script already running; exiting."
exit 0
}
PIDFILE=/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
if [ ! "$AUTOPORT_UPDATE_NO_DISTROMATIC" ]; then
pid_check
distromatic -q -t $DISTROMATIC_REPOSITORY --gensrcpkglist > $LOCAL_REPS_BASE_DIR/$DISTROMATIC_REPOSITORY/srcpkglist 2>/dev/null
fi
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
echo "Running autodist-launcher ${i}"
systemd-run -u autodist-launcher-${i} /usr/bin/autodist-launcher ${i}
done

14
etc/cron.hourly/65-autoport Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
#. /etc/sysconfig/openmamba-central
. /etc/sysconfig/autoport
[ "$AUTOPORT_ENABLE" = "1" -o "$AUTOPORT_ENABLE" = "true" ] || exit 0
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
echo "Running autoport-launcher ${i}"
systemd-run -u autoport-launcher-${i} /usr/bin/autoport-launcher ${i}
done

View File

@ -1,80 +0,0 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2014 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=/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_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 ${AUTOPORT_CHROOT_USER[$i]} -c "$CMD_PREFIX autoport -b -r $r" >> $LOGFILE
AUTODIST_HOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
cat $AUTODIST_HOME/.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,111 +0,0 @@
#!/bin/bash
#
# openmamba-autobuild-autoport daily cron script
# (c) 2008-2014 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=/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
[ "${AUTOPORT_ARCH[$i]}" ] || continue
[ "${AUTOPORT_DISABLE[$i]}" -a "${AUTOPORT_DISABLE[$i]}" != "0" ] && continue
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
# disable service restarts
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport
ln -s /bin/true /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
# sudo mount -o bind /proc /var/autoport/${AUTOPORT_CHROOT[$i]}/proc
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment"
#echo "= Updating packages in ${AUTOPORT_CHROOT[$i]} chroot environment..." >> $LOGFILE
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} smart update --quiet > /dev/null
LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} smart upgrade -y > /dev/null
[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream start
fi
for r in ${AUTOPORT_REPOSITORIES[$i]}; do
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
echo "= Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode..." >> $LOGFILE
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CHROOT[$i]}) in chroot mode" >> $LOGFILE
$CMD_PREFIX /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} su -l ${AUTOPORT_CHROOT_USER[$i]} -c "autoport -b -r $r" >> $LOGFILE
if [ "${AUTOPORT_CHROOT_USER[$i]}" = "autodist" ]; then
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/var/autodist/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
else
cat /var/autoport/${AUTOPORT_CHROOT[$i]}/home/${AUTOPORT_CHROOT_USER[$i]}/.autoport/${AUTOPORT_ARCH[$i]}/$r-current.log >> $LOGFILE
fi
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
[[ "`/usr/bin/tty`" != "not a tty" ]] && echo "Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode"
echo "= Working on $r(${AUTOPORT_CROSS[$i]}) in cross-platform mode" >> $LOGFILE
su -l autodist -c "autoport -b -x ${AUTOPORT_CROSS[$i]} -r $r" >> $LOGFILE
cat /var/autodist/.autoport/${AUTOPORT_CROSS[$i]}/$r-current.log >> $LOGFILE
fi
echo "- Autoport end at `date`" >> $LOGFILE
echo "============================================" >> $LOGFILE
done
if [ "${AUTOPORT_CHROOT[$i]}" ]; then
mv /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service.autoport /var/autoport/${AUTOPORT_CHROOT[$i]}/sbin/service
[ "${AUTOPORT_CHROOT_ICECREAM[$i]}" ] && LANG=C /usr/sbin/chroot /var/autoport/${AUTOPORT_CHROOT[$i]} /etc/init.d/icecream stop
fi
done

View File

@ -12,8 +12,8 @@ AUTOPORT_UPDATE_NO_DISTROMATIC=1
#AUTOPORT_WEBBUILD_HOST=http://localhost/webbuild.html
#ICECREAM_MONITOR_HOST=localhost
AUTOPORT_DEVEL_IMPORT_REPOSITORIES="devel-makedist devel devel-games devel-autodist devel-gnome \
devel-kde4 devel-xorg devel-kernel devel-misc devel-java devel-future devel-past devel-contrib devel-contrib-java"
AUTOPORT_DEVEL_IMPORT_REPOSITORIES="devel-makedist base devel-autodist \
devel-kernel devel-misc devel-future devel-past"
AUTOPORT_DEVEL_RELEASE_REPOSITORIES="milestone2-makedist milestone2-kernel milestone2-kernel-next"

74
repology-openmamba.py Executable file
View File

@ -0,0 +1,74 @@
#!/usr/bin/python3
#
# repology-openmamba.py - find upstream packages updates from repology.org
# Copyright (c) 2021-2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
import json
import rpm
import sys
import time
import urllib.request
with open("/var/ftp/pub/openmamba/base/legacy") as f:
legacy_packages = f.read().splitlines()
with open("/var/ftp/pub/openmamba/base/updates-conf.json") as f:
data = json.loads(f.read())
ignored_packages = data["repology"]["ignore"]
from_package = ""
last_from_package = "NONE"
results = []
while True:
if from_package == last_from_package:
break
requrl = "https://repology.org/api/v1/projects/"
if from_package != "":
requrl += from_package +"/"
requrl += "?inrepo=openmamba&outdated=1"
sys.stderr.write("Requesting: " + requrl + "\n")
url = urllib.request.urlopen(requrl)
#print(requrl)
data = json.loads(url.read().decode())
if from_package != "" and len(data.keys()) <= 1:
break
for k in data.keys():
if k == from_package:
continue
package = k
openmamba_srcname = None
openmamba_version = None
openmamba_altnames = []
newest_version = None
newest_repos = []
for p in data[k]:
if p["repo"] == "openmamba":
if not p["srcname"] in ignored_packages and \
not p["srcname"] in legacy_packages:
if openmamba_srcname is None:
openmamba_version = p["version"]
openmamba_srcname = p["srcname"]
else:
openmamba_altnames.append(p["srcname"])
elif p["status"] == "newest":
# kaos_build provides unreleased kde package versions
if p["repo"] != "kaos_build":
newest_version = p["version"]
newest_repos.append(p["repo"])
newest_repos = list(dict.fromkeys(newest_repos))
if openmamba_srcname and newest_version is not None and len(newest_repos) > 0:
results.append(openmamba_srcname + " " + newest_version)
for altname in openmamba_altnames:
results.append(altname + " " + newest_version)
last_from_package = from_package
from_package = package
time.sleep(1)
results_sorted = sorted(set(results), key=str.casefold)
#results_unique = set(results_sorted)
for result in results_sorted:
print(result)

205
telegram/openmamba_bot.py Executable file
View File

@ -0,0 +1,205 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmamba bot for Telegram
#
# Copyright (C) 2016-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# GPL v3 license
from telegram import (ParseMode, Update)
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler, Job, CallbackContext)
import logging
import subprocess
import sqlite3
import os
# Enable logging
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
timers = dict()
social_log_last_ids = dict()
reps = [ 'base', 'devel-makedist', 'devel-autodist', 'devel-kernel', 'devel-misc', 'devel-future', 'devel-past' ]
def start(update: Update, context: CallbackContext):
user = update.message.from_user
logger.info("User %s started the conversation." % user.first_name)
update.message.reply_text(
'Hi! This is the openmamba GNU/Linux Bot.\n'
'Send any text to search for packages.\n'
'Send /details [name] to see details of specified source package.\n'
'Send /set [seconds] to enable notifications.\n'
'Send /unset to disable notifications.\n\n')
return
def help(update: Update, context: CallbackContext):
update.message.reply_text(
'Send any text to search for packages.\n'
'Send /details [name] to see details of specified source package.\n'
'Send /set [seconds] to enable notifications.\n'
'Send /unset to disable notifications.\n\n')
return
def query(update: Update, context: CallbackContext):
user = update.message.from_user
logger.info("Query of %s: %s" % (user.first_name, update.message.text))
response = ""
for rep in reps:
conn = sqlite3.connect('/var/webbuild/db/%s-sources.db' % rep, check_same_thread=False)
cursor = conn.cursor()
print(rep)
cursor.execute(
'SELECT id,name,version,release,summary,url FROM sources where name like "%%%s%%" or summary like "%%%s%%" '
'ORDER BY name="%s" DESC, name like "%s%%" DESC, name like "%%%s%%" DESC limit 10'
% (update.message.text, update.message.text, update.message.text, update.message.text, update.message.text))
for row in cursor:
response += "<b>%s</b> %s-%s (%s)\n%s\n%s\n\n" % (row[1], row[2], row[3], rep, row[4], row[5])
if response != "":
update.message.reply_text(response, parse_mode=ParseMode.HTML)
else:
update.message.reply_text('No results found.')
return
def details(update: Update, context: CallbackContext):
user = update.message.from_user
logger.info("Details of %s: %s" % (user.first_name, update.message.text))
response = ""
for rep in reps:
conn = sqlite3.connect('/var/webbuild/db/%s-sources.db' % rep, check_same_thread=False)
cursor = conn.cursor()
cursor.execute(
'SELECT id,name,version,release,summary,url,description FROM sources where name="%s"' % (context.args[0]))
for row in cursor:
response += "<b>%s</b> %s-%s (devel)\n%s\n%s\n\n<i>%s</i>\n\n" % (row[1], row[2], row[3], row[4], row[5], row[6])
for arch in [ 'x86_64', 'aarch64', 'i586', 'arm' ]:
conn1 = sqlite3.connect('/var/webbuild/db/' + rep + '-' + arch + '.db', check_same_thread=False)
cursor1 = conn1.cursor()
cursor1.execute('SELECT id,name FROM packages where id_source=%s' % (row[0]))
for row1 in cursor1:
response += "<b>%s</b>(%s) " % (row1[1], arch)
response += "\n\n\n"
if response != "":
update.message.reply_text(response[0:4096], parse_mode=ParseMode.HTML)
else:
update.message.reply_text('No results found.')
return
def alarm(context):
social_log_conn = sqlite3.connect('/var/webbuild/webbuild.db')
social_log_cursor = social_log_conn.cursor()
social_log_cursor.execute('SELECT id,user,text,datetime(time,\'localtime\'),type FROM social_log where id>%s' % social_log_last_ids[context.job])
response = ""
for row in social_log_cursor:
if row[4] == "job":
response += "Job run by <i>%s</i> %s (%s)\n" % (row[1], row[2], row[3])
else:
response += "<i>%s</i> %s (%s)\n" % (row[1], row[2], row[3])
if response != "":
bot.sendMessage(context.job, response, parse_mode=ParseMode.HTML)
social_log_last_ids[context.job] = row[0]
def set(update: Update, context: CallbackContext):
chat_id = update.message.chat_id
try:
due = int(context.args[0])
if due < 0:
update.message.reply_text('Sorry we can not go back to future!')
return
#job = Job(alarm, context, next_t=due, repeat=True, context=chat_id)
#timers[chat_id] = job
context.job_queue.run_repeating(alarm, due)
#context.jobqueue.put(job)
social_log_conn = sqlite3.connect('/var/webbuild/webbuild.db')
social_log_cursor = social_log_conn.cursor()
social_log_cursor.execute('''SELECT MAX(id) FROM social_log''')
social_log_last_ids[chat_id] = social_log_cursor.fetchone()[0] - 5
update.message.reply_text('Notifications enabled!')
except (IndexError, ValueError):
update.message.reply_text('Usage: /set <seconds>')
def unset(update: Update, context: CallbackContext):
chat_id = update.message.chat_id
if chat_id not in timers:
update.message.reply_text('Notification were not enabled')
return
job = timers[chat_id]
job.schedule_removal()
del timers[chat_id]
update.message.reply_text('Notifications disabled')
def cancel(update: Update, context: CallbackContext):
user = update.message.from_user
logger.info("User %s canceled the conversation." % user.first_name)
update.message.reply_text('Bye!')
return ConversationHandler.END
def error(update: Update, context: CallbackContext):
logger.warning('Update "%s" caused error "%s"' % (update, context.error))
def main():
# Load bot token from external configuration file
bot_token = ""
with open("/etc/autodist/secrets") as myfile:
for line in myfile:
name, var = line.rstrip().split("=")
if name == "TELEGRAM_BOT_TOKEN":
bot_token = var
# Create the EventHandler and pass it your bot's token.
updater = Updater(bot_token)
# Get the dispatcher to register handlers
dp = updater.dispatcher
dp.add_handler(CommandHandler('start', start))
dp.add_handler(CommandHandler('help', help))
dp.add_handler(CommandHandler('details', details, pass_args=True))
dp.add_handler(CommandHandler('set', set, pass_args=True, pass_job_queue=True))
dp.add_handler(CommandHandler('unset', unset))
dp.add_handler(MessageHandler(Filters.text, query))
# log all errors
dp.add_error_handler(error)
# Start the Bot
updater.start_polling()
# Run the bot until the you presses Ctrl-C or the process receives SIGINT,
# SIGTERM or SIGABRT. This should be used most of the time, since
# start_polling() is non-blocking and will stop the bot gracefully.
updater.idle()
if __name__ == '__main__':
main()

View File

@ -0,0 +1,10 @@
[Unit]
Description=openmamba bot for Telegram
After=syslog.target
[Service]
Type=simple
ExecStart=/var/autodist/env/bin/python3 /usr/share/autodist/openmamba_bot.py
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
python-telegram-bot~=13.14

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

View File

@ -0,0 +1,78 @@
webbuild.a { }
pre {
background: none;
border:0;
padding:0;
margin:0;
-webkit-box-shadow:none;
box-shadow:none;
font-family: monospace;
word-break: break-all;
}
code {
font-family: monospace;
}
form { margin:0; }
a.webbuild:link { color:#0b0600; text-decoration: none; }
a.webbuild:visited { color:#0b0600; text-decoration: none; }
a.webbuild:active { color:#0b0600; text-decoration: none; }
a.webbuild:hover { text-decoration: underline; }
hr { margin:0; color:black; background: #aaaaaa; }
label { white-space:nowrap; text-decoration:none; font-weight:initial; }
.webbuild input {
font-size: 8pt;
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
padding: 1px;
margin: 1px;
}
select {
font-size: 8pt;
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
padding: 0;
margin: 1px;
max-width: 98%;
background-color: buttonface;
}
input[type="text"] {
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
padding: 1px;
margin: 1px;
border: 1px solid #AAAAAA;
}
input[type="button"] {
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
font-size: 8pt;
font-weight: 400;
margin: 1px;
border: 1px solid #AAAAAA;
white-space:nowrap;
line-height: 1.1em;
}
input[type="button"]::-moz-focus-inner { padding: 0; border: 0; }
input[type="button"]:hover {
border: 1px solid #666666;
}
input[type="radio"] {
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
font-size: 7pt;
padding: 0;
margin: 0;
}
input[type="checkbox"] {
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
vertical-align:middle;
-ms-transform: scale(0.9);
-moz-transform: scale(0.9);
-webkit-transform: scale(0.9);
-o-trasnform: scale(0.9);
padding: 1px;
margin: 1px;
}

View File

@ -0,0 +1,13 @@
body { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); }
table { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; background-color: rgb(255, 255, 255); }
img { border: 0; margin: 0px; vertical-align:middle; }
h1 { font-size: 13pt; font-weight: bold; }
h2 { font-size: 11pt; font-weight: bold; }
h3 { font-size: 10pt; font-weight: bold; margin-top: 20px; margin-bottom: 2px; }
h4 { margin:5; margin-right: 10; font-size: 9pt; font-weight: normal; }
hr { margin:0; color:white; }
a { }
a:link { color:#2b6600; text-decoration: none; }
a:visited { color:#2b6600; text-decoration: none; }
a:active { color:#2b6600; text-decoration: none; }
a:hover { text-decoration: underline; }

View File

@ -1,75 +1,18 @@
body { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); }
table { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; background-color: rgb(255, 255, 255); }
img { border: 0; margin: 0px; vertical-align:middle; }
h1 { font-size: 13pt; font-weight: bold; }
h2 { font-size: 11pt; font-weight: bold; }
h3 { font-size: 10pt; font-weight: bold; margin-top: 20px; margin-bottom: 2px; }
h4 { margin:5; margin-right: 10; font-size: 9pt; font-weight: normal; }
hr { margin:0; color:white; }
a { }
a:link { color:#2b6600; text-decoration: none; }
a:visited { color:#2b6600; text-decoration: none; }
a:active { color:#2b6600; text-decoration: none; }
a:hover { text-decoration: underline; }
label {
white-space:nowrap;
}
input {
font-size: 8pt;
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
padding: 0;
margin: 1px;
}
select {
font-size: 8pt;
font-family:liberationsans,freesans,Arial,Verdana,Helvetica,sans-serif;
padding: 0;
margin: 1px;
height: 18px;
}
input[type="text"] {
padding: 0px;
margin: 1px;
height: 1.40em;
border: 1px solid #AAAAAA;
}
input[type="button"] {
margin: 1px;
white-space:nowrap;
height: 18px;
}
input[type="radio"] {
font-size: 7pt;
padding: 0;
margin: 0;
}
input[type="checkbox"] {
vertical-align:middle;
-ms-transform: scale(0.9);
-moz-transform: scale(0.9);
-webkit-transform: scale(0.9);
-o-trasnform: scale(0.9);
padding: 1px;
margin: 1px;
}
.boldbutton {
font-weight: bold;
font-weight: bold !important;
}
.redbutton {
color: red;
color: red !important;
}
.redbutton[disabled] {
color: lightgray;
color: lightgray !important;
}
.redboldbutton {
color: red;
font-weight: bold;
color: red !important;
font-weight: bold !important;
}
.redboldbutton[disabled] {
color: lightgray;
color: lightgray !important;
}
.screencontainer {
text-align:center;
@ -83,8 +26,8 @@ input[type="checkbox"] {
.opaquebackground {
text-align:center;
position:fixed;
z-index:15 !important;
position: fixed;
height:100%;
width:100%;
left:0;
@ -166,77 +109,166 @@ input[type="checkbox"] {
.multiselect label {
display:block;
white-space:nowrap;
font-weight:400;
padding:0;
}
.socialbox {
.webbuildtopright {
float:right;
font-size:8pt;
border:0px;
padding:0px;
height:130px;
line-height: 100%;
border:1px solid #2b6600;
}
.searchbox {
position:relative;
display:block;
float:left;
width:215px;
align:center;
left:660px;
top:-25px;
// height:21px;
font-size:8pt;
border:1px solid #2b6600;
// margin:4px;
padding:2px;
background-color: #e0f2d0;
}
.chatpanel {
float:left;
width:215px;
align:center;
}
.webbuild {
font-size: 8pt;
}
.webbuild td {
font-size: 8pt;
}
.editor {
width:690px;
height:300px;
border:1px solid #cccccc;
padding:0px;
font-family: liberationsans, freesans, arial, verdana, sans-serif;
line-height: 1.3em;
color: #000000;
margin:0px;
font-family:'Courier New', Courier, 'Nimbus Mono L', monospace;
font-size:8pt;
}
.webbuild td { font-size: 8pt; border:0; }
}
.webbuild table { font-size: 9pt; font-family: liberationsans, freesans, arial, verdana, sans-serif; background-color: rgb(255, 255, 255); }
.webbuild img { border: 0; margin: 0px; vertical-align:middle; }
.webbuild h1 { font-size: 13pt; font-weight: bold; }
.webbuild h2 { font-size: 11pt; font-weight: bold; }
.webbuild h3 { font-size: 10pt; font-weight: bold; margin-top: 20px; margin-bottom: 2px; }
.webbuild h4 { margin:5; margin-right: 10; font-size: 9pt; font-weight: normal; }*/
.webbuild hr { margin:0; color:white; }
.webbuild div { margin-bottom:1px; padding-bottom:1px; }
.maintainer {
width:684px;
height:300px;
overflow:auto;
font-size:7pt;
border:1px solid #2b6600;
.webbuildcontainer {
max-width:920px;
height:auto;
}
.webbuildwrapleft {
float:left;
width:100%;
margin-right:-210px;
}
.webbuildleft {
margin-right:210px !important;
padding:0;
margin:0;
background-color:white;
}
.socialbox {
.webbuildright {
float:right;
font-size:8pt;
padding:0px;
height:130px;
line-height: 100%;
border:1px solid #2b6600;
width:202px;
margin:0;
}
.processes {
float:left;
@media screen and (min-width: 901px) {
.webbuildright {
width:202px;
}
.socialbox {
width:200px;
}
}
.operationpanelinfo {
margin-top:137px;
border:1px solid #2b6600;
background-color:#E0F2D0;
padding:1px;
}
.operationpanelsend {
margin-top:5px;
border:1px solid #2b6600;
background-color:#E0F2D0;
padding:1px;
}
.operationpanelautodist {
margin-top:5px;
border:1px solid #2b6600;
background-color:#FFFFDE;
padding:1px;
}
.operationpanelpatches {
margin-top:5px;
border:1px solid #2b6600;
background-color:#E0F2D0;
padding:1px;
}
.operationpanelupload {
margin-top:5px;
border:1px solid #2b6600;
background-color:#FFFFFF;
padding:1px;
}
.operationpanelpackageinfo {
margin-top:5px;
border:1px solid #2b6600;
background-color:#A7DEDE;
padding:1px;
}
.operationpanelgenericinfo {
margin-top:5px;
border:1px solid #2b6600;
background-color:#A7DEDE;
padding:1px;
}
.operationpanelhost {
margin-top:5px;
border:1px solid #2b6600;
background-color:#FFFFFF;
padding:1px;
}
.operationpaneloperations {
margin-top:5px;
border:1px solid #2b6600;
background-color:#FFFFDE;
padding:1px;
}
.operationpaneloperations > textarea {
padding:0;
}
.webbuildprocesses {
font-size:7pt;
padding:0px;
height:130px;
line-height: 130%;
margin-bottom: 2px;
border:1px solid #2b6600;
width:100%;
margin:0;
// display:table-cell;
background-color:#E0F2D0;
padding:1px;
}
.processes {
width:100%;
}
.editor {
float:left;
width:100%;
height:300px;
border:1px solid #cccccc;
padding:0px;
margin:0px;
font-family:monospace;
font-size:8pt;
}
.maintainer {
float:left;
width:100%;
height:300px;
overflow:auto;
font-size:7pt;
border:1px solid #2b6600;
padding:1px;
margin:0;
background-color:white;
float:left;
}
.notes {
@ -250,13 +282,14 @@ input[type="checkbox"] {
}
.output {
width:680px;
width:100%;
height:300px;
overflow:auto;
overflow-x:hidden;
word-wrap: break-word;
font-family:'Courier New', Courier, 'Nimbus Mono L', monospace;
font-family:monospace;
font-size:8pt;
font-weight:400;
border:1px solid #2b6600;
padding:2px;
margin:0;
@ -264,27 +297,71 @@ input[type="checkbox"] {
color:white;
}
.output a:link {
text-decoration: underline;
color:white;
}
.output a,
.output a:link,
.output a:visited {
text-decoration: underline;
color:white;
}
.output p {
background-color:gray;
color:white;
}
@media screen and (max-width: 900px) {
.webbuildright,
.webbuildleft,
.operationpanelinfo,
.operationpanelsend,
.operationpanelautodist {
width:100%;
}
.socialbox {
float: none !important;
}
span#socialbox > span > div > div > img,
span#socialbox > span > div > div:first-child {
height:12px !important;
width:12px !important;
}
span#socialbox > span > div > div:nth-child(2),
span#socialbox > span > div > div:nth-child(3) {
margin-left: 12px !important;
}
.operationpanelinfo {
margin-top:5px !important;
}
.webbuildtopright,
.webbuildtopleft {
margin-top:5px;
width:100%;
}
.chatpanel {
margin-left:10px;
}
select,
input {
margin:3px !important;
}
}
@media screen and (max-width: 370px) {
.webbuildright,
.webbuildleft {
width:100%;
}
}
.matrix {
width:100%;
height:100%;
height:97%;
word-wrap: break-word;
overflow:auto;
font-size:7pt;
// border:1px solid #2b6600;
padding-right:-2px;
padding-bottom:-2px;
margin-left:2px;
margin-bottom:2px;
padding:0px;
top:5px;
left:5px;
// background-color:#e0f2d0;
/* -moz-column-count: 2;
-moz-column-gap: 1.5em;
@ -316,9 +393,11 @@ input[type="checkbox"] {
}
.scroll-pane {
/* socialbox */
background-color: #e0f2d0;
height:130px;
width:200px;
min-width:200px;
width:100%;
overflow:auto;
float:right;
}
@ -337,11 +416,11 @@ input[type="checkbox"] {
}
.scroll-pane3 {
/* processes */
background-color: #e0f2d0;
height:130px;
width:685px;
width:auto;
overflow:auto;
float:right;
}
.scroll-pane3-h {
@ -357,3 +436,17 @@ input[type="checkbox"] {
overflow:auto;
}
/* socialbox */
.socialbox {
float:right;
font-size:8pt;
//border:0;
//margin:0;
//padding:0;
height:130px;
line-height: 100%;
border:1px solid #2b6600;
}
.socialbox div { margin-bottom:1px; }
.socialbox hr { margin:0; color:#FFF; }
.downloadbox table { font-size: 9pt; border:1px solid #2b6600; margin: 4px; padding:4; background-color: #e0f2d0; }

View File

@ -1,6 +1,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="/images/webbuild.ico" />
<!-- styles needed by jScrollPane -->
@ -11,6 +12,7 @@
<script type="text/javascript" src="/scripts/jquery.mousewheel.js"></script>
<!-- the jScrollPane script -->
<script type="text/javascript" src="/scripts/jquery.jscrollpane.min.js"></script>
<link rel="stylesheet" type="text/css" href="/styles/webbuild-standalone.css">
<link rel="stylesheet" type="text/css" href="/styles/webbuild.css">
<script type="text/javascript" src="/scripts/socialbox.js"></script>
<script>
@ -259,39 +261,33 @@ function ajaxFileUpload(request)
return false;
}
</script>
<link rel="stylesheet" type="text/css" href="/styles/webbuild-post.css">
</head><body>
<table width="100%">
<tr><td>
<span class=webbuild>
<div id=container style="position:relative;width:894px;height:auto;top:0;left:0;margin-left:auto;margin-right:auto;">
<div class="webbuildcontainer">
<form id=webbuildform name=webbuild method=post action="javascript:">
<img src="/images/webbuild.png" alt="build automatici">
&nbsp;&nbsp;&nbsp;<b>- Webbuild - Interfaccia Web per lo sviluppo di openmamba</b>
<span id="searchbox"></span>
<div style="position:relative;top:-30px;left:0;width:100%;height:100%;">
<div id="searchbox"></div>
<div class="chatpanel"><span id="chatpanel"></span></div>
<div id="noajax_msg"><p>Il supporto per AJAX non è abilitato nel tuo browser. L'aggiornamento live non sarà disponibile, premi Ricarica per aggiornare la pagina.</p></div>
<span id="status">Caricamento in corso, attendere...</span>
<span id="topcontrols"></span><span id="environments"></span><span id="specedit"></span>
<br><span id="repositories"></span>
<span id="repositories"></span>
<span id="packages"></span>
<span id="operations"></span>
<br><span id="speccreate"></span>
<hr>
<div style="position:relative;float:left;width:686px;padding:0;margin:1px;">
<div class="processes"><div class="scroll-pane3"><span id="processes"></span></div></div><br>
<span id="speccreate"></span>
<div class="webbuildleft">
<div class="webbuildprocesses"><div class="scroll-pane3"><span id="processes"></span></div></div>
<div><span id="editor"></span></div>
<span id="editcontrols"></span>
<span id="showlogcontrols"></span>
<span id="output"></span>
</div>
<div style="position:relative;float:right;width:200px;padding:0;margin:1px;">
<div class="webbuildright">
<div class="socialbox"><div class="scroll-pane"><span id="socialbox"></span></div></div>
<span id="operationpanel" style="margin:0;"></span>
<span id="chatpanel"></span>
<span id="operationpanel"></span>
</div>
<div style="clear:both"></div>
<span id="window"></span>
@ -305,6 +301,4 @@ ajax_getvalues_refresh("",user,user_email,encodeURIComponent(secret));
//setInterval("ajax_getvalues_refresh(\"\",user,user_email,encodeURIComponent(secret))",0);
</script>
<br><br><br><br><br><br>
</td></tr>
</table>
</body></html>

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# webbuild cgi script
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2012-2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /usr/share/autodist/webbuild-functions
. /usr/share/autodist/webbuild-functions-private
@ -49,18 +49,14 @@ if [ "$USER" ]; then
if [ "$SECRET" = "$USER_SECRET" ]; then
[ "$REMOTE_ADDR" = "127.0.0.1" -o "$USER_SECRET" ] && USER_ENABLED=1 || USER_ENABLED=
elif [ "$REQUEST" = "password" ]; then
if [ "$USER_SECRET" ]; then
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$USER_SECRET" 2>/dev/null
else
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
fi
/usr/libexec/webbuild-checkpassword "$PASSWORD" "$SECRET" 2>/dev/null
if [ $? -eq 0 ]; then
if [ ! "$USER_SECRET" ]; then
tmpfile=`mktemp --suffix=webbuildtmp`
cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
USER_SECRET=$SECRET
tmpfile=`mktemp --suffix=webbuildtmp`
cat $WEBBUILD_STATEDIR/users/$USER.conf > $tmpfile
sed -i "/USER_SECRET=/d" $tmpfile
echo "USER_SECRET='$SECRET'" >> $tmpfile
$SUDO_WRAPPER 0 local "$USER" "" "mv $tmpfile $WEBBUILD_STATEDIR/users/$USER.conf"
fi
USER_ENABLED=1
else
USER_ENABLED=
@ -141,12 +137,6 @@ if [ "$USER_ENABLED" != "1" -a "${REQUEST:0:7}" != "refresh" ]; then
exit
fi
if [ -e $WEBBUILD_STATEDIR/webbuild.state ]; then
. $WEBBUILD_STATEDIR/users/webbuild.state
else
touch $WEBBUILD_STATEDIR/users/webbuild.state
fi
if [ "$USER_ADMIN" -a "$FAKEUSERSWITCH" != "" ]; then
if [ "$FAKEUSERSWITCH" = "_disabled_" ]; then
set_user_state_var STATE_FAKEUSER
@ -213,39 +203,41 @@ fi
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
curl -s "$WEBBUILD_URL?REQUEST=refreshsocial&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&FROMID=$FROMID"
else
[ -e "$WEBBUILD_STATEDIR/social_log" ] || exit
else
[ -e "$WEBBUILD_STATEDIR/webbuild.db" ] || exit
# social box
echo -n "<socialbox>"
count=0
SID=0
if [ ! "$FROMID" -o "$FROMID" = "0" -o "$FROMID" = "NaN" ]; then
# Find id of last row - 25
if [ "$USER" ]; then
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " SUSER=$USER " 2>/dev/null | tail -n 25 | head -n 1`
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE user!='$USER' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
else
line=`tail -n 500 $WEBBUILD_STATEDIR/social_log | grep -v " STARGET=developers " 2>/dev/null | tail -n 25 | head -n 1`
LASTID_QUERY="SELECT id FROM (SELECT id FROM social_log WHERE target!='developers' ORDER BY id DESC LIMIT 25) sub ORDER BY id ASC LIMIT 1;"
fi
eval $line
FROMID=$SID
FROMID=`sqlite3 $WEBBUILD_STATEDIR/webbuild.db "$LASTID_QUERY"`
fi
tail -n 100 $WEBBUILD_STATEDIR/social_log | while read line; do
STYPE=
SPRIVACY=
SUSER=
STARGET=
SID=
eval $line
[ "$SID" ] || continue
[ $SID -ge $FROMID ] || continue
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "SELECT *,strftime('%s',time) FROM social_log WHERE id>=$FROMID LIMIT 100" | while read line; do
SAVEIFS=$IFS
IFS="|"
set -- $line
SID="$1"
SPRIVACY="$2"
SUSER="$3"
STYPE="$4"
STARGET="$5"
SEMAIL="$6"
STEXT="$7"
STIME="$9"
[ "$STARGET" = "developers" -a ! "$USER" ] && continue
[ "$SUSER" = "$USER" -a "$STARGET" == "developers" ] && continue
[ "$SUSER" = "$USER" -a "$STARGET" = "developers" ] && continue
if [ "$SPRIVACY" -a ! "$USER" ]; then
USER_GRAVATAR=
else
USER_GRAVATAR=`echo -n $SEMAIL | md5sum | sed "s| .*||"`
fi
echo -n "<add id=\"$SID\"><![CDATA[<div style=\"margin:0;padding:0;\"><div style=\"vertical-align:middle;position:relative;float:left;height:24px;width:24px;margin-right:2px;\">"
echo -n "<img src=\"http://www.gravatar.com/avatar/$USER_GRAVATAR?s=24&d=http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=24\" /></div>"
echo -n "<img src=\"https://www.gravatar.com/avatar/$USER_GRAVATAR?s=24&d=https://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=24\" /></div>"
if [ "$SPRIVACY" -a ! "$USER" ]; then
SUSER="a developer"
elif [ "$USER" = "$SUSER" ]; then
@ -253,13 +245,12 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
fi
echo -n "<div style=\"position:relative;margin-left:24px;height:auto;padding:0;\"><b>$SUSER</b> $STEXT <i><span name=socialtime time=$STIME></span></i></div>"
echo -n "</div><div style=\"clear:both;\"><hr></div>]]></add>"
count=$(($count + 1))
done
echo -n "</socialbox>"
fi
fi
if [ "$USER_ENABLED" != "1" ]; then
if [ "$USER_ENABLED" != "1" -o "$REQUEST" = "refreshsocial" ]; then
echo -n "</webbuild>"
exit
fi
@ -361,6 +352,7 @@ fi
# refresh processes list
if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
echo -n "<processes><![CDATA["
if [ "$USER_ADMIN" -a -s $WEBBUILD_STATEDIR/requests ]; then
echo -n "<div align=left class=processes><b>Pending admin requests:</b>"
@ -381,43 +373,65 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
echo -n "</div>"
fi
# echo -n "<div align=left class=processes>"
u="$(uptime)"
f="$(df / -k -h --output=avail,pcent|tail -n1)"
fap="$(df /var/autoport/* -k -h --output=avail,pcent|tail -n+2)"
[ "$fap" ] && f="$f | ${fap/$'\n'/ | }"
b=`ps ax|grep "rpmbuild .*\.spec$"|while read l; do basename "${l/.spec}"; done`
echo -n "Load: <b>${u/*: }</b> | Disk: <b>$f</b> | "
[ "$b" ] && echo -n "Building now: <b>$b</b> | "
[ "`ps cax|grep dnf`" ] && echo "<b style=\"color:red\">Updating</b> | "
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
echo "$USER's jobs: [<a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all jobs</a>]"
else
echo "All jobs: [<a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Only show my jobs</a>]"
fi
echo -n "<br>"
numprocess=0
tac $WEBBUILD_STATEDIR/processes | \
while read line; do
set -- $line
RETCODE=$6
CMDPID=$1
CMDUSER=$2
PROCESSLOG=$5
# if [ -e /proc/$1 -o $5 -lt 256 ]; then
ORIGRETCODE=$6
NOTIFIED=
if [ "${ORIGRETCODE: -1}" == "+" ]; then
NOTIFIED=1
RETCODE="${ORIGRETCODE/+*}"
else
RETCODE=$ORIGRETCODE
fi
numprocess=$(($numprocess + 1))
cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $RETCODE ||"`
cmdline=`echo "$line" | sed "s|$1 $2 $3 $4 $5 $ORIGRETCODE ||"`
cmdline=`echo "$cmdline" | sed "s| --colors web||"`
PACKAGE_ENCODED=`cgi_encodevar $4`
[ $numprocess -eq 1 ] && {
# echo -n "<div align=left class=processes>"
echo -n "<b>Webbuild jobs:</b> "
if [ "$STATE_JOBSSHOWALL" != "1" ]; then
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=true\");>Show all</a> ]"
else
echo "[ <a href=# onclick=ajax_getvalues(\"REQUEST=refreshjobs&JOBSSHOWALL=false\");>Show mine only</a> ]"
fi
echo -n "<i>(please click on [x] to clean your jobs when they are done)</i>"
echo -n "<br>"
}
[ "$STATE_JOBSSHOWALL" = "1" -o "$USER" = "$2" ] || continue
if [ $RETCODE -eq 256 -a -e /proc/$1 ]; then
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" width=10 height=10 src=\"/images/inprogress.gif\" alt=\"running...\" title=\"running...\">"
elif [ ! -e $PROCESSLOG ]; then
sed -i "\,$1 $USER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes
sed -i "\,$CMDPID $CMDUSER.* $PROCESSLOG ,d" $WEBBUILD_STATEDIR/processes
continue
else
if [ $RETCODE -eq 256 ]; then
$SUDO_WRAPPER finishprocess $1 "$USER" $5
RETCODE=$?
fi
# Process finished: add + to retcode to report notification
if [ ! "$NOTIFIED" ]; then
sed -i "s|^\($CMDPID $CMDUSER.* $PROCESSLOG $RETCODE\)|\1\+|" $WEBBUILD_STATEDIR/processes
fi
CMDEMAIL=`grep "USER_EMAIL" $WEBBUILD_STATEDIR/users/$CMDUSER.conf|sed "s|USER_EMAIL=||"`
if [ $RETCODE -eq 0 ]; then
[ "$NOTIFIED" ] || \
social_log "SUSER=$CMDUSER STYPE=job SEMAIL=$CMDEMAIL STEXT=\"''$cmdline'' <b>succesfully completed</b>!\" STIME=`date +%s`"
# echo -n "<font color=lightgreen><b>OK</b></font>"
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" src=\"/images/ok.png\" width=10 height=10 alt=\"OK\" title=\"Job successfully completed\">"
else
[ "$NOTIFIED" ] || \
social_log "SUSER=$CMDUSER STYPE=job SEMAIL=$CMDEMAIL STEXT=\"''$cmdline'' <b>failed</b>\" STIME=`date +%s`"
# echo -n "<font color=red><b>ERROR ($RETCODE)</b></font>"
echo -n "<img style=\"margin-top:-1px;margin-right:2px;\" src=\"/images/fail.png\" width=10 height=10 alt=\"ERROR\" title=\"Job returned with error $RETCODE\">"
fi
@ -456,7 +470,7 @@ fi
if [ "$REQUEST" = "message" -a "$USER" -a "$USER_CANSENDMESSAGES" ]; then
# external (autodist) social messages
[ "$MESSAGETYPE" ] || MESSAGETYPE=broadcastmessage
social_log "SUSER=$USER STYPE=$MESSAGETYPE SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
social_log "SUSER=$USER STYPE=$MESSAGETYPE STARGET=\"$TARGET\" SEMAIL=$USER_EMAIL STEXT=\"$MESSAGE\" STIME=`date +%s`"
echo "</webbuild>"
exit
fi
@ -464,11 +478,11 @@ fi
# repsearch request
if [ "$REQUEST" = "repsearch" ]; then
echo -n "<output><![CDATA["
echo -n "<hr><b>Search results for \"$REPSEARCHTEXT\":</b><div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
echo -n "<hr><b>Search results for \"$REPSEARCHTEXT\":</b><div align=left class=\"outputbox\" id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
# echo -n "<pre><!-- SCROLL -->"
REPSEARCHTEXT_FMT=`echo "${REPSEARCHTEXT}" | sed "s|[[:space:]]|+|g"`
curl -s "${WEBBUILD_DISTROQUERY_URL}?query=${REPSEARCHTEXT_FMT}&search_milestone2=true&search_devel=true\
&search_i586=true&search_x86_64=true&search_arm=true&search_sources=true&query_compact=true&replyplain=true" | \
curl -L -s "${WEBBUILD_DISTROQUERY_URL}?query=${REPSEARCHTEXT_FMT}&search_rolling=true&search_milestone2=true&search_milestone3=true&search_devel=true\
&search_i586=true&search_x86_64=true&search_arm=true&search_aarch64=true&search_sources=true&query_compact=true&replyplain=true" | \
sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
# $SUDO_WRAPPER 0 local "$USER" "" "autodist-repository search -i ${REPSEARCHTEXT/-/\-}" | \
# parse_search_output ${AUTOPORT_ARCH[$ENVIRONMENT]}
@ -483,7 +497,7 @@ fi
# environment search request
if [ "$REQUEST" = "environmentsearch" ]; then
echo -n "<output><![CDATA["
echo -n "<hr><b>Environment search results for \"$ENVSEARCHTEXT\":</b><div align=left class=output id=outputtop>"
echo -n "<hr><b>Environment search results for \"$ENVSEARCHTEXT\":</b><div align=left class=\"outputbox\" id=outputtop>"
echo -n "<pre><!-- SCROLL -->"
echo -n "<font style=\"background-color:gray\">Installed packages providing '$ENVSEARCHTEXT':</font><br>"
WHAT_PROVIDES=`$SUDO_WRAPPER binary $ENVIRONMENT "$USER" "" "rpm -q --what-provides \"$ENVSEARCHTEXT\"" | sort -u`
@ -523,9 +537,17 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "<option value=\"RPMS\" $SELECTED>Local *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMSNOARCH\" $SELECTED>Local *.noarch.rpm</option>"
if [ "${AUTOPORT_ARCH[$ENVIRONMENT]}" == "x86_64" ]; then
[ "$RPMMANAGERDIR" = "RPMS_i586" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMS_i586\" $SELECTED>Local *.i586.rpm</option>"
fi
if [ "${AUTOPORT_ARCH[$ENVIRONMENT]}" == "x86_64" -o "${AUTOPORT_ARCH[$ENVIRONMENT]}" == "i586" ]; then
[ "$RPMMANAGERDIR" = "RPMS_arm" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"RPMS_arm\" $SELECTED>Local *.arm.rpm</option>"
fi
[ "$RPMMANAGERDIR" = "SRPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"SRPMS\" $SELECTED>Local *.src.rpm</option>"
if [ -e $local_ftp/$REPOSITORY ]; then
if [ "$REPOSITORY" -a -e $local_ftp/$REPOSITORY ]; then
[ "$RPMMANAGERDIR" = "REP_RPMS" ] && SELECTED="selected=selected" || SELECTED=
echo -n "<option value=\"REP_RPMS\" $SELECTED>$REPOSITORY *.${AUTOPORT_ARCH[$ENVIRONMENT]}.rpm</option>"
[ "$RPMMANAGERDIR" = "REP_RPMSNOARCH" ] && SELECTED="selected=selected" || SELECTED=
@ -579,6 +601,7 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "<input type=button value=\"install\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
@ -590,6 +613,7 @@ if [ "$REQUEST" = "rpmmanager" ]; then
echo -n "<input type=button value=\"upgrade\" onclick="
echo -n "p=getCheckedValuesByName('rpmmanagercheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "RPMMANAGERDIR=$RPMMANAGERDIR&"
echo -n "RPMMANAGERPACKAGES=\"+encodeURIComponent(p)+\"&"
echo -n "RPMMANAGERFORCE=\"+getElementById('rpmmanagerforce').checked+\"&"
echo -n "REQUEST=rpmmanagerupgrade\""
@ -658,7 +682,7 @@ echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAG
echo -n "REQUEST=rpmmanager\");>"
# expert mode checkbox
[ "$STATE_ADVANCEDCONTROLS" ] && CHECKED="checked=checked" || CHECKED=
echo -n " <span style=\"white-space:nowrap\">Autodist:<input type=checkbox id=\"advancedcontrols\" "
echo -n " <span>Autodist:<input type=checkbox id=\"advancedcontrols\" "
echo -n "onclick=ajax_getvalues(\""
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
@ -731,7 +755,8 @@ echo -n "]]></environments>"
if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<specedit> </specedit>"
elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchmaintainermode" \
-o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "edit" ]; then
-o "$REQUEST" = "prepare" -o "$REQUEST" = "reloadspec" -o "$REQUEST" = "edit" \
-o "$REQUEST" = "reloadspeclist" -o "$REQUEST" = "prepare" ]; then
# SPECFILES select
echo -n "<specedit><![CDATA["
echo -n " Edit:<select id=specfile "
@ -743,7 +768,11 @@ elif [ ! "$REQUEST" -o "$REQUEST" = "changeenvironment" -o "$REQUEST" = "switchm
[ "$PACKAGE" = "$specname" ] && SELECTED="selected=\"selected\"" || SELECTED=
echo -n "<option value=\"$specname\" $SELECTED>${specname}</option>"
done
echo -n "</select>.spec]]></specedit>"
echo -n "</select>.spec"
echo -n "&nbsp<img class=\"button\" src=\"/images/refresh.png\" alt=\"Refresh\" title=\"Refresh spec list\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "MAINTAINERMODE=$MAINTAINERMODE&REQUEST=reloadspeclist\");></img>"
echo -n "]]></specedit>"
fi
[ "$PACKAGE" -a ! "$REQUEST" ] && REQUEST=edit
@ -765,9 +794,9 @@ if [ ! "$REPSEARCHTEXT" ]; then
# echo -n "REQUEST=repsearch&REPSEARCHTEXT=\"+encodeURIComponent(getElementById('repsearchtext').value));>"
if [ "$PACKAGE" ]; then
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"${PACKAGE/*\/}\" "
echo -n "<br><input type=text id=\"repsearchtext\" value=\"${PACKAGE/*\/}\" "
else
echo -n "<input type=text style=\"display:block;width:98%;align:center;padding:0;margin:0;\" id=repsearchtext value=\"Enter a package name to search...\" "
echo -n "<br><input type=text id=\"repsearchtext\" value=\"Enter a package name to search...\" "
echo -n "onfocus=\"if (this.value==this.defaultValue) this.value=''\" "
fi
echo -n "onkeypress=if(checkEnter(event))ajax_getvalues(\""
@ -896,11 +925,11 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo "<option value=\"\">-- Select a SRPM package --</option>"
SRPMBUTTONDISABLED="disabled=disabled"
if [ "$local_ftp" -a -e $local_ftp/$REPOSITORY ]; then
if [ $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
if [ ! -s $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY -o $local_ftp/$REPOSITORY/SRPMS.base -nt $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
curl -L -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
while read f; do
@ -947,7 +976,7 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
# SPECFILE creation
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then
echo -n "<speccreate><![CDATA[<div style=\"white-space:nowrap;\">"
echo -n "<speccreate><![CDATA[<div class=\"speccreate\">"
echo -n " Start from URL:<input onChange=\"suggestSpecName()\" type=text id=speccreateurl value=\"\" style=\"width:32%\">"
echo -n " name:<input type=text id=speccreatename disabled value=\"\" style=\"width:10%\">"
echo -n " type:<select id=speccreatetype disabled>"
@ -978,8 +1007,7 @@ if [ "$REQUEST" = "changespec" ]; then
REQUEST="edit";
fi
elif [ "$REQUEST" = "broadcastmessage" ]; then
BROADCASTMESSAGE=`echo $BROADCASTMESSAGE | sed "s|<|\&lt;|g"`
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:&quot;<i>$BROADCASTMESSAGE</i>&quot;\" STIME=`date +%s`"
social_log "SUSER=$USER STYPE=broadcastmessage SEMAIL=$USER_EMAIL STEXT=\"said:&quot;<i>`var2html BROADCASTMESSAGE`</i>&quot;\" STIME=`date +%s`"
REQUEST=
fi
@ -995,7 +1023,7 @@ if [ "$SPECTEXT" ]; then
fi
RET=$?
[ $RET -eq 0 ] || {
echo -n "<output><![CDATA[<div class=output>ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.</div>]]></output></webbuild>"
echo -n "<output><![CDATA[<div class=\"outputbox\">ERROR: could not save file ${PACKAGE/*\/}.spec! Please report the problem, thanks.</div>]]></output></webbuild>"
exit 1
}
rm -f $tmpfile
@ -1016,7 +1044,7 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
else
OUTPUTMODE="outputbottom"
fi
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=output id=$OUTPUTMODE>"
echo -n "<output><![CDATA[<hr><b>Console output:</b><div align=left class=\"outputbox\" id=$OUTPUTMODE>"
echo -n "<pre>"
RET=255
case $REQUEST in
@ -1039,14 +1067,11 @@ if [ "$REQUEST" = "prepare" -o "$REQUEST" = "updatespec" -o "$REQUEST" = "speccr
RET=$?
;;
"speccreate") if [ "$SPECCREATEURL" -a "$PACKAGE" ]; then
FOUND_EXISTING=`curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
sed "s|.*\([0-9][0-9]*\) result.*|\1|"`
if [ "$FOUND_EXISTING" != "0" -a "$FOUND_EXISTING" != "" ]; then
echo -n "<div align=left class=output id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
FOUND_EXISTING=`curl -L -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_base=true&search_milestone2=true&search_milestone3=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true&searchbox=false"`
if [ "$FOUND_EXISTING" != "" ]; then
echo -n "<div align=left class=\"output\" id=outputtop style=\"font-family:serif;color:black;background-color:#E0F2D0;\">"
echo "<b><font color=red>ERROR: package already exists, please update from appropriate version:</font><b>"
echo -n "<hr><b>Search results for \"$PACKAGE\":</b>"
curl -s "${WEBBUILD_DISTROQUERY_URL}?package=$PACKAGE&search_milestone2=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true" | \
sed "s| \(href=.\)/| \1${SITE_BASE_URL}/|g"
echo -n "<hr><b>Search results for \"$PACKAGE\":</b>$FOUND_EXISTING"
echo -n "</div>"
RET=1
continue
@ -1168,18 +1193,18 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<div class=maintainer>"
echo -n "<b>Recent packages in $REPOSITORY:</b><br>"
if [ "$local_ftp" -a -e $local_ftp/distromatic/$REPOSITORY ]; then
if [ $local_ftp/distromatic/$REPOSITORY/_recent.inc -nt $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY ]; then
if [ ! -s $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY -o $local_ftp/distromatic/$REPOSITORY/_recent.inc -nt $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY ]; then
cat $local_ftp/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
cat $local_ftp/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
curl -s $REPS_BASE_URL/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
curl -L -s $REPS_BASE_URL/distromatic/$REPOSITORY/_recent.inc > $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY
curl -L -s $REPS_BASE_URL/$REPOSITORY/distromatic.log > $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
fi
cat $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | sed "s|a \(href=.\)/|a target=new \1${SITE_BASE_URL}/|g"
iconv -c $WEBBUILD_STATEDIR/cache/repository-recent-$REPOSITORY | tr -d '\000-\011\013\014\016-\037' | sed "s|a \(href=.\)/|a target=new \1${SITE_BASE_URL}/|g"
echo -n "<br><b>Log:</b><br><pre>"
cat $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY
iconv -c $WEBBUILD_STATEDIR/cache/repository-distromaticlog-$REPOSITORY | tr -d '\000-\011\013\014\016-\037'
echo -n "</pre></div>"
echo -n "<input type=button id=updatespecbutton value=\"refresh\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
@ -1198,7 +1223,7 @@ fi
if [ "$PACKAGE" ]; then
[ "$AUTODISTJOB" ] || AUTODISTJOB=${PACKAGE/\/*}
AUTODISTJOB="${AUTODISTJOB/-/_}"
AUTODISTJOB="${AUTODISTJOB//[-]/_}"
PACKAGE=${PACKAGE/*\/}
eval `$SUDO_WRAPPER specinfo $ENVIRONMENT "$USER" $PACKAGE ""`
[ $? -eq 0 ] && SPECAVAILABLE=1
@ -1244,7 +1269,7 @@ fi
# operation panel
if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<operationpanel><![CDATA["
echo -n "<div style=\"margin-top:140px;background-color:#E0F2D0;border:1px;\">"
echo -n "<div class=\"operationpanelinfo\">"
if [ "$PACKAGE" ]; then
echo -n "Package: <b>$PACKAGE</b><br>Version: "
[ "${SPECVAR_Epoch[0]}" ] && echo -n "${SPECVAR_Epoch[0]}:"
@ -1252,8 +1277,9 @@ if [ "$MAINTAINERMODE" != "true" ]; then
fi
showEnvironmentPanel
echo -n "</div>"
echo -n "<br><b>Build/Send options:</b><br>Arch:<select id=rpmbuildarch>"
for f in i586 arm x86_64 ppc; do
echo -n "<div class=\"operationpanelsend\">"
echo -n "<b>Build/Send options:</b><br>Arch:<select id=rpmbuildarch>"
for f in i586 arm x86_64 aarch64; do
SELECTED=
if [ "$f" = "$RPMBUILDARCH" ]; then
SELECTED="selected=\"selected\"";
@ -1289,8 +1315,8 @@ if [ "$MAINTAINERMODE" != "true" ]; then
fi
echo -n "<option value=\"$repname\" $SELECTED>$repname</option>"
done
echo -n "</select><br>"
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<br><div style=\"background-color:#FFFFDE\"><b>Autodist batch builds:</b><br>"
echo -n "</select></div>"
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "<div class=\"operationpanelautodist\"><b>Autodist batch builds:</b><br>"
if [ "$PACKAGE" ]; then
if [ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
echo -n "Patch for $PACKAGE:<br>"
@ -1339,10 +1365,10 @@ if [ "$MAINTAINERMODE" != "true" ]; then
if [ "$AUTODISTJOB" -a "$AUTODISTJOB" = "$f" ]; then
SELECTED="selected=\"selected\""
AUTODISTJOBSELECTED=1
elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOB" ]; then
elif [ "${PACKAGE}" = "$f" -a ! "$AUTODISTJOB" ]; then
# elif [ "$PACKAGE" = "$f" -a ! "$AUTODISTJOBSELECTED" -a "$REQUEST" != "autodistjobchange" ]; then
SELECTED="selected=\"selected\""
AUTODISTJOB=$f
AUTODISTJOB=${f//[-]/_}
AUTODISTJOBSELECTED=1
fi
JOBENCODED=`cgi_encodevar $f`
@ -1354,7 +1380,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<option value=\"$PACKAGEENCODED\" $SELECTED>$PACKAGE (defaults)</option>"
fi
echo -n "</select>"
if [ "$AUTODISTJOBSELECTED" -a "$AUTODISTJOB" = "$PACKAGE" ]; then
if [ "$AUTODISTJOBSELECTED" -a "$AUTODISTJOB" = "${PACKAGE//[-]/_}" ]; then
echo -n "<br><font color=red>You should use autodist for this package!</font>"
fi
if [ "$AUTODISTJOB" ]; then
@ -1413,17 +1439,22 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "`cgi_encodevar "</b> job in current environment?"`\""
echo -n "); class=redbutton $DISABLED>"
# autodist send
[ ! "$USER_ALLREPOSITORIES" ] && DISABLED="disabled=disabled" || DISABLED=
if [ "$SPECVAR_CHECK_NOAUTOBUILDREQ" ]; then
HREFADD="disabled=disabled title=\"WARNING: fix specfile build requirements before you can send the package\""
else
HREFADD=
fi
echo -n "<input type=button value=\"send\" onclick="
echo -n "p=getCheckedValuesByName('autodistpkgscheckbox');ajax_getvalues(\""
echo -n "AUTODISTFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "AUTODISTARCH=\"+getSelectedValueById('rpmbuildarch')+\"&"
echo -n "AUTODISTJOB=\"+getSelectedValueById('autodistjobs')+\"&"
echo -n "AUTODISTPKGS=\"+encodeURIComponent(p)+\"&"
echo -n "SENDRECREATESRPM=true&"
echo -n "SENDREPOSITORY=\"+getSelectedValueById('sendrepository')+\"&"
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autodistsend\""
echo -n ",\"`cgi_encodevar "Send selected packages for <b>"`\"+getSelectedValueById('autodistjobs')+\"`cgi_encodevar "</b> job to <b>"`\"+"
echo -n "getSelectedValueById('sendrepository')+\"`cgi_encodevar "</b>?"`\"); class=redbutton $DISABLED>"
echo -n "getSelectedValueById('sendrepository')+\"`cgi_encodevar "</b>?"`\"); class=redbutton $HREFADD>"
# autodist schedule
echo -n "<br>New version:<input type=text id=autodistversion value=\"\" style=\"width:20%\"> "
echo -n "<input type=button value=\"schedule job\" onclick="
@ -1465,8 +1496,9 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autoportlog\");>"
fi
fi
[ "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -o "$STATE_ADVANCEDCONTROLS" ] && echo -n "</div>"
if [ "$PACKAGE" ]; then
echo -n "<hr><div style=\"background-color:#E0F2D0\">"
echo -n "<div class=\"operationpanelpatches\">"
## check for updates
#echo -n "<input type=button value=\"check for updates\" onclick="
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=autospecupdatescheck&"
@ -1486,21 +1518,22 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "ADDPATCHNAME=\"+encodeURIComponent(getElementById('addpatchname').value));>"
echo -n "&nbsp;<a href=\"http://pastebin.com\" target=_new>pastebin</a><br>"
echo -n "URL:<input type=text id=addpatchurl value=\"\" style=\"width:80%\">"
echo -n "<br><div style=\"white-space:nowrap;font-size:9px;width:100%;overflow:hidden\"><span style=\"float:left;margin-top:6px;\">$PACKAGE-${SPECVAR_Version}-</span>"
echo -n "<br><div style=\"white-space:nowrap;font-size:9pt;width:100%;overflow:hidden\"><span style=\"float:left;margin-top:6px;\">$PACKAGE-${SPECVAR_Version}-</span>"
echo -n "<span style=\"display:block;float:right;margin-top:6px;\">.patch</span>"
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\"><input type=text id=addpatchname value=\"\" style=\"width:100%\"></span></div>"
echo -n "</div>"
# upload sources
echo -n "<hr><b>Upload source:</b>"
echo -n "<div class=\"operationpanelupload\"><b>Upload source:</b>"
echo -n "<form name=\"form\" action=\"javascript:\" method=\"POST\" enctype=\"multipart/form-data\">"
echo -n "<input id=\"fileToUpload\" type=\"file\" size=\"10\" name=\"fileToUpload\" class=\"input\">"
echo -n "<button class=\"button\" id=\"buttonUpload\" onclick=ajaxFileUpload(\""
echo -n "<input type=\"button\" class=\"button\" id=\"buttonUpload\" onclick=ajaxFileUpload(\""
echo -n "REQUEST=uploadsource&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue())+\"&"
echo -n "UPLOADFILENAME=\"+encodeURIComponent(getElementById('fileToUpload').value));>Upload</button>"
echo -n "UPLOADFILENAME=\"+encodeURIComponent(getElementById('fileToUpload').value)); value=\"Upload\">"
echo -n "</form>"
echo -n "</div>"
# info from package sources
echo -n "<hr><div style=\"background-color:#A7DEDE\">"
echo -n "<div class=\"operationpanelpackageinfo\">"
echo -n "<b>Info from package in the works:</b><br>"
# show sources
echo -n "<select id=sourcefile style=\"width:98%\" onchange="
@ -1555,9 +1588,10 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\">"
echo -n "<input type=text id=pkgnote value=\"\" style=\"width:100%\">"
echo -n "</span>"
echo -n "</div>"
# generic info
echo -n "<hr><b>Generic info:</b><br>"
echo -n "<div class=\"operationpanelgenericinfo\"><b>Generic info:</b><br>"
# allowed groups
echo -n "<input type=button value=\"allowed groups\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&REQUEST=allowedgroups\");>"
@ -1586,16 +1620,15 @@ if [ "$MAINTAINERMODE" != "true" ]; then
done
echo -n "</select></div>"
echo -n "</div>"
fi
echo -n "<hr><b>Host maintainance:</b><br>"
echo -n "<div class=\"operationpanelhost\"><b>Host maintainance:</b><br>"
## 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 "<div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;align:center;padding:0;margin:2px;\" id=environmentsearch value=\"Search package or provide...\" "
echo -n "<div style=\"white-space:nowrap;width:100%;\">Provides:<input type=text style=\"width:75%;\" 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&"
@ -1606,14 +1639,14 @@ if [ "$MAINTAINERMODE" != "true" ]; then
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>"
echo -n "</div>"
echo -n "]]></operationpanel>"
fi
echo -n "<chatpanel><![CDATA["
# broadcast message
echo -n "<div style=\"position:absolute;width:220px;\">"
echo -n "<textarea id=broadcastmessage style=\"font-family:sans;height:36px;width:80%;float:left;font-size:8pt;resize:none;\" "
echo -n "<div class=\"chatpanel\">"
echo -n "<textarea id=broadcastmessage style=\"height:40px;width:80%;float:left;resize:none;\" "
echo -n "onfocus=\"if(this.value==this.defaultValue)this.value='';\">Chat with online developers...</textarea>"
echo -n "<input type=button style=\"float:right\" onclick=ajax_getvalues(\""
echo -n "ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
@ -1628,7 +1661,7 @@ if [ "$REQUEST" != "" ]; then
echo -n "<b>Console output ($REQUEST"
[ "$PACKAGE" ] && echo -n " for $PACKAGE"
echo -n "):</b>"
echo -n "<div align=left class=output "
echo -n "<div class=\"outputbox\" "
if [ "$REQUEST" = "rpmbuild" -o "$REQUEST" = "autoportnp" -o "$REQUEST" = "rpmprepare" \
-o "$REQUEST" = "sendpackage" -o "$REQUEST" = "sendsource" -o "$REQUEST" = "autospeclistcheck" \
-o "$REQUEST" = "autodistbuild" -o "$REQUEST" = "autodistinstall" -o "$REQUEST" = "autodistsend" ]; then
@ -1646,7 +1679,7 @@ case $REQUEST in
"savespec") echo "File <b>$PACKAGE.spec</b> saved."
RET=-1
;;
"smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo smart update && sudo smart upgrade"
"smartupgrade") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo dnf update -y"
RET=$?
;;
"runldconfig") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "export LANG=C;sudo /sbin/ldconfig"
@ -1726,16 +1759,26 @@ case $REQUEST in
;;
"autodistsend") [ "$AUTODISTFORCE" = "true" ] && AUTODISTADD="--force" || AUTODISTADD=
autodistjobs=
RET=0
if [ "$AUTODISTPKGS" ]; then
for p in $AUTODISTPKGS; do
autodistjobs="$autodistjobs $AUTODISTJOB/$p"
if [ "$SENDRECREATESRPM" = "true" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "$p" "rpmbuild -bs \
--define=\"_topdir $SPECVAR_WORKINGHOME/RPM\" \
$p.spec $RPMFORCEADD"
RET=$?
[ $RET -eq 0 ] || break
fi
done
else
autodistjobs="$AUTODISTJOB"
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
RET=$?
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
if [ $RET -eq 0 ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "autodist -v -s $autodistjobs --repository ${AUTOPORT_BASE_REPOSITORY[$ENVIRONMENT]} --server $SENDREPOSITORY --arch $AUTODISTARCH --user $USER $AUTODISTADD -- --colors web"
RET=$?
[ $RET -eq 0 ] && social_log "SUSER=$USER SEMAIL=$USER_EMAIL STEXT=\"sent <b>$AUTODISTPKGS $SPECVAR_Version-$SPECVAR_Release</b> from <i>`print_environment_descr $ENVIRONMENT`</i> to <b>$SENDREPOSITORY</b>\" STIME=`date +%s`"
fi
;;
"autoport") if [ "$AUTOPORTPACKAGE" ]; then
if [ "$AUTOPORTRELEASEREPOSITORY" ]; then
@ -1761,7 +1804,7 @@ case $REQUEST in
"rpmbuild") [ "$RPMFORCE" = "true" ] && RPMFORCEADD="--force-build"
[ "$RPMBUILDARCH" -a "$RPMBUILDARCH" != "${AUTOPORT_ARCH[$ENVIRONMENT]}" ] && \
RPMARCHADD="-A $RPMBUILDARCH --define \"cross_target_cpu=$RPMBUILDARCH\""
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5,6 $RPMFORCEADD $RPMARCHADD" &>/dev/null
$SUDO_WRAPPER background $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a5,6 -b $RPMFORCEADD $RPMARCHADD" &>/dev/null
# && echo \"Webbuild HINT: now you may want to click on 'build requirements', add build requirements in .spec file and then 'recreate SRPMS'\""
[ $? -ne 0 ] && RET=$? || {
RET=-1
@ -1782,7 +1825,7 @@ $RPMFORCEADD $PACKAGE.spec"
RET=$? ;;
"autospecbuildreq")
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo /sbin/ldconfig"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a6"
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a6 -b"
RET=$? ;;
"rpmchecks") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a8"; RET=$? ;;
"rpmsimulateinstall") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "$AUTOSPEC_CMD -u $PACKAGE -a7"; RET=$? ;;
@ -1860,7 +1903,7 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
fi
echo -ne "<br><pre>Patch$NEWPATCHNUM: $PACKAGE-${SPECVAR_Version}-$ADDPATCHNAME.patch</pre>"
echo -n "<font color=gold>2) in %prep section after %setup:</font><br>"
echo -ne "<br><pre>%patch$NEWPATCHNUM -p$l</pre>"
echo -ne "<br><pre>%patch $NEWPATCHNUM -p$l -b .${ADDPATCHNAME}</pre>"
RET=-1
}
else
@ -1978,7 +2021,7 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
# fi
fi
;;
"repositorymassrebuilddependant")
"repositorymassrebuilddependent")
if [ ! "$PACKAGES" ]; then
echo "ERROR: no package(s) selected."
RET=1
@ -2047,6 +2090,14 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
show_docs `$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && find . $PATTERN -maxdepth 2"`
RET=-1
;;
"consolecmd") if [ ! "$SPECVAR_BUILDDIR" ]; then
echo "ERROR: BUILDDIR is undefined"
RET=1
else
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && bash -c '$CONSOLECMD'"
RET=$?
fi
;;
"configurehelp") $SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && ./configure --help || ./waf configure --help"
RET=$?
[ $RET -eq 0 ] && RET=-1 ;;
@ -2088,18 +2139,10 @@ $PACKAGE.spec $RPMFORCEADD && $AUTOSPEC_CMD -u $PACKAGE -a10 --server $SENDREPOS
if [ "$installpackages" ]; then
if [ "$REQUEST" = "rpmmanagerinstall" ]; then
echo "Installing packages: $RPMMANAGERPACKAGES<br>"
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd"
else
sudo rpm -i $installpackages $rpmforceadd
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -i $installpackages $rpmforceadd 2>&1"
elif [ "$REQUEST" = "rpmmanagerupgrade" ]; then
echo "Upgrading packages: $RPMMANAGERPACKAGES<br>"
if [ "$rpmmanagermode" = "environment" ]; then
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd"
else
sudo rpm -U $installpackages $rpmforceadd
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "sudo rpm -U $installpackages $rpmforceadd 2>&1"
fi
RET=$?
else
@ -2140,10 +2183,43 @@ fi
if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<packages> </packages>"
echo -n "<operationpanel><![CDATA["
echo -n "<div class=\"operationpanelinfo\">"
echo "Repository: <b>$REPOSITORY</b><br>"
showEnvironmentPanel
echo -n "<hr>"
echo -n "</div>"
if [ "$REPOSITORY" ]; then
echo -n "<b>Repository maintenance:</b><br>"
# send options
echo -n "<div class=\"operationpanelsend\"><b>Send options:</b>"
# destination repository
echo -n "<br>Destination: "
echo -n "<select id=repositoryimportto>"
if [ "${REPOSITORY:0:10}" = "milestone2" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE2_IMPORT_REPOSITORIES
elif [ "${REPOSITORY:0:10}" = "milestone3" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE3_IMPORT_REPOSITORIES
else
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES $AUTOPORT_DEVEL_RELEASE_REPOSITORIES"
fi
for f in $IMPORT_REPOSITORIES; do
# [ "$f" = "$REPOSITORY" ] && continue
if [ ! "$USER_ALLREPOSITORIES" ]; then
for u in $USER_CANMAINTAIN_REPOSITORIES; do
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"
# -a "$f" != "$REPOSITORY"
done
else
#[ "$f" != "$REPOSITORY" ] &&
echo -n "<option value=\"$f\">$f</option>"
fi
done
echo -n "</select><br>"
# force checkbox
echo -n "<label style=\"background-color:red;padding:1px;\"><input type=checkbox id=\"repositoryforce\" value=\"force\">force</label>"
# simulate checkbox
echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label></div>"
# operations box
echo -n "<div class=\"operationpaneloperations\">"
echo -n "<b>Operations on selected packages:</b><br>"
# echo -n "<select multiple size=8 id=package onchange="
# echo -n "i=getElementById('repository').selectedIndex;ajax_getvalues(\"REQUEST=edit&"
# echo -n "ENVIRONMENT=$ENVIRONMENT&MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
@ -2157,7 +2233,7 @@ if [ "$MAINTAINERMODE" = "true" ]; then
ls --color=none $local_ftp/$REPOSITORY/SRPMS.base/ | grep ".src.rpm$" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
else
curl -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
curl -L -s $REPS_BASE_URL/$REPOSITORY/SRPMS.base/ | grep .src.rpm | \
sed "s|.*\.src\.rpm\">\(.*\)</a>.*|\1|" | sort -f > $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
fi
while read f; do
@ -2175,35 +2251,14 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "<label><input type=checkbox name=packagescheckbox value=\"$pkgname\" $SELECTED>${pkgname} ${pkgver}-${pkgrel}</label>"
done < $WEBBUILD_STATEDIR/cache/repository-src-$REPOSITORY
echo -n "</div>"
echo -n "Origin: <b>$REPOSITORY</b>"
# repository sync
echo -n " <input type=button value=\"sync\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&"
echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
echo -n "REQUEST=repositorysync\""
echo -n ",\"`cgi_encodevar "Make <b>$REPOSITORY</b> updates immediately available from public server?"`\""
echo -n "); class=redbutton>"
echo -n "<br>Destination: "
echo -n "<select id=repositoryimportto>"
if [ "${REPOSITORY:0:10}" = "milestone2" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE2_IMPORT_REPOSITORIES
else
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER $AUTOPORT_DEVEL_RELEASE_REPOSITORIES"
fi
for f in $IMPORT_REPOSITORIES; do
# [ "$f" = "$REPOSITORY" ] && continue
if [ ! "$USER_ALLREPOSITORIES" ]; then
for u in $USER_CANMAINTAIN_REPOSITORIES devel-$USER; do
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"
# -a "$f" != "$REPOSITORY"
done
else
#[ "$f" != "$REPOSITORY" ] &&
echo -n "<option value=\"$f\">$f</option>"
fi
done
echo -n "</select><br>"
## repository sync
#echo -n " <input type=button value=\"sync\" onclick="
#echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
#echo -n "PACKAGES=\"+encodeURIComponent(getCheckedValuesByName('packagescheckbox'))+\"&"
#echo -n "MAINTAINERMODE=\"+getElementById('maintain').checked+\"&"
#echo -n "REQUEST=repositorysync\""
#echo -n ",\"`cgi_encodevar "Make <b>$REPOSITORY</b> updates immediately available from public server?"`\""
#echo -n "); class=redbutton>"
# repository compare
echo -n "<input type=button value=\"compare\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
@ -2251,16 +2306,6 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "REQUEST=repositoryarchive\""
echo -n ",\"`cgi_encodevar "Archive <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b>?"`\""
echo -n "); class=redbutton>"
# force checkbox
echo -n "<label><input type=checkbox id=\"repositoryforce\" value=\"force\">force</label>"
# simulate checkbox
echo -n "<label><input type=checkbox id=\"repositorysimulate\" value=\"simulate\">simulate</label>"
# changelog for mass rebuild
echo -n "<hr><b>Mass rebuild of selected packages:</b><br>Changelog:"
echo -n "<input type=text id=massrebuildchangelog style=\"width:100%\">"
# autodist update buildrequirements
echo -n "Add build requirement(s):<br>"
echo -n "<textarea id=massrebuildbuildreq style=\"width:98%;font-size:8pt;resize:none;\" rows=2></textarea>"
# mass rebuild
echo -n "<input type=button value=\"rebuild\" onclick="
echo -n "p=getCheckedValuesByName('packagescheckbox');"
@ -2276,8 +2321,8 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n ",\"`cgi_encodevar "Rebuild <b>"`\"+p+\"`cgi_encodevar "</b> from <b>$REPOSITORY</b> and send to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# mass rebuild of dependant packages
echo -n "<input type=button value=\"rebuild dependant\" onclick="
# mass rebuild of dependent packages
echo -n "<input type=button value=\"rebuild deps\" onclick="
echo -n "p=getCheckedValuesByName('packagescheckbox');"
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
echo -n "PACKAGES=\"+encodeURIComponent(p)+\"&"
@ -2287,10 +2332,17 @@ if [ "$MAINTAINERMODE" = "true" ]; then
echo -n "REPOSITORYFORCE=\"+getElementById('repositoryforce').checked+\"&"
echo -n "MASSREBUILDCHANGELOG=\"+encodeURIComponent(getElementById('massrebuildchangelog').value)+\"&"
echo -n "MASSREBUILDBUILDREQ=\"+encodeURIComponent(getElementById('massrebuildbuildreq').value)+\"&"
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorymassrebuilddependant\""
echo -n ",\"`cgi_encodevar "Rebuild package which depend on <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b> and send to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "SENDREPOSITORY=$REPOSITORY&REQUEST=repositorymassrebuilddependent\""
echo -n ",\"`cgi_encodevar "Rebuild package(s) which depend on <b>"`\"+p+\"`cgi_encodevar "</b> in <b>$REPOSITORY</b> and send to <b>"`\"+getSelectedValueById('repositoryimportto')+"
echo -n "\"`cgi_encodevar "</b>?"`\""
echo -n "); class=redbutton>"
# changelog for mass rebuild
echo -n "<br>Rebuild changelog:"
echo -n "<input type=text id=massrebuildchangelog style=\"width:100%\">"
# autodist update buildrequirements
echo -n "Add build requirement(s):<br>"
echo -n "<textarea id=massrebuildbuildreq style=\"width:98%;font-size:8pt;resize:none;\" rows=2></textarea>"
echo -n "</div>"
fi
echo -n "]]></operationpanel>"
fi

View File

@ -259,6 +259,7 @@ class PasswordHash {
}
$wp_hasher = new PasswordHash(8, TRUE);
echo $wp_hasher->HashPassword($argv[1]);
if ($wp_hasher->CheckPassword($argv[1], $argv[2]) == "1")
exit(0);
else

View File

@ -27,22 +27,28 @@ function set_user_state_var() {
function social_log() {
local line=$1
local SPRIVACY=0
[ "$line" ] || return
if [ ! "$STATE_FAKEUSER" ]; then
STATE_SOCIALLOG_ID=0
. $WEBBUILD_STATEDIR/users/webbuild.state
STATE_SOCIALLOG_ID=$(($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
[ -e $WEBBUILD_STATEDIR/webbuild.db ] || \
sqlite3 $WEBBUILD_STATEDIR/webbuild.db \
"CREATE TABLE social_log(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, privacy BOOLEAN, user CHAR(40), type CHAR(40), target CHAR(40), email CHAR(80), text TEXT, time datetime default current_timestamp);"
eval "$line"
[ "$STATE_PRIVACYMODE" ] && $SPRIVACY=1
sqlite3 $WEBBUILD_STATEDIR/webbuild.db \
"INSERT into social_log (privacy, user, type, target, email, text) \
values ($SPRIVACY,'$SUSER','$STYPE','$STARGET','$SEMAIL','$STEXT');"
# Note: checking that URL does not point here again to avoid recursive requests
if [ "$WEBBUILD_URL" -a "${WEBBUILD_URL/\/localhost\//}" = "$WEBBUILD_URL" ]; then
eval $line
USER_SECRET_FIXED=`echo $USER_SECRET | sed "s|\$|\\$|"`
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$USER&SECRET=`cgi_encodevar \"$USER_SECRET\"`&USER_EMAIL=$USER_EMAIL&\
MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
TARGET=$STARGET&MESSAGE=`cgi_encodevar \"$STEXT\"`" >/dev/null
fi
fi
}
@ -179,6 +185,20 @@ function cgi_getvars()
return
}
function var2html()
{
eval r=\$$1
r="${r//\&/&amp;}"
r="${r//\</&lt;}"
r="${r//\\\n/<br>}"
r="${r//\\/&#92;}"
r="${r//\"/&quot;}"
r="${r//\$/&#36;}"
r="${r//\`/&#96;}"
r="${r//\*/&#42;}"
echo "${r}"
}
function kill_tree() {
local killpid=$1
@ -239,22 +259,27 @@ function parse_patch_output() {
}
function parse_build_output() {
#s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;
sed "s|\r.*||;
s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;s|\\\|\\\\\\\|g;s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
s/\x90\x8D.*//g;
s|\\\|\\\\\\\|g;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|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|<span class=\"outputboxerror\">\1<a %SRCURL%\2%SRCURLEND%>\2</a></span>|i;
s|^\(== =.*\)|<span class=\"outputboxok\">\1</span>|;
s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|<font style=\"color:gold\">\1</font>|;
s|[[:cntrl:]]||g;" | google_search $1
s|[[:cntrl:]]||g;" | iconv -c | google_search $1
}
function parse_generic_output() {
# s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;
sed "s|\r.*||;
s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g;
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>|;
@ -264,13 +289,12 @@ function parse_generic_output() {
function google_search() {
while read line; do
local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|"`
if [ "$SEARCH_STRING" = "$line" ]; then
if [ "${line/\%SRCURL\%}" == "${line}" ]; then
echo "$line"
else
SEARCH_STRING=`echo $SEARCH_STRING | sed "s|\&lt;|<|"`
local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|;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"
echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g"
fi
done
}

View File

@ -42,7 +42,7 @@ function showlog() {
LOGFILES=`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" "" "ls -t $LOGFILES 2>/dev/null | head -1"`
fi
echo -n "<output><![CDATA[<hr><b>Console output for $PACKAGE ($LOGTYPE$LOGSTATUSAPPEND):</b>"
echo "<div align=left class=output id=$LOGOUTPUTID>"
echo "<div align=left class=\"outputbox\" id=\"$LOGOUTPUTID\">"
for f in $LOGFILES; do
if [ -r $f ]; then
LOGFILESIZE=`stat -c %s $f`
@ -59,7 +59,7 @@ function showlog() {
tail -n +0 -f $f --pid $PROCESSPID | stdbuf -oL sed "s|<\([/]pre>\)|\&lt;\1|g"
echo -n "<!-- ENDSCROLL -->"
else
if [ $LOGFILESIZE -lt 2097152 ]; then
if [ $LOGFILESIZE -lt 12097152 ]; then
if [ -r $f ]; then
cat $f | parse_build_output $PACKAGE
else
@ -139,6 +139,21 @@ function print_showlogcontrols() {
echo -n "REQUEST=showlog&LOGTYPE=send&LOGSTATUSOK=\"+document.all.logstatusOK.checked);> with status: "
echo -n "OK <input id=\"logstatusOK\" type=\"radio\" name=\"logstatus\" value=\"OK\"> "
echo -n "FAILED <input type=\"radio\" name=\"logstatus\" value=\"FAILED\" checked=\"checked\">"
# console cmd
echo -n "<hr><b>Command:</b> "
echo -n " ["
if [ "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}" ]; then
echo -n "${AUTOPORT_CHROOT_USER[$ENVIRONMENT]}@"
else
echo -n "autodist@"
fi
echo -n "`hostname -s` ${SPECVAR_BUILDDIR}]\$ <input type=text id=consolecmd value=\"\" size=\"40\"> "
echo -n "<input type=button id=consolecmdbutton value=\"submit\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=consolecmd&CONSOLECMD=\"+getElementById('consolecmd').value+\"&"
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
# close tag
echo -n "]]></showlogcontrols>"
}
@ -148,7 +163,7 @@ function print_editorcontrols() {
echo -n "<editcontrols><![CDATA["
# specfile save
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"float:left\">"
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"width:100%;display:block\">"
echo -n "<input type=button id=savebutton value=\"save\" onclick="
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
echo -n "REQUEST=savespec&SENDREPOSITORY=$SENDREPOSITORY&SPECTEXT=\"+encodeURIComponent(editor.getValue()));"
@ -227,7 +242,7 @@ function print_editorcontrols() {
echo -n "<label style=\"color:red;padding:0;\"><input type=checkbox id=\"sendrecreatesrpm\" value=\"force\">recreate SRPM</label>"
# specfile update
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"float:left\">"
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"display:flex\">"
echo -n "<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+\"&"
@ -235,12 +250,10 @@ function print_editorcontrols() {
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
echo -n "REBUILDSPECCHANGELOG=\"+encodeURIComponent(getElementById('rebuildspecchangelog').value)+\"&"
echo -n "SPECTEXT=\"+encodeURIComponent(editor.getValue()));>"
echo -n " (automatic or specify new version:<input type=text id=updatespecversion value=\"\" size=\"10\">"
echo -n " or new release changelog:"
echo -n "</span><span style=\"display:block;float:right\">)</span>"
echo -n "<span style=\"display:block;overflow:hidden;padding-right:5px;\">"
echo -n "<input type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\" style=\"width:100%\">"
echo -n "</span></div>"
echo -n "&nbsp;<label>to new version:</label><input type=text id=updatespecversion value=\"\" size=\"10\">"
echo -n "&nbsp;<label>or to new release with changelog:</label>"
echo -n "<input style=\"flex:1\" type=text id=rebuildspecchangelog value=\"$REBUILDSPECCHANGELOG\">"
echo -n "</div>"
# close tag
echo -n "]]></editcontrols>"
@ -254,14 +267,14 @@ function show_docs() {
done
echo -n "<br>"
for f in $@; do
echo -n "<a name=logfile-$f><p style=\"background-color:gray\"><b>File $f:</b></a><pre>"
echo -n "<a name=logfile-$f></a><p><b>File $f:</b><pre>"
ftype="`$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE "cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && file $f"`"
if [ "${ftype/text}" = "${ftype}" ]; then
echo "<p>Binary file; skipping."
continue
fi
$SUDO_WRAPPER 0 $ENVIRONMENT "$USER" $PACKAGE \
"cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && head -c 10240 $f | sed \"s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output
"cd $SPECVAR_RPMBUILDDIR/$SPECVAR_BUILDDIR && head -c 10240 $f | strings | sed \"s|<|\&lt;|g;s|[[:cntrl:]]\[[0-9;]*m||g\"" | parse_generic_output
RET=$?
echo -n "</pre>"
done
@ -275,7 +288,6 @@ function download_file() {
local f
for f in $download_files; do
echo $f >> /tmp/down
echo -e "Content-Type: application/octet-stream"
echo -e "Content-Disposition: attachment; filename=\"${f/*\/}\"\n"
if [ "$download_environment" ]; then
@ -284,7 +296,7 @@ echo $f >> /tmp/down
cat $f 2>/dev/null
fi
done
RET=$?
return $RET
}
@ -310,6 +322,12 @@ function resolve_rpmmanagerdir() {
RPMSNOARCH) rpmmanagerdir=../RPMS/noarch
rpmmanagermask="*.noarch.rpm"
rpmmanagermode=environment ;;
RPMS_arm) rpmmanagerdir=../RPMS/arm
rpmmanagermask="*.arm.rpm"
rpmmanagermode=environment ;;
RPMS_i586) rpmmanagerdir=../RPMS/i586
rpmmanagermask="*.i586.rpm"
rpmmanagermode=environment ;;
*) rpmmanagerdir=../RPMS/$RPMMANAGERARCH
rpmmanagermask="*.$RPMMANAGERARCH.rpm"
rpmmanagermode=environment ;;

View File

@ -2,6 +2,7 @@
. /usr/share/autodist/webbuild-functions
. /etc/sysconfig/autoport
export LANG="C.UTF-8"
MODE=$1
ENVIRONMENT=$2
USER=$3
@ -87,10 +88,11 @@ if [ "$MODE" = "specinfo" ]; then
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"
# _setup: prevent %setup macro expansion
$SUCMDPREFIX "rpmspec -P ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec --define \"%setup _setup\" > ${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|"`
BUILDDIR=`grep -m1 "^_setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
while read line; do
set -- $line
[ "$1" = "%package" -o "$1" = "%description" ] && break