Commit Graph

1127 Commits

Author SHA1 Message Date
Martchus 8a753d84f2 Add builduser to same groups as on host
This prevents permission errors when relying on a user's group
for accessing certain files (made available within the container
via bind mounts).
2024-03-16 00:45:20 +01:00
Martchus 329cd98df6 Log systemd-nspawn invocation parameters
When debugging it is useful to know what parameters where
used.
2024-03-16 00:45:20 +01:00
Martchus 8f5833a31b Set TERM within the systemd-nspawn container in makechrootpkg
This is required by WINE to prevent
```
unknown: I need something more specific
```
2024-03-16 00:45:20 +01:00
Martchus 4b2e024b61 Adjust systemd-nspawn flags
* Increase maximum number of open files (the default of 1000 is too less
  for some packages)
* Use /etc/resolv.conf from host (otherwise systemd-nspawn uses a config
  which does not work on my host setup)
2024-03-16 00:45:15 +01:00
Kevin Mihelich 67382b2784 makechrootpkg: don't delete MAKEFLAGS and PACKAGER 2024-03-16 00:45:15 +01:00
Kevin Mihelich ed8696be78 archbuild: no setarch 2024-03-16 00:45:15 +01:00
Kevin Mihelich 7895ae5218 makechrootpkg: no default logging 2024-03-16 00:45:15 +01:00
Kevin Mihelich 881c5530bb arch-nspawn: arm fix 2024-03-16 00:45:15 +01:00
Kevin Mihelich 415170d646 makechrootpkg: distcc 2024-03-16 00:45:15 +01:00
Kevin Mihelich 8a97edc9b1 arch-nspawn: keep mirrorlist 2024-03-16 00:45:15 +01:00
Kevin Mihelich 0ed93d467e makechrootpkg: Allow specifying cache dir 2024-03-16 00:45:12 +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
Christian Heusel 36ece44b12
chore(release): version v1.1.0 2024-02-08 01:31:00 +01:00
Levente Polyak fc05ea19d9
fix(build): allow unstable repositories to override repo target
This works around the fact that we are currently not auto detecting
unstable repository targets while providing a stability layer option on
the subcommand. Soften the --repo option rules by allowing unstable
repositories to use that flag for building and releasing against the
unstable repositories.

This will be replaced in the near future by proper integration of target
repository auto-detection that in aware of unstable repositories while
providing a unstable stability layer options.

Component: pkgctl build
Component: pkgctl release
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-08 01:21:40 +01:00
Levente Polyak 3ecba314fc
feat(build): consolidate repo flags in build and release subcommand
Previously the behavior was inconsistent and not fully fulfilling its
purpose of only using --repo once when initially pushing a new and
unknown package to the official repositories.

Consolidate the behavior by only allowing to use --repo during the
initial packaging and disallow any subsequent usage. The expected user
experience is to subsequently use --testing or --staging to influence
the auto-detection of the build target. This avoids any kind of human
error which leads to releasing core packages to extra-testing by
accident.

Furthermore, allow the build subcommand to automatically fallback to
extra as the default stable repository target which greatly improves the
usability for AUR or local override builds.

Fixes #193
Fixes #191

Component: pkgctl build
Component: pkgctl release
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-08 00:52:20 +01:00
Christian Heusel 5042dcaeb4
feat(build): allow to test-install the built packages
This change introduces the new --install-to-host flag to pkgctl build,
which can be used with one of the modes 'all' or 'auto'. Depending on
the mode either all or just already installed packages are installed to
the host system.

BREAKING CHANGE: the --install flag is renamed to --install-to-chroot
to avoid confusion with the newly introduced flag.

Component: pkgctl build
Signed-off-by: Christian Heusel <christian@heusel.eu>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-06 19:38:50 +01:00
Levente Polyak 67fdb58758
feat(search): add status spinner to long running GitLab calls
This helps people to be slightly more patient as the progress status
update includes the current percentage.

Component: pkgctl search
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-02-06 17:37:17 +01:00
Carl Smedstad eabb1a9313
fix(doc): Correct typo in version check error message
Change 'none pkgbase' to 'non-pkgbase' as the sentence refers sections
that are not the pkgbase section, rather than an empty pkgbase section
or something of that sort that could be misconstrued by using the word
'none'.

