Compare commits

...

8 Commits

Author SHA1 Message Date
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: #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: #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
11 changed files with 190 additions and 88 deletions

View File

@@ -93,7 +93,7 @@ done
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' C en_US de_DE > "$working_dir/etc/locale.gen"
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
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

@@ -112,8 +112,8 @@ update_tree() {
set_maintainer() {
local name email path="$1"
name=$(git config --get user.name)
email=$(git config --get user.email)
name=$(git -C $path config --get user.name)
email=$(git -C $path config --get user.email)
sed -e "1s|Maintainer:.*|Maintainer: $name <$email>|" \
-i "$path"/PKGBUILD
}

View File

@@ -15,8 +15,6 @@
m4_include(lib/base/message.sh)
m4_include(lib/pkg/diff.sh)
shopt -s extglob
load_makepkg_config
usage() {

View File

@@ -22,18 +22,6 @@ m4_include(lib/pkg/repo.sh)
#{{{ functions
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]}" ]] || \
@@ -50,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() {
@@ -72,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"
}
@@ -88,60 +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 -r 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 -r "$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 tree
local artixpath head tree tree_name
artixpath=$(find_pkg "${TREE_DIR_ARTIX}" "${package}")
if [[ -n ${artixpath} ]];then
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 "$tree" || return
case "${cmd}" in
'commitpkg') commit_pkg ;;
*) repo_commit_pkg ;;
esac
msg "Checking (%s) (Artix)" "${tree##*/}"
pull_tree "${tree##*/}" "$head"
if braid push "${package}"; then
braid update "${package}"
msg "Update (%s)" "${tree##*/}"
git push origin master
git prune
[[ "${cmd}" != 'commitpkg' ]] && check_team
else
warning "'braid push %s' failed.\n" "${package}"
fi
msg "Checking (%s) (Artix)" "$tree_name"
pull_tree "$tree_name" "$head"
push_pkg "$tree_name"
else
die "Package '%s' does not exist!" "${package}"
fi
@@ -168,8 +158,6 @@ repo_src='trunk'
package=''
remove=false
pkgbuild=trunk/PKGBUILD
cmd=${0##*/}
repo_dest=${cmd%pkg}

View File

@@ -2,8 +2,6 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
shopt -s extglob
m4_include(lib/base/message.sh)
m4_include(lib/pkg/diff.sh)
@@ -37,12 +35,19 @@ _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
@@ -51,6 +56,7 @@ while (( $# )); do
exit 0
;;
-M|--makepkg-config)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAKEPKG_CONF="$2"
shift 2
;;
@@ -74,11 +80,50 @@ while (( $# )); do
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"
;;
*)
@@ -87,13 +132,29 @@ while (( $# )); do
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
TARLIST=1
fi
# Source makepkg.conf; fail if it is not found
if [[ -r "${MAKEPKG_CONF}" ]]; then
# shellcheck source=makepkg-x86_64.conf
# shellcheck source=config/makepkg/x86_64.conf
source "${MAKEPKG_CONF}"
else
die "${MAKEPKG_CONF} not found!"
@@ -121,6 +182,19 @@ tar_list() {
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")
@@ -129,32 +203,45 @@ diff_pkgs() {
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/filelist-old"
tar_list "$newpkg" > "$TMPDIR/filelist"
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
sdiff -s "$TMPDIR/filelist-old" "$TMPDIR/filelist"
if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/old"
tar_list "$newpkg" > "$TMPDIR/new"
fi
if (( PKGINFO )); then
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/pkginfo-old"
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/pkginfo"
sdiff -s "$TMPDIR/pkginfo-old" "$TMPDIR/pkginfo"
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/new"
fi
if (( BUILDINFO )); then
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/buildinfo-old"
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/buildinfo"
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
fi
sdiff -s "$TMPDIR/buildinfo-old" "$TMPDIR/buildinfo"
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 "$oldpkg" "$newpkg"
diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
fi
}
shopt -s extglob
fetch_pkg() {
local pkg pkgdest pkgurl
case $1 in
@@ -165,13 +252,24 @@ fetch_pkg() {
*.pkg.tar*)
pkgurl=$1 ;;
'')
;;
;;
*)
pkg=$1 ;;
esac
[[ -n $pkgurl ]] || pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
die "Couldn't download previous package for %s." "$pkg"
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}
@@ -192,12 +290,14 @@ fetch_pkg() {
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=PKGBUILD.proto
# shellcheck source=contrib/makepkg/PKGBUILD.proto
. ./PKGBUILD
if [[ ${arch[0]} == 'any' ]]; then
CARCH='any'

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*');;

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

@@ -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

@@ -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*}

View File

@@ -12,15 +12,21 @@ pkgver_equal() {
fi
}
shopt -s extglob
find_cached_package() {
local searchdirs=("$PKGDEST" "$PWD") results=()
local searchdirs=("$PWD" "$PKGDEST") results=()
local targetname=$1 targetver=$2 targetarch=$3
local dir pkg pkgbasename name ver rel arch r results
local dir pkg packages pkgbasename name ver rel arch r results
for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
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
@@ -64,4 +70,6 @@ find_cached_package() {
esac
}
shopt -u extglob
#}}}