Compare commits

..

1 Commits

Author SHA1 Message Date
Levente Polyak
93928f7409 wip: version edit 2024-02-16 22:33:59 +01:00
39 changed files with 242 additions and 370 deletions

View File

@@ -8,7 +8,7 @@ build:
stage: build
needs: []
script:
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc
- make PREFIX=/usr
- make PREFIX=/usr DESTDIR=build install
@@ -16,6 +16,6 @@ check:
stage: test
needs: []
script:
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor shellcheck
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc shellcheck
- make check || true
- SHELLCHECK_OPTS="-S error" make check

View File

@@ -92,10 +92,10 @@ $(eval $(call buildInScript,build/bin,src/,.in,755))
$(eval $(call buildInScript,build/lib,src/lib/,,644))
$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,.in,444)))
$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/man/include/footer.asciidoc
$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc
$(GEN_MSG)
@mkdir -p $(BUILDDIR)/doc/man
@asciidoctor --backend=manpage --destination-dir=$(BUILDDIR)/doc/man --attribute pkgdatadir=$(DATADIR) $<
@a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $<
conf:
@install -d $(BUILDDIR)/makepkg.conf.d

View File

@@ -95,7 +95,7 @@ Component: pkgctl db remove
### Development Dependencies
- asciidoctor
- asciidoc
- make
- shellcheck

View File

@@ -42,13 +42,12 @@ CHOST="x86_64-pc-linux-gnu"
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
-fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
-Wl,-z,pack-relative-relocs"
LTOFLAGS="-flto=auto"
RUSTFLAGS="-Cforce-frame-pointers=yes"
RUSTFLAGS=""
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags

View File

@@ -42,13 +42,12 @@ CHOST="x86_64-pc-linux-gnu"
#CPPFLAGS=""
CFLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
-fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
-Wl,-z,pack-relative-relocs"
LTOFLAGS="-flto=auto"
RUSTFLAGS="-Cforce-frame-pointers=yes"
RUSTFLAGS=""
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags

View File

