Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
3a0c8532e0 | |||
684bb69379 | |||
5680a10d1e | |||
b211b80241 | |||
6f20135a8b | |||
5298802d65 | |||
ade2fbc122 | |||
1a5b85cf9c | |||
1d35f4fe2b | |||
ef2a739df4 | |||
b4af591361 | |||
dc76be906a | |||
f54041d4df | |||
0c2162fe62 | |||
36b00b7e43 | |||
b8e6a0a960 | |||
a292621b9c |
2
autodist
2
autodist
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Released under the terms of the GNU GPL release 3 license
|
||||
#
|
||||
VERSION=1.5.3
|
||||
VERSION=1.5.6
|
||||
me=(${0##*/} $VERSION "Tue Jan 26 2016")
|
||||
exec 3>`readlink /proc/self/fd/0`
|
||||
|
||||
|
@ -20,7 +20,7 @@ function clean() {
|
||||
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 | \
|
||||
find $dir/RPM/BUILD/ -maxdepth 1 | grep -V SPECPARTS | sort -V | \
|
||||
while read curr; do
|
||||
if [ "${curr/-[0-9._]*}" = "${last/-[0-9._]*}" -a "${last}" ]; then
|
||||
rm -rf $last
|
||||
|
113
autodist-git
113
autodist-git
@ -1,16 +1,20 @@
|
||||
#!/usr/bin/python3
|
||||
"""
|
||||
autodist git integration
|
||||
"""
|
||||
import argparse
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import rpm
|
||||
import subprocess
|
||||
import sys
|
||||
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 gitea import Gitea, NotFoundException, Organization, Repository
|
||||
import rpm
|
||||
from pyrpm.spec import Spec, replace_macros
|
||||
from git import Repo
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
||||
@ -18,9 +22,6 @@ 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']),
|
||||
@ -41,6 +42,14 @@ def giteaGetRepository(repo_name):
|
||||
except NotFoundException:
|
||||
return None
|
||||
|
||||
def giteaGetRepositories(page, limit):
|
||||
try:
|
||||
path = f'/orgs/{cfg["GITEA_ORGANIZATION"]}/repos?page={page}&limit={limit}'
|
||||
results = gitea.requests_get(path)
|
||||
return [Repository.parse_response(gitea, result) for result in results]
|
||||
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')
|
||||
@ -69,9 +78,29 @@ def findOrCreateRepo(pkg_name, pkg_description=None, create=True):
|
||||
gitea_repo = giteaGetRepository(repo_name)
|
||||
return gitea_repo
|
||||
|
||||
def commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir):
|
||||
global options
|
||||
def archiveRepo(pkg_name):
|
||||
# Replace '+' for repository name as it is not allowed
|
||||
repo_name = pkg_name.replace('+','Plus')
|
||||
|
||||
# Get gitea repository instance
|
||||
#try:
|
||||
# gitea_repo = org.get_repository(repo_name)
|
||||
gitea_repo = giteaGetRepository(repo_name)
|
||||
|
||||
if gitea_repo is None:
|
||||
print(f'archiveRepo: repository {repo_name} not found')
|
||||
return
|
||||
|
||||
if getattr(gitea_repo, "archived"):
|
||||
print(f'Repository {repo_name} is already archived')
|
||||
return False
|
||||
|
||||
setattr(gitea_repo, "archived", True)
|
||||
gitea_repo.commit()
|
||||
return True
|
||||
|
||||
|
||||
def commitReleaseFromDir(options, pkg_info, gitea_repo, repo, temp_dir):
|
||||
src_dir = pkg_info["src"]
|
||||
|
||||
if src_dir.endswith(".src.rpm"):
|
||||
@ -80,11 +109,11 @@ def commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir):
|
||||
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)
|
||||
stdout=subprocess.PIPE, check=False)
|
||||
# Delete binary source archives
|
||||
for pattern in [
|
||||
'*.zip','*.tar.bz2','*.tar.xz','*.tar.gz','*.tgz','*.txz','*.iso',
|
||||
'*.run','*.dll','*.bin','*.jar','*.msi']:
|
||||
'*.run','*.dll','*.bin','*.jar','*.msi','*.deb']:
|
||||
for filename in glob.glob(f'{src_dir}/{pattern}'):
|
||||
os.remove(filename)
|
||||
|
||||
@ -145,7 +174,7 @@ def commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir):
|
||||
return
|
||||
|
||||
# Create/update README.md
|
||||
with open(f'{temp_dir.name}/README.md', "w") as readme_file:
|
||||
with open(file=f'{temp_dir.name}/README.md', mode="w", encoding="utf-8") as readme_file:
|
||||
readme_file.write(f"# {pkg_info['name']}\n\n{spec_description}")
|
||||
repo.index.add(['README.md'])
|
||||
|
||||
@ -180,9 +209,7 @@ def commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir):
|
||||
repo.create_tag(new_tag, message=f'Release {new_tag}')
|
||||
#origin.push(new_tag)
|
||||
|
||||
def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
global options
|
||||
|
||||
def findAndCommitPackageReleases(options, pkgname, pkgvr):
|
||||
print(f'Processing package {pkgname} on {cfg["GITEA_URL"]}...')
|
||||
|
||||
pkgs_info = []
|
||||
@ -190,10 +217,10 @@ def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
# 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}'
|
||||
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)
|
||||
parts = re.split(f'{pkgnamere}-([^-]*)-([^-]*)$', _dir)
|
||||
|
||||
epoch = 0 if spec.epoch is None else int(spec.epoch)
|
||||
version = parts[1]
|
||||
@ -203,12 +230,12 @@ def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
|
||||
# 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 _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')
|
||||
stdout=subprocess.PIPE, check=False).stdout.decode('utf-8')
|
||||
# result is "(none)" if no Epoch is set
|
||||
if len(epoch) > 2:
|
||||
epoch = "0"
|
||||
@ -223,7 +250,7 @@ def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
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')
|
||||
stdout=subprocess.PIPE, check=False).stdout.decode('utf-8')
|
||||
# result is "(none)" if no Epoch is set
|
||||
if len(epoch) > 2:
|
||||
epoch = "0"
|
||||
@ -266,7 +293,7 @@ def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
#exit(1)
|
||||
|
||||
#pkg_dir = f'{cfg["ARCHIVE_DIR"]}/{pkgname[0:1]}/{pkgname}-{vr}'
|
||||
commitReleaseFromDir(pkg_info, gitea_repo, repo, temp_dir)
|
||||
commitReleaseFromDir(options, pkg_info, gitea_repo, repo, temp_dir)
|
||||
new_commits = True
|
||||
|
||||
if new_commits:
|
||||
@ -280,7 +307,8 @@ def findAndCommitPackageReleases(pkgname, pkgvr):
|
||||
|
||||
|
||||
def main():
|
||||
global options
|
||||
# argparse options
|
||||
options = None
|
||||
|
||||
parser = argparse.ArgumentParser(prog='autodist-git',
|
||||
description='RPM repository sync and management with git service.',
|
||||
@ -294,6 +322,9 @@ def main():
|
||||
parser_syncpkg.add_argument('-d', '--delete', action='store_true', help="delete and recreate existing repository",
|
||||
required=False)
|
||||
|
||||
parser_archiverepo = subparsers.add_parser('archiverepo', help="archive a specified repository package on git server")
|
||||
parser_archiverepo.add_argument('pkgname', help="name of package")
|
||||
|
||||
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)
|
||||
@ -303,7 +334,7 @@ def main():
|
||||
try:
|
||||
options = parser.parse_args()
|
||||
except:
|
||||
exit(1)
|
||||
sys.exit(1)
|
||||
|
||||
if options.mode == 'syncpkg':
|
||||
if options.delete:
|
||||
@ -315,10 +346,18 @@ def main():
|
||||
if gitea_repo is not None:
|
||||
print(f'Deleting repository for {options.pkgname}...')
|
||||
gitea_repo.delete()
|
||||
findAndCommitPackageReleases(options.pkgname, options.pkgver)
|
||||
findAndCommitPackageReleases(options, options.pkgname, options.pkgver)
|
||||
|
||||
elif options.mode == 'archiverepo':
|
||||
print(f'Archiving repository for {options.pkgname}...')
|
||||
archiveRepo(options.pkgname)
|
||||
|
||||
elif options.mode == 'syncrepo':
|
||||
# Get list for packages from SRPMS dir
|
||||
dir_list = sorted(filter(os.path.isfile, glob.glob(f'{cfg["SRPMS_DIR"]}/*.src.rpm')))
|
||||
|
||||
# Check for package updates to sync with git repositories
|
||||
print("Checking for package updates to sync with git repositories...")
|
||||
for dir_file in dir_list:
|
||||
parts = re.split('.*/([^/]*)-([^-]*)-([^-]*).src.rpm$', dir_file)
|
||||
pkg_name = parts[1]
|
||||
@ -343,7 +382,7 @@ def main():
|
||||
found_newer = True
|
||||
else:
|
||||
for repo_tag in repo_tags:
|
||||
parts = re.split(f'([^-]*)-([^-]*)$', repo_tag["name"])
|
||||
parts = re.split('([^-]*)-([^-]*)$', repo_tag["name"])
|
||||
tag_item = { 'e':0, 'v': parts[1], 'r': parts[2]}
|
||||
compare = comparePkgInfo(pkg_item, tag_item)
|
||||
if compare == 0:
|
||||
@ -355,10 +394,28 @@ def main():
|
||||
if not found_equal:
|
||||
if repo_tags is not None:
|
||||
print(f'{pkg_name} ({pkg_vr}): needs update')
|
||||
findAndCommitPackageReleases(pkg_name, None)
|
||||
findAndCommitPackageReleases(options, 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}')
|
||||
|
||||
# Check for git repositories to archive
|
||||
print("Checking for git repositories to archive...")
|
||||
pkg_names = []
|
||||
for dir_file in dir_list:
|
||||
parts = re.split('.*/([^/]*)-([^-]*)-([^-]*).src.rpm$', dir_file)
|
||||
pkg_names.append(parts[1])
|
||||
page = 1
|
||||
while True:
|
||||
gitea_repos = giteaGetRepositories(page, 50)
|
||||
for gitea_repo in gitea_repos:
|
||||
if not getattr(gitea_repo, "archived") and not gitea_repo.name.replace('Plus','+') in pkg_names:
|
||||
print(f'Archiving repository {gitea_repo.name}')
|
||||
archiveRepo(gitea_repo.name)
|
||||
if len(gitea_repos) < 50:
|
||||
break
|
||||
page += 1
|
||||
|
||||
else:
|
||||
parser.print_help()
|
||||
|
||||
|
2
autoport
2
autoport
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Released under the terms of the GNU GPL release 3 license
|
||||
#
|
||||
VERSION=1.5.3
|
||||
VERSION=1.5.6
|
||||
|
||||
BASE_REPOSITORY=base
|
||||
PORT_REPOSITORY=base
|
||||
|
@ -62,11 +62,13 @@ for r in ${AUTOPORT_REPOSITORIES[$i]}; do
|
||||
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 refresh >> $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 refresh > /dev/null
|
||||
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
|
||||
|
@ -54,11 +54,13 @@ done
|
||||
# Distribution global changes
|
||||
sed -i "s|^Vendor:.*|Vendor: openmamba|;
|
||||
s|^Distribution:.*|Distribution: openmamba|;
|
||||
/^%debug_package$/d;
|
||||
/BuildRequires:[[:space:]]*libffmpeg-devel/d;
|
||||
/^BuildRequires:[[:space:]]*libkdegames-devel/d;
|
||||
/^BuildRequires:[[:space:]]*libkdegames5-devel/d;
|
||||
/^BuildRequires:[[:space:]]*python3.7dist/d;
|
||||
/^BuildRoot:[[:space:]]*.*/d;
|
||||
\,%post.* -p /sbin/ldconfig$,d;
|
||||
s|\(BuildRequires:[[:space:]]*\)libmysql-devel|\1libmysql5-devel|;
|
||||
s|\(BuildRequires:[[:space:]]*\)libdb42-devel|\1libdb47-devel|;
|
||||
s|\(BuildRequires:[[:space:]]*\)libdb51-devel|\1libdb53-devel|;
|
||||
|
@ -30,7 +30,12 @@ while True:
|
||||
requrl += from_package +"/"
|
||||
requrl += "?inrepo=openmamba&outdated=1"
|
||||
sys.stderr.write("Requesting: " + requrl + "\n")
|
||||
url = urllib.request.urlopen(requrl)
|
||||
req = urllib.request.Request(
|
||||
requrl,
|
||||
data=None,
|
||||
headers={'User-Agent': 'autodist/1.5.3 (Linux; openmamba; reports@openmamba.org)'}
|
||||
)
|
||||
url = urllib.request.urlopen(req)
|
||||
#print(requrl)
|
||||
data = json.loads(url.read().decode())
|
||||
|
||||
|
@ -56,6 +56,9 @@ if [ "$USER" ]; then
|
||||
USER_ENABLED=
|
||||
fi
|
||||
elif [ "${REQUEST:0:7}" != "refresh" ]; then
|
||||
if [ "$SECRET" ]; then
|
||||
echo "webbuild: invalid credentials: REQUEST=${REQUEST} USER=${USER} SECRET=${SECRET}" >&2
|
||||
fi
|
||||
# no "$USER_SECRET" set; require password
|
||||
echo -n "<output><![CDATA[Please enter your password: <input type=password id=password "
|
||||
echo -n "onkeypress=if(checkEnter(event))"
|
||||
@ -370,7 +373,7 @@ 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)"
|
||||
[ -z "/var/autoport" ] && 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> | "
|
||||
@ -969,23 +972,29 @@ if [ "$MAINTAINERMODE" = "true" -o ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" ]; then
|
||||
|
||||
# SPECFILE creation
|
||||
if [ ! "${AUTOPORT_UPDATE[$ENVIRONMENT]}" -a "$MAINTAINERMODE" != "true" ]; then
|
||||
SPECCREATENAME=""
|
||||
[ "$SPECCREATEURL" != "" ] && SPECCREATENAME=$PACKAGE
|
||||
DISABLED="disabled"
|
||||
[ "$SPECCREATEURL" != "" ] && DISABLED=""
|
||||
DISABLED_GIT="disabled"
|
||||
[ "$SPECCREATEGITBRANCH" != "" ] && DISABLED_GIT=""
|
||||
echo -n "<speccreate><![CDATA[<div class=\"speccreate\">"
|
||||
echo -n " Start from URL:<input onChange=\"suggestSpecName()\" type=text id=speccreateurl value=\"\" style=\"width:32%\">"
|
||||
echo -n " name:<input type=text id=speccreatename disabled value=\"\" style=\"width:10%\">"
|
||||
echo -n " type:<select id=speccreatetype disabled>"
|
||||
echo -n " Start from URL:<input onChange=\"suggestSpecName()\" type=text id=speccreateurl value=\"$SPECCREATEURL\" style=\"width:32%\">"
|
||||
echo -n " name:<input type=text id=speccreatename $DISABLED value=\"$SPECCREATENAME\" style=\"width:10%\">"
|
||||
echo -n " type:<select id=speccreatetype $DISABLED>"
|
||||
for t in `ls /usr/share/autospec/templates`; do
|
||||
[ "$t" = "library" ] && SELECTED="selected=selected" || SELECTED=
|
||||
[ "$t" = "$SPECCREATETYPE" ] && SELECTED="selected=selected" || SELECTED=
|
||||
echo -n "<option id=speccreatetype value=\"$t\" $SELECTED>$t</option>"
|
||||
done
|
||||
echo -n "</select>"
|
||||
echo -n " version:<input type=text disabled id=speccreateversion value=\"\" style=\"width:5%\">"
|
||||
echo -n " branch/tag:<input type=text disabled id=speccreategitbranch value=\"\" style=\"width:5%\">"
|
||||
echo -n "<input type=button disabled id=speccreatebutton value=\"Create .spec\" onclick=ajax_getvalues(\""
|
||||
echo -n " version:<input type=text $DISABLED id=speccreateversion value=\"$SPECCREATEVERSION\" style=\"width:5%\">"
|
||||
echo -n " branch/tag:<input type=text $DISABLED_GIT id=speccreategitbranch value=\"$SPECCREATEGITBRANCH\" style=\"width:5%\">"
|
||||
echo -n "<input type=button $DISABLED id=speccreatebutton value=\"Create .spec\" onclick=ajax_getvalues(\""
|
||||
echo -n "REQUEST=speccreate&ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&"
|
||||
echo -n "PACKAGE=\"+encodeURIComponent(getElementById('speccreatename').value)+\"&"
|
||||
echo -n "SPECCREATETYPE=\"+getElementById('speccreatetype').value+\"&"
|
||||
echo -n "SPECCREATEVERSION=\"+getElementById('speccreateversion').value+\"&"
|
||||
echo -n "SPECCREATEGITBRANCH=\"+getElementById('speccreategitbranch').value+\"&"
|
||||
echo -n "SPECCREATEVERSION=\"+encodeURIComponent(getElementById('speccreateversion').value)+\"&"
|
||||
echo -n "SPECCREATEGITBRANCH=\"+encodeURIComponent(getElementById('speccreategitbranch').value)+\"&"
|
||||
echo -n "SPECCREATEURL=\"+encodeURIComponent(getElementById('speccreateurl').value));>"
|
||||
echo "</div>]]></speccreate>"
|
||||
elif [ "$MAINTAINERMODE" = "true" ]; then
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# webbuild functions
|
||||
# Copyright (c) 2012-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
# Copyright (c) 2012-2024 by Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||
#
|
||||
. /etc/autodist/config
|
||||
|
||||
@ -273,10 +273,10 @@ function parse_build_output() {
|
||||
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
|
||||
s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
|
||||
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
|
||||
s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|<span class=\"outputboxerror\">\1<a %SRCURL%\2%SRCURLEND%>\2</a></span>|i;
|
||||
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;" | iconv -c | google_search $1
|
||||
s|[[:cntrl:]]||g;" | iconv -c | hint_search $1
|
||||
}
|
||||
|
||||
function parse_generic_output() {
|
||||
@ -288,17 +288,18 @@ function parse_generic_output() {
|
||||
s|</font|</font|g;
|
||||
s|^\([\+#] .*\)|<font style=\"color:cyan\">\1</font>|;
|
||||
s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;
|
||||
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;" | google_search $1
|
||||
s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|<a href=\1 target=new>\1</a>|;" | hint_search $1
|
||||
}
|
||||
|
||||
function google_search() {
|
||||
function hint_search() {
|
||||
while read line; do
|
||||
if [ "${line/\%SRCURL\%}" == "${line}" ]; then
|
||||
echo "$line"
|
||||
else
|
||||
local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|;s|\<|<|"`
|
||||
local SEARCH_STRING_ENCODED=`cgi_encodevar "$1 $SEARCH_STRING"`
|
||||
echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g"
|
||||
local SEARCH_STRING_ENCODED=`cgi_encodevar "I get this error while building $1: $SEARCH_STRING"`
|
||||
#echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://duckduckgo.gom/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g"
|
||||
echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://chatgpt.com/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Query ChatGPT on this error\"|g"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ function print_editorcontrols() {
|
||||
echo -n "<div style=\"width:100%;overflow:hidden;\"><span style=\"display:flex\">"
|
||||
echo -n "<input type=button id=updatespecbutton value=\"update\" onclick="
|
||||
echo -n "ajax_getvalues(\"ENVIRONMENT=$ENVIRONMENT&REPOSITORY=$REPOSITORY&PACKAGE=$PACKAGEENCODED&"
|
||||
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+getElementById('updatespecversion').value+\"&"
|
||||
echo -n "REQUEST=updatespec&UPDATESPECVERSION=\"+encodeURIComponent(getElementById('updatespecversion').value)+\"&"
|
||||
echo -n "RPMFORCE=\"+getElementById('rpmforce').checked+\"&"
|
||||
echo -n "DEBUG=\"+getElementById('debug').checked+\"&"
|
||||
echo -n "REBUILDSPECCHANGELOG=\"+encodeURIComponent(getElementById('rebuildspecchangelog').value)+\"&"
|
||||
|
@ -93,6 +93,7 @@ if [ "$MODE" = "specinfo" ]; then
|
||||
if [ -e $SPECFILE.tmp ]; then
|
||||
echo "SPECVAR_Specfile=\"$SPECFILE\""
|
||||
BUILDDIR=`grep -m1 "^_setup.*-n " $SPECFILE.tmp | sed "s|.*-n \([^[:space:]]*\).*|\1|"`
|
||||
PACKAGE_VERSION=`rpmspec -q --srpm --queryformat \"%{VERSION}\" ${WORKINGHOME}/RPM/SPECS/$PACKAGE.spec`
|
||||
while read line; do
|
||||
set -- $line
|
||||
[ "$1" = "%package" -o "$1" = "%description" ] && break
|
||||
@ -111,10 +112,10 @@ if [ "$MODE" = "specinfo" ]; then
|
||||
rm -f $SPECFILE.tmp
|
||||
echo "SPECVAR_BUILDDIR=\"$BUILDDIR\""
|
||||
echo "SPECVAR_BUILDROOT=\"$PACKAGE-root\""
|
||||
echo "SPECVAR_RPMBUILDDIR=\"${WORKINGHOME}/RPM/BUILD\""
|
||||
echo "SPECVAR_RPMSOURCESDIR=\"${WORKINGHOME}/RPM/SOURCES\""
|
||||
echo "SPECVAR_RPMBUILDROOT=\"$RPMBUILDROOT\""
|
||||
echo "SPECVAR_WORKINGHOME=\"$WORKINGHOME\""
|
||||
echo "SPECVAR_RPMBUILDDIR=\"${WORKINGHOME}/RPM/BUILD/${PACKAGE}-${PACKAGE_VERSION}-build\""
|
||||
echo "SPECVAR_RPMSOURCESDIR=\"${WORKINGHOME}/RPM/SOURCES\""
|
||||
echo "SPECVAR_RPMBUILDROOT=\"${WORKINGHOME}/RPM/BUILD/${PACKAGE}-${PACKAGE_VERSION}-build/BUILDROOT\""
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
|
Reference in New Issue
Block a user