mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-14 02:16:18 +02:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
02bc8bfbc0 | ||
![]() |
f632659563 | ||
![]() |
7e41adf00b | ||
![]() |
a316b50f88 | ||
![]() |
547961681a | ||
![]() |
8190a22480 | ||
![]() |
f31ea3a48e | ||
![]() |
9f7808c26e | ||
![]() |
5f4fd52e38 | ||
![]() |
1b25190176 | ||
![]() |
030e6af880 | ||
![]() |
662d6c5274 | ||
![]() |
3de03e8b1f | ||
![]() |
720b7c9b05 | ||
![]() |
0ea7e9e0e5 | ||
![]() |
be5f54c95c | ||
![]() |
5c6e13a672 | ||
![]() |
a07df0beea | ||
![]() |
c7d627165f | ||
![]() |
e47035e74d | ||
![]() |
9b11b16a7e | ||
![]() |
3283b2ca59 | ||
![]() |
71cb9e97bb | ||
![]() |
1b808b8e32 | ||
![]() |
e4c40a9802 | ||
![]() |
a08bc2acf4 | ||
![]() |
f11cb9018e | ||
![]() |
d759eadb50 | ||
![]() |
1c399778f9 |
19
Makefile
19
Makefile
@@ -1,6 +1,6 @@
|
|||||||
SHELL=/bin/bash
|
SHELL=/bin/bash
|
||||||
|
|
||||||
V=1.0.0
|
V=1.0.4
|
||||||
BUILDTOOLVER ?= $(V)
|
BUILDTOOLVER ?= $(V)
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
@@ -145,19 +145,20 @@ uninstall:
|
|||||||
$(DESTDIR)$(DATADIR)/pacman.conf.d \
|
$(DESTDIR)$(DATADIR)/pacman.conf.d \
|
||||||
$(DESTDIR)$(DATADIR)
|
$(DESTDIR)$(DATADIR)
|
||||||
|
|
||||||
TODAY=$(shell date +"%Y%m%d")
|
|
||||||
tag:
|
tag:
|
||||||
@sed -E "s|^V=[0-9]{8}|V=$(TODAY)|" -i Makefile
|
@echo "current version: v$(V)"
|
||||||
@git commit --gpg-sign --message "Version $(TODAY)" Makefile
|
@read -r -p "tag version: v" VERSION && \
|
||||||
@git tag --sign --message "Version $(TODAY)" $(TODAY)
|
sed -E "s|^V=.+|V=$$VERSION|" -i Makefile && \
|
||||||
|
git commit --gpg-sign --message "chore(release): version v$$VERSION" Makefile && \
|
||||||
|
git tag --sign --message "Version v$$VERSION" v$$VERSION
|
||||||
|
|
||||||
|
release: dist
|
||||||
|
glab release create v$(V) devtools-$(V).tar.gz*
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip > devtools-$(V).tar.gz
|
git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz
|
||||||
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
||||||
|
|
||||||
upload:
|
|
||||||
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/
|
|
||||||
|
|
||||||
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
|
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
|
||||||
shellcheck $^
|
shellcheck $^
|
||||||
|
|
||||||
|
29
README.md
29
README.md
@@ -23,6 +23,34 @@ will automatically build the project and proxy all calls to the local build dire
|
|||||||
./test/bin/pkgctl --help
|
./test/bin/pkgctl --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Commit messages
|
||||||
|
|
||||||
|
All commits must follow [conventional commits](https://www.conventionalcommits.org).
|
||||||
|
|
||||||
|
The following groups are allowed:
|
||||||
|
|
||||||
|
- chore
|
||||||
|
- feat
|
||||||
|
- fix
|
||||||
|
- doc
|
||||||
|
- perf
|
||||||
|
- test
|
||||||
|
|
||||||
|
To override the scope for the changelog entry use the `Component:` trailer.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
feat(db): yay mega cool feature
|
||||||
|
|
||||||
|
Very long and useful description.
|
||||||
|
|
||||||
|
Fixes #1
|
||||||
|
Fixes #2
|
||||||
|
|
||||||
|
Component: pkgctl db remove
|
||||||
|
```
|
||||||
|
|
||||||
## Releasing
|
## Releasing
|
||||||
|
|
||||||
1. bump the version in the Makefile
|
1. bump the version in the Makefile
|
||||||
@@ -42,6 +70,7 @@ will automatically build the project and proxy all calls to the local build dire
|
|||||||
- binutils
|
- binutils
|
||||||
- coreutils
|
- coreutils
|
||||||
- diffutils
|
- diffutils
|
||||||
|
- fakeroot
|
||||||
- findutils
|
- findutils
|
||||||
- grep
|
- grep
|
||||||
- jq
|
- jq
|
||||||
|
44
cliff.toml
Normal file
44
cliff.toml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
[changelog]
|
||||||
|
header = "# Changelog\n\n"
|
||||||
|
body = """
|
||||||
|
{%- if version -%}
|
||||||
|
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||||
|
{%- else -%}
|
||||||
|
## [unreleased]
|
||||||
|
{%- endif %}
|
||||||
|
{% for group, commits in commits | group_by(attribute="group") %}
|
||||||
|
### {{ group | upper_first }}
|
||||||
|
{% for commit in commits | sort(attribute="message") %}
|
||||||
|
- {% set component = commit.footers | filter(attribute="token", value="Component") | map(attribute="value") | join %}
|
||||||
|
{%- if component %}{{ component }}: {% elif commit.scope %}{{ commit.scope }}: {% endif %}
|
||||||
|
{{- commit.message | upper_first }}
|
||||||
|
{%- set fixes = commit.footers | filter(attribute="token", value="Fixes") %}
|
||||||
|
{%- for fix in fixes %}{{ fix.separator }}{{ fix.value }}{% endfor %}
|
||||||
|
{%- endfor %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
"""
|
||||||
|
footer = ""
|
||||||
|
|
||||||
|
# remove the leading and trailing whitespaces from the template
|
||||||
|
trim = true
|
||||||
|
|
||||||
|
[git]
|
||||||
|
# allow only conventional commits
|
||||||
|
# https://www.conventionalcommits.org
|
||||||
|
conventional_commits = true
|
||||||
|
# regex for parsing and grouping commits
|
||||||
|
commit_parsers = [
|
||||||
|
{ message = "^chore\\(release\\): version", skip = true},
|
||||||
|
{ message = "^feat", group = "Features"},
|
||||||
|
{ message = "^fix", group = "Bug Fixes"},
|
||||||
|
{ message = "^doc", group = "Documentation"},
|
||||||
|
{ message = "^perf", group = "Performance"},
|
||||||
|
{ message = "^test", group = "Testing"},
|
||||||
|
{ message = "^chore", group = "Miscellaneous Tasks"},
|
||||||
|
{ body = ".*security", group = "Security"},
|
||||||
|
]
|
||||||
|
# filter out the commits that are not matched by commit parsers
|
||||||
|
filter_commits = false
|
||||||
|
# glob pattern for matching git tags
|
||||||
|
tag_pattern = "*v[0-9]*"
|
@@ -25,7 +25,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
|||||||
|
|
||||||
#-- The package required by makepkg to download VCS sources
|
#-- The package required by makepkg to download VCS sources
|
||||||
# Format: 'protocol::package'
|
# Format: 'protocol::package'
|
||||||
VCSCLIENTS=('bzr::bzr'
|
VCSCLIENTS=('bzr::breezy'
|
||||||
'fossil::fossil'
|
'fossil::fossil'
|
||||||
'git::git'
|
'git::git'
|
||||||
'hg::mercurial'
|
'hg::mercurial'
|
||||||
|
@@ -25,7 +25,7 @@ DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
|
|||||||
|
|
||||||
#-- The package required by makepkg to download VCS sources
|
#-- The package required by makepkg to download VCS sources
|
||||||
# Format: 'protocol::package'
|
# Format: 'protocol::package'
|
||||||
VCSCLIENTS=('bzr::bzr'
|
VCSCLIENTS=('bzr::breezy'
|
||||||
'fossil::fossil'
|
'fossil::fossil'
|
||||||
'git::git'
|
'git::git'
|
||||||
'hg::mercurial'
|
'hg::mercurial'
|
||||||
|
@@ -265,6 +265,7 @@ _pkgctl_repo_cmds=(
|
|||||||
|
|
||||||
_pkgctl_repo_clone_args=(
|
_pkgctl_repo_clone_args=(
|
||||||
-m --maintainer
|
-m --maintainer
|
||||||
|
--protocol
|
||||||
--switch
|
--switch
|
||||||
-u --unprivileged
|
-u --unprivileged
|
||||||
--universe
|
--universe
|
||||||
@@ -273,6 +274,7 @@ _pkgctl_repo_clone_args=(
|
|||||||
)
|
)
|
||||||
_pkgctl_repo_clone_args__maintainer_opts() { :; }
|
_pkgctl_repo_clone_args__maintainer_opts() { :; }
|
||||||
_pkgctl_repo_clone_args_m_opts() { _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__switch_opts() { :; }
|
||||||
_pkgctl_repo_clone_args__jobs_opts() { :; }
|
_pkgctl_repo_clone_args__jobs_opts() { :; }
|
||||||
_pkgctl_repo_clone_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
_pkgctl_repo_clone_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
||||||
@@ -280,9 +282,11 @@ _pkgctl_repo_clone_opts() { _devtools_completions_all_packages; }
|
|||||||
|
|
||||||
|
|
||||||
_pkgctl_repo_configure_args=(
|
_pkgctl_repo_configure_args=(
|
||||||
|
--protocol
|
||||||
-j --jobs
|
-j --jobs
|
||||||
-h --help
|
-h --help
|
||||||
)
|
)
|
||||||
|
_pkgctl_repo_configure_args__protocol_opts() { _devtools_completions_protocol; }
|
||||||
_pkgctl_repo_configure_args__jobs_opts() { :; }
|
_pkgctl_repo_configure_args__jobs_opts() { :; }
|
||||||
_pkgctl_repo_configure_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
_pkgctl_repo_configure_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
|
||||||
_pkgctl_repo_configure_opts() { _filedir -d; }
|
_pkgctl_repo_configure_opts() { _filedir -d; }
|
||||||
@@ -363,6 +367,9 @@ _devtools_completions_build_repo() {
|
|||||||
_devtools_completions_all_packages() {
|
_devtools_completions_all_packages() {
|
||||||
mapfile -t COMPREPLY < <(compgen -W "$(pacman -Sql)" -- "$cur")
|
mapfile -t COMPREPLY < <(compgen -W "$(pacman -Sql)" -- "$cur")
|
||||||
}
|
}
|
||||||
|
_devtools_completions_protocol() {
|
||||||
|
mapfile -t COMPREPLY < <(compgen -W "https" -- "$cur")
|
||||||
|
}
|
||||||
|
|
||||||
__devtools_complete() {
|
__devtools_complete() {
|
||||||
local service=$1
|
local service=$1
|
||||||
|
@@ -108,6 +108,7 @@ _pkgctl_repo_switch_args=(
|
|||||||
|
|
||||||
_pkgctl_repo_clone_args=(
|
_pkgctl_repo_clone_args=(
|
||||||
'(-m --maintainer=)'{-m,--maintainer=}'[Clone all packages of the named maintainer]:maintainer:'
|
'(-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]'
|
'--switch=[Switch the current working tree to a specified version]'
|
||||||
'--universe[Clone all existing packages, useful for cache warming]'
|
'--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:'
|
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
|
||||||
@@ -116,6 +117,7 @@ _pkgctl_repo_clone_args=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
_pkgctl_repo_configure_args=(
|
_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:'
|
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
|
||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
'*:git_dir:_files -/'
|
'*:git_dir:_files -/'
|
||||||
@@ -239,7 +241,7 @@ _pkgctl_cmds=(
|
|||||||
"pkgctl command"
|
"pkgctl command"
|
||||||
"auth[Authenticate with services like GitLab]"
|
"auth[Authenticate with services like GitLab]"
|
||||||
"build[Build packages inside a clean chroot]"
|
"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]"
|
"diff[Compare package files using different modes]"
|
||||||
"release[Release step to commit, tag and upload build artifacts]"
|
"release[Release step to commit, tag and upload build artifacts]"
|
||||||
"repo[Manage Git packaging repositories and their configuration]"
|
"repo[Manage Git packaging repositories and their configuration]"
|
||||||
|
@@ -25,6 +25,9 @@ Options
|
|||||||
*-m, --maintainer* 'NAME'::
|
*-m, --maintainer* 'NAME'::
|
||||||
Clone all packages of the named maintainer
|
Clone all packages of the named maintainer
|
||||||
|
|
||||||
|
*--protocol* 'https'::
|
||||||
|
Clone the repository over https
|
||||||
|
|
||||||
*--universe*::
|
*--universe*::
|
||||||
Clone all existing packages, useful for cache warming
|
Clone all existing packages, useful for cache warming
|
||||||
|
|
||||||
|
@@ -25,6 +25,9 @@ read-only HTTPS otherwise.
|
|||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
*--protocol* 'https'::
|
||||||
|
Configure remote url to use https
|
||||||
|
|
||||||
*-j, --jobs* 'N'::
|
*-j, --jobs* 'N'::
|
||||||
Run up to N jobs in parallel. By default the number of jobs is equal to the
|
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
|
number of available processing units. For sequential processing this option
|
||||||
|
@@ -33,7 +33,7 @@ pkgctl build::
|
|||||||
Build packages inside a clean chroot
|
Build packages inside a clean chroot
|
||||||
|
|
||||||
pkgctl db::
|
pkgctl db::
|
||||||
Pacman database modification for packge update, move etc
|
Pacman database modification for package update, move etc
|
||||||
|
|
||||||
pkgctl diff::
|
pkgctl diff::
|
||||||
Compare package files using different modes
|
Compare package files using different modes
|
||||||
|
@@ -16,7 +16,6 @@ umask 0022
|
|||||||
working_dir=''
|
working_dir=''
|
||||||
|
|
||||||
files=()
|
files=()
|
||||||
mount_args=()
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
|
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
|
||||||
@@ -32,6 +31,9 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# save all args for check_root
|
||||||
|
orig_args=("$@")
|
||||||
|
|
||||||
while getopts 'hC:M:c:f:s' arg; do
|
while getopts 'hC:M:c:f:s' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
C) pac_conf="$OPTARG" ;;
|
C) pac_conf="$OPTARG" ;;
|
||||||
@@ -46,13 +48,23 @@ done
|
|||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||||
|
|
||||||
working_dir=$(readlink -f "$1")
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
[[ -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
|
if (( ${#cache_dirs[@]} == 0 )); then
|
||||||
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
mapfile -t cache_dirs < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" CacheDir)
|
||||||
fi
|
fi
|
||||||
@@ -80,10 +92,10 @@ while read -r line; do
|
|||||||
done
|
done
|
||||||
done < <(pacman-conf --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
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
|
for cache_dir in "${cache_dirs[@]:1}"; do
|
||||||
mount_args+=("--bind-ro=${cache_dir//:/\\:}")
|
nspawn_args+=(--bind-ro="${cache_dir//:/\\:}")
|
||||||
done
|
done
|
||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
@@ -126,9 +138,4 @@ else
|
|||||||
set_arch="${CARCH}"
|
set_arch="${CARCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$set_arch"} systemd-nspawn -q \
|
exec ${CARCH:+setarch "$set_arch"} systemd-nspawn "${nspawn_args[@]}" "$@"
|
||||||
-D "$working_dir" \
|
|
||||||
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
|
||||||
--register=no --keep-unit --as-pid2 \
|
|
||||||
"${mount_args[@]}" \
|
|
||||||
"$@"
|
|
||||||
|
@@ -7,6 +7,7 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
|||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
|
|
||||||
source /usr/share/makepkg/util/util.sh
|
source /usr/share/makepkg/util/util.sh
|
||||||
|
source /usr/share/makepkg/srcinfo.sh
|
||||||
|
|
||||||
|
|
||||||
check_pkgbuild_validity() {
|
check_pkgbuild_validity() {
|
||||||
@@ -111,7 +112,7 @@ if (( ${#validpgpkeys[@]} != 0 )); then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# find files which should be under source control
|
# find files which should be under source control
|
||||||
needsversioning=()
|
needsversioning=(PKGBUILD)
|
||||||
for s in "${source[@]}"; do
|
for s in "${source[@]}"; do
|
||||||
[[ $s != *://* ]] && needsversioning+=("$s")
|
[[ $s != *://* ]] && needsversioning+=("$s")
|
||||||
done
|
done
|
||||||
@@ -129,6 +130,10 @@ done
|
|||||||
# assert that they really are controlled by git
|
# assert that they really are controlled by git
|
||||||
if (( ${#needsversioning[*]} )); then
|
if (( ${#needsversioning[*]} )); then
|
||||||
for file in "${needsversioning[@]}"; do
|
for file in "${needsversioning[@]}"; do
|
||||||
|
# skip none existing files
|
||||||
|
if [[ ! -f "${file}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
if ! git ls-files --error-unmatch "$file"; then
|
if ! git ls-files --error-unmatch "$file"; then
|
||||||
die "%s is not under version control" "$file"
|
die "%s is not under version control" "$file"
|
||||||
fi
|
fi
|
||||||
@@ -173,7 +178,13 @@ done
|
|||||||
# check for PKGBUILD standards
|
# check for PKGBUILD standards
|
||||||
check_pkgbuild_validity
|
check_pkgbuild_validity
|
||||||
|
|
||||||
if [[ -n $(git status --short --untracked-files=no) ]]; then
|
# auto generate .SRCINFO
|
||||||
|
stat_busy 'Generating .SRCINFO'
|
||||||
|
write_srcinfo_content > .SRCINFO
|
||||||
|
git add --force .SRCINFO
|
||||||
|
stat_done
|
||||||
|
|
||||||
|
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
|
||||||
stat_busy 'Staging files'
|
stat_busy 'Staging files'
|
||||||
for f in $(git ls-files --modified); do
|
for f in $(git ls-files --modified); do
|
||||||
git add "$f"
|
git add "$f"
|
||||||
|
@@ -215,7 +215,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"
|
||||||
@@ -236,7 +237,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
|
||||||
@@ -244,7 +245,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
|
||||||
|
@@ -129,7 +129,7 @@ pkgctl_build() {
|
|||||||
local WORKER_SLOT=
|
local WORKER_SLOT=
|
||||||
|
|
||||||
# variables
|
# variables
|
||||||
local path pkgbase pkgrepo source
|
local loop_arch path pkgbase pkgrepo source
|
||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -200,7 +200,7 @@ pkgctl_build() {
|
|||||||
;;
|
;;
|
||||||
-I|--install)
|
-I|--install)
|
||||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
MAKECHROOT_OPTIONS+=("-I" "$2")
|
MAKECHROOT_OPTIONS+=("-I" "$(realpath "$2")")
|
||||||
warning 'installing packages into the chroot may break reproducible builds, use with caution!'
|
warning 'installing packages into the chroot may break reproducible builds, use with caution!'
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
@@ -298,7 +298,7 @@ pkgctl_build() {
|
|||||||
die 'failed to get pacman repo'
|
die 'failed to get pacman repo'
|
||||||
fi
|
fi
|
||||||
if [[ -z "${pkgrepo}" ]]; then
|
if [[ -z "${pkgrepo}" ]]; then
|
||||||
die 'unknown repo, please specify --repo for new packages'
|
die 'unknown repo, specify --repo for packages not currently in any official repo'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -318,7 +318,13 @@ pkgctl_build() {
|
|||||||
if in_array any "${arch[@]}"; then
|
if in_array any "${arch[@]}"; then
|
||||||
BUILD_ARCH=("${_arch[0]}")
|
BUILD_ARCH=("${_arch[0]}")
|
||||||
else
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -329,7 +335,7 @@ pkgctl_build() {
|
|||||||
|
|
||||||
# increment pkgrel on rebuild
|
# increment pkgrel on rebuild
|
||||||
if (( REBUILD )); then
|
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
|
if ! old_pkgrel=$(git_diff_tree HEAD PKGBUILD | grep --perl-regexp --only-matching --max-count=1 '^-pkgrel=\K\w+'); then
|
||||||
old_pkgrel=${pkgrel}
|
old_pkgrel=${pkgrel}
|
||||||
fi
|
fi
|
||||||
|
@@ -15,7 +15,7 @@ pkgctl_db_usage() {
|
|||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
Usage: ${COMMAND} [COMMAND] [OPTIONS]
|
Usage: ${COMMAND} [COMMAND] [OPTIONS]
|
||||||
|
|
||||||
Pacman database modification for packge update, move etc
|
Pacman database modification for package update, move etc
|
||||||
|
|
||||||
COMMANDS
|
COMMANDS
|
||||||
move Move packages between pacman repositories
|
move Move packages between pacman repositories
|
||||||
|
@@ -12,6 +12,8 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
|||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
|
||||||
# shellcheck source=src/lib/repo/configure.sh
|
# shellcheck source=src/lib/repo/configure.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/configure.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/configure.sh
|
||||||
|
# shellcheck source=src/lib/util/git.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||||
|
|
||||||
source /usr/share/makepkg/util/message.sh
|
source /usr/share/makepkg/util/message.sh
|
||||||
|
|
||||||
@@ -26,12 +28,13 @@ pkgctl_repo_clone_usage() {
|
|||||||
Clone Git packaging repositories from the canonical namespace.
|
Clone Git packaging repositories from the canonical namespace.
|
||||||
|
|
||||||
The configure command is subsequently invoked to synchronize the distro
|
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
|
for cloning packaging repositories without SSH access using read-only
|
||||||
HTTPS.
|
HTTPS.
|
||||||
|
|
||||||
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
|
||||||
--switch VERSION Switch the current working tree to a specified version
|
--switch VERSION Switch the current working tree to a specified version
|
||||||
--universe Clone all existing packages, useful for cache warming
|
--universe Clone all existing packages, useful for cache warming
|
||||||
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
|
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
|
||||||
@@ -51,6 +54,7 @@ pkgctl_repo_clone() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# options
|
# options
|
||||||
|
local protocol=ssh
|
||||||
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||||
local CLONE_ALL=0
|
local CLONE_ALL=0
|
||||||
local MAINTAINER=
|
local MAINTAINER=
|
||||||
@@ -69,11 +73,23 @@ pkgctl_repo_clone() {
|
|||||||
pkgctl_repo_clone_usage
|
pkgctl_repo_clone_usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-u|--unprivileged)
|
--protocol=https)
|
||||||
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
||||||
|
protocol=https
|
||||||
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
|
||||||
|
protocol="$2"
|
||||||
|
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"
|
||||||
@@ -160,6 +176,12 @@ pkgctl_repo_clone() {
|
|||||||
if [[ -n "${VERSION}" ]]; then
|
if [[ -n "${VERSION}" ]]; then
|
||||||
command+=" --switch '${VERSION}'"
|
command+=" --switch '${VERSION}'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# warm up ssh connection as it may require user input (key unlock, hostkey verification etc)
|
||||||
|
if [[ ${protocol} == ssh ]]; then
|
||||||
|
git_warmup_ssh_connection
|
||||||
|
fi
|
||||||
|
|
||||||
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${pkgbases[@]}"; then
|
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${pkgbases[@]}"; then
|
||||||
die 'Failed to clone some packages, please check the output'
|
die 'Failed to clone some packages, please check the output'
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -10,6 +10,8 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
|||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
# shellcheck source=src/lib/api/gitlab.sh
|
# shellcheck source=src/lib/api/gitlab.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
|
||||||
|
# shellcheck source=src/lib/util/git.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||||
|
|
||||||
source /usr/share/makepkg/util/config.sh
|
source /usr/share/makepkg/util/config.sh
|
||||||
source /usr/share/makepkg/util/message.sh
|
source /usr/share/makepkg/util/message.sh
|
||||||
@@ -33,11 +35,12 @@ pkgctl_repo_configure_usage() {
|
|||||||
read-only HTTPS otherwise.
|
read-only HTTPS otherwise.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--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
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
$ ${COMMAND} configure *
|
$ ${COMMAND} *
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ pkgctl_repo_configure() {
|
|||||||
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
||||||
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=()
|
||||||
@@ -109,6 +113,19 @@ pkgctl_repo_configure() {
|
|||||||
pkgctl_repo_configure_usage
|
pkgctl_repo_configure_usage
|
||||||
exit 0
|
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)
|
-j|--jobs)
|
||||||
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
jobs=$2
|
jobs=$2
|
||||||
@@ -152,8 +169,10 @@ pkgctl_repo_configure() {
|
|||||||
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_PACKAGING_URL_SSH}
|
proto=ssh
|
||||||
|
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -171,6 +190,12 @@ pkgctl_repo_configure() {
|
|||||||
if [[ -n ${BOLD} ]]; then
|
if [[ -n ${BOLD} ]]; then
|
||||||
export DEVTOOLS_COLOR=always
|
export DEVTOOLS_COLOR=always
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# warm up ssh connection as it may require user input (key unlock, hostkey verification etc)
|
||||||
|
if [[ ${proto} == ssh ]]; then
|
||||||
|
git_warmup_ssh_connection
|
||||||
|
fi
|
||||||
|
|
||||||
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${paths[@]}"; then
|
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${paths[@]}"; then
|
||||||
die 'Failed to configure some packages, please check the output'
|
die 'Failed to configure some packages, please check the output'
|
||||||
exit 1
|
exit 1
|
||||||
|
@@ -26,7 +26,7 @@ pkgctl_repo_web_usage() {
|
|||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
$ ${COMMAND} web linux
|
$ ${COMMAND} linux
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,6 +7,9 @@ DEVTOOLS_INCLUDE_UTIL_GIT_SH=1
|
|||||||
|
|
||||||
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||||
|
|
||||||
|
# shellcheck source=src/lib/common.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
|
|
||||||
|
|
||||||
git_diff_tree() {
|
git_diff_tree() {
|
||||||
local commit=$1
|
local commit=$1
|
||||||
@@ -22,3 +25,10 @@ git_diff_tree() {
|
|||||||
"${commit}" \
|
"${commit}" \
|
||||||
-- "${path}"
|
-- "${path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git_warmup_ssh_connection() {
|
||||||
|
msg 'Establishing ssh connection to git@%s' "${GITLAB_HOST}"
|
||||||
|
if ! ssh -T "git@${GITLAB_HOST}" >/dev/null; then
|
||||||
|
die 'Failed to establish ssh connection to git@%s' "${GITLAB_HOST}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
@@ -39,12 +39,15 @@ get_pacman_repo_from_pkgbuild() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
slock 10 "${_DEVTOOLS_PACMAN_CACHE_DIR}.lock" "Locking pacman database cache"
|
slock 10 "${_DEVTOOLS_PACMAN_CACHE_DIR}.lock" "Locking pacman database cache"
|
||||||
|
# query repo of passed pkgname, specify --nodeps twice to skip all dependency checks
|
||||||
mapfile -t repos < <(pacman --config "${_DEVTOOLS_PACMAN_CONF_DIR}/multilib.conf" \
|
mapfile -t repos < <(pacman --config "${_DEVTOOLS_PACMAN_CONF_DIR}/multilib.conf" \
|
||||||
--dbpath "${_DEVTOOLS_PACMAN_CACHE_DIR}" \
|
--dbpath "${_DEVTOOLS_PACMAN_CACHE_DIR}" \
|
||||||
-S \
|
--sync \
|
||||||
|
--nodeps \
|
||||||
|
--nodeps \
|
||||||
--print \
|
--print \
|
||||||
--print-format '%n %r' \
|
--print-format '%n %r' \
|
||||||
"${pkgnames[0]}" | grep -E "^${pkgnames[0]} " | awk '{print $2}'
|
"${pkgnames[0]}" | awk '$1=="'"${pkgnames[0]}"'"{print $2}'
|
||||||
)
|
)
|
||||||
lock_close 10
|
lock_close 10
|
||||||
|
|
||||||
|
@@ -14,7 +14,8 @@ _repos=(
|
|||||||
|
|
||||||
# shellcheck disable=2034
|
# shellcheck disable=2034
|
||||||
_build_repos=(
|
_build_repos=(
|
||||||
extra staging testing
|
core-staging core-testing
|
||||||
|
extra extra-staging extra-testing
|
||||||
multilib multilib-staging multilib-testing
|
multilib multilib-staging multilib-testing
|
||||||
gnome-unstable
|
gnome-unstable
|
||||||
kde-unstable
|
kde-unstable
|
||||||
|
@@ -125,6 +125,9 @@ OPTIONS
|
|||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# save all args for check_root
|
||||||
|
orig_args=("$@")
|
||||||
|
|
||||||
while getopts 'dM:c:l:h' arg; do
|
while getopts 'dM:c:l:h' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
d) diffoscope=1 ;;
|
d) diffoscope=1 ;;
|
||||||
@@ -137,7 +140,7 @@ while getopts 'dM:c:l:h' arg; do
|
|||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||||
|
|
||||||
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
|
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
|
||||||
|
|
||||||
|
@@ -32,6 +32,9 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# save all args for check_root
|
||||||
|
orig_args=("$@")
|
||||||
|
|
||||||
while getopts 'hUC:M:c:f:s' arg; do
|
while getopts 'hUC:M:c:f:s' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
U) umode=U ;;
|
U) umode=U ;;
|
||||||
@@ -52,7 +55,7 @@ shift $((OPTIND - 1))
|
|||||||
|
|
||||||
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
|
||||||
|
|
||||||
check_root "" "${BASH_SOURCE[0]}" "$@"
|
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
|
||||||
|
|
||||||
working_dir="$(readlink -f "$1")"
|
working_dir="$(readlink -f "$1")"
|
||||||
shift 1
|
shift 1
|
||||||
|
@@ -21,7 +21,7 @@ usage() {
|
|||||||
COMMANDS
|
COMMANDS
|
||||||
auth Authenticate with services like GitLab
|
auth Authenticate with services like GitLab
|
||||||
build Build packages inside a clean chroot
|
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
|
diff Compare package files using different modes
|
||||||
release Release step to commit, tag and upload build artifacts
|
release Release step to commit, tag and upload build artifacts
|
||||||
repo Manage Git packaging repositories and their configuration
|
repo Manage Git packaging repositories and their configuration
|
||||||
|
Reference in New Issue
Block a user