mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d7c7074457 | ||
![]() |
5f4fd52e38 | ||
![]() |
1b25190176 | ||
![]() |
030e6af880 | ||
![]() |
662d6c5274 | ||
![]() |
3de03e8b1f | ||
![]() |
720b7c9b05 | ||
![]() |
0ea7e9e0e5 | ||
![]() |
be5f54c95c | ||
![]() |
5c6e13a672 |
4
Makefile
4
Makefile
@@ -1,6 +1,6 @@
|
||||
SHELL=/bin/bash
|
||||
|
||||
V=1.0.2
|
||||
V=1.0.3
|
||||
BUILDTOOLVER ?= $(V)
|
||||
|
||||
PREFIX = /usr/local
|
||||
@@ -153,7 +153,7 @@ tag:
|
||||
git tag --sign --message "Version v$$VERSION" v$$VERSION
|
||||
|
||||
release: dist
|
||||
glab release create v$(RELEASE) devtools-$(RELEASE).tar.gz*
|
||||
glab release create v$(V) devtools-$(V).tar.gz*
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz
|
||||
|
@@ -42,6 +42,7 @@ will automatically build the project and proxy all calls to the local build dire
|
||||
- binutils
|
||||
- coreutils
|
||||
- diffutils
|
||||
- fakeroot
|
||||
- findutils
|
||||
- grep
|
||||
- jq
|
||||
|
@@ -241,7 +241,7 @@ _pkgctl_cmds=(
|
||||
"pkgctl command"
|
||||
"auth[Authenticate with services like GitLab]"
|
||||
"build[Build packages inside a clean chroot]"
|
||||
"db[Pacman database modification for packge update, move etc]"
|
||||
"db[Pacman database modification for package update, move etc]"
|
||||
"diff[Compare package files using different modes]"
|
||||
"release[Release step to commit, tag and upload build artifacts]"
|
||||
"repo[Manage Git packaging repositories and their configuration]"
|
||||
|
@@ -33,7 +33,7 @@ pkgctl build::
|
||||
Build packages inside a clean chroot
|
||||
|
||||
pkgctl db::
|
||||
Pacman database modification for packge update, move etc
|
||||
Pacman database modification for package update, move etc
|
||||
|
||||
pkgctl diff::
|
||||
Compare package files using different modes
|
||||
|
@@ -16,7 +16,6 @@ umask 0022
|
||||
working_dir=''
|
||||
|
||||
files=()
|
||||
mount_args=()
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
|
||||
@@ -56,6 +55,16 @@ shift 1
|
||||
|
||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||
|
||||
nspawn_args=(
|
||||
--quiet
|
||||
--directory="$working_dir"
|
||||
--setenv="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin"
|
||||
--register=no
|
||||
--slice="devtools-$(systemd-escape "${SUDO_USER:-$USER}")"
|
||||
--machine="arch-nspawn-$$"
|
||||
--as-pid2
|
||||
)
|
||||
|
||||
if (( ${#cache_dirs[@]} == 0 )); then
|
||||
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
||||
fi
|
||||
@@ -83,10 +92,10 @@ while read -r line; do
|
||||
done
|
||||
done < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
||||
|
||||
mount_args+=("--bind=${cache_dirs[0]//:/\\:}")
|
||||
nspawn_args+=(--bind="${cache_dirs[0]//:/\\:}")
|
||||
|
||||
for cache_dir in "${cache_dirs[@]:1}"; do
|
||||
mount_args+=("--bind-ro=${cache_dir//:/\\:}")
|
||||
nspawn_args+=(--bind-ro="${cache_dir//:/\\:}")
|
||||
done
|
||||
|
||||
# {{{ functions
|
||||
@@ -129,9 +138,4 @@ else
|
||||
set_arch="${CARCH}"
|
||||
fi
|
||||
|
||||
exec ${CARCH:+setarch "$set_arch"} systemd-nspawn -q \
|
||||
-D "$working_dir" \
|
||||
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
||||
--register=no --keep-unit --as-pid2 \
|
||||
"${mount_args[@]}" \
|
||||
"$@"
|
||||
exec ${CARCH:+setarch "$set_arch"} systemd-nspawn "${nspawn_args[@]}" "$@"
|
||||
|
@@ -7,6 +7,8 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||
# shellcheck source=src/lib/valid-tags.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh
|
||||
# shellcheck source=src/lib/util/git.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||
|
||||
set -e
|
||||
|
||||
@@ -55,8 +57,8 @@ gittag=$(get_tag_from_pkgver "$pkgver")
|
||||
if ! branchname=$(git symbolic-ref --short HEAD); then
|
||||
die 'not on any branch'
|
||||
fi
|
||||
if [[ "${branchname}" != main ]]; then
|
||||
die 'must be run from the main branch'
|
||||
if ! is_valid_release_branch "${branchname}"; then
|
||||
die 'must be run from a valid release branch (%s)' "${VALID_RELEASE_BRANCHES[@]}"
|
||||
fi
|
||||
|
||||
# Check if remote origin is setup properly
|
||||
@@ -85,10 +87,10 @@ if git tag --verify "$gittag" &> /dev/null; then
|
||||
if [[ "$cwd_checksum" != "$tag_checksum" ]]; then
|
||||
die "tagged PKGBUILD is not the same as the working dir PKGBUILD"
|
||||
fi
|
||||
git push --tags --set-upstream origin main || abort
|
||||
git push --tags --set-upstream origin "${branchname}" || abort
|
||||
exit 0
|
||||
fi
|
||||
|
||||
msg "Releasing package"
|
||||
git tag --sign --message="Package release ${pkgver}" "$gittag" || abort
|
||||
git push --tags --set-upstream origin main || abort
|
||||
git push --tags --set-upstream origin "${branchname}" || abort
|
||||
|
@@ -5,6 +5,8 @@
|
||||
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||
# shellcheck source=src/lib/common.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||
# shellcheck source=src/lib/util/git.sh
|
||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||
|
||||
source /usr/share/makepkg/util/util.sh
|
||||
|
||||
@@ -70,8 +72,12 @@ if ! repo_spec=$(git config --local devtools.version) || [[ ${repo_spec} != "${G
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$(git symbolic-ref --short HEAD)" != main ]]; then
|
||||
die 'must be run from the main branch'
|
||||
if ! branchname=$(git symbolic-ref --short HEAD); then
|
||||
die 'not on any branch'
|
||||
fi
|
||||
|
||||
if ! is_valid_release_branch "${branchname}"; then
|
||||
die 'must be run from a valid release branch (%s)' "${VALID_RELEASE_BRANCHES[@]}"
|
||||
fi
|
||||
|
||||
source=()
|
||||
@@ -95,6 +101,9 @@ case "$cmd" in
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ "${branchname}" == "unstable" ]] && [[ "$repo" != *"unstable" ]]; then
|
||||
die 'Cannot release from unstable branch into non-unstable repo: %s' "${repo}"
|
||||
fi
|
||||
|
||||
if (( ${#validpgpkeys[@]} != 0 )); then
|
||||
if [[ -d keys ]]; then
|
||||
@@ -111,7 +120,7 @@ if (( ${#validpgpkeys[@]} != 0 )); then
|
||||
fi
|
||||
|
||||
# find files which should be under source control
|
||||
needsversioning=()
|
||||
needsversioning=(PKGBUILD)
|
||||
for s in "${source[@]}"; do
|
||||
[[ $s != *://* ]] && needsversioning+=("$s")
|
||||
done
|
||||
|
@@ -129,7 +129,7 @@ pkgctl_build() {
|
||||
local WORKER_SLOT=
|
||||
|
||||
# variables
|
||||
local path pkgbase pkgrepo source
|
||||
local loop_arch path pkgbase pkgrepo source
|
||||
|
||||
while (( $# )); do
|
||||
case $1 in
|
||||
@@ -318,7 +318,13 @@ pkgctl_build() {
|
||||
if in_array any "${arch[@]}"; then
|
||||
BUILD_ARCH=("${_arch[0]}")
|
||||
else
|
||||
BUILD_ARCH+=("${arch[@]}")
|
||||
for loop_arch in "${arch[@]}"; do
|
||||
if in_array "${loop_arch}" "${_arch[@]}"; then
|
||||
BUILD_ARCH+=("$loop_arch")
|
||||
else
|
||||
warning 'invalid architecture, not building for: %s' "${loop_arch}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -329,7 +335,7 @@ pkgctl_build() {
|
||||
|
||||
# increment pkgrel on rebuild
|
||||
if (( REBUILD )); then
|
||||
# try to figure out of pkgrel has been changed
|
||||
# try to figure out if pkgrel has been changed
|
||||
if ! old_pkgrel=$(git_diff_tree HEAD PKGBUILD | grep --perl-regexp --only-matching --max-count=1 '^-pkgrel=\K\w+'); then
|
||||
old_pkgrel=${pkgrel}
|
||||
fi
|
||||
|
@@ -29,6 +29,8 @@ 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
|
||||
|
||||
export VALID_RELEASE_BRANCHES=(main unstable)
|
||||
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 && "$TERM" != dumb ]] || [[ ${DEVTOOLS_COLOR} == always ]]; then
|
||||
colorize
|
||||
|
@@ -15,7 +15,7 @@ pkgctl_db_usage() {
|
||||
cat <<- _EOF_
|
||||
Usage: ${COMMAND} [COMMAND] [OPTIONS]
|
||||
|
||||
Pacman database modification for packge update, move etc
|
||||
Pacman database modification for package update, move etc
|
||||
|
||||
COMMANDS
|
||||
move Move packages between pacman repositories
|
||||
|
@@ -22,3 +22,8 @@ git_diff_tree() {
|
||||
"${commit}" \
|
||||
-- "${path}"
|
||||
}
|
||||
|
||||
is_valid_release_branch() {
|
||||
local branch=$1
|
||||
in_array "${branch}" "${VALID_RELEASE_BRANCHES[@]}"
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ usage() {
|
||||
COMMANDS
|
||||
auth Authenticate with services like GitLab
|
||||
build Build packages inside a clean chroot
|
||||
db Pacman database modification for packge update, move etc
|
||||
db Pacman database modification for package update, move etc
|
||||
diff Compare package files using different modes
|
||||
release Release step to commit, tag and upload build artifacts
|
||||
repo Manage Git packaging repositories and their configuration
|
||||
|
Reference in New Issue
Block a user