Component: pkgctl version check
2024-02-05 12:25:18 +01:00
Carl Smedstad a7a2f25fb0
fix(version): Handle pkgbase with '.' correctly
For pkgbases with '.' in the name, the TOML-section must be wrapped in
double quotes in order for it not to be parsed as a supersection and a
subsection. This case was not properly handled by checks for if the
TOML-file contains a pkgbase section, and for if the TOML-file contains
superfluous sections. Address this by handling optional double quotes in
the greps related to said checks.

This was discovered in the AUR package ruby-cool.io and the issue can be
reproduced with the following minimal PKGBUILD and .nvchecker.toml file:

    $ cat PKGBUILD
    pkgname=ruby-cool.io
    pkgver=1.8.0
    $ cat .nvchecker.toml
    ["ruby-cool.io"]
    source = "gems"
    gems = "cool.io"

Before the fix:

    $ pkgctl version check
    Failure
     x ruby-cool.io: missing pkgbase section in .nvchecker.toml: ruby-cool.io

After the fix:

    $ pkgctl version check
    GEN lib/version/check.sh
    Out-of-date
     ✓ ruby-cool.io: current version 1.8.0 is latest

Component: pkgctl version check
2024-02-05 12:25:18 +01:00
Jelle van der Waa 800cf9b56b
fix(version): fix typo never should be newer
Component: pkgctl version check
Component: pkgctl version update
2024-02-05 11:54:55 +01:00
Levente Polyak 4d72f4560c
doc(version): extensively revamp documentation for version subcommands
Enhanced and overhauled the documentation for the 'version' subcommand.
The improvements include comprehensive details on the subcommand's
behavior, usage, and a variety of scenarios it handles.

Added a central section within the pkgctl-version manpage that documents
the nvchecker configuration and rules.

Component: pkgctl version
Singled-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-22 19:45:16 +01:00
Levente Polyak e3edf25554
feat(version): use exit code for check to indicate out-of-date versions
It can be handy to have an exit code that allows better status
indication or chaining.

On exit, return one of the following codes:

- 0: Normal exit condition, all checked versions are up-to-date
- 1: Unknown cause of failure
- 2: Normal exit condition, but there are out-of-date versions
- 3: Failed to run some version checks

Component: pkgctl version check
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-22 19:45:10 +01:00
Levente Polyak b258bb3b7c
feat(version): add verbose option to display up-to-date versions
Sometimes it can be desired to get a results for each entry even if the
current version is up-to-date. Add a --verbose option to print this
optional detail.

Component: pkgctl version check
Component: pkgctl version upgrade
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-22 19:45:04 +01:00
Levente Polyak 08ece1640b
feat(version): add spinner while checking upstream versions
It may take quite some time to check a lot of upstream versions.
However, we still want to nicely group the results together. To avoid
just showing a static status message it makes much more sense to show a
dynamic spinner with a summary of the progress.

Component: pkgctl version check
Component: pkgctl version upgrade
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-22 19:44:57 +01:00
Levente Polyak fedfc80ca1
feat(term): add terminal utils to handle a dynamic spinner
The spinner uses a status file that can be used to dynamically update
the message. The spinner itself buffers the output in a frame buffer
variable before flushing a frame in one go.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-22 19:44:51 +01:00
Levente Polyak 66e83c950c
feat(version): pretty print and group together version check results
Collect all check results in arrays and pretty print the results after
grouping them together based on out-of-date, up-to-date and failures.
Print a summary that shows a brief statistic about the results when
processing multiple check items.

Component: pkgctl version check
Component: pkgctl version upgrade
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-21 23:28:29 +01:00
Levente Polyak 96f39525bf
feat(version): support nvchecker keyfile from user config home
This adds support for global keyfile from the user config home
XDG_CONFIG_HOME which allows to set tokens for GitHub and GitLab for
certain nvchecker configuration.

When ~/.config/nvchecker/keyfile.toml exists, it will automatically be
appended as keyfile of the local .nvchecker.toml file.

