Compare commits

...

18 Commits

Author SHA1 Message Date
Christian Heusel
b095aeee61 wip: pkgctl rebuild-todo 2024-03-19 18:43:05 +01:00
Levente Polyak
01b6b0849e doc(man): fix cut off page names by switching to modern asciidoctor
Asciidoc is the old reference implementation in Python, which has some
shortcoming. Specifically we are hitting cut off page names for long
subcommands. Fix this by switching to a more modern implementation named
asciidoctor.

During the migration, get rid of the explicit asciidoc.conf file that
was required to define a linkman macro, which is now supported out of
the box.

Fixes #170

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-03-09 02:48:14 +01:00
Caleb Maclennan
7033554e45 fix(drop-from-repo): avoid Git trying to push tags to the AUR
If users have enabled push.followTags in their Git config then dropping
packages to the AUR spews errors because all the release tags from
official repos are rejected by AUR repos.
2024-03-09 01:33:56 +01:00
Morten Linderud
40f476c649 fix(pkgctl): skip path arguments that are not directories
Several subcommands accept multiple paths in a way that passing a
wildcard is an expected use case. Previously this wasn't possible if the
main directory contained any text files or scripts.
Fix this by skipping none directory paths for such commands.

Component: pkgctl
Signed-off-by: Morten Linderud <foxboron@archlinux.org>
2024-03-09 00:49:24 +01:00
Levente Polyak
509dd24bdc fix(completion): allow multi opts more than once in zsh
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-29 23:35:29 +01:00
Frederik “Freso” S. Olesen
7a9ef3bc57 feat(makepkg.conf): Add no-omit-frame-pointer flags by default
RFC-26 proposes to add -fno-omit-frame-pointer and
-mno-omit-leaf-frame-pointer to the default compilation flags
to improve the effectiveness of profiling and debugging tools.

See https://rfc.archlinux.page/0026-fno-omit-frame-pointer/
2024-02-29 21:39:22 +01:00
Levente Polyak
354c9dcd12 fix(drop-from-repo): avoid error when updating remote head
We can only update the local ref to the remote head from main to master
once we have actually pushed the master branch to the remote. If we do
this too early, the call will simply error out.

Instead, only update the local head for the configured remote after we
have successfully renamed the branch and pushed it to the AUR.

Fixes #212

Component: pkgctl aur drop-from-repo
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-29 21:20:31 +01:00
Orhun Parmaksız
39eaeaa4b2 feat(offload-build): use rsync instead of scp
This commit simply replaces the usage of `scp` with `rsync`
for faster file transfer.

Signed-off-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2024-02-15 22:23:54 +01:00
kpcyrd
c79a993148 feat(makepkg.conf): Increase _FORTIFY_SOURCE level to 3
RFC: https://rfc.archlinux.page/0017-increase-fortification-level/
2024-02-14 02:08:01 +01:00
Levente Polyak
6d0ac6b9a8 chore(release): version v1.1.1 2024-02-14 01:40:16 +01:00
Levente Polyak
66a4357f3e fix(common): ensure TERM is always set with a fallback to dumb
This avoids some corner cases that some applications behave ill when
TERM is completely unset. Instead, ensure we set TERM to dumb as a
fallback, which should serve better than not having any term defined.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-14 01:28:40 +01:00
Christian Heusel
db2f82bf19 feat(offload-build): preserve the TERM variable
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-02-14 01:28:34 +01:00
Christian Heusel
e0a84aefc3 fix(common): check before using tput with a fallback for colors
The latest release of devtools has included some pretty printing
capabilities and fancy terminal stuff with the spinner and so on.

It seems like the existing safeguards to disable this for incapable
terminals were not enough though, therefore we saw two types of errors:

- offload-build:
  ```
  ==> Building in chroot for [extra] (x86_64)...
  tput: unknown terminal "unknown"
  tput: unknown terminal "unknown"
  tput: unknown terminal "unknown"
  ```
- repro builders:
  ```
  ==> Successfully switched <package> to version <version>
  tput: No value for $TERM and no -T specified
  ERROR: Failed checkout <package>
  ```

The recently included fail option made this error populate to the
command level and therefore increased its impact from a not so nice
logging message to a more severe problem which made the command abort.

We fix this by checking if tput is supported or else use the raw escape
sequences instead of tput commands.

