mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 09:56:18 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1b808b8e32 | ||
![]() |
e4c40a9802 | ||
![]() |
a08bc2acf4 | ||
![]() |
f11cb9018e | ||
![]() |
d759eadb50 | ||
![]() |
1c399778f9 | ||
![]() |
edc14ef19c | ||
![]() |
6ce666a166 | ||
![]() |
bf61b8472a | ||
![]() |
80a8cdcba2 |
2
Makefile
2
Makefile
@@ -1,6 +1,6 @@
|
||||
SHELL=/bin/bash
|
||||
|
||||
V=20230307
|
||||
V=1.0.1
|
||||
BUILDTOOLVER ?= $(V)
|
||||
|
||||
PREFIX = /usr/local
|
||||
|
@@ -265,20 +265,30 @@ _pkgctl_repo_cmds=(
|
||||
|
||||
_pkgctl_repo_clone_args=(
|
||||
-m --maintainer
|
||||
--protocol
|
||||
--switch
|
||||
-u --unprivileged
|
||||
--universe
|
||||
-j --jobs
|
||||
-h --help
|
||||
)
|
||||
_pkgctl_repo_clone_args__maintainer_opts() { :; }
|
||||
_pkgctl_repo_clone_args_m_opts() { _pkgctl_repo_clone_args__maintainer_opts; }
|
||||
_pkgctl_repo_clone_args__protocol_opts() { _devtools_completions_protocol; }
|
||||
_pkgctl_repo_clone_args__switch_opts() { :; }
|
||||
_pkgctl_repo_clone_args__jobs_opts() { :; }
|
||||
_pkgctl_repo_clone_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
||||
_pkgctl_repo_clone_opts() { _devtools_completions_all_packages; }
|
||||
|
||||
|
||||
_pkgctl_repo_configure_args=(
|
||||
--protocol
|
||||
-j --jobs
|
||||
-h --help
|
||||
)
|
||||
_pkgctl_repo_configure_args__protocol_opts() { _devtools_completions_protocol; }
|
||||
_pkgctl_repo_configure_args__jobs_opts() { :; }
|
||||
_pkgctl_repo_configure_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
||||
_pkgctl_repo_configure_opts() { _filedir -d; }
|
||||
|
||||
|
||||
@@ -357,6 +367,9 @@ _devtools_completions_build_repo() {
|
||||
_devtools_completions_all_packages() {
|
||||
mapfile -t COMPREPLY < <(compgen -W "$(pacman -Sql)" -- "$cur")
|
||||
}
|
||||
_devtools_completions_protocol() {
|
||||
mapfile -t COMPREPLY < <(compgen -W "https" -- "$cur")
|
||||
}
|
||||
|
||||
__devtools_complete() {
|
||||
local service=$1
|
||||
|
@@ -108,13 +108,17 @@ _pkgctl_repo_switch_args=(
|
||||
|
||||
_pkgctl_repo_clone_args=(
|
||||
'(-m --maintainer=)'{-m,--maintainer=}'[Clone all packages of the named maintainer]:maintainer:'
|
||||
'--protocol[Clone the repository over https]:proto:(https)'
|
||||
'--switch=[Switch the current working tree to a specified version]'
|
||||
'--universe[Clone all existing packages, useful for cache warming]'
|
||||
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
|
||||
'(-h --help)'{-h,--help}'[Display usage]'
|
||||
'*:packages:_devtools_completions_all_packages'
|
||||
)
|
||||
|
||||
_pkgctl_repo_configure_args=(
|
||||
'--protocol[Configure remote url to use https]:proto:(https)'
|
||||
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
|
||||
'(-h --help)'{-h,--help}'[Display usage]'
|
||||
'*:git_dir:_files -/'
|
||||
)
|
||||
|
@@ -25,6 +25,9 @@ Options
|
||||
*-m, --maintainer* 'NAME'::
|
||||
Clone all packages of the named maintainer
|
||||
|
||||
*--protocol* 'https'::
|
||||
Clone the repository over https
|
||||
|
||||
*--universe*::
|
||||
Clone all existing packages, useful for cache warming
|
||||
|
||||
@@ -32,6 +35,11 @@ Options
|
||||
Switch to a specified version. The working tree and the index are updated to
|
||||
match the version.
|
||||
|
||||
*-j, --jobs* 'N'::
|
||||
Run up to N jobs in parallel. By default the number of jobs is equal to the
|
||||
number of available processing units. For sequential processing this option
|
||||
needs to be passed with 1.
|
||||
|
||||
*-h, --help*::
|
||||
Show a help text
|
||||
|
||||
|
@@ -25,6 +25,14 @@ read-only HTTPS otherwise.
|
||||
Options
|
||||
-------
|
||||
|
||||
*--protocol* 'https'::
|
||||
Configure remote url to use https
|
||||
|
||||
*-j, --jobs* 'N'::
|
||||
Run up to N jobs in parallel. By default the number of jobs is equal to the
|
||||
number of available processing units. For sequential processing this option
|
||||
needs to be passed with 1.
|
||||
|
||||
*-h, --help*::
|
||||
Show a help text
|
||||
|
||||
|
@@ -173,7 +173,15 @@ done
|
||||
# check for PKGBUILD standards
|
||||
check_pkgbuild_validity
|
||||
|
||||
if [[ -n $(git status --short --untracked-files=no) ]]; then
|
||||
# auto generate .SRCINFO if present
|
||||
if [[ -f .SRCINFO ]]; then
|
||||
stat_busy 'Generating .SRCINFO'
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
git add .SRCINFO
|
||||
stat_done
|
||||
fi
|
||||
|
||||
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
|
||||
stat_busy 'Staging files'
|
||||
for f in $(git ls-files --modified); do
|
||||
git add "$f"
|
||||
|
@@ -215,7 +215,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"
|
||||
@@ -236,7 +237,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
|
||||
@@ -244,7 +245,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
|
||||
|
@@ -4,7 +4,7 @@
|
||||
:
|
||||
|
||||
# shellcheck disable=2034
|
||||
CHROOT_VERSION='v4'
|
||||
CHROOT_VERSION='v5'
|
||||
|
||||
##
|
||||
# usage : check_root $keepenv
|
||||
|
@@ -25,12 +25,12 @@ export GITLAB_HOST=gitlab.archlinux.org
|
||||
export GIT_REPO_SPEC_VERSION=1
|
||||
export GIT_PACKAGING_NAMESPACE=archlinux/packaging/packages
|
||||
export GIT_PACKAGING_NAMESPACE_ID=11323
|
||||
export GIT_PACKAGING_URL_SSH="ssh://git@${GITLAB_HOST}/${GIT_PACKAGING_NAMESPACE}"
|
||||
export GIT_PACKAGING_URL_SSH="git@${GITLAB_HOST}:${GIT_PACKAGING_NAMESPACE}"
|
||||
export GIT_PACKAGING_URL_HTTPS="https://${GITLAB_HOST}/${GIT_PACKAGING_NAMESPACE}"
|
||||
export PACKAGING_REPO_RELEASE_HOST=repos.archlinux.org
|
||||
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && "$TERM" != dumb ]]; then
|
||||
if [[ -t 2 && "$TERM" != dumb ]] || [[ ${DEVTOOLS_COLOR} == always ]]; then
|
||||
colorize
|
||||
else
|
||||
# shellcheck disable=2034
|
||||
|
@@ -26,14 +26,16 @@ pkgctl_repo_clone_usage() {
|
||||
Clone Git packaging repositories from the canonical namespace.
|
||||
|
||||
The configure command is subsequently invoked to synchronize the distro
|
||||
specs and makepkg.conf settings. The unprivileged option can be used
|
||||
specs and makepkg.conf settings. The protocol option can be used
|
||||
for cloning packaging repositories without SSH access using read-only
|
||||
HTTPS.
|
||||
|
||||
OPTIONS
|
||||
-m, --maintainer=NAME Clone all packages of the named maintainer
|
||||
--protocol https Clone the repository over https
|
||||
--switch VERSION Switch the current working tree to a specified version
|
||||
--universe Clone all existing packages, useful for cache warming
|
||||
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
|
||||
-h, --help Show this help text
|
||||
|
||||
EXAMPLES
|
||||
@@ -55,9 +57,11 @@ pkgctl_repo_clone() {
|
||||
local MAINTAINER=
|
||||
local VERSION=
|
||||
local CONFIGURE_OPTIONS=()
|
||||
local pkgbases
|
||||
local jobs=
|
||||
jobs=$(nproc)
|
||||
|
||||
# variables
|
||||
local command=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
local project_path
|
||||
|
||||
while (( $# )); do
|
||||
@@ -66,11 +70,21 @@ pkgctl_repo_clone() {
|
||||
pkgctl_repo_clone_usage
|
||||
exit 0
|
||||
;;
|
||||
-u|--unprivileged)
|
||||
--protocol=https)
|
||||
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
||||
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"
|
||||
@@ -97,6 +111,11 @@ pkgctl_repo_clone() {
|
||||
CLONE_ALL=1
|
||||
shift
|
||||
;;
|
||||
-j|--jobs)
|
||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||
jobs=$2
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@@ -142,12 +161,31 @@ pkgctl_repo_clone() {
|
||||
stat_done
|
||||
fi
|
||||
|
||||
# parallelization
|
||||
if [[ ${jobs} != 1 ]] && (( ${#pkgbases[@]} > 1 )); then
|
||||
# force colors in parallel if parent process is colorized
|
||||
if [[ -n ${BOLD} ]]; then
|
||||
export DEVTOOLS_COLOR=always
|
||||
fi
|
||||
# assign command options
|
||||
if [[ -n "${VERSION}" ]]; then
|
||||
command+=" --switch '${VERSION}'"
|
||||
fi
|
||||
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${pkgbases[@]}"; then
|
||||
die 'Failed to clone some packages, please check the output'
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for pkgbase in "${pkgbases[@]}"; do
|
||||
if [[ ! -d ${pkgbase} ]]; then
|
||||
msg "Cloning ${pkgbase} ..."
|
||||
project_path=$(gitlab_project_name_to_path "${pkgbase}")
|
||||
remote_url="${GIT_REPO_BASE_URL}/${project_path}.git"
|
||||
git clone --origin origin "${remote_url}" "${pkgbase}"
|
||||
if ! git clone --origin origin "${remote_url}" "${pkgbase}"; then
|
||||
die 'failed to clone %s' "${pkgbase}"
|
||||
fi
|
||||
else
|
||||
warning "Skip cloning ${pkgbase}: Directory exists"
|
||||
fi
|
||||
|
@@ -33,6 +33,8 @@ pkgctl_repo_configure_usage() {
|
||||
read-only HTTPS otherwise.
|
||||
|
||||
OPTIONS
|
||||
--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
|
||||
@@ -93,9 +95,13 @@ pkgctl_repo_configure() {
|
||||
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
||||
local official=0
|
||||
local proto=https
|
||||
local proto_force=0
|
||||
local jobs=
|
||||
jobs=$(nproc)
|
||||
local paths=()
|
||||
|
||||
# variables
|
||||
local -r command=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||
local path realpath pkgbase remote_url project_path
|
||||
local PACKAGER GPGKEY packager_name packager_email
|
||||
|
||||
@@ -105,6 +111,24 @@ pkgctl_repo_configure() {
|
||||
pkgctl_repo_configure_usage
|
||||
exit 0
|
||||
;;
|
||||
--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
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
@@ -143,8 +167,10 @@ pkgctl_repo_configure() {
|
||||
fi
|
||||
if is_packager_email_official "${packager_email}"; then
|
||||
official=1
|
||||
proto=ssh
|
||||
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||
if (( ! proto_force )); then
|
||||
proto=ssh
|
||||
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -157,10 +183,21 @@ pkgctl_repo_configure() {
|
||||
msg2 "protocol: ${YELLOW}${proto}${ALL_OFF}"
|
||||
fi
|
||||
|
||||
# parallelization
|
||||
if [[ ${jobs} != 1 ]] && (( ${#paths[@]} > 1 )); then
|
||||
if [[ -n ${BOLD} ]]; then
|
||||
export DEVTOOLS_COLOR=always
|
||||
fi
|
||||
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${paths[@]}"; then
|
||||
die 'Failed to configure some packages, please check the output'
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for path in "${paths[@]}"; do
|
||||
if ! realpath=$(realpath -e "${path}"); then
|
||||
error "No such directory: ${path}"
|
||||
continue
|
||||
die "No such directory: ${path}"
|
||||
fi
|
||||
|
||||
pkgbase=$(basename "${realpath}")
|
||||
@@ -168,8 +205,7 @@ pkgctl_repo_configure() {
|
||||
msg "Configuring ${pkgbase}"
|
||||
|
||||
if [[ ! -d "${path}/.git" ]]; then
|
||||
error "Not a Git repository: ${path}"
|
||||
continue
|
||||
die "Not a Git repository: ${path}"
|
||||
fi
|
||||
|
||||
pushd "${path}" >/dev/null
|
||||
|
@@ -14,7 +14,8 @@ _repos=(
|
||||
|
||||
# shellcheck disable=2034
|
||||
_build_repos=(
|
||||
extra staging testing
|
||||
core-staging core-testing
|
||||
extra extra-staging extra-testing
|
||||
multilib multilib-staging multilib-testing
|
||||
gnome-unstable
|
||||
kde-unstable
|
||||
|
Reference in New Issue
Block a user