@@ -48,8 +48,8 @@ _pkgctl_build_args=(
'(-o --offload)'{-o,--offload}'[Build on a remote server and transfer artifacts afterwards]'
'(-c --clean)'{-c,--clean}'[Recreate the chroot before building]'
"--inspect[Spawn an interactive shell to inspect the chroot (never, always, failure)]:inspect:($DEVTOOLS_VALID_INSPECT_MODES[*])"
'*'{-I,--install-to-chroot}'[Install a package to the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"'
'*'{-i,--install-to-host}"[Install the built packages to the host system]:mode:($DEVTOOLS_VALID_BUILD_INSTALL[*])"
'(-I --install-to-chroot)'{-I,--install-to-chroot}'[Install a package to the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"'
'(-i --install-to-host)'{-i,--install-to-host}"[Install the built packages to the host system]:mode:($DEVTOOLS_VALID_BUILD_INSTALL[*])"
'(-w --worker)'{-w,--worker}'[Name of the worker slot, useful for concurrent builds (disables auto-detection)]:slot:'
'--nocheck[Do not run the check() function in the PKGBUILD]'
'--pkgver=[Set pkgver, reset pkgrel and update checksums]:pkgver:'
@@ -168,8 +168,8 @@ _pkgctl_search_args=(
_arch_nspawn_args=(
'-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"'
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
'*-c[Set pacman cache]:pacman_cache:_files -/'
'*-f[Copy file from the host to the chroot]:copy_file:_files'
'-c[Set pacman cache]:pacman_cache:_files -/'
'-f[Copy file from the host to the chroot]:copy_file:_files'
'-s[Do not run setarch]'
'-h[Display usage]'
'1:chroot_dir:_files -/'
@@ -211,11 +211,11 @@ _finddeps_args=(
_makechrootpkg_args=(
'-h[Display usage]'
'-c[Clean the chroot before building]'
'*-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/'
'*-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/'
'-d[Bind directory into build chroot as read-write]:bind_dir_rw:_files -/'
'-D[Bind directory into build chroot as read-only]:bind_dir_ro:_files -/'
'-u[Update the working copy of the chroot before building]'
'-r[The chroot dir to use]:chroot_dir:_files -/'
'*-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
'-I[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
'-l[The directory to use as the working copy]:copy_dir:_files -/'
'-n[Run namcap on the package]'
'-T[Build in a temporary directory]'

37
doc/asciidoc.conf Normal file
View File

@@ -0,0 +1,37 @@
## linkman: macro
# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
#
# Usage: linkman:command[manpage-section]
#
# Note, {0} is the manpage section, while {target} is the command.
#
# Show man link as: <command>(<section>); if section is defined, else just show
# the command.
[macros]
(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
[attributes]
asterisk=&#42;
plus=&#43;
caret=&#94;
startsb=&#91;
endsb=&#93;
backslash=&#92;
tilde=&#126;
apostrophe=&#39;
backtick=&#96;
litdd=&#45;&#45;
ifdef::backend-docbook[]
[linkman-inlinemacro]
{0%{target}}
{0#<citerefentry>}
{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
{0#</citerefentry>}
endif::backend-docbook[]
ifdef::backend-xhtml11[]
[linkman-inlinemacro]
<a href="{target}.{0}.html">{target}{0?({0})}</a>
endif::backend-xhtml11[]

View File

@@ -43,6 +43,6 @@ Options
See Also
--------
devtools(7)
linkman:devtools[7]
include::include/footer.asciidoc[]

View File

@@ -38,6 +38,6 @@ Options
See Also
--------
find-libprovides(1)
linkman:find-libprovides[1]
include::include/footer.asciidoc[]

View File

@@ -21,47 +21,47 @@ Programs
The list below gives a short overview; see the respective documentation
for details.
pkgctl(1)
linkman:pkgctl[1]
Unified command-line frontend for devtools
archbuild(1)
linkman:archbuild[1]
Build an Arch Linux package inside a clean chroot
arch-nspawn(1)
linkman:arch-nspawn[1]
Run a command or OS in a light-weight namespace container
checkpkg(1)
linkman:checkpkg[1]
Compare the current build package with the repository version
diffpkg(1)
linkman:diffpkg[1]
Compare package files using different modes
export-pkgbuild-keys(1)
linkman:export-pkgbuild-keys[1]
Export valid source signing keys from a PKGBUILD
find-libdeps(1)
linkman:find-libdeps[1]
Find soname dependencies for a package
find-libprovides(1)
linkman:find-libprovides[1]
Find soname's which are provided by a package
lddd(1)
linkman:lddd[1]
Find broken library links on your system
mkarchroot(1)
linkman:mkarchroot[1]
Creates an arch chroot in a specified location with a specified set of
packages
makechrootpkg(1)
linkman:makechrootpkg[1]
Build a PKGBUILD in a given chroot environment
makerepropkg(1)
linkman:makerepropkg[1]
Rebuild a package to see if it is reproducible
offload-build(1)
linkman:offload-build[1]
Build a PKGBUILD on a remote server using makechrootpkg
sogrep(1)
linkman:sogrep[1]
Find packages using a linked to a given shared library
include::include/footer.asciidoc[]

View File

@@ -20,6 +20,6 @@ collected data is written to a temporary directory created by mktemp.
See Also
--------
ldd(1)
linkman:ldd[1]
include::include/footer.asciidoc[]

View File

@@ -16,7 +16,7 @@ Given the path to a built pacman package(s), attempt to rebuild it using the
PKGBUILD in the current directory. The package will be built in an environment
as closely matching the environment of the initial package as possible, by
building up a chroot to match the information exposed in the package's
BUILDINFO(5) manifest. On success, the resulting package will be
linkman:BUILDINFO[5] manifest. On success, the resulting package will be
compared to the input package, and makerepropkg will report whether the
artifacts are identical.

View File

@@ -44,6 +44,6 @@ Options
See Also
--------
pacman(1)
linkman:pacman[1]
include::include/footer.asciidoc[]

View File

@@ -36,6 +36,6 @@ Options
See Also
--------
pkgctl-db-remove(1)
linkman:pkgctl-db-remove[1]
include::include/footer.asciidoc[]

View File

@@ -32,6 +32,6 @@ pkgctl aur drop-from-repo::
See Also
--------
pkgctl-aur-drop-from-repo(1)
linkman:pkgctl-aur-drop-from-repo[1]
include::include/footer.asciidoc[]

View File

@@ -35,6 +35,6 @@ Options
See Also
--------
pkgctl-auth-status(1)
linkman:pkgctl-auth-status[1]
include::include/footer.asciidoc[]

View File

@@ -27,6 +27,6 @@ Options
See Also
--------
pkgctl-auth-login(1)
linkman:pkgctl-auth-login[1]
include::include/footer.asciidoc[]

View File

@@ -32,7 +32,7 @@ pkgctl auth status::
See Also
--------
pkgctl-auth-login(1)
pkgctl-auth-status(1)
linkman:pkgctl-auth-login[1]
linkman:pkgctl-auth-status[1]
include::include/footer.asciidoc[]

View File

@@ -107,7 +107,7 @@ Options
See Also
--------
pkgctl-release(1)
pkgctl-db-update(1)
linkman:pkgctl-release[1]
linkman:pkgctl-db-update[1]
include::include/footer.asciidoc[]

View File

@@ -1,5 +1,5 @@
pkgctl-db-update(1)
===================
=================
Name
----

View File

@@ -46,6 +46,6 @@ Options
See Also
--------
pkgctl-db-update(1)
linkman:pkgctl-db-update[1]
include::include/footer.asciidoc[]

View File

@@ -46,7 +46,7 @@ Options
See Also
--------
pkgctl-repo-configure(1)
pkgctl-repo-switch(1)
linkman:pkgctl-repo-configure[1]
linkman:pkgctl-repo-switch[1]
include::include/footer.asciidoc[]

View File

@@ -33,8 +33,8 @@ Options
See Also
--------
pkgctl-auth(1)
pkgctl-repo-clone(1)
pkgctl-repo-configure(1)
linkman:pkgctl-auth[1]
linkman:pkgctl-repo-clone[1]
linkman:pkgctl-repo-configure[1]
include::include/footer.asciidoc[]

View File

@@ -50,10 +50,10 @@ pkgctl repo web::
See Also
--------
pkgctl-repo-clone(1)
pkgctl-repo-configure(1)
pkgctl-repo-create(1)
pkgctl-repo-switch(1)
pkgctl-repo-web(1)
linkman:pkgctl-repo-clone[1]
linkman:pkgctl-repo-configure[1]
linkman:pkgctl-repo-create[1]
linkman:pkgctl-repo-switch[1]
linkman:pkgctl-repo-web[1]
include::include/footer.asciidoc[]

View File

@@ -66,6 +66,6 @@ Output Options
See Also
--------
pkgctl-auth(1)
linkman:pkgctl-auth[1]
include::include/footer.asciidoc[]

View File

@@ -28,8 +28,8 @@ required to track version changes from upstream sources.
Configuration
-------------
Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
PKGBUILD. Refer to the configuration section in pkgctl-version(1).
Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
PKGBUILD. Refer to the configuration section in linkman:pkgctl-version[1].
Options
-------
@@ -60,7 +60,7 @@ On exit, return one of the following codes:
See Also
--------
pkgctl-version(1)
nvchecker(1)
linkman:pkgctl-version[1]
linkman:nvchecker[1]
include::include/footer.asciidoc[]

View File

@@ -29,8 +29,8 @@ required to track and implement version changes from upstream sources.
Configuration
-------------
Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
PKGBUILD. Refer to the configuration section in pkgctl-version(1).
Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
PKGBUILD. Refer to the configuration section in linkman:pkgctl-version[1].
Options
-------
@@ -44,7 +44,7 @@ Options
See Also
--------
pkgctl-version(1)
nvchecker(1)
linkman:pkgctl-version[1]
linkman:nvchecker[1]
include::include/footer.asciidoc[]

View File

@@ -15,7 +15,7 @@ Description
Commands related to package versions, including checks for outdated packages.
Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
PKGBUILD.
Configuration
@@ -28,7 +28,7 @@ corresponding package.
For detailed information on the various configuration options available for the
`.nvchecker.toml` file, refer to the configuration files section in
nvchecker(1). This documentation provides insights into the possible
linkman:nvchecker[1]. This documentation provides insights into the possible
options that can be utilized to customize the version checking process.
To supply GitHub or GitLab tokens to nvchecker, a `keyfile.toml` should be
@@ -54,7 +54,7 @@ pkgctl version upgrade::
See Also
--------
pkgctl-version-check(1)
pkgctl-version-upgrade(1)
linkman:pkgctl-version-check[1]
linkman:pkgctl-version-upgrade[1]
include::include/footer.asciidoc[]

View File

@@ -56,14 +56,14 @@ pkgctl version::
See Also
--------
pkgctl-aur(1)
pkgctl-auth(1)
pkgctl-build(1)
pkgctl-db(1)
pkgctl-diff(1)
pkgctl-release(1)
pkgctl-repo(1)
pkgctl-search(1)
pkgctl-version(1)
linkman:pkgctl-aur[1]
linkman:pkgctl-auth[1]
linkman:pkgctl-build[1]
linkman:pkgctl-db[1]
linkman:pkgctl-diff[1]
linkman:pkgctl-release[1]
linkman:pkgctl-repo[1]
linkman:pkgctl-search[1]
linkman:pkgctl-version[1]
include::include/footer.asciidoc[]

View File

@@ -92,19 +92,14 @@ pkgctl_aur_drop_from_repo() {
fi
for path in "${paths[@]}"; do
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
if ! realpath=$(realpath -e "${path}"); then
die "No such directory: ${path}"
fi
# skip paths that are not directories
if [[ ! -d "${realpath}" ]]; then
continue
fi
pkgbase=$(basename "${realpath}")
pkgbase=${pkgbase%.git}
if [[ ! -d "${realpath}/.git" ]]; then
if [[ ! -d "${path}/.git" ]]; then
die "Not a Git repository: ${path}"
fi
@@ -125,6 +120,7 @@ pkgctl_aur_drop_from_repo() {
if [[ $(git symbolic-ref --quiet --short HEAD) == main ]]; then
git branch --move master
git config branch.master.merge refs/heads/master
git remote set-head origin master
fi
# auto generate .SRCINFO if not already present
@@ -141,14 +137,11 @@ pkgctl_aur_drop_from_repo() {
if (( FORCE )); then
AUR_OVERWRITE=1 \
GIT_SSH_COMMAND="ssh -o SendEnv=AUR_OVERWRITE" \
git push --force --no-follow-tags origin master
git push --force origin master
else
git push --no-follow-tags origin master
git push origin master
fi
# update the local default branch in case this clone is used in the future
git remote set-head origin master
if (( DISOWN )); then
msg "Disowning ${pkgbase} on the AUR"
# shellcheck disable=SC2029

View File

@@ -319,10 +319,6 @@ pkgctl_build() {
fi
for path in "${paths[@]}"; do
# skip paths that are not directories
if [[ ! -d "${path}" ]]; then
continue
fi
pushd "${path}" >/dev/null
if [[ ! -f PKGBUILD ]]; then

View File

@@ -1,234 +0,0 @@
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_REBUILD_TODO_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_REBUILD_TODO_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
source /usr/share/makepkg/util/util.sh
# shellcheck source=src/lib/repo/clone.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/clone.sh
# shellcheck source=src/lib/build/build.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/build/build.sh
# shellcheck source=src/lib/release.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
set -e
pkgctl_rebuild_todo_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] URL
Rebuilds packages from a todo list.
OPTIONS
-h, --help Show this help text
-m, --message MSG Use the given <msg> as the commit message
-i, --ignore Give one or more pkgbases to ignore
-f, --maintainer Filter for one or more maintainers (orphan for orphan packages)
-o, --offload Build on a remote server and transfer artifacts afterwards
-e, --edit Edit PKGBUILD before building. Default when todo type is "Task"
-r, --repo REPO Specify a target repository (disables auto-detection)
-s, --staging Release to the staging counterpart of the auto-detected repo
-t, --testing Release to the testing counterpart of the auto-detected repo
-u, --db-update Automatically update the pacman database after uploading
--no-build Don't build PKGBUILD
--no-release Don't run commitpkg after building
EXAMPLES
TODO
_EOF_
}
pkgctl_rebuild_todo() {
if (( $# < 1 )); then
pkgctl_rebuild_todo_usage
exit 1
fi
local URL=""
local REPO=""
local MAINTAINERS=()
local IGNORE_PKGBASES=()
local FILTER_REPOSITORY=("extra")
local DRY_RUN=0
local MESSAGE_SET=0
local NO_RELEASE=0
local NO_BUILD=0
local RELEASE_OPTIONS=("--staging")
local BUILD_OPTIONS=("--staging" "--rebuild")
local packages
# option checking
while (( $# )); do
case $1 in
-h|--help)
pkgctl_rebuild_todo_usage
exit 0
;;
--dry-run)
DRY_RUN=1
shift 1
;;
-f|--maintainer)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAINTAINERS+=("$2")
shift 2
;;
-i|--ignore)
(( $# <= 1 )) && die "missing argument for %s" "$1"
IGNORE_PKGBASES+=("$2")
shift 2
;;
-o|--offload)
BUILD_OPTIONS+=("--offload")
shift
;;
-e|--edit)
BUILD_OPTIONS+=("--edit")
shift
;;
-m|--message)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MESSAGE_SET=1
RELEASE_OPTIONS+=("--message" "$2")
shift 2
;;
-s|--staging)
RELEASE_OPTIONS+=("--staging")
shift
;;
-t|--testing)
RELEASE_OPTIONS+=("--testing")
shift
;;
--no-release)
NO_RELEASE=1
shift
;;
--no-build)
NO_BUILD=1
shift
;;
-*)
die "invalid option: %s" "$1"
;;
*)
if [[ ! "$1" == https* ]]; then
die "Missing url!"
fi
URL="$1"
if [[ ! "$URL" == */ ]]; then
URL+="/"
fi
if [[ ! "$URL" == *json ]]; then
URL+="json"
fi
break
;;
esac
done
# TODO: setup default values for options
while read -r json; do
readarray -t packages < <(jq --slurpfile repo <(printf '"%s" ' "${FILTER_REPOSITORY[@]}") \
--slurpfile maint <(printf '"%s" ' "${MAINTAINERS[@]}") \
-r '.created as $created
| .packages[]
| select(.status_str == "Incomplete" )
| select([.repo] | inside($repo))
| select(($maint[0] == "") or (($maint[0] == "orphan") and .maintainers == []) or (select(.maintainers | any([.] | inside($maint)))))
| "\(.pkgbase)"' \
- <<< "$json" | sort -u)
# This removes any elements we have ignored.... it's not pretty
readarray -t packages < <(comm -1 -3 <(printf "%s\n" "${IGNORE_PKGBASES[@]}" | sort) <(printf "%s\n" "${packages[@]}"| sort))
# Default to include the list name in the commit message
if (( ! MESSAGE_SET )); then
RELEASE_OPTIONS+=("--message" "$(jq -r '.name' - <<< "$json")")
fi
# If we are doing a Task we probably want to edit the PKGBUILD
if [[ "$(jq -r '.kind' - <<< "$json")" == "Task" ]]; then
BUILD_OPTIONS+=("--edit")
fi
done <<< "$(curl -s "$URL")"
if (( DRY_RUN )); then
msg "Would rebuild the following packages:"
msg2 '%s' "${packages[@]}"
msg "by running the following for each:"
if ! ((NO_BUILD)); then
msg2 "pkgctl build ${BUILD_OPTIONS[*]}"
fi
if ! ((NO_RELEASE)); then
msg2 "pkgctl release ${RELEASE_OPTIONS[*]}"
fi
exit 0
fi
if (( 0 == ${#packages[@]} )); then
die "No packages to rebuild!"
fi
msg "Rebuilding the following packages:"
msg2 '%s' "${packages[@]}"
msg "Press [Enter] to continue..."
read <&1
[[ -z ${WORKDIR:-} ]] && setup_workdir
pushd "$WORKDIR" &>/dev/null
# TODO set -j 1 to circumvent bug in repo clone
msg "Clone the pacakges"
if ! pkgctl_repo_clone -j 1 "${packages[@]}"; then
die "error while cloning packages"
fi
for pkg in "${packages[@]}"; do
pushd "$pkg" &>/dev/null
# This should help us figure out if the package is already built
readarray -t pkgs < <(makepkg --packagelist)
if [[ -f ${pkgs[0]} ]]; then
msg "${pkg[0]} has already been rebuilt!"
continue
fi
if ! ((NO_BUILD)); then
SKIP_BUILD=0
while true; do
# TODO: it seems like pkgctl build does not set the exit code correctly if (offload?) build fails
if pkgctl_build "${BUILD_OPTIONS[@]}"; then
break
fi
error "We failed to build! You are in a subshell to fix the build. Exit the shell to build again."
$SHELL || true
read -p "Skip build? [N/y] " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
SKIP_BUILD=1
break
fi
done
if ((SKIP_BUILD)); then
popd &>/dev/null
continue
fi
fi
if ! ((NO_RELEASE)); then
pkgctl_release "${RELEASE_OPTIONS[@]}"
fi
popd &>/dev/null
done
}

View File

@@ -207,14 +207,9 @@ pkgctl_repo_configure() {
fi
for path in "${paths[@]}"; do
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
if ! realpath=$(realpath -e "${path}"); then
die "No such directory: ${path}"
fi
# skip paths that aren't directories
if [[ ! -d "${realpath}" ]]; then
continue
fi
pkgbase=$(basename "${realpath}")
pkgbase=${pkgbase%.git}

View File

@@ -101,21 +101,16 @@ pkgctl_repo_switch() {
fi
for path in "${paths[@]}"; do
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
if ! realpath=$(realpath -e -- "${path}"); then
die "No such directory: ${path}"
fi
# skip paths that are not directories
if [[ ! -d "${realpath}" ]]; then
continue
fi
# skip paths that are not git repositories
if [[ ! -d "${realpath}/.git" ]]; then
pkgbase=$(basename "${realpath}")
if [[ ! -d "${path}/.git" ]]; then
error "Not a Git repository: ${path}"
continue
fi
pkgbase=$(basename "${realpath}")
if ! git -C "${path}" checkout "${GIT_CHECKOUT_OPTIONS[@]}" "${GIT_REF}"; then
die "Failed to switch ${pkgbase} to version ${VERSION}"
fi

View File

@@ -49,6 +49,14 @@ pkgctl_version() {
pkgctl_version_check "$@"
exit $?
;;
edit)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/version/edit.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/edit.sh
pkgctl_version_edit "$@"
exit $?
;;
upgrade)
_DEVTOOLS_COMMAND+=" $1"
shift

View File

@@ -108,10 +108,6 @@ pkgctl_version_check() {
term_spinner_start "${status_dir}"
for path in "${pkgbases[@]}"; do
# skip paths that are not directories
if [[ ! -d "${path}" ]]; then
continue
fi
pushd "${path}" >/dev/null
if [[ ! -f "PKGBUILD" ]]; then

101
src/lib/version/edit.sh Normal file
View File

@@ -0,0 +1,101 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
[[ -z ${DEVTOOLS_INCLUDE_VERSION_CHECK_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_VERSION_CHECK_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/util/term.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/term.sh
source /usr/share/makepkg/util/message.sh
set -eo pipefail
pkgctl_version_edit_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
Compares the versions of packages in the local packaging repository against
their latest upstream versions.
Upon execution, it generates a grouped list that provides detailed insights
into each package's status. For each package, it displays the current local
version alongside the latest version available upstream.
Outputs a summary of up-to-date packages, out-of-date packages, and any
check failures.
OPTIONS
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} neovim vim
_EOF_
}
pkgctl_version_edit() {
local pkgbases=()
local path pkgbase
while (( $# )); do
case $1 in
-h|--help)
pkgctl_version_edit_usage
exit 0
;;
--)
shift
break
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
pkgbases=("$@")
break
;;
esac
done
# Check if used without pkgbases in a packaging directory
if (( ${#pkgbases[@]} == 0 )); then
if [[ -f PKGBUILD ]]; then
pkgbases=(".")
else
pkgctl_version_check_usage
exit 1
fi
fi
# Check if EDITOR or xdg-open are present
if [[ -z ${EDITOR} ]] && ! command -v xdg-open &>/dev/null; then
die "The version edit command requires either \$EDITOR or 'xdg-open'"
fi
for path in "${pkgbases[@]}"; do
pushd "${path}" >/dev/null
if [[ ! -f "PKGBUILD" ]]; then
die "No PKGBUILD found for ${path}"
fi
if [[ ! -f .nvchecker.toml ]]; then
touch .nvchecker.toml
fi
if [[ -n ${EDITOR} ]]; then
"${EDITOR}" .nvchecker.toml
else
xdg-open .nvchecker.toml
fi
popd >/dev/null
done
}

View File

@@ -99,10 +99,6 @@ pkgctl_version_upgrade() {
term_spinner_start "${status_dir}"
for path in "${pkgbases[@]}"; do
# skip paths that aren't directories
if [[ ! -d "${path}" ]]; then
continue
fi
pushd "${path}" >/dev/null
if [[ ! -f "PKGBUILD" ]]; then

View File

@@ -19,16 +19,15 @@ usage() {
Unified command-line frontend for devtools.
COMMANDS
aur Interact with the Arch User Repository
auth Authenticate with services like GitLab
build Build packages inside a clean chroot
db Pacman database modification for package update, move etc
diff Compare package files using different modes
release Release step to commit, tag and upload build artifacts
repo Manage Git packaging repositories and their configuration
search Search for an expression across the GitLab packaging group
rebuild-todo Rebuilds packages from a todo list.
version Check and manage package versions against upstream
aur Interact with the Arch User Repository
auth Authenticate with services like GitLab
build Build packages inside a clean chroot
db Pacman database modification for package update, move etc
diff Compare package files using different modes
release Release step to commit, tag and upload build artifacts
repo Manage Git packaging repositories and their configuration
search Search for an expression across the GitLab packaging group
version Check and manage package versions against upstream
OPTIONS
-h, --help Show this help text
@@ -113,14 +112,6 @@ while (( $# )); do
pkgctl_release "$@"
exit 0
;;
rebuild-todo)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/rebuild-todo.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/rebuild-todo.sh
pkgctl_rebuild_todo "$@"
exit 0
;;
search)
_DEVTOOLS_COMMAND+=" $1"
shift