Fixes: fedfc80 ("feat(term): add terminal utils to handle a dynamic spinner")
Fixes: 66e83c9 ("feat(version): pretty print and group together version check results")
Fixes: d0dc0e1 ("feat(search): add optional plain output formatting")
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-02-14 01:21:28 +01:00
Jakub Klinkovský
98bd7e3760 fix(build): explicitly add --nosign when building a srcpkg
We should explicitly instruct makepkg to not sign the source package,
even when the BUILDENV array in makepkg.conf contains 'sign'. The
devtools workflow is to always sign separately from building, which is
different from makepkg and it should not depend on its configuration.

Furthermore, this function is currently used only in offload-build to
collect sources that are transferred to the server before the build
itself. Signing this source package does not provide any benefits.
2024-02-11 13:37:49 +01:00
Christian Heusel
3e79cb8f4a doc: add pacman-contrib to optdeps in the README
We are depending on updpkgsums for the --update-checksums option used in
pkgctl build. Document this requirement.

Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-02-10 20:13:15 +01:00
Levente Polyak
1cf402eae9 fix(build): forward target repo options to the release subcommand
The adequate target repo options are not appropriately forwarded to the
release subcommand if the auto-release options is activated. Previously
we did not restrict the --repo option, which the build option has used
as a shortcut. Since last release, this option is restricted to new
packages that are not in any official repository yet.

Fix this issue by forwarding the same target repo options that have been
used during the build command and not forcefully the --repo options.

Fixes #209

Component: pkgctl build
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-09 20:18:30 +01:00
Levente Polyak
0469d3c902 fix(build): avoid trying to download none existing debug packages
Since last release, offload building now has proper error handling
enabled. This unfortunately lead to a regression for packages, like any
packages, where makepkg claims debug packages are available during
--packagelist while none were actually built. This leads to the scp
command failing when trying to download the none existing packages
which ultimately leads to a termination of the build script.

Fix this by filtering out package files that do not exist before trying
to download them.

Fixes #208

Component: pkgctl build
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-08 22:08:54 +01:00
Christian Heusel
f6b1b1ba45 doc: add curl to the dependencies in the README
We use curl all over pkgctl, i.e. to do the Gitlab API calls.

Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-02-08 02:01:55 +01:00
40 changed files with 403 additions and 144 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 asciidoc
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor
- 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 asciidoc shellcheck
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor shellcheck
- make check || true
- SHELLCHECK_OPTS="-S error" make check

View File

@@ -1,6 +1,6 @@
SHELL=/bin/bash
V=1.1.0
V=1.1.1
BUILDTOOLVER ?= $(V)
PREFIX = /usr/local
@@ -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/asciidoc.conf doc/man/include/footer.asciidoc
$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/man/include/footer.asciidoc
$(GEN_MSG)
@mkdir -p $(BUILDDIR)/doc/man
@a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $<
@asciidoctor --backend=manpage --destination-dir=$(BUILDDIR)/doc/man --attribute pkgdatadir=$(DATADIR) $<
conf:
@install -d $(BUILDDIR)/makepkg.conf.d

View File

@@ -69,6 +69,7 @@ Component: pkgctl db remove
- bash
- binutils
- coreutils
- curl
- diffutils
- fakeroot
- findutils
@@ -90,10 +91,11 @@ Component: pkgctl db remove
- bat (pretty printing)
- nvchecker (version checking)
- pacman-contrib (--update-checksums options for pkgctl build)
### Development Dependencies
- asciidoc
- asciidoctor
- make
- shellcheck

View File

@@ -41,13 +41,14 @@ CHOST="x86_64-pc-linux-gnu"
#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection"
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
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=""
RUSTFLAGS="-Cforce-frame-pointers=yes"
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags

View File

@@ -41,13 +41,14 @@ CHOST="x86_64-pc-linux-gnu"
#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection"
-Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection \
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"
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=""
RUSTFLAGS="-Cforce-frame-pointers=yes"
#-- 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)'{-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[*])"
'*'{-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[*])"
'(-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]'

View File

@@ -1,37 +0,0 @@
## 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
--------
linkman:devtools[7]
devtools(7)
include::include/footer.asciidoc[]

View File

