mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-16 03:16:19 +02:00
Compare commits
13 Commits
anthraxx/g
...
anthraxx/d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c081ddf2ba | ||
![]() |
12c63702f6 | ||
![]() |
ac743ac437 | ||
![]() |
6dfd8bc70d | ||
![]() |
951fe3bc08 | ||
![]() |
39d46036fb | ||
![]() |
cb36536c7a | ||
![]() |
10450ac610 | ||
![]() |
33e6ee7999 | ||
![]() |
ef299af575 | ||
![]() |
104d173aa9 | ||
![]() |
c3c14f7a39 | ||
![]() |
6d3456c635 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1,3 @@
|
|||||||
*~
|
*~
|
||||||
devtools-*.tar.gz*
|
devtools-*.tar.gz*
|
||||||
build/
|
/build/
|
||||||
|
30
README.md
30
README.md
@@ -32,6 +32,36 @@ will automatically build the project and proxy all calls to the local build dire
|
|||||||
5. Upload the source tarball with ```make dist upload```
|
5. Upload the source tarball with ```make dist upload```
|
||||||
6. Update the package
|
6. Update the package
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
### Runtime
|
||||||
|
|
||||||
|
- arch-install-scripts
|
||||||
|
- awk
|
||||||
|
- bash
|
||||||
|
- binutils
|
||||||
|
- coreutils
|
||||||
|
- diffutils
|
||||||
|
- findutils
|
||||||
|
- grep
|
||||||
|
- jq
|
||||||
|
- openssh
|
||||||
|
- parallel
|
||||||
|
- rsync
|
||||||
|
- sed
|
||||||
|
- util-linux
|
||||||
|
|
||||||
|
- bzr
|
||||||
|
- git
|
||||||
|
- mercurial
|
||||||
|
- subversion
|
||||||
|
|
||||||
|
### Development
|
||||||
|
|
||||||
|
- asciidoc
|
||||||
|
- make
|
||||||
|
- shellcheck
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
Devtools is licensed under the terms of the **GPL-3.0-or-later** (see [LICENSE](LICENSE)).
|
Devtools is licensed under the terms of the **GPL-3.0-or-later** (see [LICENSE](LICENSE)).
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#compdef archbuild arch-nspawn archrelease commitpkg pkgctl diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild checkpkg sogrep offload-build makerepropkg
|
#compdef archbuild arch-nspawn archrelease commitpkg pkgctl diffpkg finddeps makechrootpkg mkarchroot extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild checkpkg sogrep offload-build makerepropkg
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
@@ -34,6 +34,26 @@ _pkgctl_auth_status_args=(
|
|||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_pkgctl_build_args=(
|
||||||
|
"--arch=[Specify architectures to build for (disables auto-detection)]:arch:($_arch[*])"
|
||||||
|
"--repo=[Specify a target repository (disables auto-detection)]:repo:($_repos[*])"
|
||||||
|
'(-s --staging)'{-s,--staging}'[Build against the staging counterpart of the auto-detected repo]'
|
||||||
|
'(-t --testing)'{-t,--testing}'[Build against the testing counterpart of the auto-detected repo]'
|
||||||
|
'(-o --offload)'{-o,--offload}'[Build on a remote server and transfer artifacts afterwards]'
|
||||||
|
'(-c --clean)'{-c,--clean}'[Recreate the chroot before building]'
|
||||||
|
'(-I --install)'{-I,--install}'[Install a package into the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"'
|
||||||
|
'--nocheck[Do not run the check() function in the PKGBUILD]'
|
||||||
|
'--pkgver=[Set pkgver, reset pkgrel and update checksums]:pkgver:'
|
||||||
|
'--pkgrel=[Set pkgrel to a given value]:pkgrel:'
|
||||||
|
'--rebuild[Increment the pkgrel variable]'
|
||||||
|
'(-e --edit)'{-e,--edit}'[Edit the PKGBUILD before building]'
|
||||||
|
'(-r --release)'{-r,--release}'[Automatically commit, tag and release after building]'
|
||||||
|
'(-m --message=)'{-m,--message=}"[Use the given <msg> as the commit message]:message:"
|
||||||
|
'(-u --db-update)'{-u,--db-update}'[Automatically update the pacman database as last action]'
|
||||||
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
|
'*:git_dir:_files -/'
|
||||||
|
)
|
||||||
|
|
||||||
_pkgctl_db_cmds=(
|
_pkgctl_db_cmds=(
|
||||||
"pkgctl db command"
|
"pkgctl db command"
|
||||||
"move[Move packages between pacman repositories]"
|
"move[Move packages between pacman repositories]"
|
||||||
@@ -79,14 +99,12 @@ _pkgctl_repo_cmds=(
|
|||||||
|
|
||||||
_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:'
|
||||||
'(-u --unprivileged)'{-u,--unprivileged}'[Read-only access without packager info as Git author]'
|
|
||||||
'--universe[Clone all existing packages, useful for cache warming]'
|
'--universe[Clone all existing packages, useful for cache warming]'
|
||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
'*:packages:_devtools_completions_all_packages'
|
'*:packages:_devtools_completions_all_packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
_pkgctl_repo_configure_args=(
|
_pkgctl_repo_configure_args=(
|
||||||
'(-u --unprivileged)'{-u,--unprivileged}'[Configure read-only repo without packager info as Git author]'
|
|
||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
'*:git_dir:_files -/'
|
'*:git_dir:_files -/'
|
||||||
)
|
)
|
||||||
@@ -169,11 +187,6 @@ _mkarchroot_args=(
|
|||||||
'*:packages:_devtools_completions_all_packages'
|
'*:packages:_devtools_completions_all_packages'
|
||||||
)
|
)
|
||||||
|
|
||||||
_rebuildpkgs_args=(
|
|
||||||
'1:chroot_dir:_files -/'
|
|
||||||
'*:packages:_devtools_completions_all_packages'
|
|
||||||
)
|
|
||||||
|
|
||||||
_checkpkg_args=(
|
_checkpkg_args=(
|
||||||
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
|
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
|
||||||
'(-w --warn)'{-w,--warn}'[Print a warning in case of differences]'
|
'(-w --warn)'{-w,--warn}'[Print a warning in case of differences]'
|
||||||
@@ -213,6 +226,7 @@ _devtools_completions_all_packages() {
|
|||||||
_pkgctl_cmds=(
|
_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]"
|
||||||
"db[Pacman database modification for packge update, move etc]"
|
"db[Pacman database modification for packge 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]"
|
||||||
|
@@ -1,27 +1,7 @@
|
|||||||
|
|
||||||
Bugs
|
Homepage
|
||||||
----
|
--------
|
||||||
Bugs can be reported on the project's GitLab bug tracker 'https://gitlab.archlinux.org/archlinux/devtools'
|
|
||||||
|
|
||||||
|
'https://gitlab.archlinux.org/archlinux/devtools'
|
||||||
|
|
||||||
Authors
|
Please report bugs and feature requests in the issue tracker. Please do your best to provide a reproducible test case for bugs.
|
||||||
-------
|
|
||||||
|
|
||||||
Maintainers:
|
|
||||||
|
|
||||||
* Aaron Griffin <aaronmgriffin@gmail.com>
|
|
||||||
* Allan McRae <allan@archlinux.org>
|
|
||||||
* Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
|
|
||||||
* Dan McGee <dan@archlinux.org>
|
|
||||||
* Dave Reisner <dreisner@archlinux.org>
|
|
||||||
* Evangelos Foutras <evangelos@foutrelis.com>
|
|
||||||
* Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
|
|
||||||
* Jelle van der Waa <jelle@archlinux.org>
|
|
||||||
* Levente Polyak <anthraxx@archlinux.org>
|
|
||||||
* Pierre Schmitz <pierre@archlinux.de>
|
|
||||||
* Sébastien Luttringer <seblu@seblu.net>
|
|
||||||
* Sven-Hendrik Haase <svenstaro@gmail.com>
|
|
||||||
* Thomas Bächler <thomas@archlinux.org>
|
|
||||||
|
|
||||||
For additional contributors, use `git shortlog -s` on the devtools.git
|
|
||||||
repository.
|
|
||||||
|
83
doc/man/pkgctl-build.1.asciidoc
Normal file
83
doc/man/pkgctl-build.1.asciidoc
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
pkgctl-build(1)
|
||||||
|
===============
|
||||||
|
|
||||||
|
Name
|
||||||
|
----
|
||||||
|
pkgctl-build - Build packages inside a clean chroot
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
pkgctl build [OPTIONS] [PATH...]
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
Build Options
|
||||||
|
-------------
|
||||||
|
|
||||||
|
*--arch* 'ARCH'::
|
||||||
|
Specify architectures to build for (disables auto-detection)
|
||||||
|
|
||||||
|
*--repo* 'REPO'::
|
||||||
|
Specify a target repository (disables auto-detection)
|
||||||
|
|
||||||
|
*-s, --staging*::
|
||||||
|
Build against the staging counterpart of the auto-detected repo
|
||||||
|
|
||||||
|
*-t, --testing*::
|
||||||
|
Build against the testing counterpart of the auto-detected repo
|
||||||
|
|
||||||
|
*-o, --offload*::
|
||||||
|
Build on a remote server and transfer artifacts afterwards
|
||||||
|
|
||||||
|
*-c, --clean*::
|
||||||
|
Recreate the chroot before building
|
||||||
|
|
||||||
|
*-I, --install* 'FILE'::
|
||||||
|
Install a package into the working copy of the chroot
|
||||||
|
|
||||||
|
*--nocheck*::
|
||||||
|
Do not run the check() function in the PKGBUILD
|
||||||
|
|
||||||
|
PKGBUILD Options
|
||||||
|
----------------
|
||||||
|
|
||||||
|
*--pkgver*='PKGVER'::
|
||||||
|
Set pkgver, reset pkgrel and update checksums
|
||||||
|
|
||||||
|
*--pkgrel*='PKGREL'::
|
||||||
|
Set pkgrel to a given value
|
||||||
|
|
||||||
|
*--rebuild*::
|
||||||
|
Increment the current pkgrel variable
|
||||||
|
|
||||||
|
*-e, --edit*::
|
||||||
|
Edit the PKGBUILD before building
|
||||||
|
|
||||||
|
Release Options
|
||||||
|
---------------
|
||||||
|
|
||||||
|
*-r, --release*::
|
||||||
|
Automatically commit, tag and release after building
|
||||||
|
|
||||||
|
*-m, --message* 'MSG'::
|
||||||
|
Use the given <msg> as the commit message
|
||||||
|
|
||||||
|
*-u, --db-update*::
|
||||||
|
Automatically update the pacman database as last action
|
||||||
|
|
||||||
|
Options
|
||||||
|
-------
|
||||||
|
|
||||||
|
*-h, --help*::
|
||||||
|
Show a help text
|
||||||
|
|
||||||
|
See Also
|
||||||
|
--------
|
||||||
|
|
||||||
|
linkman:pkgctl-release[1]
|
||||||
|
linkman:pkgctl-db-update[1]
|
||||||
|
|
||||||
|
include::include/footer.asciidoc[]
|
@@ -25,9 +25,6 @@ Options
|
|||||||
*-m, --maintainer* 'NAME'::
|
*-m, --maintainer* 'NAME'::
|
||||||
Clone all packages of the named maintainer
|
Clone all packages of the named maintainer
|
||||||
|
|
||||||
*-u, --unprivileged*::
|
|
||||||
Clone package with read-only access and without packager info as Git author
|
|
||||||
|
|
||||||
*--universe*::
|
*--universe*::
|
||||||
Clone all existing packages, useful for cache warming
|
Clone all existing packages, useful for cache warming
|
||||||
|
|
||||||
|
@@ -17,15 +17,14 @@ Configure Git packaging repositories according to distro specs and
|
|||||||
|
|
||||||
Git author information and the used signing key is set up from
|
Git author information and the used signing key is set up from
|
||||||
'makepkg.conf' read from any valid location like '/etc' or 'XDG_CONFIG_HOME'.
|
'makepkg.conf' read from any valid location like '/etc' or 'XDG_CONFIG_HOME'.
|
||||||
The unprivileged option can be used for cloning packaging repositories
|
|
||||||
without SSH access using read-only HTTPS.
|
The remote protocol is automatically determined from the author email
|
||||||
|
address by choosing SSH for all official packager identities and
|
||||||
|
read-only HTTPS otherwise.
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
*-u, --unprivileged*::
|
|
||||||
Configure read-only repo without packager info as Git author
|
|
||||||
|
|
||||||
*-h, --help*::
|
*-h, --help*::
|
||||||
Show a help text
|
Show a help text
|
||||||
|
|
||||||
|
@@ -20,6 +20,9 @@ Subcommands
|
|||||||
pkgctl auth::
|
pkgctl auth::
|
||||||
Authenticate with services like GitLab
|
Authenticate with services like GitLab
|
||||||
|
|
||||||
|
pkgctl build::
|
||||||
|
Build packages inside a clean chroot
|
||||||
|
|
||||||
pkgctl db::
|
pkgctl db::
|
||||||
Pacman database modification for packge update, move etc
|
Pacman database modification for packge update, move etc
|
||||||
|
|
||||||
@@ -36,6 +39,7 @@ See Also
|
|||||||
--------
|
--------
|
||||||
|
|
||||||
linkman:pkgctl-auth[1]
|
linkman:pkgctl-auth[1]
|
||||||
|
linkman:pkgctl-build[1]
|
||||||
linkman:pkgctl-db[1]
|
linkman:pkgctl-db[1]
|
||||||
linkman:pkgctl-diff[1]
|
linkman:pkgctl-diff[1]
|
||||||
linkman:pkgctl-release[1]
|
linkman:pkgctl-release[1]
|
||||||
|
@@ -198,8 +198,10 @@ if [[ -n $(git status --short --untracked-files=no) ]]; then
|
|||||||
$VISUAL "$msgfile" || die
|
$VISUAL "$msgfile" || die
|
||||||
elif [[ -n $EDITOR ]]; then
|
elif [[ -n $EDITOR ]]; then
|
||||||
$EDITOR "$msgfile" || die
|
$EDITOR "$msgfile" || die
|
||||||
|
elif giteditor=$(git config --get core.editor); then
|
||||||
|
$giteditor "$msgfile" || die
|
||||||
else
|
else
|
||||||
vi "$msgfile" || die
|
die "No usable editor found (tried \$GIT_EDITOR, \$VISUAL, \$EDITOR, git config [core.editor])."
|
||||||
fi
|
fi
|
||||||
[[ -s $msgfile ]] || die
|
[[ -s $msgfile ]] || die
|
||||||
stat_busy 'Committing changes'
|
stat_busy 'Committing changes'
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||||
# shellcheck source=src/lib/common.sh
|
# shellcheck source=src/lib/common.sh
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
|
# shellcheck source=src/lib/util/util.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/util.sh
|
||||||
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
@@ -26,6 +28,8 @@ usage() {
|
|||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-M, --makepkg-config Set an alternate makepkg configuration file
|
-M, --makepkg-config Set an alternate makepkg configuration file
|
||||||
|
-M, --pacman-config Set an alternate pacman configuration file
|
||||||
|
--dbpath Set an alternate pacman database path
|
||||||
-P, --pool=DIR Search diff target in pool dir (default '/srv/ftp/pool')
|
-P, --pool=DIR Search diff target in pool dir (default '/srv/ftp/pool')
|
||||||
-v, --verbose Provide more detailed/unfiltered output
|
-v, --verbose Provide more detailed/unfiltered output
|
||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
@@ -37,12 +41,14 @@ usage() {
|
|||||||
-y, --side-by-side Output in two columns
|
-y, --side-by-side Output in two columns
|
||||||
-W, --width=NUM Output at most NUM (default 'auto') print columns
|
-W, --width=NUM Output at most NUM (default 'auto') print columns
|
||||||
NUM can be 'auto', 'columns' or a number
|
NUM can be 'auto', 'columns' or a number
|
||||||
|
--summary Print a summary or warning message on disparity
|
||||||
|
|
||||||
MODES
|
MODES
|
||||||
-l, --list Activate content list diff mode (default)
|
-l, --list Activate content list diff mode (default)
|
||||||
-d, --diffoscope Activate diffoscope diff mode
|
-d, --diffoscope Activate diffoscope diff mode
|
||||||
-p, --pkginfo Activate .PKGINFO diff mode
|
-p, --pkginfo Activate .PKGINFO diff mode
|
||||||
-b, --buildinfo Activate .BUILDINFO diff mode
|
-b, --buildinfo Activate .BUILDINFO diff mode
|
||||||
|
-s, --soname Activate library SONAME diff mode
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,11 +60,13 @@ TARLIST=0
|
|||||||
DIFFOSCOPE=0
|
DIFFOSCOPE=0
|
||||||
PKGINFO=0
|
PKGINFO=0
|
||||||
BUILDINFO=0
|
BUILDINFO=0
|
||||||
|
SONAME=0
|
||||||
|
SUMMARY=0
|
||||||
|
|
||||||
DIFFMODE=--side-by-side
|
DIFFMODE=--side-by-side
|
||||||
DIFFCOLOR=--color=auto
|
DIFFCOLOR=--color=auto
|
||||||
DIFFWIDTH=--width=auto
|
DIFFWIDTH=--width=auto
|
||||||
DIFFOPTIONS=(--expand-tabs)
|
DIFFOPTIONS=(--expand-tabs --suppress-common-lines)
|
||||||
|
|
||||||
# option checking
|
# option checking
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
@@ -88,10 +96,18 @@ while (( $# )); do
|
|||||||
BUILDINFO=1
|
BUILDINFO=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-s|--soname)
|
||||||
|
SONAME=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-v|--verbose)
|
-v|--verbose)
|
||||||
VERBOSE=1
|
VERBOSE=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--summary)
|
||||||
|
SUMMARY=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-u|-U|--unified)
|
-u|-U|--unified)
|
||||||
DIFFMODE=--unified
|
DIFFMODE=--unified
|
||||||
shift
|
shift
|
||||||
@@ -135,7 +151,7 @@ while (( $# )); do
|
|||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-*|--*)
|
-*)
|
||||||
die "invalid argument: %s" "$1"
|
die "invalid argument: %s" "$1"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@@ -158,6 +174,9 @@ fi
|
|||||||
if [[ $DIFFWIDTH != --width=auto ]]; then
|
if [[ $DIFFWIDTH != --width=auto ]]; then
|
||||||
DIFFOPTIONS+=("${DIFFWIDTH}")
|
DIFFOPTIONS+=("${DIFFWIDTH}")
|
||||||
fi
|
fi
|
||||||
|
if [[ $DIFFCOLOR == --color=auto ]] && is_tty; then
|
||||||
|
DIFFCOLOR="--color=always"
|
||||||
|
fi
|
||||||
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
|
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
|
||||||
|
|
||||||
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
|
||||||
@@ -232,23 +251,31 @@ diff_pkgs() {
|
|||||||
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
|
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( TARLIST || PKGINFO || BUILDINFO )); then
|
if (( SONAME )); then
|
||||||
|
find-libprovides "$oldpkg" 2>/dev/null | sort > "$TMPDIR/old"
|
||||||
|
find-libprovides "$newpkg" 2>/dev/null | sort > "$TMPDIR/new"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( TARLIST || PKGINFO || BUILDINFO || SONAME )); then
|
||||||
# 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
|
if ! output=$(diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"); then
|
||||||
if [[ $DIFFMODE == --side-by-side ]]; then
|
# Print a header for side-by-side view as it lacks labels
|
||||||
printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
|
if [[ $DIFFMODE == --side-by-side ]]; then
|
||||||
|
printf -- "%s--- %s\n+++ %s%s\n" "${BOLD}" "${oldpkg}" "${newpkg}" "${ALL_OFF}"
|
||||||
|
fi
|
||||||
|
printf "%s\n" "${output}"
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( DIFFOSCOPE )); then
|
if (( DIFFOSCOPE )); then
|
||||||
diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
|
diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
|
||||||
|
return $?
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,13 +304,14 @@ fetch_pkg() {
|
|||||||
fi
|
fi
|
||||||
# Search via pacman database if no pool file exists
|
# Search via pacman database if no pool file exists
|
||||||
if [[ ! -f ${pkgurl} ]]; then
|
if [[ ! -f ${pkgurl} ]]; then
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm -- "$pkg") ||
|
||||||
die "Couldn't download previous package for %s." "$pkg"
|
die "Couldn't download previous package for %s." "$pkg"
|
||||||
|
# TODO: check and download via Swdd so we also do signatures checks before processing
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pkg=${pkgurl##*/}
|
pkg=${pkgurl##*/}
|
||||||
pkgdest=$(mktemp -t -d "${pkg}-XXXXXX")/${pkg}
|
pkgdest=$(mktemp -t -d -- "${pkg}-XXXXXX")/${pkg}
|
||||||
|
|
||||||
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
|
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
|
||||||
ln -sf "${pkgurl#file://}" "$pkgdest"
|
ln -sf "${pkgurl#file://}" "$pkgdest"
|
||||||
@@ -313,6 +341,7 @@ if (( $# < 2 )); then
|
|||||||
CARCH='any'
|
CARCH='any'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ret=0
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
comparepkg=$_pkgname
|
comparepkg=$_pkgname
|
||||||
pkgurl=
|
pkgurl=
|
||||||
@@ -330,10 +359,13 @@ if (( $# < 2 )); then
|
|||||||
oldpkg=$(fetch_pkg "$comparepkg") || exit 1
|
oldpkg=$(fetch_pkg "$comparepkg") || exit 1
|
||||||
|
|
||||||
diff_pkgs "$oldpkg" "$pkgfile"
|
diff_pkgs "$oldpkg" "$pkgfile"
|
||||||
|
ret+=$?
|
||||||
done
|
done
|
||||||
|
exit $ret
|
||||||
else
|
else
|
||||||
file1=$(fetch_pkg "$1") || exit 1
|
file1=$(fetch_pkg "$1") || exit 1
|
||||||
file2=$(fetch_pkg "$2") || exit 1
|
file2=$(fetch_pkg "$2") || exit 1
|
||||||
|
|
||||||
diff_pkgs "$file1" "$file2"
|
diff_pkgs "$file1" "$file2"
|
||||||
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
@@ -81,16 +81,30 @@ gitlab_api_get_user() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 1. replace single '+' between word boundaries with '-'
|
||||||
|
# 2. replace any other '+' with literal 'plus'
|
||||||
|
# 3. replace any special chars other than '_', '-' and '.' with '-'
|
||||||
|
gitlab_project_name_to_path() {
|
||||||
|
local name=$1
|
||||||
|
printf "%s" "${name}" \
|
||||||
|
| sed -E 's/([a-zA-Z0-9]+)\+([a-zA-Z]+)/\1-\2/g' \
|
||||||
|
| sed -E 's/\+/plus/g' \
|
||||||
|
| sed -E 's/[^a-zA-Z0-9_\-\.]/-/g'
|
||||||
|
}
|
||||||
|
|
||||||
gitlab_api_create_project() {
|
gitlab_api_create_project() {
|
||||||
local pkgbase=$1
|
local pkgbase=$1
|
||||||
local outfile data path
|
local outfile data path project_path
|
||||||
|
|
||||||
[[ -z ${WORKDIR:-} ]] && setup_workdir
|
[[ -z ${WORKDIR:-} ]] && setup_workdir
|
||||||
outfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-gitlab-api.XXXXXXXXXX)
|
outfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-gitlab-api.XXXXXXXXXX)
|
||||||
|
|
||||||
|
project_path=$(gitlab_project_name_to_path "${pkgbase}")
|
||||||
|
|
||||||
# create GitLab project
|
# create GitLab project
|
||||||
data='{
|
data='{
|
||||||
"name": "'"${pkgbase}"'",
|
"name": "'"${pkgbase}"'",
|
||||||
|
"path": "'"${project_path}"'",
|
||||||
"namespace_id": "'"${GIT_PACKAGING_NAMESPACE_ID}"'",
|
"namespace_id": "'"${GIT_PACKAGING_NAMESPACE_ID}"'",
|
||||||
"request_access_enabled": "false"
|
"request_access_enabled": "false"
|
||||||
}'
|
}'
|
||||||
|
416
src/lib/build/build.sh
Normal file
416
src/lib/build/build.sh
Normal file
@@ -0,0 +1,416 @@
|
|||||||
|
#!/hint/bash
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
[[ -z ${DEVTOOLS_INCLUDE_BUILD_SH:-} ]] || return 0
|
||||||
|
DEVTOOLS_INCLUDE_BUILD_SH=1
|
||||||
|
|
||||||
|
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||||
|
# shellcheck source=src/lib/common.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
||||||
|
# shellcheck source=src/lib/db/update.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/db/update.sh
|
||||||
|
# shellcheck source=src/lib/release.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
|
||||||
|
# shellcheck source=src/lib/util/git.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/git.sh
|
||||||
|
# shellcheck source=src/lib/util/pacman.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/pacman.sh
|
||||||
|
# shellcheck source=src/lib/valid-repos.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
|
||||||
|
# shellcheck source=src/lib/valid-tags.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-tags.sh
|
||||||
|
|
||||||
|
source /usr/share/makepkg/util/config.sh
|
||||||
|
source /usr/share/makepkg/util/message.sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
|
||||||
|
pkgctl_build_usage() {
|
||||||
|
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
|
||||||
|
cat <<- _EOF_
|
||||||
|
Usage: ${COMMAND} [OPTIONS] [PATH]...
|
||||||
|
|
||||||
|
Build packages inside a clean chroot
|
||||||
|
|
||||||
|
When a new pkgver is set using the appropriate PKGBUILD options the
|
||||||
|
checksums are automatically updated.
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
BUILD OPTIONS
|
||||||
|
--arch ARCH Specify architectures to build for (disables auto-detection)
|
||||||
|
--repo REPO Specify a target repository (disables auto-detection)
|
||||||
|
-s, --staging Build against the staging counterpart of the auto-detected repo
|
||||||
|
-t, --testing Build against the testing counterpart of the auto-detected repo
|
||||||
|
-o, --offload Build on a remote server and transfer artifacts afterwards
|
||||||
|
-c, --clean Recreate the chroot before building
|
||||||
|
-I, --install FILE Install a package into the working copy of the chroot
|
||||||
|
--nocheck Do not run the check() function in the PKGBUILD
|
||||||
|
|
||||||
|
PKGBUILD OPTIONS
|
||||||
|
--pkgver=PKGVER Set pkgver, reset pkgrel and update checksums
|
||||||
|
--pkgrel=PKGREL Set pkgrel to a given value
|
||||||
|
--rebuild Increment the current pkgrel variable
|
||||||
|
-e, --edit Edit the PKGBUILD before building
|
||||||
|
|
||||||
|
RELEASE OPTIONS
|
||||||
|
-r, --release Automatically commit, tag and release after building
|
||||||
|
-m, --message MSG Use the given <msg> as the commit message
|
||||||
|
-u, --db-update Automatically update the pacman database as last action
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-h, --help Show this help text
|
||||||
|
|
||||||
|
EXAMPLES
|
||||||
|
$ ${COMMAND}
|
||||||
|
$ ${COMMAND} --rebuild --staging --message 'libyay 0.42 rebuild' libfoo libbar
|
||||||
|
$ ${COMMAND} --pkgver 1.42 --release --db-update
|
||||||
|
_EOF_
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgctl_build_check_option_group_repo() {
|
||||||
|
local option=$1
|
||||||
|
local repo=$2
|
||||||
|
local testing=$3
|
||||||
|
local staging=$4
|
||||||
|
if ( (( testing )) && (( staging )) ) ||
|
||||||
|
( [[ $repo =~ ^.*-(staging|testing)$ ]] && ( (( testing )) || (( staging )) )); then
|
||||||
|
die "The argument '%s' cannot be used with one or more of the other specified arguments" "${option}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgctl_build_check_option_group_ver() {
|
||||||
|
local option=$1
|
||||||
|
local pkgver=$2
|
||||||
|
local pkgrel=$3
|
||||||
|
local rebuild=$4
|
||||||
|
if [[ -n "${pkgver}" ]] || [[ -n "${pkgrel}" ]] || (( rebuild )); then
|
||||||
|
die "The argument '%s' cannot be used with one or more of the other specified arguments" "${option}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# TODO: import pgp keys
|
||||||
|
pkgctl_build() {
|
||||||
|
if (( $# < 1 )) && [[ ! -f PKGBUILD ]]; then
|
||||||
|
pkgctl_build_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local UPDPKGSUMS=0
|
||||||
|
local EDIT=0
|
||||||
|
local REBUILD=0
|
||||||
|
local OFFLOAD=0
|
||||||
|
local STAGING=0
|
||||||
|
local TESTING=0
|
||||||
|
local RELEASE=0
|
||||||
|
local DB_UPDATE=0
|
||||||
|
|
||||||
|
local REPO=
|
||||||
|
local PKGVER=
|
||||||
|
local PKGREL=
|
||||||
|
local MESSAGE=
|
||||||
|
|
||||||
|
local paths=()
|
||||||
|
local BUILD_ARCH=()
|
||||||
|
local BUILD_OPTIONS=()
|
||||||
|
local MAKECHROOT_OPTIONS=()
|
||||||
|
local RELEASE_OPTIONS=()
|
||||||
|
local MAKEPKG_OPTIONS=()
|
||||||
|
|
||||||
|
local PTS
|
||||||
|
PTS="$(tty | sed 's|/dev/pts/||')"
|
||||||
|
local WORKER="${USER}-${PTS}"
|
||||||
|
|
||||||
|
# variables
|
||||||
|
local path pkgbase pkgrepo source soname_changed=0
|
||||||
|
|
||||||
|
while (( $# )); do
|
||||||
|
case $1 in
|
||||||
|
-h|--help)
|
||||||
|
pkgctl_build_usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
--repo)
|
||||||
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
|
REPO="${2}"
|
||||||
|
pkgctl_build_check_option_group_repo '--repo' "${REPO}" "${TESTING}" "${STAGING}"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--arch)
|
||||||
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
|
if [[ ${2} == all ]]; then
|
||||||
|
BUILD_ARCH=("${_arch[@]::${#_arch[@]}-1}")
|
||||||
|
elif [[ ${2} == any ]]; then
|
||||||
|
BUILD_ARCH=("${_arch[0]}")
|
||||||
|
elif ! in_array "${2}" "${BUILD_ARCH[@]}"; then
|
||||||
|
if ! in_array "${2}" "${_arch[@]}"; then
|
||||||
|
die 'invalid architecture: %s' "${2}"
|
||||||
|
fi
|
||||||
|
BUILD_ARCH+=("${2}")
|
||||||
|
fi
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--pkgver=*)
|
||||||
|
pkgctl_build_check_option_group_ver '--pkgver' "${PKGVER}" "${PKGREL}" "${REBUILD}"
|
||||||
|
PKGVER="${1#*=}"
|
||||||
|
PKGREL=1
|
||||||
|
UPDPKGSUMS=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--pkgrel=*)
|
||||||
|
pkgctl_build_check_option_group_ver '--pkgrel' "${PKGVER}" "${PKGREL}" "${REBUILD}"
|
||||||
|
PKGREL="${1#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--rebuild)
|
||||||
|
pkgctl_build_check_option_group_ver '--rebuild' "${PKGVER}" "${PKGREL}" "${REBUILD}"
|
||||||
|
REBUILD=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-e|--edit)
|
||||||
|
EDIT=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-o|--offload)
|
||||||
|
OFFLOAD=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-s|--staging)
|
||||||
|
STAGING=1
|
||||||
|
pkgctl_build_check_option_group_repo '--staging' "${REPO}" "${TESTING}" "${STAGING}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-t|--testing)
|
||||||
|
TESTING=1
|
||||||
|
pkgctl_build_check_option_group_repo '--testing' "${REPO}" "${TESTING}" "${STAGING}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-c|--clean)
|
||||||
|
BUILD_OPTIONS+=("-c")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-I|--install)
|
||||||
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
|
MAKECHROOT_OPTIONS+=("-I" "$2")
|
||||||
|
warning 'installing packages into the chroot may break reproducible builds, use with caution!'
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--nocheck)
|
||||||
|
MAKEPKG_OPTIONS+=("--nocheck")
|
||||||
|
warning 'not running checks is disallowed for official packages, except for bootstrapping. Please rebuild after bootstrapping is completed!'
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-r|--release)
|
||||||
|
# shellcheck source=src/lib/release.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
|
||||||
|
RELEASE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-m|--message)
|
||||||
|
(( $# <= 1 )) && die "missing argument for %s" "$1"
|
||||||
|
MESSAGE=$2
|
||||||
|
RELEASE_OPTIONS+=("--message" "${MESSAGE}")
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-u|--db-update)
|
||||||
|
DB_UPDATE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
die "invalid argument: %s" "$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
paths=("$@")
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# check if invoked without any path from within a packaging repo
|
||||||
|
if (( ${#paths[@]} == 0 )); then
|
||||||
|
if [[ -f PKGBUILD ]]; then
|
||||||
|
paths=(".")
|
||||||
|
else
|
||||||
|
pkgctl_build_usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update pacman cache for auto-detection
|
||||||
|
if [[ -z ${REPO} ]]; then
|
||||||
|
update_pacman_repo_cache
|
||||||
|
# Check valid repos if not resolved dynamically
|
||||||
|
elif ! in_array "${REPO}" "${_repos[@]}"; then
|
||||||
|
die "Invalid repository target: %s" "${REPO}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for path in "${paths[@]}"; do
|
||||||
|
pushd "${path}" >/dev/null
|
||||||
|
|
||||||
|
if [[ ! -f PKGBUILD ]]; then
|
||||||
|
die 'PKGBUILD not found in %s' "${path}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
source=()
|
||||||
|
# shellcheck source=contrib/makepkg/PKGBUILD.proto
|
||||||
|
. ./PKGBUILD
|
||||||
|
pkgbase=${pkgbase:-$pkgname}
|
||||||
|
pkgrepo=${REPO}
|
||||||
|
soname_changed=0
|
||||||
|
msg "Building ${pkgbase}"
|
||||||
|
|
||||||
|
# auto-detection of build target
|
||||||
|
if [[ -z ${pkgrepo} ]]; then
|
||||||
|
if ! pkgrepo=$(get_pacman_repo_from_pkgbuild PKGBUILD); then
|
||||||
|
die 'failed to get pacman repo'
|
||||||
|
fi
|
||||||
|
if [[ -z "${pkgrepo}" ]]; then
|
||||||
|
die 'unknown repo, please specify --repo for new packages'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: REMOVE AFTER POC
|
||||||
|
if [[ ${pkgrepo} == community ]]; then
|
||||||
|
pkgrepo=extra
|
||||||
|
fi
|
||||||
|
|
||||||
|
# special cases to resolve final build target
|
||||||
|
if (( TESTING )); then
|
||||||
|
pkgrepo="${pkgrepo}-testing"
|
||||||
|
elif (( STAGING )); then
|
||||||
|
pkgrepo="${pkgrepo}-staging"
|
||||||
|
elif [[ $pkgrepo == core ]]; then
|
||||||
|
pkgrepo="${pkgrepo}-testing"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# auto-detection of build architecture
|
||||||
|
if [[ $pkgrepo = multilib* ]]; then
|
||||||
|
BUILD_ARCH=("")
|
||||||
|
elif (( ${#BUILD_ARCH[@]} == 0 )); then
|
||||||
|
if in_array any "${arch[@]}"; then
|
||||||
|
BUILD_ARCH=("${_arch[0]}")
|
||||||
|
else
|
||||||
|
BUILD_ARCH+=("${arch[@]}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# print gathered build modes
|
||||||
|
msg2 "repo: ${pkgrepo}"
|
||||||
|
msg2 "arch: ${BUILD_ARCH[*]}"
|
||||||
|
|
||||||
|
# increment pkgrel on rebuild
|
||||||
|
if (( REBUILD )); then
|
||||||
|
# try to figure out of 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
|
||||||
|
# check if pkgrel conforms expectations
|
||||||
|
[[ ${pkgrel/.*} =~ ^[0-9]+$ ]] || die "Non-standard pkgrel declaration"
|
||||||
|
[[ ${old_pkgrel/.*} =~ ^[0-9]+$ ]] || die "Non-standard pkgrel declaration"
|
||||||
|
# increment pkgrel if it hasn't been changed yet
|
||||||
|
if [[ ${pkgrel} = "${old_pkgrel}" ]]; then
|
||||||
|
PKGREL=$((${pkgrel/.*}+1))
|
||||||
|
else
|
||||||
|
warning 'ignoring --rebuild as pkgrel has already been incremented from %s to %s' "${old_pkgrel}" "${pkgrel}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update pkgver
|
||||||
|
if [[ -n ${PKGVER} ]]; then
|
||||||
|
if [[ $(type -t pkgver) == function ]]; then
|
||||||
|
# TODO: check if die or warn, if we provide _commit _gitcommit setter maybe?
|
||||||
|
warning 'setting pkgver variable has no effect if the PKGBUILD has a pkgver() function'
|
||||||
|
fi
|
||||||
|
msg "Bumping pkgver to ${PKGVER}"
|
||||||
|
grep --extended-regexp --quiet --max-count=1 "^pkgver=${pkgver}$" PKGBUILD || die "Non-standard pkgver declaration"
|
||||||
|
sed --regexp-extended "s|^(pkgver=)${pkgver}$|\1${PKGVER}|g" -i PKGBUILD
|
||||||
|
fi
|
||||||
|
|
||||||
|
# update pkgrel
|
||||||
|
if [[ -n ${PKGREL} ]]; then
|
||||||
|
msg "Bumping pkgrel to ${PKGREL}"
|
||||||
|
grep --extended-regexp --quiet --max-count=1 "^pkgrel=${pkgrel}$" PKGBUILD || die "Non-standard pkgrel declaration"
|
||||||
|
sed --regexp-extended "s|^(pkgrel=)${pkgrel}$|\1${PKGREL}|g" -i PKGBUILD
|
||||||
|
fi
|
||||||
|
|
||||||
|
# edit PKGBUILD
|
||||||
|
if (( EDIT )); then
|
||||||
|
stat_busy 'Editing PKGBUILD'
|
||||||
|
if [[ -n $GIT_EDITOR ]]; then
|
||||||
|
$GIT_EDITOR PKGBUILD || die
|
||||||
|
elif [[ -n $VISUAL ]]; then
|
||||||
|
$VISUAL PKGBUILD || die
|
||||||
|
elif [[ -n $EDITOR ]]; then
|
||||||
|
$EDITOR PKGBUILD || die
|
||||||
|
elif giteditor=$(git config --get core.editor); then
|
||||||
|
$giteditor PKGBUILD || die
|
||||||
|
else
|
||||||
|
die "No usable editor found (tried \$GIT_EDITOR, \$VISUAL, \$EDITOR, git config [core.editor])."
|
||||||
|
fi
|
||||||
|
stat_done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# update checksums if any sources are declared
|
||||||
|
if (( UPDPKGSUMS )) && (( ${#source[@]} >= 1 )); then
|
||||||
|
updpkgsums
|
||||||
|
fi
|
||||||
|
|
||||||
|
# execute build
|
||||||
|
for arch in "${BUILD_ARCH[@]}"; do
|
||||||
|
if [[ -n $arch ]]; then
|
||||||
|
msg "Building ${pkgbase} for [${pkgrepo}] (${arch})"
|
||||||
|
BUILDTOOL="${pkgrepo}-${arch}-build"
|
||||||
|
else
|
||||||
|
msg "Building ${pkgbase} for [${pkgrepo}]"
|
||||||
|
BUILDTOOL="${pkgrepo}-build"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# TODO: REMOVE AFTER POC
|
||||||
|
offload_tool=${pkgrepo}
|
||||||
|
if [[ ${pkgrepo} == core-* ]]; then
|
||||||
|
BUILDTOOL=${BUILDTOOL/core-/}
|
||||||
|
offload_tool=${offload_tool/core-/}
|
||||||
|
elif [[ ${pkgrepo} == extra-* ]]; then
|
||||||
|
BUILDTOOL=${BUILDTOOL/extra-/}
|
||||||
|
offload_tool=${offload_tool/extra-/}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( OFFLOAD )); then
|
||||||
|
offload-build --repo "${offload_tool}" -- "${BUILD_OPTIONS[@]}" -- "${MAKECHROOT_OPTIONS[@]}" -l "${WORKER}" -- "${MAKEPKG_OPTIONS[@]}"
|
||||||
|
else
|
||||||
|
"${BUILDTOOL}" "${BUILD_OPTIONS[@]}" -- "${MAKECHROOT_OPTIONS[@]}" -l "${WORKER}" -- "${MAKEPKG_OPTIONS[@]}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# release the build
|
||||||
|
if (( RELEASE )); then
|
||||||
|
if [[ ${pkgrepo} != *-staging ]] && ! diffpkg --soname >/dev/null; then
|
||||||
|
die "abort none staging auto-release: package contains soname differences"
|
||||||
|
fi
|
||||||
|
echo RELEASE, ABORT
|
||||||
|
exit 0
|
||||||
|
pkgctl_release --repo "${pkgrepo}" "${RELEASE_OPTIONS[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# reset common PKGBUILD variables
|
||||||
|
unset pkgbase pkgname arch pkgrepo source pkgver pkgrel validpgpkeys
|
||||||
|
popd >/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
# update the binary package repo db as last action
|
||||||
|
if (( RELEASE )) && (( DB_UPDATE )); then
|
||||||
|
# shellcheck disable=2119
|
||||||
|
pkgctl_db_update
|
||||||
|
fi
|
||||||
|
}
|
@@ -22,12 +22,12 @@ export BUILDTOOLVER=@buildtoolver@
|
|||||||
# Set common properties
|
# Set common properties
|
||||||
export PACMAN_KEYRING_DIR=/etc/pacman.d/gnupg
|
export PACMAN_KEYRING_DIR=/etc/pacman.d/gnupg
|
||||||
export GITLAB_HOST=gitlab.archlinux.org
|
export GITLAB_HOST=gitlab.archlinux.org
|
||||||
export GIT_REPO_SPEC_VERSION=1
|
export GIT_REPO_SPEC_VERSION=0
|
||||||
export GIT_PACKAGING_NAMESPACE=archlinux/packaging/packages
|
export GIT_PACKAGING_NAMESPACE=bot-test/packages
|
||||||
export GIT_PACKAGING_NAMESPACE_ID=11233
|
export GIT_PACKAGING_NAMESPACE_ID=11233
|
||||||
export GIT_PACKAGING_URL_SSH="ssh://git@${GITLAB_HOST}:222/${GIT_PACKAGING_NAMESPACE}"
|
export GIT_PACKAGING_URL_SSH="ssh://git@${GITLAB_HOST}:222/${GIT_PACKAGING_NAMESPACE}"
|
||||||
export GIT_PACKAGING_URL_HTTPS="https://${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 PACKAGING_REPO_RELEASE_HOST=repos.sandbox.archlinux.org
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
if [[ -t 2 && "$TERM" != dumb ]]; then
|
if [[ -t 2 && "$TERM" != dumb ]]; then
|
||||||
|
@@ -14,14 +14,31 @@ readonly XDG_DEVTOOLS_GITLAB_CONFIG="${XDG_DEVTOOLS_DIR}/gitlab.conf"
|
|||||||
export GITLAB_TOKEN=""
|
export GITLAB_TOKEN=""
|
||||||
|
|
||||||
load_devtools_config() {
|
load_devtools_config() {
|
||||||
if [[ ! -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then
|
# temporary permission fixup
|
||||||
GITLAB_TOKEN=""
|
if [[ -d "${XDG_DEVTOOLS_DIR}" ]]; then
|
||||||
|
chmod 700 "${XDG_DEVTOOLS_DIR}"
|
||||||
|
fi
|
||||||
|
if [[ -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then
|
||||||
|
chmod 600 "${XDG_DEVTOOLS_GITLAB_CONFIG}"
|
||||||
|
fi
|
||||||
|
if [[ -n "${DEVTOOLS_GITLAB_TOKEN}" ]]; then
|
||||||
|
GITLAB_TOKEN="${DEVTOOLS_GITLAB_TOKEN}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
GITLAB_TOKEN=$(grep GITLAB_TOKEN "${XDG_DEVTOOLS_GITLAB_CONFIG}"|cut -d= -f2|cut -d\" -f2)
|
if [[ -f "${XDG_DEVTOOLS_GITLAB_CONFIG}" ]]; then
|
||||||
|
GITLAB_TOKEN=$(grep GITLAB_TOKEN "${XDG_DEVTOOLS_GITLAB_CONFIG}"|cut -d= -f2|cut -d\" -f2)
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
GITLAB_TOKEN=""
|
||||||
}
|
}
|
||||||
|
|
||||||
save_devtools_config() {
|
save_devtools_config() {
|
||||||
mkdir -p "${XDG_DEVTOOLS_DIR}"
|
# temporary permission fixup
|
||||||
printf 'GITLAB_TOKEN="%s"\n' "${GITLAB_TOKEN}" > "${XDG_DEVTOOLS_GITLAB_CONFIG}"
|
chmod 700 "${XDG_DEVTOOLS_DIR}"
|
||||||
|
chmod 600 "${XDG_DEVTOOLS_GITLAB_CONFIG}"
|
||||||
|
(
|
||||||
|
umask 0077
|
||||||
|
mkdir -p "${XDG_DEVTOOLS_DIR}"
|
||||||
|
printf 'GITLAB_TOKEN="%s"\n' "${GITLAB_TOKEN}" > "${XDG_DEVTOOLS_GITLAB_CONFIG}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@@ -145,6 +145,11 @@ pkgctl_release() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: REMOVE AFTER POC
|
||||||
|
if [[ ${repo} == community ]]; then
|
||||||
|
repo=extra
|
||||||
|
fi
|
||||||
|
|
||||||
if (( TESTING )); then
|
if (( TESTING )); then
|
||||||
repo="${repo}-testing"
|
repo="${repo}-testing"
|
||||||
elif (( STAGING )); then
|
elif (( STAGING )); then
|
||||||
|
@@ -32,8 +32,6 @@ pkgctl_repo_clone_usage() {
|
|||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-m, --maintainer=NAME Clone all packages of the named maintainer
|
-m, --maintainer=NAME Clone all packages of the named maintainer
|
||||||
-u, --unprivileged Clone package with read-only access and without
|
|
||||||
packager info as Git author
|
|
||||||
--universe Clone all existing packages, useful for cache warming
|
--universe Clone all existing packages, useful for cache warming
|
||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
|
|
||||||
@@ -56,6 +54,9 @@ pkgctl_repo_clone() {
|
|||||||
local CONFIGURE_OPTIONS=()
|
local CONFIGURE_OPTIONS=()
|
||||||
local pkgbases
|
local pkgbases
|
||||||
|
|
||||||
|
# variables
|
||||||
|
local project_path
|
||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
@@ -128,7 +129,8 @@ pkgctl_repo_clone() {
|
|||||||
for pkgbase in "${pkgbases[@]}"; do
|
for pkgbase in "${pkgbases[@]}"; do
|
||||||
if [[ ! -d ${pkgbase} ]]; then
|
if [[ ! -d ${pkgbase} ]]; then
|
||||||
msg "Cloning ${pkgbase} ..."
|
msg "Cloning ${pkgbase} ..."
|
||||||
remote_url="${GIT_REPO_BASE_URL}/${pkgbase}.git"
|
project_path=$(gitlab_project_name_to_path "${pkgbase}")
|
||||||
|
remote_url="${GIT_REPO_BASE_URL}/${project_path}.git"
|
||||||
git clone --origin origin "${remote_url}" "${pkgbase}"
|
git clone --origin origin "${remote_url}" "${pkgbase}"
|
||||||
else
|
else
|
||||||
warning "Skip cloning ${pkgbase}: Directory exists"
|
warning "Skip cloning ${pkgbase}: Directory exists"
|
||||||
|
@@ -27,11 +27,12 @@ pkgctl_repo_configure_usage() {
|
|||||||
|
|
||||||
Git author information and the used signing key is set up from
|
Git author information and the used signing key is set up from
|
||||||
makepkg.conf read from any valid location like /etc or XDG_CONFIG_HOME.
|
makepkg.conf read from any valid location like /etc or XDG_CONFIG_HOME.
|
||||||
The unprivileged option can be used for cloning packaging repositories
|
|
||||||
without SSH access using read-only HTTPS.
|
The remote protocol is automatically determined from the author email
|
||||||
|
address by choosing SSH for all official packager identities and
|
||||||
|
read-only HTTPS otherwise.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-u, --unprivileged Configure read-only repo without packager info as Git author
|
|
||||||
-h, --help Show this help text
|
-h, --help Show this help text
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
@@ -39,16 +40,64 @@ pkgctl_repo_configure_usage() {
|
|||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_packager_name() {
|
||||||
|
local packager=$1
|
||||||
|
local packager_pattern="(.+) <(.+@.+)>"
|
||||||
|
local name
|
||||||
|
|
||||||
|
if [[ ! $packager =~ $packager_pattern ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
name=$(echo "${packager}"|sed -E "s/${packager_pattern}/\1/")
|
||||||
|
printf "%s" "${name}"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_packager_email() {
|
||||||
|
local packager=$1
|
||||||
|
local packager_pattern="(.+) <(.+@.+)>"
|
||||||
|
local email
|
||||||
|
|
||||||
|
if [[ ! $packager =~ $packager_pattern ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
email=$(echo "${packager}"|sed -E "s/${packager_pattern}/\2/")
|
||||||
|
printf "%s" "${email}"
|
||||||
|
}
|
||||||
|
|
||||||
|
is_packager_name_valid() {
|
||||||
|
local packager_name=$1
|
||||||
|
if [[ -z ${packager_name} ]]; then
|
||||||
|
return 1
|
||||||
|
elif [[ ${packager_name} == "John Doe" ]]; then
|
||||||
|
return 1
|
||||||
|
elif [[ ${packager_name} == "Unknown Packager" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
is_packager_email_official() {
|
||||||
|
local packager_email=$1
|
||||||
|
if [[ -z ${packager_email} ]]; then
|
||||||
|
return 1
|
||||||
|
elif [[ $packager_email =~ .+@archlinux.org ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
pkgctl_repo_configure() {
|
pkgctl_repo_configure() {
|
||||||
# options
|
# options
|
||||||
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
||||||
local UNPRIVILEGED=0
|
local official=0
|
||||||
local PACKAGER_NAME=
|
local proto=https
|
||||||
local PACKAGER_EMAIL=
|
|
||||||
local paths=()
|
local paths=()
|
||||||
|
|
||||||
# variables
|
# variables
|
||||||
local path realpath pkgbase remote_url
|
local path realpath pkgbase remote_url project_path
|
||||||
|
local PACKAGER GPGKEY packager_name packager_email
|
||||||
|
|
||||||
while (( $# )); do
|
while (( $# )); do
|
||||||
case $1 in
|
case $1 in
|
||||||
@@ -56,11 +105,6 @@ pkgctl_repo_configure() {
|
|||||||
pkgctl_repo_configure_usage
|
pkgctl_repo_configure_usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
-u|--unprivileged)
|
|
||||||
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
|
|
||||||
UNPRIVILEGED=1
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@@ -85,34 +129,33 @@ pkgctl_repo_configure() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Load makepkg.conf variables to be available
|
# Load makepkg.conf variables to be available for packager identity
|
||||||
|
msg "Collecting packager identity from makepkg.conf"
|
||||||
# shellcheck disable=2119
|
# shellcheck disable=2119
|
||||||
load_makepkg_config
|
load_makepkg_config
|
||||||
|
if [[ -n ${PACKAGER} ]]; then
|
||||||
# Check official packaging identity before setting Git author
|
if ! packager_name=$(get_packager_name "${PACKAGER}") || \
|
||||||
if (( ! UNPRIVILEGED )); then
|
! packager_email=$(get_packager_email "${PACKAGER}"); then
|
||||||
if [[ $PACKAGER == *"Unknown Packager"* ]]; then
|
die "invalid PACKAGER format '${PACKAGER}' in makepkg.conf"
|
||||||
die "Packager must be set in makepkg.conf"
|
|
||||||
fi
|
fi
|
||||||
packager_pattern="(.+) <(.+@.+)>"
|
if ! is_packager_name_valid "${packager_name}"; then
|
||||||
if [[ ! $PACKAGER =~ $packager_pattern ]]; then
|
die "invalid PACKAGER '${PACKAGER}' in makepkg.conf"
|
||||||
die "Invalid Packager format '${PACKAGER}' in makepkg.conf"
|
|
||||||
fi
|
fi
|
||||||
|
if is_packager_email_official "${packager_email}"; then
|
||||||
PACKAGER_NAME=$(echo "${PACKAGER}"|sed -E "s/${packager_pattern}/\1/")
|
official=1
|
||||||
PACKAGER_EMAIL=$(echo "${PACKAGER}"|sed -E "s/${packager_pattern}/\2/")
|
proto=ssh
|
||||||
|
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
|
||||||
if [[ ! $PACKAGER_EMAIL =~ .+@archlinux.org ]]; then
|
|
||||||
die "Packager email '${PACKAGER_EMAIL}' is not an @archlinux.org address"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Collected packager settings"
|
msg2 "name : ${packager_name:-${YELLOW}undefined${ALL_OFF}}"
|
||||||
msg2 "name : ${PACKAGER_NAME}"
|
msg2 "email : ${packager_email:-${YELLOW}undefined${ALL_OFF}}"
|
||||||
msg2 "email : ${PACKAGER_EMAIL}"
|
msg2 "gpg-key : ${GPGKEY:-${YELLOW}undefined${ALL_OFF}}"
|
||||||
msg2 "gpg-key : ${GPGKEY:-undefined}"
|
if [[ ${proto} == ssh ]]; then
|
||||||
|
msg2 "protocol: ${GREEN}${proto}${ALL_OFF}"
|
||||||
# TODO: print which protocol got auto detected, ssh https
|
else
|
||||||
|
msg2 "protocol: ${YELLOW}${proto}${ALL_OFF}"
|
||||||
|
fi
|
||||||
|
|
||||||
for path in "${paths[@]}"; do
|
for path in "${paths[@]}"; do
|
||||||
if ! realpath=$(realpath -e "${path}"); then
|
if ! realpath=$(realpath -e "${path}"); then
|
||||||
@@ -129,41 +172,52 @@ pkgctl_repo_configure() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
remote_url="${GIT_REPO_BASE_URL}/${pkgbase}.git"
|
pushd "${path}" >/dev/null
|
||||||
if ! git -C "${path}" remote add origin "${remote_url}" &>/dev/null; then
|
|
||||||
git -C "${path}" remote set-url origin "${remote_url}"
|
project_path=$(gitlab_project_name_to_path "${pkgbase}")
|
||||||
|
remote_url="${GIT_REPO_BASE_URL}/${project_path}.git"
|
||||||
|
if ! git remote add origin "${remote_url}" &>/dev/null; then
|
||||||
|
git remote set-url origin "${remote_url}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# move the master branch to main
|
# move the master branch to main
|
||||||
if [[ $(git -C "${path}" symbolic-ref --short HEAD) == master ]]; then
|
if [[ $(git symbolic-ref --short HEAD) == master ]]; then
|
||||||
git -C "${path}" branch --move main
|
git branch --move main
|
||||||
git -C "${path}" config branch.main.merge refs/heads/main
|
git config branch.main.merge refs/heads/main
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git -C "${path}" config devtools.version "${GIT_REPO_SPEC_VERSION}"
|
git config devtools.version "${GIT_REPO_SPEC_VERSION}"
|
||||||
git -C "${path}" config pull.rebase true
|
git config pull.rebase true
|
||||||
git -C "${path}" config branch.autoSetupRebase always
|
git config branch.autoSetupRebase always
|
||||||
git -C "${path}" config branch.main.remote origin
|
git config branch.main.remote origin
|
||||||
git -C "${path}" config branch.main.rebase true
|
git config branch.main.rebase true
|
||||||
|
|
||||||
git -C "${path}" config transfer.fsckobjects true
|
git config transfer.fsckobjects true
|
||||||
git -C "${path}" config fetch.fsckobjects true
|
git config fetch.fsckobjects true
|
||||||
git -C "${path}" config receive.fsckobjects true
|
git config receive.fsckobjects true
|
||||||
|
|
||||||
if (( ! UNPRIVILEGED )); then
|
# setup author identity
|
||||||
git -C "${path}" config user.name "${PACKAGER_NAME}"
|
if [[ -n ${packager_name} ]]; then
|
||||||
git -C "${path}" config user.email "${PACKAGER_EMAIL}"
|
git config user.name "${packager_name}"
|
||||||
git -C "${path}" config commit.gpgsign true
|
git config user.email "${packager_email}"
|
||||||
if [[ -n $GPGKEY ]]; then
|
fi
|
||||||
git -C "${path}" config user.signingKey "${GPGKEY}"
|
|
||||||
else
|
# force gpg for official packagers
|
||||||
warning "Missing makepkg.conf configuration: GPGKEY"
|
if (( official )); then
|
||||||
fi
|
git config commit.gpgsign true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set custom pgp key from makepkg.conf
|
||||||
|
if [[ -n $GPGKEY ]]; then
|
||||||
|
git config commit.gpgsign true
|
||||||
|
git config user.signingKey "${GPGKEY}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! git ls-remote origin &>/dev/null; then
|
if ! git ls-remote origin &>/dev/null; then
|
||||||
warning "configured remote origin may not exist, run:"
|
warning "configured remote origin may not exist, run:"
|
||||||
msg2 "pkgctl repo create ${pkgbase}"
|
msg2 "pkgctl repo create ${pkgbase}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
popd >/dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
24
src/lib/util/git.sh
Normal file
24
src/lib/util/git.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/hint/bash
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
[[ -z ${DEVTOOLS_INCLUDE_UTIL_GIT_SH:-} ]] || return 0
|
||||||
|
DEVTOOLS_INCLUDE_UTIL_GIT_SH=1
|
||||||
|
|
||||||
|
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||||
|
|
||||||
|
|
||||||
|
git_diff_tree() {
|
||||||
|
local commit=$1
|
||||||
|
local path=$2
|
||||||
|
git \
|
||||||
|
--no-pager \
|
||||||
|
diff \
|
||||||
|
--color=never \
|
||||||
|
--color-moved=no \
|
||||||
|
--unified=0 \
|
||||||
|
--no-prefix \
|
||||||
|
--no-ext-diff \
|
||||||
|
"${commit}" \
|
||||||
|
-- "${path}"
|
||||||
|
}
|
19
src/lib/util/util.sh
Normal file
19
src/lib/util/util.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/hint/bash
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
[[ -z ${DEVTOOLS_INCLUDE_UTIL_UTIL_SH:-} ]] || return 0
|
||||||
|
DEVTOOLS_INCLUDE_UTIL_UTIL_SH=1
|
||||||
|
|
||||||
|
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
||||||
|
|
||||||
|
|
||||||
|
is_tty() {
|
||||||
|
if [ ! -t 1 ] || [ -p /dev/stdout ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [[ $TERM == dumb ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
@@ -102,9 +102,9 @@ mapfile -t files < <(
|
|||||||
printf "\t%s\n" "$temp"/*
|
printf "\t%s\n" "$temp"/*
|
||||||
} >&2 &&
|
} >&2 &&
|
||||||
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
|
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
|
||||||
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${arch}"'.conf" &&
|
makepkg_config="/usr/share/devtools/makepkg-'"${arch}"'.conf" &&
|
||||||
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
|
if [[ -f /usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf ]]; then
|
||||||
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf"
|
makepkg_config="/usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf"
|
||||||
fi &&
|
fi &&
|
||||||
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
|
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
|
||||||
printf "%s\n" "${temp}/PKGBUILD"
|
printf "%s\n" "${temp}/PKGBUILD"
|
||||||
|
@@ -20,6 +20,7 @@ usage() {
|
|||||||
|
|
||||||
COMMANDS
|
COMMANDS
|
||||||
auth Authenticate with services like GitLab
|
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 packge 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
|
||||||
@@ -46,6 +47,14 @@ while (( $# )); do
|
|||||||
usage
|
usage
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
build)
|
||||||
|
_DEVTOOLS_COMMAND+=" $1"
|
||||||
|
shift
|
||||||
|
# shellcheck source=src/lib/build/build.sh
|
||||||
|
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/build/build.sh
|
||||||
|
pkgctl_build "$@"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
repo)
|
repo)
|
||||||
_DEVTOOLS_COMMAND+=" $1"
|
_DEVTOOLS_COMMAND+=" $1"
|
||||||
shift
|
shift
|
||||||
|
@@ -1,114 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
#
|
|
||||||
# This script rebuilds a list of packages in order
|
|
||||||
# and reports anything that fails
|
|
||||||
#
|
|
||||||
# Due to sudo usage, it is recommended to allow makechrootpkg
|
|
||||||
# to be run with NOPASSWD in your sudoers file
|
|
||||||
#
|
|
||||||
# FIXME
|
|
||||||
# Currently uses $(pwd)/rebuilds as the directory for rebuilding...
|
|
||||||
# TODO make this work for community too
|
|
||||||
|
|
||||||
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
|
|
||||||
# shellcheck source=src/lib/common.sh
|
|
||||||
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
|
|
||||||
|
|
||||||
|
|
||||||
if (( $# < 1 )); then
|
|
||||||
printf 'Usage: %s <chrootdir> <packages to rebuild>\n' "$(basename "${BASH_SOURCE[0]}")"
|
|
||||||
printf ' example: %s ~/chroot readline bash foo bar baz\n' "$(basename "${BASH_SOURCE[0]}")"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
|
||||||
# shellcheck source=config/makepkg/x86_64.conf
|
|
||||||
source '/etc/makepkg.conf'
|
|
||||||
else
|
|
||||||
die '/etc/makepkg.conf not found!'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source user-specific makepkg.conf overrides
|
|
||||||
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
|
|
||||||
elif [[ -r "$HOME/.makepkg.conf" ]]; then
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source "$HOME/.makepkg.conf"
|
|
||||||
fi
|
|
||||||
|
|
||||||
bump_pkgrel() {
|
|
||||||
# Get the current pkgrel from git and update the working copy with it
|
|
||||||
# This prevents us from incrementing out of control :)
|
|
||||||
pbuild='.svn/text-base/PKGBUILD.svn-base'
|
|
||||||
oldrel=$(grep 'pkgrel=' $pbuild | cut -d= -f2)
|
|
||||||
|
|
||||||
#remove decimals
|
|
||||||
rel=${oldrel%%.*}
|
|
||||||
|
|
||||||
newrel=$((rel + 1))
|
|
||||||
|
|
||||||
sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_from_pkgbuild() {
|
|
||||||
# we want the sourcing to be done in a subshell so we don't pollute our current namespace
|
|
||||||
export CARCH PKGEXT
|
|
||||||
# shellcheck source=contrib/makepkg/PKGBUILD.proto
|
|
||||||
(source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
|
|
||||||
}
|
|
||||||
|
|
||||||
chrootdir="$1"; shift
|
|
||||||
pkgs=("$@")
|
|
||||||
|
|
||||||
SVNPATH='svn+ssh://repos.archlinux.org/srv/repos/svn-packages/svn'
|
|
||||||
|
|
||||||
msg "Work will be done in %s" "$(pwd)/rebuilds"
|
|
||||||
|
|
||||||
REBUILD_ROOT="$(pwd)/rebuilds"
|
|
||||||
mkdir -p "$REBUILD_ROOT"
|
|
||||||
cd "$REBUILD_ROOT"
|
|
||||||
|
|
||||||
/usr/bin/svn co -N $SVNPATH
|
|
||||||
|
|
||||||
FAILED=""
|
|
||||||
for pkg in "${pkgs[@]}"; do
|
|
||||||
cd "$REBUILD_ROOT/svn-packages"
|
|
||||||
|
|
||||||
msg2 "Building '%s'" "$pkg"
|
|
||||||
/usr/bin/svn update "$pkg"
|
|
||||||
if [[ ! -d "$pkg/trunk" ]]; then
|
|
||||||
FAILED="$FAILED $pkg"
|
|
||||||
warning "%s does not exist in SVN" "$pkg"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
cd "$pkg/trunk/"
|
|
||||||
|
|
||||||
bump_pkgrel
|
|
||||||
|
|
||||||
if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
|
|
||||||
FAILED="$FAILED $pkg"
|
|
||||||
error "%s Failed!" "$pkg"
|
|
||||||
else
|
|
||||||
pkgfile=$(pkg_from_pkgbuild)
|
|
||||||
if [[ -e $pkgfile ]]; then
|
|
||||||
msg2 "%s Complete" "$pkg"
|
|
||||||
else
|
|
||||||
FAILED="$FAILED $pkg"
|
|
||||||
error "%s Failed, no package built!" "$pkg"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
cd "$REBUILD_ROOT"
|
|
||||||
if [[ -n $FAILED ]]; then
|
|
||||||
msg 'Packages failed:'
|
|
||||||
for pkg in $FAILED; do
|
|
||||||
msg2 "%s" "$pkg"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg 'SVN pkgbumps in svn-packages/ - commit when ready'
|
|
Reference in New Issue
Block a user