Compare commits

...

24 Commits

Author SHA1 Message Date
2ba8cb4fa5 deploypkg: fix exit code 2023-05-03 23:45:58 +02:00
278a6d17a7 buildtree: fix exit codes 2023-05-03 17:50:19 +02:00
d068fa6b75 Merge pull request 'buildtree: don't strip arch maintainer' (#69) from Dudemanguy/artools:keep-original-maintainer into master
Reviewed-on: artix/artools#69
2023-05-03 17:47:01 +02:00
70e93c3843 buildtree: don't strip arch maintainer
Instead of completely overwriting the first maintainer line when doing
an import, copy it to the second line and then find/replace maintainer
with contributor.
2023-05-01 20:27:43 -05:00
8a0168cbe5 arch patches 2023-04-30 19:03:11 +02:00
c2082be241 upd makepkg.conf 2023-01-20 00:12:22 +01:00
d5d89cf7a4 commitpkg: small msg change 2022-11-04 18:36:55 +01:00
cc8c2fe38e commitpkg: clean up 2022-11-04 15:10:12 +01:00
9bf2bd2671 commitpkg: drop rebuild check, pipeline now supports skipping add/rm stages if rebuild <--> staging moves, both goblins 2022-11-04 12:01:50 +01:00
eb638abdfe patches (#67)
Reviewed-on: artix/artools#67
2022-11-03 23:10:30 +01:00
332cc9751b Merge pull request 'buildtree: use git -C when importing packages' (#65) from Dudemanguy/artools:buildtree-use-path into master
Reviewed-on: artix/artools#65
2022-11-02 18:02:41 +01:00
f86e36c361 buildtree: use git -C when importing packages
This way, the git config credentials that are retrieved correctly match
the actual directory of the package
2022-10-27 13:29:19 -05:00
2edcd2fd54 commitpkg: cp -r on move 2022-07-31 18:23:22 +02:00
80887fba39 commitpkg: cp -r to support keys sub dirs 2022-07-26 18:25:52 +02:00
bd07105192 patches (#64)
Reviewed-on: artix/artools#64
2022-07-21 18:35:47 +02:00
02edf46d6a buildtree: set maintainer 2022-06-10 00:41:08 +02:00
860d2272ba buildtree: don't braid push ci 2022-06-09 01:26:01 +02:00
0d9e54c4e3 buildtree: braid push the ci fiiles 2022-06-09 00:09:37 +02:00
26bd425d55 buildtree: add func to set maintainer 2022-06-08 10:04:23 +02:00
c08f82044c commitpkg: only run braid update if push is success 2022-06-06 18:05:10 +02:00
74af21ca25 batchpkg: drop -u arg on move 2022-06-06 12:44:21 +02:00
e3b8439b04 commitpkg: fix update msg 2022-06-06 01:35:24 +02:00
e00096d503 braid (#63)
* use braid instead of git-subrepo

Reviewed-on: artix/artools#63
2022-06-06 01:28:53 +02:00
f7ebc6bd11 mkdepgraph: include mode to graph artix-rebuild-order output 2022-05-28 09:30:37 +02:00
23 changed files with 920 additions and 281 deletions

View File

@@ -1,4 +1,4 @@
V=0.27
V=0.28
TOOLS = artools
PREFIX ?= /usr
@@ -42,7 +42,10 @@ PKG_BIN = \
bin/pkg/checkrepo \
bin/pkg/gitearepo \
bin/pkg/tidyarch \
bin/pkg/mkdepgraph
bin/pkg/mkdepgraph \
bin/pkg/diffpkg \
bin/pkg/makerepropkg \
bin/pkg/export-pkgbuild-keys
LN_COMMITPKG = \
extrapkg \

View File

@@ -23,7 +23,7 @@ artools
- pkg:
* namcap
* git-subrepo
* ruby-braid
* rsync
- iso:

View File

@@ -90,11 +90,11 @@ for f in "${files[@]}"; do
cp "$f" "$working_dir$f"
done
basestrap -${umode}Mc ${pacman_conf:+-C "$pacman_conf"} "$working_dir" \
unshare --mount basestrap -${umode}Mc ${pacman_conf:+-C "$pacman_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
printf 'LANG=en_US.UTF-8\n' > "$working_dir/etc/locale.conf"
printf 'LANG=C.UTF-8\n' > "$working_dir/etc/locale.conf"
# printf 'KEYMAP=en\n' > "$working_dir/etc/vconsole.conf"
printf "%s\n" "${CHROOTVERSION}" > "$working_dir/.artools"

View File

@@ -28,9 +28,9 @@ batch_move() {
src=${src#*:}
local dest=${entry%%:*}
if ${runlist}; then
"${dest}"pkg -s "${src}" -u -p "${pkg}"
"${dest}"pkg -s "${src}" -p "${pkg}"
else
msg "%s" "${dest}pkg -s ${src} -u -p ${pkg}"
msg "%s" "${dest}pkg -s ${src} -p ${pkg}"
fi
done < "$pkglist"
}
@@ -65,10 +65,10 @@ batch_update() {
local dest=${entry%:*}
if ${runlist}; then
buildtree -i -p "${pkg}"
"${dest}"pkg -u -p "${pkg}"
"${dest}"pkg -p "${pkg}"
else
msg "buildtree -i -p ${pkg}"
msg2 "${dest}pkg -u -p ${pkg}"
msg2 "${dest}pkg -p ${pkg}"
fi
done < "$pkglist"
}
@@ -78,8 +78,8 @@ batch_update() {
usage() {
printf 'Usage: %s [optional listname]\n' "${0##*/}"
printf ' -r Run generated commands\n'
printf ' -c Create subrepos from list\n'
printf ' -u Update subrepos from list\n'
printf ' -c Create pkgrepos from list\n'
printf ' -u Update pkgrepos from list\n'
printf ' -h This help\n'
printf '\n'
printf '\n'

View File

@@ -23,23 +23,31 @@ m4_include(lib/pkg/jenkins.sh)
#{{{ new git repo
subrepo_new(){
pkgrepo_new(){
cd "${TREE_DIR_ARTIX}/${group}" || return
local org gitname
org=$(get_pkg_org "${package}")
gitname=$(get_compliant_name "${package}")
gitearepo -cr "$gitname"
if [[ ! -d "${package}" ]]; then
gitearepo -cr "$gitname"
add_team_to_repo "$gitname" "$org" "${team}"
add_team_to_repo "$gitname" "$org" "${team}"
msg2 "Subrepo clone [%s] from (%s)" "${package}" "$org/$gitname"
git subrepo clone "${GIT_SSH}":"$org/$gitname".git "${package}"
msg2 "Adding [%s] from (%s)" "${package}" "$org/$gitname"
braid add "${GIT_SSH}":"$org/$gitname".git "${package}"
prepare_dir "${TREE_DIR_ARTIX}/${group}/${package}/trunk"
prepare_dir "${TREE_DIR_ARTIX}/${group}/${package}/trunk"
commit_jenkins_files "${package}"
commit_ci "${package}"
# if braid push "${package}"; then
# braid update "${package}"
# fi
else
die "Package %s already exists!" "${package}"
fi
}
#}}}
@@ -52,7 +60,7 @@ config_tree() {
Artix)
if "$vars"; then
dist_tree=("${ARTIX_TREE[@]}")
dist_url="${GIT_SSH}:artixlinux"
dist_url="${GIT_SSH}:pkgbuild"
dist_dir=${TREE_DIR_ARTIX}
else
git config --bool pull.rebase true
@@ -102,11 +110,23 @@ update_tree() {
#{{{ patch
set_maintainer() {
local name email path="$1"
name=$(git -C $path config --get user.name)
email=$(git -C $path config --get user.email)
firstline=$(head -n 1 "$path"/PKGBUILD)
sed "2i ${firstline}" -i "$path"/PKGBUILD
sed -e "1s|Maintainer:.*|Maintainer: $name <$email>|" \
-i "$path"/PKGBUILD
sed -e "2s|Maintainer|Contributor|" -i "$path"/PKGBUILD
}
patch_pkg(){
local pkgpath="$1"
local pkg=${pkgpath%/*}
pkg=${pkg##*/}
sed -e 's|arch-meson|artix-meson|' -i "$pkgpath"/PKGBUILD
set_maintainer "$pkgpath"
case $pkg in
glibc)
msg2 "Patching %s" "$pkg"
@@ -195,7 +215,7 @@ from_arch(){
show_deps "$archpath"
if [[ -f "$artixpath"/.gitrepo ]]; then
if [[ -f "$artixpath"/Jenkinsfile ]]; then
artixpath="$artixpath"/trunk
if [[ -d "$artixpath" ]];then
@@ -269,7 +289,7 @@ usage() {
printf " -a Don't clone or pull arch repos\n"
printf " -b Don't clone or pull artix repos\n"
printf ' -i Import a package from arch repos\n'
printf ' -n New remote subrepo and clone it\n'
printf ' -n New remote pkgrepo and add it\n'
printf ' -v Check if a package is in the artix tree(s)\n'
printf ' -c View package depends\n'
printf ' -x Exclude testing (only with -i)\n'
@@ -306,12 +326,22 @@ shift $(( OPTIND - 1 ))
set_arch_repos "$testing" "$staging" "$unstable"
${sync} && sync_repos
if ${sync}; then
sync_repos
fi
${view} && view_build
if ${view}; then
view_build
fi
${check} && check_tree
if ${check}; then
check_tree
fi
${import} && from_arch
if ${import}; then
from_arch
fi
${createnew} && subrepo_new
if ${createnew}; then
pkgrepo_new
fi

View File

@@ -13,77 +13,10 @@
# GNU General Public License for more details.
m4_include(lib/base/message.sh)
shopt -s extglob
m4_include(lib/pkg/diff.sh)
load_makepkg_config
#{{{ functions
pkgver_equal() {
if [[ $1 = *-* && $2 = *-* ]]; then
# if both versions have a pkgrel, then they must be an exact match
[[ $1 = "$2" ]]
else
# otherwise, trim any pkgrel and compare the bare version.
[[ ${1%%-*} = "${2%%-*}" ]]
fi
}
find_cached_package() {
local searchdirs=("$PKGDEST" "$PWD") results=()
local targetname=$1 targetver=$2 targetarch=$3
local dir pkg pkgbasename name ver rel arch r results
for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
[[ -f $pkg ]] || continue
# avoid adding duplicates of the same inode
for r in "${results[@]}"; do
[[ $r -ef $pkg ]] && continue 2
done
# split apart package filename into parts
pkgbasename=${pkg##*/}
pkgbasename=${pkgbasename%.pkg.tar*}
arch=${pkgbasename##*-}
pkgbasename=${pkgbasename%-"$arch"}
rel=${pkgbasename##*-}
pkgbasename=${pkgbasename%-"$rel"}
ver=${pkgbasename##*-}
name=${pkgbasename%-"$ver"}
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
pkgver_equal "$targetver" "$ver-$rel"; then
results+=("$pkg")
fi
done
done
case ${#results[*]} in
0)
return 1
;;
1)
printf '%s\n' "${results[0]}"
return 0
;;
*)
error 'Multiple packages found:'
printf '\t%s\n' "${results[@]}" >&2
return 1
;;
esac
}
#}}}
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS]

View File

@@ -22,42 +22,6 @@ m4_include(lib/pkg/repo.sh)
#{{{ functions
push_tree(){
local tree="$1"
msg "Update (%s)" "${tree}"
git push origin master
}
subrepo_push(){
local pkg="$1"
msg2 "Subrepo push (%s)" "$pkg"
git subrepo push "$pkg" || die "%s push failed" "$pkg"
}
subrepo_clean(){
local pkg="$1"
msg2 "Subrepo clean (%s)" "$pkg"
git subrepo clean "$pkg"
}
subrepo_pull(){
local pkg="$1"
msg2 "Subrepo pull (%s)" "$pkg"
git subrepo pull "$pkg"
}
check_rebuild(){
if [[ -d "$CARCH"/"${valid_names[10]}" ]] \
&& [[ "${repo_dest}" == "${valid_names[7]}" ]]; then
git rm -r "$CARCH"/"${valid_names[10]}"
git commit -m "switch from ${valid_names[10]} to ${valid_names[7]}"
elif [[ -d "$CARCH"/"${valid_names[7]}" ]] \
&& [[ "${repo_dest}" == "${valid_names[10]}" ]]; then
git rm -r "$CARCH"/"${valid_names[7]}"
git commit -m "switch from ${valid_names[7]} to ${valid_names[10]}"
fi
}
check_team(){
if [[ "${repo_src}" == "${valid_names[0]}" && "${repo_dest}" == "${valid_names[1]}" ]] || \
[[ "${repo_src}" == "${valid_names[1]}" && "${repo_dest}" == "${valid_names[0]}" ]] || \
@@ -74,11 +38,22 @@ check_team(){
fi
}
path_config() {
[[ "${repo_src}" != 'trunk' ]] && pkgbuild="$CARCH/${repo_src}"/PKGBUILD
push_super() {
local name="$1"
msg "Update (%s)" "$name"
git push origin master
git prune
[[ "${cmd}" != 'commitpkg' ]] && check_team
}
# shellcheck disable=1090
. "$pkgbuild"
push_pkg() {
local name="$1"
if braid push "${package}"; then
braid update "${package}"
push_super "$name"
else
error "'braid push %s' failed.\n" "${package}"
fi
}
get_repo_commit_msg() {
@@ -96,15 +71,15 @@ commit_pkg() {
commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
if [[ "${repo_src}" == 'trunk' ]];then
git rm -r trunk
git rm -r $package/trunk
else
git rm -r "$CARCH/${repo_src}"
git rm -r "$package/$CARCH/${repo_src}"
fi
else
action='modify'
commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
git add .
git add "$package"
fi
git commit -m "$commit_msg"
}
@@ -112,61 +87,51 @@ commit_pkg() {
repo_commit_pkg() {
local commit_msg
[[ -d "$CARCH/${repo_dest}" ]] && git rm -r "$CARCH/${repo_dest}"
[[ ! -d "$CARCH" ]] && mkdir "$CARCH"
[[ ! -d "$CARCH/${repo_dest}" ]] && mkdir "$CARCH/${repo_dest}"
[[ -d "$package/$CARCH/${repo_dest}" ]] && git rm -r "$package/$CARCH/${repo_dest}"
[[ ! -d "$package/$CARCH" ]] && mkdir "$package/$CARCH"
[[ ! -d "$package/$CARCH/${repo_dest}" ]] && mkdir "$package/$CARCH/${repo_dest}"
if [[ "${repo_src}" == 'trunk' ]]; then
action='add'
commit_msg=$(get_repo_commit_msg)
msg "Action: %s" "$commit_msg"
check_rebuild
cp trunk/* "$CARCH/${repo_dest}"/
cp -r "$package"/trunk/* "$package/$CARCH/${repo_dest}"/
else
action='move'
[[ ! -f $pkgbuild ]] && die "%s does not exist!" "$pkgbuild"
commit_msg=$(get_repo_commit_msg)
msg "Action: %s" "$commit_msg"
cp "$CARCH/${repo_src}"/* "$CARCH/${repo_dest}"/
git rm -r "$CARCH/${repo_src}"
cp -r "$package/$CARCH/${repo_src}"/* "$package/$CARCH/${repo_dest}"/
git rm -r "$package/$CARCH/${repo_src}"
fi
git add .
git add "$package"
git commit -m "$commit_msg"
}
run(){
local artixpath head group
local artixpath head tree tree_name
artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${package}")
if [[ -n ${artixpath} ]];then
group=${artixpath%/*}
cd "${group}" || return
tree=${artixpath%/*}
tree_name=${tree##*/}
cd "$tree" || return
head=$(get_local_head)
cd "${artixpath}" || return
path_config
if [[ "${cmd}" == 'commitpkg' ]];then
commit_pkg
else
repo_commit_pkg
pkgbuild="$package"/trunk/PKGBUILD
if [[ "${repo_src}" != 'trunk' ]]; then
pkgbuild="$package/$CARCH/${repo_src}"/PKGBUILD
fi
# shellcheck disable=1090
. "$pkgbuild"
cd "${group}" || return
case "${cmd}" in
'commitpkg') commit_pkg ;;
*) repo_commit_pkg ;;
esac
if ${push}; then
msg "Checking (%s) (Artix)" "${group##*/}"
pull_tree "${group##*/}" "$head"
fi
subrepo_push "${package}"
subrepo_clean "${package}"
${push} && push_tree "${group##*/}"
git prune
[[ "${cmd}" != 'commitpkg' ]] && check_team
msg "Checking (%s) (Artix)" "$tree_name"
pull_tree "$tree_name" "$head"
push_pkg "$tree_name"
else
die "Package '%s' does not exist!" "${package}"
fi
@@ -192,9 +157,6 @@ load_valid_names
repo_src='trunk'
package=''
remove=false
push=false
pkgbuild=trunk/PKGBUILD
cmd=${0##*/}
repo_dest=${cmd%pkg}
@@ -204,21 +166,19 @@ usage() {
printf " -s <name> Source repository [default: %s]\n" "${repo_src}"
printf ' -p <pkg> Package name\n'
printf ' -r Delete from repo (commitpkg only)\n'
printf ' -u Push\n'
printf ' -h This help\n'
printf '\n'
printf '\n'
exit "$1"
}
opts='p:s:urh'
opts='p:s:rh'
while getopts "${opts}" arg; do
case "${arg}" in
s) repo_src="$OPTARG" ;;
p) package="$OPTARG" ;;
r) remove=true ;;
u) push=true ;;
h|?) usage 0 ;;
esac
done

View File

@@ -168,7 +168,7 @@ upgrades=false
downgrades=false
move=false
readonly table="%-18s %-18s %-25s %-27s %-27s %-10s"
readonly table="%-18s %-18s %-29s %-27s %-27s %-7s"
usage() {
printf 'Usage: %s [options]\n' "${0##*/}"

View File

@@ -42,7 +42,9 @@ repo_action(){
cd "$repo_path" || return
if [[ -n "${action}" ]]; then
repo-"${action}" -R "${dest_repo}"."${pkgdb_ext}" "${packages[@]}"
${linksdb} && links-"${action}" "${dest_repo}"."${linksdb_ext}" "${packages[@]}"
if ${linksdb}; then
links-"${action}" "${dest_repo}"."${linksdb_ext}" "${packages[@]}"
fi
fi
}

329
bin/pkg/diffpkg.in Normal file
View File

@@ -0,0 +1,329 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/base/message.sh)
m4_include(lib/pkg/diff.sh)
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS] [MODES] [FILE|PKGNAME...]
Searches for a locally built package corresponding to the PKGBUILD, and
downloads the last version of that package from the Pacman repositories.
It then compares the package archives using different modes while using
simple tar content list by default.
When given one package, use it to diff against the locally built one.
When given two packages, diff both packages against each other.
In either case, a package name will be converted to a filename from the
cache, and diffpkg will proceed as though this filename was initially
specified.
OPTIONS
-M, --makepkg-config Set an alternate makepkg configuration file
-v, --verbose Provide more detailed/unfiltered output
-h, --help Show this help text
MODES
-l, --list Activate content list diff mode (default)
-d, --diffoscope Activate diffoscope diff mode
-p, --pkginfo Activate .PKGINFO diff mode
-b, --buildinfo Activate .BUILDINFO diff mode
_EOF_
}
MAKEPKG_CONF=/etc/makepkg.conf
POOLDIR=/srv/pkgpool
VERBOSE=0
TARLIST=0
DIFFOSCOPE=0
PKGINFO=0
BUILDINFO=0
DIFFMODE=--side-by-side
DIFFCOLOR=--color=auto
DIFFWIDTH=--width=auto
DIFFOPTIONS=(--expand-tabs)
# option checking
while (( $# )); do
case $1 in
-h|--help)
usage
exit 0
;;
-M|--makepkg-config)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAKEPKG_CONF="$2"
shift 2
;;
-l|--list)
TARLIST=1
shift
;;
-d|--diffoscope)
DIFFOSCOPE=1
shift
;;
-p|--pkginfo)
PKGINFO=1
shift
;;
-b|--buildinfo)
BUILDINFO=1
shift
;;
-v|--verbose)
VERBOSE=1
shift
;;
-u|-U|--unified)
DIFFMODE=--unified
shift
;;
-y|--side-by-side)
DIFFMODE=--side-by-side
shift
;;
--color|--color=*)
if [[ $2 == never || $2 == always || $2 == auto ]]; then
DIFFCOLOR="--color=$2"
shift 2
continue
fi
if [[ $1 == --color ]]; then
DIFFCOLOR="--color=auto"
else
DIFFCOLOR="$1"
fi
shift
;;
-W|--width)
(( $# <= 1 )) && die "missing argument for %s" "$1"
DIFFWIDTH="--width=$2"
shift 2
;;
--width=*)
DIFFWIDTH="$1"
shift
;;
-P|--pool)
(( $# <= 1 )) && die "missing argument for %s" "$1"
POOLDIR="$2"
shift 2
;;
--pool=*)
POOLDIR="${1#*=}"
shift
;;
--)
shift
break
;;
-*|--*)
die "invalid argument: %s" "$1"
;;
*)
break
;;
esac
done
# Set options based on flags or magic values
if (( VERBOSE )); then
if [[ $DIFFMODE == --unified ]]; then
DIFFMODE="--unified=99999"
fi
else
DIFFOPTIONS+=(--suppress-common-lines)
fi
if [[ $DIFFWIDTH == --width=columns ]]; then
DIFFWIDTH="--width=${COLUMNS:-130}"
fi
if [[ $DIFFWIDTH != --width=auto ]]; then
DIFFOPTIONS+=("${DIFFWIDTH}")
fi
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
TARLIST=1
fi
# Source makepkg.conf; fail if it is not found
if [[ -r "${MAKEPKG_CONF}" ]]; then
# shellcheck source=config/makepkg/x86_64.conf
source "${MAKEPKG_CONF}"
else
die "${MAKEPKG_CONF} not found!"
fi
# Source user-specific makepkg.conf overrides
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
# shellcheck source=/dev/null
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
# shellcheck source=/dev/null
source "$HOME/.makepkg.conf"
fi
STARTDIR=$(pwd)
trap 'rm -rf $TMPDIR' EXIT INT TERM QUIT
TMPDIR=$(mktemp -d --tmpdir diffpkg-script.XXXXXXXX)
export TMPDIR
tar_list() {
bsdtar tf "$*" | if (( VERBOSE )); then
cat
else
sed -E 's|^usr/lib/modules/[0-9][^/]+|usr/lib/modules/[…]|g'
fi | sort
}
file_line_length() {
path="$1"
wc -L "${path}" | tail -n1 | sed -E 's/^ +//g' | cut -d' ' -f1
}
file_diff_columns() {
file1="$1"
file2="$2"
file1_length=$(file_line_length "$file1")
file2_length=$(file_line_length "$file2")
echo $(( file1_length + file2_length + 3 ))
}
diff_pkgs() {
local oldpkg newpkg
oldpkg=$(readlink -m "$1")
newpkg=$(readlink -m "$2")
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/old"
tar_list "$newpkg" > "$TMPDIR/new"
fi
if (( PKGINFO )); then
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/new"
fi
if (( BUILDINFO )); then
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
fi
if (( TARLIST || PKGINFO || BUILDINFO )); then
# Resolve dynamic auto width one we know the content to diff
if [[ $DIFFWIDTH == --width=auto ]]; then
AUTOLENGTH=$(file_diff_columns "$TMPDIR/old" "$TMPDIR/new")
DIFFOPTIONS+=("--width=${AUTOLENGTH}")
fi
# Print a header for side-by-side view as it lacks labels
if [[ $DIFFMODE == --side-by-side ]]; then
printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
fi
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
fi
if (( DIFFOSCOPE )); then
diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
fi
}
shopt -s extglob
fetch_pkg() {
local pkg pkgdest pkgurl
case $1 in
*://*)
pkgurl=$1 ;;
/*|*/*)
pkgurl=$(readlink -m "$1") ;;
*.pkg.tar*)
pkgurl=$1 ;;
'')
;;
*)
pkg=$1 ;;
esac
if [[ -z ${pkgurl} ]]; then
# Try to find latest package in pool dir
if [[ -d ${POOLDIR} ]]; then
shopt -s extglob nullglob
pkgurl=$(printf "%s\n" "${POOLDIR}"/*/"${_pkgname}"-!(*-*)-!(*-*)-!(*-*).pkg.tar!(*.sig)|sort -Vr|head -1)
shopt -u extglob nullglob
fi
# Search via pacman database if no pool file exists
if [[ ! -f ${pkgurl} ]]; then
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
die "Couldn't download previous package for %s." "$pkg"
fi
fi
pkg=${pkgurl##*/}
pkgdest=$(mktemp -t -d "${pkg}-XXXXXX")/${pkg}
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
ln -sf "${pkgurl#file://}" "$pkgdest"
elif [[ -f "$PKGDEST/$pkg" ]]; then
ln -sf "$PKGDEST/$pkg" "$pkgdest"
elif [[ -f "$STARTDIR/$pkg" ]]; then
ln -sf "$STARTDIR/$pkg" "$pkgdest"
elif [[ $pkgurl = *://* ]]; then
curl -fsLC - --retry 3 --retry-delay 3 -o "$pkgdest" "$pkgurl" || \
die "Couldn't download %s" "$pkgurl"
else
die "File not found: %s" "$pkgurl"
fi
echo "$pkgdest"
}
shopt -u extglob
if (( $# < 2 )); then
if [[ ! -f PKGBUILD ]]; then
die "This must be run in the directory of a built package.\nTry '$(basename "$0") --help' for more information."
fi
# shellcheck source=contrib/makepkg/PKGBUILD.proto
. ./PKGBUILD
if [[ ${arch[0]} == 'any' ]]; then
CARCH='any'
fi
for _pkgname in "${pkgname[@]}"; do
comparepkg=$_pkgname
pkgurl=
target_pkgver=$(get_full_version "$_pkgname")
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
fi
ln -s "$pkgfile" "$TMPDIR"
if (( $# )); then
comparepkg="$1"
fi
oldpkg=$(fetch_pkg "$comparepkg") || exit 1
diff_pkgs "$oldpkg" "$pkgfile"
done
else
file1=$(fetch_pkg "$1") || exit 1
file2=$(fetch_pkg "$2") || exit 1
diff_pkgs "$file1" "$file2"
fi

View File

@@ -0,0 +1,70 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/base/message.sh)
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/}
Export the PGP keys from a PKGBUILDs validpgpkeys array into the keys/pgp/
subdirectory. Useful for distributing packager validated source signing
keys alongside PKGBUILDs.
OPTIONS
-h, --help Show this help text
_EOF_
}
# option checking
while (( $# )); do
case $1 in
-h|--help) usage; exit 0 ;;
*) die "invalid argument: %s" "$1" ;;
esac
done
if [[ ! -f PKGBUILD ]]; then
die "This must be run a directory containing a PKGBUILD."
fi
mapfile -t validpgpkeys < <(
# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
if (( ${#validpgpkeys[@]} )); then
printf "%s\n" "${validpgpkeys[@]}"
fi
)
msg "Exporting ${#validpgpkeys[@]} PGP keys..."
if (( ${#validpgpkeys[@]} == 0 )); then
exit 0
fi
trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
TEMPDIR=$(mktemp -d --tmpdir export-pkgbuild-keys.XXXXXXXXXX)
mkdir -p keys/pgp
error=0
for key in "${validpgpkeys[@]}"; do
gpg --output "$TEMPDIR/$key.asc" --armor --export --export-options export-minimal "$key" 2>/dev/null
# gpg does not give a non-zero return value if it fails to export...
if [[ -f $TEMPDIR/$key.asc ]]; then
msg2 "Exported $key"
mv "$TEMPDIR/$key.asc" "keys/pgp/$key.asc"
else
if [[ -f keys/pgp/$key.asc ]]; then
warning "Failed to update key: $key"
else
error "Key unavailable: $key"
error=1
fi
fi
done
if (( error )); then
die "Failed to export all \'validpgpkeys\' entries."
fi

View File

@@ -15,7 +15,6 @@
m4_include(lib/base/message.sh)
set -e
shopt -s extglob
IGNORE_INTERNAL=0
@@ -51,9 +50,13 @@ else
pushd "$WORKDIR" >/dev/null
fi
shopt -s extglob
process_sofile() {
# extract the library name: libfoo.so
shopt -s extglob nullglob
soname="${sofile%.so?(+(.+([0-9])))}".so
shopt -u extglob nullglob
# extract the major version: 1
soversion="${sofile##*\.so\.}"
if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
@@ -66,6 +69,8 @@ process_sofile() {
fi
}
shopt -u extglob
case $script_mode in
deps) find_args=(-perm -u+x);;
provides) find_args=(-name '*.so*');;

271
bin/pkg/makerepropkg.in Normal file
View File

@@ -0,0 +1,271 @@
#!/bin/bash
#
# makerepropkg - rebuild a package to see if it is reproducible
#
# Copyright (c) 2019 by Eli Schwartz <eschwartz@archlinux.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/util-base.sh)
m4_include(lib/base/message.sh)
m4_include(lib/base/chroot.sh)
m4_include(lib/base/chroot.sh)
declare -A buildinfo
declare -a buildenv buildopts installed installpkgs
archiveurl='https://archive.artixlinux.org/packages'
buildroot="${CHROOTS_DIR}"/reproducible
diffoscope=0
chroot=$USER
[[ -n ${SUDO_USER:-} ]] && chroot=$SUDO_USER
[[ -z "$chroot" || $chroot = root ]] && chroot=copy
parse_buildinfo() {
local line var val
while read -r line; do
var="${line%% = *}"
val="${line#* = }"
case ${var} in
buildenv)
buildenv+=("${val}")
;;
options)
buildopts+=("${val}")
;;
installed)
installed+=("${val}")
;;
*)
buildinfo["${var}"]="${val}"
;;
esac
done
}
get_pkgfile() {
local cdir=${cache_dirs[0]}
local pkgfilebase=${1}
local mode=${2}
local pkgname=${pkgfilebase%-*-*-*}
local pkgfile ext
# try without downloading
if [[ ${mode} != localonly ]] && get_pkgfile "${pkgfilebase}" localonly; then
return 0
fi
for ext in .zst .xz ''; do
pkgfile=${pkgfilebase}.pkg.tar${ext}
for c in "${cache_dirs[@]}"; do
if [[ -f ${c}/${pkgfile} ]]; then
cdir=${c}
break
fi
done
for f in "${pkgfile}" "${pkgfile}.sig"; do
if [[ ! -f "${cdir}/${f}" ]]; then
if [[ ${mode} = localonly ]]; then
continue 2
fi
msg2 "retrieving '%s'..." "${f}" >&2
curl -Llf -# -o "${cdir}/${f}" "${archiveurl}/${pkgname:0:1}/${pkgname}/${f}" || continue 2
fi
done
printf '%s\n' "file://${cdir}/${pkgfile}"
return 0
done
return 1
}
get_makepkg_conf() {
local fname=${1}
local makepkg_conf="${2}"
if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}"
return 1
fi
msg2 "using makepkg.conf from ${fname}"
bsdtar xOqf "${buildtool_file/file:\/\//}" usr/share/artools/makepkg.conf > "${makepkg_conf}"
return 0
}
usage() {
cat << __EOF__
usage: ${BASH_SOURCE[0]##*/} [options] <package_file>
Run this script in a PKGBUILD dir to build a package inside a
clean chroot while attempting to reproduce it. The package file
will be used to derive metadata needed for reproducing the
package, including the .PKGINFO as well as the buildinfo.
For more details see https://reproducible-builds.org/
OPTIONS
-d Run diffoscope if the package is unreproducible
-c <dir> Set pacman cache
-M <file> Location of a makepkg config file
-l <chroot> The directory name to use as the chroot namespace
Useful for maintaining multiple copies
Default: $chroot
-h Show this usage message
__EOF__
}
while getopts 'dM:c:l:h' arg; do
case "$arg" in
d) diffoscope=1 ;;
M) artixroot_args+=(-M "$OPTARG") ;;
c) cache_dirs+=("$OPTARG") ;;
l) chroot="$OPTARG" ;;
h) usage; exit 0 ;;
*|?) usage; exit 1 ;;
esac
done
shift $((OPTIND - 1))
check_root
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
# without arguments, get list of packages from PKGBUILD
if [[ -z $1 ]]; then
mapfile -t pkgnames < <(source PKGBUILD; pacman -Sddp --print-format '%r/%n' "${pkgname[@]}")
wait $! || {
error "No package file specified and failed to retrieve package names from './PKGBUILD'."
plain "Try '${BASH_SOURCE[0]##*/} -h' for more information." >&2
exit 1
}
msg "Reproducing all pkgnames listed in ./PKGBUILD"
set -- "${pkgnames[@]}"
fi
# check each package to see if it's a file, and if not, try to download it
# using pacman -Sw, and get the filename from there
splitpkgs=()
for p in "$@"; do
if [[ -f ${p} ]]; then
splitpkgs+=("${p}")
else
pkgfile_remote=$(pacman -Sddp "${p}" 2>/dev/null) || { error "package name '%s' not in repos" "${p}"; exit 1; }
pkgfile=${pkgfile_remote#file://}
if [[ ! -f ${pkgfile} ]]; then
msg "Downloading package '%s' into pacman's cache" "${pkgfile}"
sudo pacman -Swdd --noconfirm --logfile /dev/null "${p}" || exit 1
pkgfile_remote=$(pacman -Sddp "${p}" 2>/dev/null)
pkgfile="${pkgfile_remote#file://}"
fi
splitpkgs+=("${pkgfile}")
fi
done
for f in "${splitpkgs[@]}"; do
if ! bsdtar -tqf "${f}" .BUILDINFO >/dev/null 2>&1; then
error "file is not a valid pacman package: '%s'" "${f}"
exit 1
fi
done
if (( ${#cache_dirs[@]} == 0 )); then
mapfile -t cache_dirs < <(pacman-conf CacheDir)
fi
ORIG_HOME=${HOME}
IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}")
load_makepkg_config
HOME=${ORIG_HOME}
[[ -d ${SRCDEST} ]] || SRCDEST=${PWD}
parse_buildinfo < <(bsdtar -xOqf "${splitpkgs[0]}" .BUILDINFO)
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
PACKAGER="${buildinfo[packager]}"
BUILDDIR="${buildinfo[builddir]}"
BUILDTOOL="${buildinfo[buildtool]}"
BUILDTOOLVER="${buildinfo[buildtoolver]}"
PKGEXT=${splitpkgs[0]#${splitpkgs[0]%.pkg.tar*}}
# nuke and restore reproducible testenv
namespace="$buildroot/$chroot"
lock 9 "${namespace}.lock" "Locking chroot namespace '%s'" "${namespace}"
for copy in "${namespace}"/*/; do
[[ -d ${copy} ]] || continue
subvolume_delete_recursive "${copy}"
done
rm -rf --one-file-system "${namespace}"
(umask 0022; mkdir -p "${namespace}")
for fname in "${installed[@]}"; do
if ! allpkgfiles+=("$(get_pkgfile "${fname}")"); then
error "failed to retrieve ${fname}"
exit 1
fi
done
trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
TEMPDIR=$(mktemp -d --tmpdir makerepropkg.XXXXXXXXXX)
makepkg_conf="${TEMPDIR}/makepkg.conf"
# anything before buildtool support is pinned to the last none buildtool aware release
if [[ -z "${BUILDTOOL}" ]]; then
get_makepkg_conf "artools-pkg-0.28.2-1-any" "${makepkg_conf}" || exit 1
# prefere to assume artools-pkg up until matching makepkg version so repository packages remain reproducible
elif [[ "${BUILDTOOL}" = makepkg ]] && (( $(vercmp "${BUILDTOOLVER}" 6.0.1) <= 0 )); then
get_makepkg_conf "artools-pkg-0.28.2-1-any" "${makepkg_conf}" || exit 1
# all artools-pkg builds
elif [[ "${BUILDTOOL}" = artools-pkg ]] && get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${makepkg_conf}"; then
true
# fallback to current makepkg.conf
else
warning "Unknown buildtool (${BUILDTOOL}-${BUILDTOOLVER}), using fallback"
makepkg_conf="${DATADIR}"/makepkg.conf
fi
printf '%s\n' "${allpkgfiles[@]}" | mkchroot -M "${makepkg_conf}" -U "${artixroot_args[@]}" "${namespace}/root" - || exit 1
# use makechrootpkg to prep the build directory
mkchrootpkg -r "${namespace}" -l build -- --packagelist || exit 1
# set detected makepkg.conf options
{
for var in PACKAGER BUILDDIR BUILDTOOL BUILDTOOLVER PKGEXT; do
printf '%s=%s\n' "${var}" "${!var@Q}"
done
printf 'OPTIONS=(%s)\n' "${buildopts[*]@Q}"
printf 'BUILDENV=(%s)\n' "${buildenv[*]@Q}"
} >> "${namespace}/build"/etc/makepkg.conf
install -d -o "${SUDO_UID:-$UID}" -g "$(id -g "${SUDO_UID:-$UID}")" "${namespace}/build/${BUILDDIR}"
bindmounts+=("-B:${PWD}:/startdir" "-B:${SRCDEST}:/srcdest")
# kick off the build
chroot-run \
-b "${bindmounts[*]}" \
"${namespace}/build" \
/chrootbuild -C --noconfirm --log --holdver --skipinteg
ret=$?
if (( ${ret} == 0 )); then
msg2 "built succeeded! built packages can be found in ${namespace}/build/pkgdest"
msg "comparing artifacts..."
for pkgfile in "${splitpkgs[@]}"; do
comparefiles=("${pkgfile}" "${namespace}/build/pkgdest/${pkgfile##*/}")
if cmp -s "${comparefiles[@]}"; then
msg2 "Package '%s' successfully reproduced!" "${pkgfile}"
else
ret=1
warning "Package '%s' is not reproducible. :(" "${pkgfile}"
sha256sum "${comparefiles[@]}"
if (( diffoscope )); then
diffoscope "${comparefiles[@]}"
fi
fi
done
fi
# return failure from chrootbuild, or the reproducibility status
exit ${ret}

View File

@@ -329,13 +329,14 @@ fi
# Pass all arguments after -- right to makepkg
makepkg_args+=("${@:$OPTIND}")
# See if -R or -e was passed to makepkg
# See if -R, -e or -A was passed to makepkg
for arg in "${@:$OPTIND}"; do
case ${arg%%=*} in
--skip*|--holdver) verifysource_args+=("$arg") ;;
--skip*|--holdver|--ignorearch) verifysource_args+=("$arg") ;;
--repackage|--noextract) keepbuilddir=1 ;;
--*) ;;
-*R*|-*e*) keepbuilddir=1 ;;
-*A*) verifysource_args+=(-A) ;;&
-*R*|-*e*) keepbuilddir=1 ;;&
esac
done

