Compare commits

...

64 Commits
v1.2 ... v1.4.2

Author SHA1 Message Date
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
31 changed files with 1091 additions and 594 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
unitdir = /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
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)
@ -62,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,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
@ -84,10 +88,13 @@ install-programs:
@$(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
@ -95,10 +102,9 @@ 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

View File

@ -1 +1 @@
VERSION = 1.0.2
VERSION = 1.4.2

View File

@ -5,7 +5,7 @@
#
# Released under the terms of the GNU GPL release 3 license
#
VERSION=1.0.2
VERSION=1.4.2
me=(${0##*/} $VERSION "Tue Jan 26 2016")
exec 3>`readlink /proc/self/fd/0`
@ -123,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
@ -236,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
@ -688,7 +691,7 @@ function launch_pkgs_loop() {
continue
fi
fi
command_opts="-a5:6" ;;
command_opts="-a5:6 -b" ;;
buildsrpm)
command_opts="-a5:6 --norpm" ;;
buildinstall)
@ -763,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
@ -1133,8 +1136,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`

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-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-2016 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
@ -276,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

105
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`"
@ -179,15 +177,18 @@ for p in ${allpkgs}; do
done
[ "$pkgcontinue" ] && continue
for a in `seq 1 ${#ARCHS[*]}`; do
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$PORT_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 ${ARCHS[$a-1]} $p
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
@ -197,15 +198,16 @@ for p in ${allpkgs}; do
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
@ -216,8 +218,8 @@ for p in ${allpkgs}; do
[ "$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
@ -225,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[*]}`
@ -239,46 +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
if [[ 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
fi
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" -o "$pkg_repository" == "$PORT_REPOSITORY" ]; 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
elif [ "$pkg_repository" == "$DEST_REPOSITORY" ]; then
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
else
echo "$p: unexpected upstream package repository; ignoring."
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

137
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=1.0.2
VERSION=1.4.2
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-2016 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,18 +241,26 @@ function find_requirements() {
fetch_repfiles() {
local u
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching ${REPS_BASE_URL}/$PORT_REPOSITORY/srcpkglist"
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"
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/sources-$BASE_ARCH"
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"
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/sources-$TARGET_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"
[ "$VERBOSE_MODE" = "1" ] && echo "Fetching $PORT_REPOSITORY_DISTROMATIC_URL/builds-$TARGET_ARCH.sh"
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
@ -266,10 +274,10 @@ fetch_repfiles() {
[ $# -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
@ -330,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=()
@ -377,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
@ -389,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
@ -404,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[*]}"
@ -418,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[*]}
@ -465,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
@ -536,6 +555,7 @@ 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"
@ -547,24 +567,23 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
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"
# [ "$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
@ -573,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) "
@ -587,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 ] && {
@ -610,8 +630,8 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
continue
}
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}"
# [ "$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 --changelog "$REBUILD_MILESTONE milestone rebuild" $src_version $src_release_num${REBUILD_MILESTONE} &>$tmpfile
[ $? -gt 0 ] && {
@ -649,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
@ -789,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[*]}

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,8 +4,7 @@ openmamba-sound-theme
desktop-base-openmamba
autodist
kernel27
rpm
apt
rootfiles
soundfont-2rock9
livecd-tools
makedist

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

@ -54,17 +54,27 @@ sed -i "s|^Vendor:.*|Vendor: 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|^\(Requires:[[:space:]]*kde-workspace\)$|#\1|;
s|http://.*.dl\.sourceforge\.net/|http://downloads.sourceforge.net/|;
s|http://ftp.kde.org/stable/|http://download.kde.org/stable/|;
s|ftp://ftp.kde.org/pub/kde/|http://download.kde.org/|;
s|http://download.kde.org/stable/%{version}|http://download.kde.org/stable/applications/%{version}|" $SPECFILE
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

@ -2,11 +2,12 @@
[ -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="+40"
SOURCES_PATH_CTIME_OLD="+730"
SRPMS_CTIME_OLD="+14"
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() {
@ -18,10 +19,23 @@ function clean() {
[ -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 {} \;
[ -e $dir/RPM/BUILD/ ] && find $dir/RPM/BUILD/ -mindepth 1 -maxdepth 1 -type d -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
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_PATH_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 {} \;
}
@ -33,16 +47,19 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
[ -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 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
find /var/autoport/$a/tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${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
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
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
fi
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -type f -mtime ${TMP_CTIME_OLD} -exec rm -rf {} \;
find /var/autodist-tmp/ -mindepth 1 -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
fi
done

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,75 +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`
# Disable icecc
export PATH=/usr/bin:$PATH
# 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,85 +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
NATIVE_UPGRADED=
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]}
if [ ! "$NATIVE_UPGRADED" ]; then
[[ "`/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
NATIVE_UPGRADED=1
fi
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)

View File

@ -1,15 +1,16 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# openmamba bot for Telegram
#
# Copyright (C) 2016-2017 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (C) 2016-2023 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
# GPL v3 license
from telegram import (ParseMode)
from telegram import (ParseMode, Update)
from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
ConversationHandler, Job)
ConversationHandler, Job, CallbackContext)
import logging
import subprocess
@ -24,8 +25,9 @@ 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(bot, update):
def start(update: Update, context: CallbackContext):
user = update.message.from_user
logger.info("User %s started the conversation." % user.first_name)
@ -33,22 +35,33 @@ def start(bot, update):
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 /details [name] to see details of specified source package.\n'
'Send /set [seconds] to enable notifications.\n'
'Send /unset to disable notifications.\n'
'Send /cancel to stop talking to me.\n\n')
'Send /unset to disable notifications.\n\n')
return
def query(bot, update):
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 [ 'devel', 'devel-games', 'devel-makedist', 'devel-autodist', 'devel-kernel', 'devel-misc', 'devel-kde4' ]:
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'
@ -63,19 +76,19 @@ def query(bot, update):
return
def details(bot, update, args):
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 [ 'devel', 'devel-games', 'devel-makedist', 'devel-autodist', 'devel-kernel', 'devel-misc', 'devel-kde4' ]:
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"' % (args[0]))
'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', 'i586', 'arm' ]:
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]))
@ -84,16 +97,16 @@ def details(bot, update, args):
response += "\n\n\n"
if response != "":
update.message.reply_text(response, parse_mode=ParseMode.HTML)
update.message.reply_text(response[0:4096], parse_mode=ParseMode.HTML)
else:
update.message.reply_text('No results found.')
return
def alarm(bot, job):
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[job.context])
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":
@ -101,20 +114,21 @@ def alarm(bot, job):
else:
response += "<i>%s</i> %s (%s)\n" % (row[1], row[2], row[3])
if response != "":
bot.sendMessage(job.context, response, parse_mode=ParseMode.HTML)
social_log_last_ids[job.context] = row[0]
bot.sendMessage(context.job, response, parse_mode=ParseMode.HTML)
social_log_last_ids[context.job] = row[0]
def set(bot, update, args, job_queue):
def set(update: Update, context: CallbackContext):
chat_id = update.message.chat_id
try:
due = int(args[0])
due = int(context.args[0])
if due < 0:
update.message.reply_text('Sorry we can not go back to future!')
return
job = Job(alarm, due, repeat=True, context=chat_id)
timers[chat_id] = job
job_queue.put(job)
#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()
@ -127,7 +141,7 @@ def set(bot, update, args, job_queue):
update.message.reply_text('Usage: /set <seconds>')
def unset(bot, update):
def unset(update: Update, context: CallbackContext):
chat_id = update.message.chat_id
if chat_id not in timers:
@ -140,7 +154,7 @@ def unset(bot, update):
update.message.reply_text('Notifications disabled')
def cancel(bot, update):
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!')
@ -148,8 +162,8 @@ def cancel(bot, update):
return ConversationHandler.END
def error(bot, update, error):
logger.warn('Update "%s" caused error "%s"' % (update, error))
def error(update: Update, context: CallbackContext):
logger.warning('Update "%s" caused error "%s"' % (update, context.error))
def main():
@ -161,7 +175,7 @@ def main():
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)
@ -169,11 +183,11 @@ def main():
dp = updater.dispatcher
dp.add_handler(CommandHandler('start', start))
dp.add_handler(MessageHandler(Filters.text, query))
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(CommandHandler('cancel', cancel))
dp.add_handler(MessageHandler(Filters.text, query))
# log all errors
dp.add_error_handler(error)