@@ -38,6 +38,6 @@ Options
See Also
--------
linkman:find-libprovides[1]
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.
linkman:pkgctl[1]
pkgctl(1)
Unified command-line frontend for devtools
linkman:archbuild[1]
archbuild(1)
Build an Arch Linux package inside a clean chroot
linkman:arch-nspawn[1]
arch-nspawn(1)
Run a command or OS in a light-weight namespace container
linkman:checkpkg[1]
checkpkg(1)
Compare the current build package with the repository version
linkman:diffpkg[1]
diffpkg(1)
Compare package files using different modes
linkman:export-pkgbuild-keys[1]
export-pkgbuild-keys(1)
Export valid source signing keys from a PKGBUILD
linkman:find-libdeps[1]
find-libdeps(1)
Find soname dependencies for a package
linkman:find-libprovides[1]
find-libprovides(1)
Find soname's which are provided by a package
linkman:lddd[1]
lddd(1)
Find broken library links on your system
linkman:mkarchroot[1]
mkarchroot(1)
Creates an arch chroot in a specified location with a specified set of
packages
linkman:makechrootpkg[1]
makechrootpkg(1)
Build a PKGBUILD in a given chroot environment
linkman:makerepropkg[1]
makerepropkg(1)
Rebuild a package to see if it is reproducible
linkman:offload-build[1]
offload-build(1)
Build a PKGBUILD on a remote server using makechrootpkg
linkman:sogrep[1]
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
--------
linkman:ldd[1]
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
linkman:BUILDINFO[5] manifest. On success, the resulting package will be
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
--------
linkman:pacman[1]
pacman(1)
include::include/footer.asciidoc[]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -50,10 +50,10 @@ pkgctl repo web::
See Also
--------
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]
pkgctl-repo-clone(1)
pkgctl-repo-configure(1)
pkgctl-repo-create(1)
pkgctl-repo-switch(1)
pkgctl-repo-web(1)
include::include/footer.asciidoc[]

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,7 @@ Description
Commands related to package versions, including checks for outdated packages.
Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
Uses 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
linkman:nvchecker[1]. This documentation provides insights into the possible
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
--------
linkman:pkgctl-version-check[1]
linkman:pkgctl-version-upgrade[1]
pkgctl-version-check(1)
pkgctl-version-upgrade(1)
include::include/footer.asciidoc[]

View File

@@ -56,14 +56,14 @@ pkgctl version::
See Also
--------
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]
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)
include::include/footer.asciidoc[]

View File