View File

@@ -12,48 +12,66 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
mk_graph(){
printf "%s\n" "$(pactree "${pactree_args[@]}" "${package}")" \
mk_tree_graph(){
printf "%s\n" "$(pactree "${tree_args[@]}" "${package}")" \
| dot -T "${ext}" > "${graph_dir}/${package}.${ext}"
}
mk_rebuild_graph(){
local tmpfile
tmpfile=/tmp/rebuild.dot
rebuild_args+=(-d "${tmpfile}")
artix-rebuild-order "${packages[@]}" "${rebuild_args[@]}"
dot -T "${ext}" "${tmpfile}" > "${graph_dir}/rebuild.${ext}"
rm -f "${tmpfile}"
}
usage() {
printf "Usage: %s [options] <package>\n" "${0##*/}"
printf " -l enable linear output\n"
printf " -r list packages that depend on the named package\n"
printf " -u show dependencies with no duplicates (implies -l)\n"
printf " -d <#> limit the depth of recursion\n"
printf " -o <#> controls at which depth to stop printing optional deps\n"
printf " (-1 for no limit)\n"
printf " -h display this help message\n"
printf "Usage: %s [options] <package|packages>\n" "${0##*/}"
printf " -m <tree|rebuild> default mode: [%s]\n" "$mode"
printf " rebuild mode accepts packages input\n"
printf " -r list packages that depend on the named package (tree)\n"
printf " -u show dependencies with no duplicates (tree)\n"
printf " -d <#> limit the depth of recursion (tree)\n"
printf " default: [%s]\n" "$depth"
printf " -o <#> controls at which depth to stop printing optional deps\n"
printf " default: [%s]\n" "$optdepth"
printf " (-1 for no limit) (tree)\n"
printf " -i only use the pkgnames provided as input (rebuild)\n"
printf " -h display this help message\n"
exit "$1"
}
graph_dir=${XDG_PICTURES_DIR:-$(xdg-user-dir PICTURES)/artix}
ext="png"
pactree_args=(-gs)
mode=tree
tree_args=(-gs)
rebuild_args=()
depth=0
optdepth=-1
while getopts :d:o:rluh arg; do
opts=':m:d:o:iruh'
while getopts "$opts" arg; do
case "${arg}" in
r) pactree_args+=(-r) ;;
l) pactree_args+=(-l) ;;
u) pactree_args+=(-u) ;;
d) depth="$OPTARG"; pactree_args+=(-d "$depth") ;;
o) optdepth="$OPTARG"; pactree_args+=(-o"$optdepth") ;;
m) mode="$OPTARG" ;;
r) tree_args+=(-r) ;;
u) tree_args+=(-ul) ;;
d) depth="$OPTARG"; tree_args+=(-d "$depth") ;;
o) optdepth="$OPTARG"; tree_args+=(-o"$optdepth") ;;
i) rebuild_args+=(--no-reverse-depends) ;;
h|?) usage 0 ;;
esac
done
shift $(( OPTIND - 1 ))
package="$1"
[[ -d "${graph_dir}" ]] || mkdir -p "${graph_dir}"
if [[ ! -d "${graph_dir}" ]];then
mkdir -p "${graph_dir}"
fi
mk_graph
case "$mode" in
tree) package=("$@"); mk_tree_graph ;;
rebuild) packages=("$@"); mk_rebuild_graph ;;
*) usage 1 ;;
esac