View File

@ -4,7 +4,7 @@ After=syslog.target
[Service]
Type=simple
ExecStart=/usr/bin/python /usr/share/autodist/openmamba_bot.py
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

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# webbuild cgi script
# Copyright (c) 2012-2015 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
@ -217,7 +217,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshsocial" -o ! "$USER" ]; then
fi
FROMID=`sqlite3 $WEBBUILD_STATEDIR/webbuild.db "$LASTID_QUERY"`
fi
sqlite3 $WEBBUILD_STATEDIR/webbuild.db "SELECT *,strftime('%s',time) FROM social_log WHERE id>$FROMID LIMIT 100" | while read line; do
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
@ -376,10 +376,12 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
# 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 smart`" ] && echo "<b style=\"color:red\">Updating</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
@ -398,7 +400,7 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
NOTIFIED=
if [ "${ORIGRETCODE: -1}" == "+" ]; then
NOTIFIED=1
RETCODE="${ORIGRETCODE::-1}"
RETCODE="${ORIGRETCODE/+*}"
else
RETCODE=$ORIGRETCODE
fi
@ -421,14 +423,15 @@ if [ "$REQUEST" = "refresh" -o "$REQUEST" = "refreshjobs" ]; then
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=$USER STYPE=job SEMAIL=$USER_EMAIL STEXT=\"''$cmdline'' <b>succesfully completed</b>!\" STIME=`date +%s`" >> /tmp/y
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=$USER STYPE=job SEMAIL=$USER_EMAIL STEXT=\"''$cmdline'' <b>failed</b>\" STIME=`date +%s`"
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
@ -478,8 +481,8 @@ if [ "$REQUEST" = "repsearch" ]; then
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_milestone3=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]}
@ -922,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
@ -1064,7 +1067,7 @@ 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_milestone3=true&search_devel=true&search_sources=true&query_compact=true&replyplain=true&searchbox=false"`
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>"
@ -1190,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&"
@ -1276,7 +1279,7 @@ if [ "$MAINTAINERMODE" != "true" ]; then
echo -n "</div>"
echo -n "<div class=\"operationpanelsend\">"
echo -n "<b>Build/Send options:</b><br>Arch:<select id=rpmbuildarch>"
for f in i586 arm x86_64 ppc; do
for f in i586 arm x86_64 aarch64; do
SELECTED=
if [ "$f" = "$RPMBUILDARCH" ]; then
SELECTED="selected=\"selected\"";
@ -1676,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"
@ -1801,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
@ -1822,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=$? ;;
@ -1900,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
@ -2195,12 +2198,12 @@ if [ "$MAINTAINERMODE" = "true" ]; then
elif [ "${REPOSITORY:0:10}" = "milestone3" ]; then
IMPORT_REPOSITORIES=$AUTOPORT_MILESTONE3_IMPORT_REPOSITORIES
else
IMPORT_REPOSITORIES="$AUTOPORT_DEVEL_IMPORT_REPOSITORIES devel-$USER $AUTOPORT_DEVEL_RELEASE_REPOSITORIES"
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 devel-$USER; do
for u in $USER_CANMAINTAIN_REPOSITORIES; do
[ "$u" = "$f" ] && echo -n "<option value=\"$f\">$f</option>"
# -a "$f" != "$REPOSITORY"
done
@ -2230,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

View File

@ -261,6 +261,7 @@ function parse_patch_output() {
function parse_build_output() {
#s|\(.\{10000\}\).*|\1 [CUT - LONG LINE]|;
sed "s|\r.*||;
s/\x90\x8D.*//g;
s|\\\|\\\\\\\|g;s|<|\&lt;|g;
s|[[:cntrl:]]\[[0-9;]*m||g;
s|&lt;font|<font|g;
@ -271,7 +272,7 @@ function parse_build_output() {
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() {

View File

@ -88,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 "rpmspec -P ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec > ${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