@@ -92,14 +92,19 @@ pkgctl_aur_drop_from_repo() {
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e "${path}"); then
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${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 "${path}/.git" ]]; then
if [[ ! -d "${realpath}/.git" ]]; then
die "Not a Git repository: ${path}"
fi
@@ -120,7 +125,6 @@ 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
@@ -137,11 +141,14 @@ pkgctl_aur_drop_from_repo() {
if (( FORCE )); then
AUR_OVERWRITE=1 \
GIT_SSH_COMMAND="ssh -o SendEnv=AUR_OVERWRITE" \
git push --force origin master
git push --force --no-follow-tags origin master
else
git push origin master
git push --no-follow-tags 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

@@ -154,6 +154,7 @@ pkgctl_build() {
(( $# <= 1 )) && die "missing argument for %s" "$1"
pkgctl_build_check_option_group_repo '--repo' "${REPO}" "${TESTING}" "${STAGING}"
REPO="${2}"
RELEASE_OPTIONS+=("--repo" "${REPO}")
shift 2
;;
--arch)
@@ -204,11 +205,13 @@ pkgctl_build() {
-s|--staging)
pkgctl_build_check_option_group_repo '--staging' "${REPO}" "${TESTING}" "${STAGING}"
STAGING=1
RELEASE_OPTIONS+=("--staging")
shift
;;
-t|--testing)
pkgctl_build_check_option_group_repo '--testing' "${REPO}" "${TESTING}" "${STAGING}"
TESTING=1
RELEASE_OPTIONS+=("--testing")
shift
;;
-c|--clean)
@@ -316,6 +319,10 @@ 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
@@ -495,7 +502,7 @@ pkgctl_build() {
# release the build
if (( RELEASE )); then
pkgctl_release --repo "${pkgrepo}" "${RELEASE_OPTIONS[@]}"
pkgctl_release "${RELEASE_OPTIONS[@]}"
fi
# reset common PKGBUILD variables

View File

@@ -31,12 +31,21 @@ export PACKAGING_REPO_RELEASE_HOST=repos.archlinux.org
export PKGBASE_MAINTAINER_URL=https://archlinux.org/packages/pkgbase-maintainer
export AUR_URL_SSH=aur@aur.archlinux.org
# ensure TERM is set with a fallback to dumb
export TERM=${TERM:-dumb}
# check if messages are to be printed using color
if [[ -t 2 && "$TERM" != dumb ]] || [[ ${DEVTOOLS_COLOR} == always ]]; then
colorize
PURPLE="$(tput setaf 5)"
DARK_GREEN="$(tput setaf 2)"
UNDERLINE="$(tput smul)"
if tput setaf 0 &>/dev/null; then
PURPLE="$(tput setaf 5)"
DARK_GREEN="$(tput setaf 2)"
UNDERLINE="$(tput smul)"
else
PURPLE="\e[35m"
DARK_GREEN="\e[32m"
UNDERLINE="\e[4m"
fi
else
# shellcheck disable=2034
declare -gr ALL_OFF='' BOLD='' BLUE='' GREEN='' RED='' YELLOW='' PURPLE='' DARK_GREEN='' UNDERLINE=''
@@ -108,7 +117,9 @@ cleanup() {
if [[ -n ${WORKDIR:-} ]] && $_setup_workdir; then
rm -rf "$WORKDIR"
fi
tput cnorm >&2
if tput setaf 0 &>/dev/null; then
tput cnorm >&2
fi
exit "${1:-0}"
}

234
src/lib/rebuild-todo.sh Normal file
View File

@@ -0,0 +1,234 @@
#!/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,9 +207,14 @@ pkgctl_repo_configure() {
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e "${path}"); then
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${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,16 +101,21 @@ pkgctl_repo_switch() {
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e -- "${path}"); then
# resolve symlink for basename
if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
die "No such directory: ${path}"
fi
pkgbase=$(basename "${realpath}")
if [[ ! -d "${path}/.git" ]]; then
# skip paths that are not directories
if [[ ! -d "${realpath}" ]]; then
continue
fi
# skip paths that are not git repositories
if [[ ! -d "${realpath}/.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

@@ -28,7 +28,9 @@ makepkg_source_package() {
export LIBMAKEPKG_SRCINFO_SH=1
write_srcinfo() { print_srcinfo; }
set +e -- -F --source
# explicitly instruct makepkg to not sign the source package, even when
# the BUILDENV array in makepkg.conf contains 'sign'
set +e -- -F --source --nosign
# shellcheck source=/usr/bin/makepkg
source "$(command -v makepkg)"
)

View File

@@ -108,6 +108,10 @@ 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

View File

@@ -99,6 +99,10 @@ 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

@@ -23,6 +23,7 @@ fi
repo=extra
arch=x86_64
server=build.archlinux.org
rsyncopts=(-e ssh -c -h -L --progress --partial -y)
usage() {
cat <<- _EOF_
@@ -99,6 +100,7 @@ mapfile -t files < <(
# shellcheck disable=SC2145
cat "$SRCPKGDEST"/*"$SRCEXT" |
ssh $server '
export TERM="'"${TERM}"'"
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
mkdir -p "$temp" &&
temp=$(mktemp -d -p "$temp") &&
@@ -114,14 +116,16 @@ mapfile -t files < <(
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf"
fi &&
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
while read -r file; do
[[ -f "${file}" ]] && printf "%s\n" "${file}" ||:
done < <(makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist) &&
printf "%s\n" "${temp}/PKGBUILD"
')
if (( ${#files[@]} )); then
printf '%s\n' '' '-> copying files...'
scp "${files[@]/#/$server:}" "${TEMPDIR}/"
rsync "${rsyncopts[@]}" "${files[@]/#/$server:}" "${TEMPDIR}/" || die
mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/"
mv "${TEMPDIR}/PKGBUILD" "${PWD}/"
else

View File

@@ -19,15 +19,16 @@ 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
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
rebuild-todo Rebuilds packages from a todo list.
version Check and manage package versions against upstream
OPTIONS
-h, --help Show this help text
@@ -112,6 +113,14 @@ 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