View File

@@ -7,47 +7,13 @@
# TREE_DIR_ARTIX=${WORKSPACE_DIR}/artixlinux
# customize buildtree; uncomment to include
# TREE_NAMES_ARTIX=(
# packages-kernel
# packages-llvm
# packages-openrc
# packages-runit
# packages-s6
# packages-suite66
# packages-dinit
# packages-perl
# packages-java
# packages-ruby
# packages-gtk
# packages-qt5
# packages-qt6
# packages-xorg
# packages-plasma
# kde-utils
# kde-devel
# kde-media
# kde-games
# kde-edu
# kde-net
# kde-pim
# packages-gnome
# packages-cinnamon
# packages-lxqt
# packages-lxde
# packages-mate
# packages-xfce
# packages-wm
# packages-devel
# packages-qt6
# packages-office
# packages-misc
# python-world
# python-galaxy
# python-galaxy-groups
# python-misc
# packages-python
# packages-lib32
# customize buildtree
# ARTIX_TREE=(
# main
# initsys
# desktop
# addons
# lib32
# )
# TREE_DIR_ARCH=${WORKSPACE_DIR}/archlinux

View File

@@ -46,13 +46,13 @@ CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"
#RUSTFLAGS="-C opt-level=2"
RUSTFLAGS=""
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
#DEBUG_RUSTFLAGS="-C debuginfo=2"
DEBUG_RUSTFLAGS="-C debuginfo=2"
#########################################################################
# BUILD ENVIRONMENT