Component: pkgctl version check
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-21 23:28:29 +01:00
Levente Polyak 03d5c928cf
fix(version): add error handling to version check subcommand
Add defensive programming to the execution chain of the version check
subcommand for graceful error handling of subprocesses as well as errors
returned from nvchecker itself indicated in the returned JSON.

Furthermore this fixes a bug when processing multiple packages where the
pkgbase variable is stuck for subsequent packages that do not declare a
pkgbase variable itself.

Component: pkgctl version check
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-21 23:28:29 +01:00
Christian Heusel 6054c869e1
feat(upgrade): introduce the version upgrade subcommand
This subcommand applies the detected upstream version upgrades to a
PKGBUILD.

Component: pkgctl version upgrade
Co-authored-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-01-21 23:28:29 +01:00
Christian Heusel 313c5b4d32
chore(check): factor out function to get upstream version
Component: pkgctl version check
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-01-21 23:28:28 +01:00
Christian Heusel db8c157eea
chore(build): factor out functions to modify PKGBUILDs
Component: pkgctl build
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-01-21 23:28:28 +01:00
Levente Polyak 343a2b5d4c
chore(search): correct typo in optional dependency bat 2024-01-18 19:38:42 +01:00
Levente Polyak 7a8f0eb47e
fix(doc): correct typo in optional dependency bat
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-18 03:02:18 +01:00
Jelle van der Waa e6f7aa395f
feat(version): introduce version check subcommand
The version subcommand handles pkgver related commands, the first
subcommand being `check`. Check runs nvchecker if a `.nvchecker.toml`
file exists and compares the current pkgver with the latest release.

Introduces nvchecker as optional dependency which has to be installed in
order to use this particular subcommand.

BREAKING CHANGE: formerly pkgctl version would output the version of the
pkgctl tool, now it is used as a version related subcommand.

Fixes #140

Component: pkgctl version
Component: pkgctl version check
Co-authored-by: Christian Heusel <christian@heusel.eu>
2024-01-10 19:44:15 +01:00
Levente Polyak e413b65df3
fix(build): re-source the PKGBUILD to update changed values
During certain operations like --edit, --pkgver etc the PKGBUILD
may change since last sourced. If a modified checksum of the PKGBUILD
is detected, re-source it before processing.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-10 00:14:20 +01:00
Levente Polyak ef04960b98
feat(build): update srcinfo file after build
The srcinfo file is essentially a representation of the current build
recipes, hence generate an up to date version by adding it as secondary
build artifact to the build process.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-10 00:14:14 +01:00
Levente Polyak d210079037
feat(util): add library function to generate source packages 2024-01-10 00:14:08 +01:00
Levente Polyak b264c7f1c7
feat(util): parallelize srcinfo generation
Heavily improve the runtime of huge split packages, by creating an own
parallelized high level implementation of the makepkg low level building
blocks for srcinfo generation.

This reduces the runtine to generate the srcinfo file for thunderbird
from 24 seconds down to 1 second.
2024-01-10 00:14:01 +01:00
Christian Heusel 2b8033b911
feat(aur): add subcommand to drop a package from the repos to the AUR
Add an aur command to interact with the Arch User Repository including
the drop-from-repo subommand which allows to drop packages from the
official repository to the Arch User Repository in one go.

Related to #143

Component: pkgctl aur drop-from-repo
Co-authored-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Christian Heusel <christian@heusel.eu>
2024-01-09 23:47:45 +01:00
Levente Polyak 8f45c65830
fix(completion): support subcommands that have multiple dashes
Dashes are not supported in function names and underscores were not
automatically translated. Replace all dashes of the current completion
token, if it is an arg which allows subcommands to use underscores
instead of dashes to declare their completion handlers.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-07 19:32:30 +01:00
Levente Polyak d0dc0e1a32
feat(search): add optional plain output formatting
This allows to run the search command without bats, which is not used in
the default pretty output format.

Component: pkgctl search
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-07 02:38:42 +01:00
Levente Polyak 0e538cf498
fix(util): open lock file in append mode to avoid overwriting files
Previously if we opened a lock on an existing file with useful content
we overwrote it with an empty file. This is obviously not desired, hence
open the file handle in append mode preserving its content.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2024-01-07 02:38:34 +01:00