Compare commits

...

4 Commits

Author SHA1 Message Date
6787d5fafb merge branch 'artixpkg' 2023-05-25 20:57:42 +02:00
2a0c08e34b artixpkg git: fix config help examples 2023-05-25 17:02:57 +02:00
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
10 changed files with 193 additions and 79 deletions

View File

@@ -205,7 +205,8 @@ diff_pkgs() {
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -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
tar_list "$oldpkg" > "$TMPDIR/old"
@@ -226,7 +227,7 @@ diff_pkgs() {
# 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}")
diffoptions+=("--width=${AUTOLENGTH}")
fi
# 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}"
fi
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
diff "${diffoptions[@]}" "$TMPDIR/old" "$TMPDIR/new"
fi
if (( DIFFOSCOPE )); then

View File

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

View File

@@ -17,6 +17,7 @@ artixpkg_git_clone_usage() {
OPTIONS
-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
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
--universe Clone all existing packages, useful for cache warming
@@ -55,11 +56,21 @@ artixpkg_git_clone() {
artixpkg_git_clone_usage
exit 0
;;
-u|--unprivileged)
--protocol=https)
GIT_REPO_BASE_URL="${GIT_URL}/"
CONFIGURE_OPTIONS+=("$1")
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)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAINTAINER="$2"

View File

@@ -17,13 +17,14 @@ artixpkg_git_config_usage() {
OPTIONS
-t, --topic Set the maintainer topic via gitea api
-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))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} config -t libfoo
$ ${COMMAND} config -u libfoo
$ ${COMMAND} config *
$ ${COMMAND} -t libfoo
$ ${COMMAND} -u libfoo
$ ${COMMAND} *
_EOF_
}
@@ -80,6 +81,7 @@ artixpkg_git_config() {
local GIT_REPO_BASE_URL=${GIT_URL}
local official=0
local proto=https
local proto_force=0
local jobs=
jobs=$(nproc)
local paths=()
@@ -106,6 +108,19 @@ artixpkg_git_config() {
UPSTREAM=1
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)
(( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2
@@ -149,8 +164,10 @@ artixpkg_git_config() {
fi
if is_packager_email_official "${packager_email}"; then
official=1
proto=ssh
GIT_REPO_BASE_URL=${GIT_SSH}
if (( ! proto_force )); then
proto=ssh
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
fi
fi
fi

View File

@@ -7,7 +7,7 @@ ARTOOLS_INCLUDE_GIT_CREATE_SH=1
source "${LIBDIR}"/pkg/git/clone.sh
source "${LIBDIR}"/pkg/git/config.sh
source "${LIBDIR}"/pkg/git/ci/jenkins.sh
source "${LIBDIR}"/pkg/ci/jenkins.sh
set -e

View File

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

View File

@@ -98,32 +98,40 @@ artixpkg_repo_add() {
cp -r trunk/* "$CARCH/${DEST}"/
if [[ "${DEST}" != 'trunk' ]]; then
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
pkgbuild="$CARCH/${DEST}"/PKGBUILD
# shellcheck disable=1090
source "$pkgbuild"
local commit_msg
commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
git add .
git commit -m "$commit_msg"
if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
if (( PUSH )); then
msg "Push (${pkgbase})"
git push origin master
fi
msg 'Staging files'
for f in $(git ls-files --modified -o --directory); do
git add "$f"
done
# stat_done
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}"
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="${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

View File

@@ -7,16 +7,48 @@ ARTOOLS_INCLUDE_REPO_IMPORT_SH=1
set -e
patch_pkgbase(){
local name="$1"
local pkgbuild
pkgbuild=trunk/PKGBUILD
sed -e 's|arch-meson|artix-meson|' -i "${pkgbuild}"
case "${name}" in
glibc)
msg "Patching %s" "${name}"
sed -e 's|{locale,systemd/system,tmpfiles.d}|{locale,tmpfiles.d}|' \
-e '/nscd.service/d' \
-i "${pkgbuild}"
;;
linux|linux-lts)
msg "Patching %s" "${name}"
sed -e 's|KBUILD_BUILD_HOST=.*|KBUILD_BUILD_HOST=artixlinux|' -i "${pkgbuild}"
sed -e 's|CONFIG_DEFAULT_HOSTNAME=.*|CONFIG_DEFAULT_HOSTNAME="artixlinux"|' \
-i "$pkgpath"/config
;;
gstreamer|gst-plugins-*|licenses)
msg "Patching %s" "${name}"
sed -e 's|https://www.archlinux.org/|https://www.artixlinux.org/|' \
-e 's|(Arch Linux)|(Artix Linux)|' \
-i "${pkgbuild}"
;;
esac
}
artixpkg_repo_import_usage() {
local -r COMMAND=${_ARTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
OPTIONS
--switch TAG Switch the current trunk to a specified version tag
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} libfoo
$ ${COMMAND} libfoo --switch TAG
_EOF_
}
@@ -29,9 +61,18 @@ artixpkg_repo_import() {
# options
local pkgbases=()
local pkgbase
local upstream_url
upstream_url="https://gitlab.archlinux.org/archlinux/packaging/packages"
local TAG
local rsync_args=()
rsync_args+=(-aWxvci --progress --delete-before --no-R --no-implied-dirs --exclude '.git')
while (( $# )); do
case $1 in
--switch=*)
TAG="${1#*=}"
shift
;;
-h|--help)
artixpkg_repo_import_usage
exit 0
@@ -58,7 +99,7 @@ artixpkg_repo_import() {
( cd "${pkgbase}" || return
stat_busy "Checking for upstream url"
if ! git config --local --get remote.upstream.url &>/dev/null; then
git remote add upstream https://gitlab.archlinux.org/archlinux/packaging/packages/${pkgbase}.git
git remote add upstream "${upstream_url}"/${pkgbase}.git
fi
stat_done
@@ -66,17 +107,26 @@ artixpkg_repo_import() {
git fetch upstream --tags
stat_done
local latest
local latest version
latest=$(git describe --tags FETCH_HEAD)
version="${latest}"
if [[ -n "${TAG}" ]]; then
version="${TAG}"
fi
stat_busy "Importing upstream changeset for ${latest}"
git checkout "${latest}" -b "${latest}" &>/dev/null
stat_busy "Importing upstream changeset for ${version}"
git checkout "${version}" -b "${version}" &>/dev/null
local temp
temp=$(mktemp -d --tmpdir "${pkgbase}.XXXXXXXXXX")
local rsync_args=(-aWxvci --progress --delete-before --no-R --no-implied-dirs --exclude '.git')
rsync "${rsync_args[@]}" "$(pwd)"/ "${temp}"/ &>/dev/null
git checkout master &>/dev/null
git branch -D "${latest}" &>/dev/null
git branch -D "${version}" &>/dev/null
rsync "${rsync_args[@]}" "${temp}"/ "$(pwd)"/trunk/ &>/dev/null
patch_pkgbase "${pkgbase}"
stat_done
)
fi

View File

@@ -103,39 +103,50 @@ artixpkg_repo_move() {
[[ ! -d "$CARCH" ]] && mkdir "$CARCH"
[[ ! -d "$CARCH/${DEST}" ]] && mkdir "$CARCH/${DEST}"
cp -r "$CARCH/${SRC}"/* "$CARCH/${DEST}"/
git rm -r "$CARCH/${SRC}"
mv -T "$CARCH/${SRC}" "$CARCH/${DEST}"
pkgbuild="$CARCH/${DEST}"/PKGBUILD
if [[ "${SRC}" != 'trunk' ]]; then
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
# shellcheck disable=1090
source "$pkgbuild"
local commit_msg
commit_msg=$(get_commit_msg)
msg "Action: %s" "$commit_msg"
git add .
git commit -m "$commit_msg"
if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
if (( PUSH )); then
msg "Push (${pkgbase})"
git push origin master
fi
# git add .
msg 'Staging files'
for f in $(git ls-files --deleted); do
git rm "$f"
done
for f in $(git ls-files -o --unmerged); do
git add "$f"
done
# stat_done
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}"
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="${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

View File

@@ -91,35 +91,44 @@ artixpkg_repo_remove() {
die "No PKGBUILD found in (%s)" "trunk"
fi
if [[ "${DEST}" != 'trunk' ]]; then
pkgbuild="$CARCH/${DEST}"/PKGBUILD
fi
pkgbuild="$CARCH/${DEST}"/PKGBUILD
# shellcheck disable=1090
source "$pkgbuild"
local 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
msg "Push (${pkgbase})"
git push origin master
fi
rm -r "$CARCH/${DEST}"
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}"
if [[ -n $(git status --porcelain --untracked-files=normal) ]]; then
msg 'Staging files'
for f in $(git ls-files --deleted); do
git rm "$f"
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