View File

@@ -9,8 +9,6 @@
export LANG=C
shopt -s extglob
if [[ -t 2 && "$TERM" != dumb ]]; then
colorize
else

View File

@@ -5,7 +5,8 @@
get_compliant_name(){
local gitname="$1"
case "$gitname" in
*+) gitname=${gitname//+/plus}
*+) gitname=${gitname//+/plus} ;;
*+*) gitname=${gitname//+/-} ;;
esac
printf "%s\n" "$gitname"
}

View File

@@ -2,6 +2,8 @@
#{{{ functions
shopt -s extglob
find_cached_pkgfile() {
local searchdirs=("$PKGDEST" "$PWD") results=()
local pkg="$1"
@@ -25,6 +27,8 @@ find_cached_pkgfile() {
esac
}
shopt -u extglob
get_pkgbasename() {
local name="$1"
local rm_pkg=${name%.pkg.tar*}

75
lib/pkg/diff.sh Normal file
View File

@@ -0,0 +1,75 @@
#!/hint/bash
#{{{ functions
pkgver_equal() {
if [[ $1 = *-* && $2 = *-* ]]; then
# if both versions have a pkgrel, then they must be an exact match
[[ $1 = "$2" ]]
else
# otherwise, trim any pkgrel and compare the bare version.
[[ ${1%%-*} = "${2%%-*}" ]]
fi
}
shopt -s extglob
find_cached_package() {
local searchdirs=("$PWD" "$PKGDEST") results=()
local targetname=$1 targetver=$2 targetarch=$3
local dir pkg packages pkgbasename name ver rel arch r results
for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue
shopt -s extglob nullglob
mapfile -t packages < <(printf "%s\n" "$dir"/"${targetname}"-"${targetver}"-*"${targetarch}".pkg.tar?(.!(sig|*.*)))
shopt -u extglob nullglob
for pkg in "${packages[@]}"; do
[[ -f $pkg ]] || continue
# avoid adding duplicates of the same inode
for r in "${results[@]}"; do
[[ $r -ef $pkg ]] && continue 2
done
# split apart package filename into parts
pkgbasename=${pkg##*/}
pkgbasename=${pkgbasename%.pkg.tar*}
arch=${pkgbasename##*-}
pkgbasename=${pkgbasename%-"$arch"}
rel=${pkgbasename##*-}
pkgbasename=${pkgbasename%-"$rel"}
ver=${pkgbasename##*-}
name=${pkgbasename%-"$ver"}
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
pkgver_equal "$targetver" "$ver-$rel"; then
results+=("$pkg")
fi
done
done
case ${#results[*]} in
0)
return 1
;;
1)
printf '%s\n' "${results[0]}"
return 0
;;
*)
error 'Multiple packages found:'
printf '\t%s\n' "${results[@]}" >&2
return 1
;;
esac
}
shopt -u extglob
#}}}

View File

@@ -31,7 +31,7 @@ write_agentyaml(){
git add "$agent"
}
commit_jenkins_files(){
commit_ci(){
local pkg="$1"
write_jenkinsfile "$pkg"

View File

@@ -21,35 +21,8 @@ load_pkg_config(){
TREE_DIR_ARTIX=${TREE_DIR_ARTIX:-"${WORKSPACE_DIR}/artixlinux"}
ARTIX_TREE=(
packages community
packages-{llvm,gfx,media,net}
)
local dev_tree=(
packages-{python,perl,java,ruby,misc}
python-{world,galaxy,galaxy-groups,misc}
)
local init_tree=(packages-{openrc,runit,s6,suite66,dinit})
local desktop_tree=(
packages-{xorg,gtk,qt5,qt6,kf5,plasma}
kde-{utils,devel,net,pim,media,edu,games}
packages-{lxqt,gnome,cinnamon,mate,xfce,wm,lxde}
)
[[ -z ${TREE_NAMES_ARTIX[*]} ]] && \
TREE_NAMES_ARTIX=(
packages-kernel
"${init_tree[@]}"
"${dev_tree[@]}"
"${desktop_tree[@]}"
packages-devel
packages-lib32
)
ARTIX_TREE+=("${TREE_NAMES_ARTIX[@]}")
[[ -z ${ARTIX_TREE[*]} ]] && \
ARTIX_TREE=(main initsys desktop addons lib32)
TREE_DIR_ARCH=${TREE_DIR_ARCH:-"${WORKSPACE_DIR}/archlinux"}