Compare commits

..

2 Commits

Author SHA1 Message Date
b48b056194 merge branch 'arch-patches' 2023-05-24 21:30:43 +02:00
50b71dfb55 artixpkg: add special rebuild repo names 2023-05-24 16:02:20 +02:00
8 changed files with 133 additions and 69 deletions

View File

@@ -205,7 +205,8 @@ diff_pkgs() {
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}" [[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}" [[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}") local -a diffoptions
diffoptions=("${DIFFOPTIONS[@]}" --label "${oldpkg}" --label "${newpkg}")
if (( TARLIST )); then if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/old" tar_list "$oldpkg" > "$TMPDIR/old"
@@ -226,7 +227,7 @@ diff_pkgs() {
# Resolve dynamic auto width one we know the content to diff # Resolve dynamic auto width one we know the content to diff
if [[ $DIFFWIDTH == --width=auto ]]; then if [[ $DIFFWIDTH == --width=auto ]]; then
AUTOLENGTH=$(file_diff_columns "$TMPDIR/old" "$TMPDIR/new") AUTOLENGTH=$(file_diff_columns "$TMPDIR/old" "$TMPDIR/new")
DIFFOPTIONS+=("--width=${AUTOLENGTH}") diffoptions+=("--width=${AUTOLENGTH}")
fi fi
# Print a header for side-by-side view as it lacks labels # Print a header for side-by-side view as it lacks labels
@@ -234,7 +235,7 @@ diff_pkgs() {
printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}" printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
fi fi
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new" diff "${diffoptions[@]}" "$TMPDIR/old" "$TMPDIR/new"
fi fi
if (( DIFFOSCOPE )); then if (( DIFFOSCOPE )); then

View File

@@ -22,14 +22,19 @@ stat_busy() {
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2 printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}...${ALL_OFF}" "$@" >&2
} }
stat_progress() {
# shellcheck disable=2059
printf "${BOLD}.${ALL_OFF}" >&2
}
stat_done() { stat_done() {
# shellcheck disable=2059 # shellcheck disable=2059
printf "${BOLD}done${ALL_OFF}\n" >&2 printf "${BOLD}done${ALL_OFF}\n" >&2
} }
lock_close() { lock_close() {
local fd=$1 local fd=$1
exec {fd}>&- exec {fd}>&-
} }
lock() { lock() {

View File

@@ -17,6 +17,7 @@ artixpkg_git_clone_usage() {
OPTIONS OPTIONS
-m, --maintainer=NAME Clone all packages of the named maintainer -m, --maintainer=NAME Clone all packages of the named maintainer
--protocol https Clone the repository over https
-t, --topic=NAME Clone all packages of the named topic -t, --topic=NAME Clone all packages of the named topic
-j, --jobs N Run up to N jobs in parallel (default: $(nproc)) -j, --jobs N Run up to N jobs in parallel (default: $(nproc))
--universe Clone all existing packages, useful for cache warming --universe Clone all existing packages, useful for cache warming
@@ -55,11 +56,21 @@ artixpkg_git_clone() {
artixpkg_git_clone_usage artixpkg_git_clone_usage
exit 0 exit 0
;; ;;
-u|--unprivileged) --protocol=https)
GIT_REPO_BASE_URL="${GIT_URL}/" GIT_REPO_BASE_URL="${GIT_URL}/"
CONFIGURE_OPTIONS+=("$1") CONFIGURE_OPTIONS+=("$1")
shift shift
;; ;;
--protocol)
(( $# <= 1 )) && die "missing argument for %s" "$1"
if [[ $2 == https ]]; then
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
else
die "unsupported protocol: %s" "$2"
fi
CONFIGURE_OPTIONS+=("$1" "$2")
shift 2
;;
-m|--maintainer) -m|--maintainer)
(( $# <= 1 )) && die "missing argument for %s" "$1" (( $# <= 1 )) && die "missing argument for %s" "$1"
MAINTAINER="$2" MAINTAINER="$2"

View File

@@ -17,6 +17,7 @@ artixpkg_git_config_usage() {
OPTIONS OPTIONS
-t, --topic Set the maintainer topic via gitea api -t, --topic Set the maintainer topic via gitea api
-u, --upstream Add upstream arch remote -u, --upstream Add upstream arch remote
--protocol https Configure remote url to use https
-j, --jobs N Run up to N jobs in parallel (default: $(nproc)) -j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text -h, --help Show this help text
@@ -80,6 +81,7 @@ artixpkg_git_config() {
local GIT_REPO_BASE_URL=${GIT_URL} local GIT_REPO_BASE_URL=${GIT_URL}
local official=0 local official=0
local proto=https local proto=https
local proto_force=0
local jobs= local jobs=
jobs=$(nproc) jobs=$(nproc)
local paths=() local paths=()
@@ -106,6 +108,19 @@ artixpkg_git_config() {
UPSTREAM=1 UPSTREAM=1
shift shift
;; ;;
--protocol=https)
proto_force=1
shift
;;
--protocol)
(( $# <= 1 )) && die "missing argument for %s" "$1"
if [[ $2 == https ]]; then
proto_force=1
else
die "unsupported protocol: %s" "$2"
fi
shift 2
;;
-j|--jobs) -j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1" (( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2 jobs=$2
@@ -149,8 +164,10 @@ artixpkg_git_config() {
fi fi
if is_packager_email_official "${packager_email}"; then if is_packager_email_official "${packager_email}"; then
official=1 official=1
proto=ssh if (( ! proto_force )); then
GIT_REPO_BASE_URL=${GIT_SSH} proto=ssh
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
fi
fi fi
fi fi

View File

@@ -44,6 +44,8 @@ ARTIX_DB=(
multilib-staging multilib-staging
kde-unstable kde-unstable
gnome-unstable gnome-unstable
core-rebuild
extra-rebuild
) )
artixpkg_repo() { artixpkg_repo() {

View File

@@ -98,32 +98,40 @@ artixpkg_repo_add() {
cp -r trunk/* "$CARCH/${DEST}"/ cp -r trunk/* "$CARCH/${DEST}"/
if [[ "${DEST}" != 'trunk' ]]; then pkgbuild="$CARCH/${DEST}"/PKGBUILD
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
# shellcheck disable=1090 # shellcheck disable=1090
source "$pkgbuild" source "$pkgbuild"
local commit_msg local commit_msg
commit_msg=$(get_commit_msg) commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
git add . if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
git commit -m "$commit_msg"
if (( PUSH )); then msg 'Staging files'
msg "Push (${pkgbase})" for f in $(git ls-files --modified -o --directory); do
git push origin master git add "$f"
fi done
# stat_done
if (( SET_TOPIC )); then msg 'Commit'
# topics meta git commit -m "${commit_msg}"
if [[ -n ${GIT_TOKEN} ]]; then # stat_done
local topic="${DEST}"
local gitname=$(get_compliant_name "${pkgbase}") if (( PUSH )); then
if ! add_topic "${gitname}" "${topic}" >/dev/null; then msg "Push (${pkgbase})"
warning "failed to add pacman repo topic: ${topic}" git push origin master
# stat_done
fi
if (( SET_TOPIC )); then
# topics meta
if [[ -n ${GIT_TOKEN} ]]; then
local topic="${DEST}"
local gitname=$(get_compliant_name "${pkgbase}")
if ! add_topic "${gitname}" "${topic}" >/dev/null; then
warning "failed to add pacman repo topic: ${topic}"
fi
fi fi
fi fi
fi fi

View File

@@ -103,39 +103,50 @@ artixpkg_repo_move() {
[[ ! -d "$CARCH" ]] && mkdir "$CARCH" [[ ! -d "$CARCH" ]] && mkdir "$CARCH"
[[ ! -d "$CARCH/${DEST}" ]] && mkdir "$CARCH/${DEST}" [[ ! -d "$CARCH/${DEST}" ]] && mkdir "$CARCH/${DEST}"
cp -r "$CARCH/${SRC}"/* "$CARCH/${DEST}"/ mv -T "$CARCH/${SRC}" "$CARCH/${DEST}"
git rm -r "$CARCH/${SRC}"
pkgbuild="$CARCH/${DEST}"/PKGBUILD
if [[ "${SRC}" != 'trunk' ]]; then
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
# shellcheck disable=1090 # shellcheck disable=1090
source "$pkgbuild" source "$pkgbuild"
local commit_msg local commit_msg
commit_msg=$(get_commit_msg) commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
git add . if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
git commit -m "$commit_msg"
if (( PUSH )); then # git add .
msg "Push (${pkgbase})" msg 'Staging files'
git push origin master for f in $(git ls-files --deleted); do
fi git rm "$f"
done
for f in $(git ls-files -o --unmerged); do
git add "$f"
done
# stat_done
if (( SET_TOPIC )); then msg 'Commit'
# topics meta git commit -m "${commit_msg}"
if [[ -n ${GIT_TOKEN} ]]; then # stat_done
local topic="${DEST}"
local gitname=$(get_compliant_name "${pkgbase}") if (( PUSH )); then
if ! add_topic "${gitname}" "${topic}" >/dev/null; then msg "Push (${pkgbase})"
warning "failed to add pacman repo topic: ${topic}" git push origin master
fi # stat_done
topic="${SRC}" fi
if ! remove_topic "${gitname}" "${topic}" >/dev/null; then
warning "failed to remove pacman repo topic: ${topic}" if (( SET_TOPIC )); then
# topics meta
if [[ -n ${GIT_TOKEN} ]]; then
local topic="${DEST}"
local gitname=$(get_compliant_name "${pkgbase}")
if ! add_topic "${gitname}" "${topic}" >/dev/null; then
warning "failed to add pacman repo topic: ${topic}"
fi
topic="${SRC}"
if ! remove_topic "${gitname}" "${topic}" >/dev/null; then
warning "failed to remove pacman repo topic: ${topic}"
fi
fi fi
fi fi
fi fi

View File

@@ -91,35 +91,44 @@ artixpkg_repo_remove() {
die "No PKGBUILD found in (%s)" "trunk" die "No PKGBUILD found in (%s)" "trunk"
fi fi
if [[ "${DEST}" != 'trunk' ]]; then pkgbuild="$CARCH/${DEST}"/PKGBUILD
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
# shellcheck disable=1090 # shellcheck disable=1090
source "$pkgbuild" source "$pkgbuild"
local commit_msg local commit_msg
commit_msg=$(get_commit_msg) commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
if [[ "${DEST}" == 'trunk' ]];then
git rm -r "trunk"
else
git rm -r "$CARCH/${DEST}"
fi
if (( PUSH )); then rm -r "$CARCH/${DEST}"
msg "Push (${pkgbase})"
git push origin master
fi
if (( SET_TOPIC )); then if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
# topics meta
if [[ -n ${GIT_TOKEN} ]]; then msg 'Staging files'
local topic="${SRC}" for f in $(git ls-files --deleted); do
if ! remove_topic "${gitname}" "${topic}" >/dev/null; then git rm "$f"
warning "failed to remove pacman repo topic: ${topic}" done
# stat_done
msg 'Commit'
git commit -m "${commit_msg}"
# stat_done
if (( PUSH )); then
msg "Push (${pkgbase})"
git push origin master
# stat_done
fi
if (( SET_TOPIC )); then
# topics meta
if [[ -n ${GIT_TOKEN} ]]; then
local topic="${SRC}"
if ! remove_topic "${gitname}" "${topic}" >/dev/null; then
warning "failed to remove pacman repo topic: ${topic}"
fi
fi fi
fi fi
fi fi
) )
fi fi