Compare commits

..

39 Commits

Author SHA1 Message Date
Levente Polyak
aa938224d1 wip getopt 2023-04-17 23:28:25 +02:00
Levente Polyak
02d04a7c43 completion: implemented structured declarative bash completions
This will make it tremendously easier to add arguments, subcommands and
special positional option handling. Instead of the need to code the
nested structure via bash and switch cases, we can simply declare
functions and arrays with the matching names according to the
subcommands or argument labels.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:39 +02:00
Christian Heusel
9860819976 pkgctl: introduce the version subcommand
Related to https://gitlab.archlinux.org/archlinux/devtools/-/issues/125

Closes #125

Signed-off-by: Christian Heusel <christian@heusel.eu>
Co-Authored-By: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:39 +02:00
Levente Polyak
c2271745c4 completion: zsh: allow args even when the command has subcommands
This allows to show arguments on root level of commands that themselves
have subcommands available. Complete those when any - is used in the
completion word.
2023-04-15 23:03:39 +02:00
Levente Polyak
4aaa7e67fd WIP: REMOVE after POC, map community to extra 2023-04-15 23:03:38 +02:00
Levente Polyak
653759343a WIP: set git packaging namespace to bot-test for testing 2023-04-15 23:03:38 +02:00
Levente Polyak
900f675385 config: fixup file permissions to be more strict
Normally the default in Arch is that all home directories are private.
However, this may have been changed locally. To make sure we never
expose secrets, lets use a umask of 0077 when writing the config.

Additionally add some temporary fixup code to migrate the file and
directory permissions of already existing paths.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:38 +02:00
Levente Polyak
9d009de849 build: support nocheck for initial bootstrap builds
Output a warning when this option is used to remind packagers to rebuild
the packages with checks once the bootstrap cycle has been completed.
2023-04-15 23:03:38 +02:00
Levente Polyak
7003aecba1 doc: add dependency declaration to the README.md
This will help to make sure dependencies are explicitly stated and
reflected in the PKGBUILD.
2023-04-15 23:03:38 +02:00
Christian Heusel
6517dd780e config: allow suppying the gitlab token via env var
This would allow to supply the gitlab tokens via the env var
DEVTOOLS_GITLAB_TOKEN and therefore allow users to choose whatever
program they want to fill this env var.

Closes #113

Signed-off-by: Christian Heusel <christian@heusel.eu>
2023-04-15 23:03:38 +02:00
Campbell Jones
f484f9eccb edit: improve editor presence checking
Adds a check for the configured Git editor (git config core.editor) in
both commitpkg and build.sh.

Additionally, instead of blindly executing vi when all other options are
exhausted, remove it instead as it is a none standard installed editor
anyway.

Closes #106

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:38 +02:00
Levente Polyak
3a41c91524 rebuildpkgs: drop legacy script, will be replaced with a smarter UX
Instead of trying to port this ancient script, which doesn't even seem
to work with community, let's instead remove it. We will be adding a
replacement script in pkgctl soon with a smarter and more convenient UX.
2023-04-15 23:03:38 +02:00
Levente Polyak
fbe8028e82 doc: update manpage footer for GitLab and remove static list of maintainers
The list of all maintainers that have worked so far on devtools is
exceeding a sane amount making each manpage convulsed. The authors can
be pulled from GitLab directly without occupying lots of space on every
manpage. We would like to express gratitude to all our maintainers.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:38 +02:00
Levente Polyak
7659b2f6ab gitlab: add project path function to map special chars
Automatic path conversion is limited to GitLab API v4 and will be
removed in the future. It's expected that the caller does the path
conversion on caller side and only passes a valid path to the API within
its limitations.

Hence convert project names to valid paths:
  1. replace single '+' between word boundaries with '-'
  2. replace any other '+' with literal 'plus'
  3. replace any special chars other than '_', '-' and '.' with '-'

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:38 +02:00
Levente Polyak
9f75e17adf repo-configure: automatically determine protocol from packager identity
The remote protocol is automatically determined from the author email
address by choosing SSH for all official packager identities and
read-only HTTPS otherwise.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-04-15 23:03:38 +02:00
Levente Polyak
e21f2085b2 build: command to build packages inside a clean chroot 2023-04-15 23:03:38 +02:00
Levente Polyak
3d4bb4a0b3 commitpkg: error out if the repo is not configured to latest specs
This ensures the repository we try to commit and release from uses the
latest distro specs for its local git config. The check errors out early
before touching anything and prints a recommendation how to update the
repo.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:04:48 +01:00
Levente Polyak
4527874b8e commitpkg: print deprecation warning when executed directly 2023-03-19 22:04:48 +01:00
Levente Polyak
3f7fda02a1 archrelease: print deprecation warning when executed directly 2023-03-19 22:04:48 +01:00
Levente Polyak
52e937a498 test: added pkgctl devel wrapper for convenient development testing
For local development testing, there is a convenience wrapper for
`pkgctl` that will automatically build the project using make and proxy
all calls to the local build directory.

Either `./test/bin/pkgctl` can be run directly or the `test/bin`
directory can be added to the PATH.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:04:48 +01:00
Levente Polyak
38a56a056a archrelease: add checks for valid remote and up-to-date branch ref
It's safest to probe for the validity of the remote origin and abort
early otherwise. This also allows to print some hints how to create or
configure new repositories at appropriate times.
Additionally fetch remote changes and check the local branch contains
the remote branch ref, otherwise abort and print a hint how to pull and
update the branch.

This should add all check needed for the average failure case that may
lead to a weird state or creation of a local tag that may not be
pushable.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:04:48 +01:00
Levente Polyak
bf64b5750c build: replace m4 defines with sed scripts during build
There is no reason anymore to use m4 since we got rid of the includes by
using library files. Let's replace the last usage of m4 and completely
red rid of it.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:04:47 +01:00
Levente Polyak
199c0dffcc conf: move makepkg and pacman config into separate conf.d dirs
We have used the datadir like a kitchen sink, lets clean up a bit by
having a better and well structured layout. Put makepkg and pacman
configs in separate directories: makepkg.conf.d and pacman.conf.d.
2023-03-19 22:04:47 +01:00
Levente Polyak
8d46f05c1f release: command to commit, tag and upload build artifacts
This is a smart and more convenient invocation of the classical
commitpkg and archrelease with auto-discovery for target repositories
and a shorthand option to directly call db-update.
2023-03-19 22:04:47 +01:00
Levente Polyak
a90f2074ee git: convert repos and tags config to new repo layout 2023-03-19 22:04:47 +01:00
Levente Polyak
3ea2367693 db: command for Pacman database modification like update, move etc 2023-03-19 22:04:47 +01:00
Levente Polyak
8569687ced commitpkg: add exported pgp keys with git 2023-03-19 22:04:47 +01:00
Levente Polyak
8202b3aed6 repo: added command to create a new packaging repository 2023-03-19 22:04:47 +01:00
Levente Polyak
9922beb1df auth: implemented module to authenticate against our GitLab
This helps to have a convenient way to manage and test our personal
GitLab tokens. Those are used for certain API calls like creating new
repositories.
2023-03-19 22:04:47 +01:00
Levente Polyak
cd6eb29035 gitlab: implemented module for required API calls
We need to use API calls as we can't create repositories in protected
namespaces by simply pushing a none existing repository. For privacy
reasons this is limited to private personal repositories in GitLab.
2023-03-19 22:04:47 +01:00
Levente Polyak
f8ca042b0f config: implemented simple config module to store token and settings 2023-03-19 22:04:47 +01:00
Levente Polyak
83a0587bc5 src: modularize repo layout into a library
This will greatly help us to structure the functionality and commands in
a more sane way. We will distribute the sources as actual libraries and
reuse code with imports instead of processing everything with m4 and
duplicating a lot of code.
2023-03-19 22:04:47 +01:00
Levente Polyak
4e82d313c6 pkgctl: add a unified command-line frontend for devtools
This is the first step of a simple and highly structured unified
interface to devtools commands in a single wrapper.

The split is based on groups like `repo`, `build` and `diff`

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
a5cc17a61f pkgrepo: add subcommand to open the packaging repository's website
This can be quite handy if a packager quickly wants to check the GitLab
page for merge requests or but reports. Quickly calling a cli command
inside the current packaging clone or with the pkgname provided will
open the remote location inside the browser.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
080bef6012 pkgrepo: add option to clone all existing packages
This can be very handy for cache warming on the repo server or
to perform mass operations on all PKGBUILDs.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
ea47d22c20 pkgrepo: rename archco as a general purpose tool for packaging repos
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
727fba8eb4 commitpkg: use library location for common server and remote properties
It makes a lot of sense to have them in a central place that can be
swapped and also re-used across different execution units. Hence lets
move the repos.archlinux.org host to lib/common.sh

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
126d99ac9a archco: add option to clone all packages of a maintainer
Query Archweb to retrieve a list of all packages of a maintainer by
their pkgbase. AFterwards loop through all packages and clone them.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
Levente Polyak
79eb6680dd archco: implement clone and configure subcommands
Manages Git packaging repositories and helps with their configuration
according to distro specs.

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.

The configure command can be used to synchronize the distro specs and
makepkg.conf settings for previously cloned repositories.

The unprivileged option can be used for cloning packaging repositories
without SSH access using read-only HTTPS.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-19 22:02:05 +01:00
68 changed files with 233 additions and 2341 deletions

View File

@@ -1,6 +1,6 @@
SHELL=/bin/bash
V=1.0.2
V=20230307
BUILDTOOLVER ?= $(V)
PREFIX = /usr/local
@@ -17,7 +17,6 @@ LIBRARY = $(addprefix $(BUILDDIR)/,$(patsubst src/%,%,$(patsubst %.in,%,$(LIBRAR
MAKEPKG_CONFIGS=$(wildcard config/makepkg/*)
PACMAN_CONFIGS=$(wildcard config/pacman/*)
SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*)
INIT_SCRIPTS = $(wildcard config/init.d/*)
MANS = $(addprefix $(BUILDDIR)/,$(patsubst %.asciidoc,%,$(wildcard doc/man/*.asciidoc)))
COMMITPKG_LINKS = \
@@ -33,16 +32,12 @@ COMMITPKG_LINKS = \
gnome-unstablepkg
ARCHBUILD_LINKS = \
core-testing-x86_64-build \
core-testing-x86_64_v3-build \
core-staging-x86_64-build \
core-staging-x86_64_v3-build \
extra-x86_64-build \
extra-x86_64_v3-build \
extra-testing-x86_64-build \
extra-testing-x86_64_v3-build \
extra-staging-x86_64-build \
extra-staging-x86_64_v3-build \
testing-x86_64-build \
testing-x86_64_v3-build \
staging-x86_64-build \
staging-x86_64_v3-build \
multilib-build \
multilib-testing-build \
multilib-staging-build \
@@ -90,7 +85,6 @@ endef
$(eval $(call buildInScript,build/bin,src/,.in,755))
$(eval $(call buildInScript,build/lib,src/lib/,,644))
$(eval $(call buildInScript,build/init.d,config/init.d/,,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
@@ -102,8 +96,6 @@ conf:
@install -d $(BUILDDIR)/makepkg.conf.d $(BUILDDIR)/pacman.conf.d
@cp -a $(MAKEPKG_CONFIGS) $(BUILDDIR)/makepkg.conf.d
@cp -a $(PACMAN_CONFIGS) $(BUILDDIR)/pacman.conf.d
@install -d $(BUILDDIR)/init.d
@cp -a $(INIT_SCRIPTS) $(BUILDDIR)/init.d
clean:
rm -rf $(BUILDDIR)
@@ -113,19 +105,16 @@ install: all
install -dm0755 $(DESTDIR)$(DATADIR)/setarch-aliases.d
install -dm0755 $(DESTDIR)$(DATADIR)/makepkg.conf.d
install -dm0755 $(DESTDIR)$(DATADIR)/pacman.conf.d
install -dm0755 $(DESTDIR)$(DATADIR)/init.d
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
install -dm0755 $(DESTDIR)$(DATADIR)/lib
cp -ra $(BUILDDIR)/lib/* $(DESTDIR)$(DATADIR)/lib
for conf in $(notdir $(MAKEPKG_CONFIGS)); do install -Dm0644 $(BUILDDIR)/makepkg.conf.d/$$conf $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done
for conf in $(notdir $(PACMAN_CONFIGS)); do install -Dm0644 $(BUILDDIR)/pacman.conf.d/$$conf $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done
for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(DATADIR)/setarch-aliases.d; done
for f in $(notdir ${INIT_SCRIPTS}); do install -m0644 $(BUILDDIR)/init.d/$$f -t $(DESTDIR)$(DATADIR)/init.d; done
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 $(BUILDDIR)/contrib/completion/bash/devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
for f in $(notdir $(BINPROGS)); do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done
install -Dm0644 $(BUILDDIR)/contrib/completion/zsh/_devtools $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
for manfile in $(MANS); do \
install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \
@@ -134,15 +123,12 @@ install: all
uninstall:
for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
for f in $(notdir $(LIBRARY)); do rm -f $(DESTDIR)$(DATADIR)/lib/$$f; done
rm -rf $(DESTDIR)$(DATADIR)/lib
for conf in $(notdir $(MAKEPKG_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/makepkg.conf.d/$${conf##*/}; done
for conf in $(notdir $(PACMAN_CONFIGS)); do rm -f $(DESTDIR)$(DATADIR)/pacman.conf.d/$${conf##*/}; done
for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(DATADIR)/setarch-aliases.d/$$f; done
for f in $(notdir $(INIT_SCRIPTS)); do rm -f $(DESTDIR)$(DATADIR)/init.d/$$f; done
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$f; done
rm -f $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
for manfile in $(notdir $(MANS)); do rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile}; done;
@@ -150,22 +136,22 @@ uninstall:
$(DESTDIR)$(DATADIR)/setarch-aliases.d \
$(DESTDIR)$(DATADIR)/makepkg.conf.d \
$(DESTDIR)$(DATADIR)/pacman.conf.d \
$(DESTDIR)$(DATADIR)/lib \
$(DESTDIR)$(DATADIR)
TODAY=$(shell date +"%Y%m%d")
tag:
@echo "current version: v$(V)"
@read -r -p "tag version: v" VERSION && \
sed -E "s|^V=.+|V=$$VERSION|" -i Makefile && \
git commit --gpg-sign --message "chore(release): version v$$VERSION" Makefile && \
git tag --sign --message "Version v$$VERSION" v$$VERSION
release: dist
glab release create v$(RELEASE) devtools-$(RELEASE).tar.gz*
@sed -E "s|^V=[0-9]{8}|V=$(TODAY)|" -i Makefile
@git commit --gpg-sign --message "Version $(TODAY)" Makefile
@git tag --sign --message "Version $(TODAY)" $(TODAY)
dist:
git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip > devtools-$(V).tar.gz
gpg --detach-sign --use-agent devtools-$(V).tar.gz
upload:
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
shellcheck $^

View File

@@ -34,7 +34,7 @@ will automatically build the project and proxy all calls to the local build dire
## Dependencies
### Runtime Dependencies
### Runtime
- arch-install-scripts
- awk
@@ -43,22 +43,20 @@ will automatically build the project and proxy all calls to the local build dire
- coreutils
- diffutils
- findutils
- fzf
- grep
- jq
- ncurses
- openssh
- parallel
- rsync
- sed
- systemd
- util-linux
- bzr
- git
- mercurial
- subversion
### Development Dependencies
### Development
- asciidoc
- make

View File

@@ -1,22 +0,0 @@
function pkgctl {
local cmd cmd_file code
cmd_file=$(mktemp --tmpdir "pkgctl.outcmd.XXXXXXXXXX")
if PKGCTL_OUTCMD="${cmd_file}" command pkgctl "$@"; then
cmd=$(<"$cmd_file")
command rm -f "$cmd_file"
eval "$cmd"
else
code=$?
command rm -f "$cmd_file"
return "$code"
fi
}
#\builtin alias pkgctl=__pkgctl
# =============================================================================
#
# To initialize pkgctl, add this to your configuration (usually ~/.zshrc):
#
# eval "$(pkgctl init bash)"

View File

@@ -1,28 +0,0 @@
# This script was automatically generated by pkgctl
# This function starts pkgctl and executes the command
# it produces, if any.
# It's needed because some shell commands, like `cd`,
# have no useful effect if executed in a subshell.
function pkgctl {
local cmd cmd_file code
cmd_file=$(mktemp --tmpdir "pkgctl.outcmd.XXXXXXXXXX")
if PKGCTL_OUTCMD="${cmd_file}" command pkgctl "$@"; then
cmd=$(<"$cmd_file")
command rm -f "$cmd_file"
eval "$cmd"
else
code=$?
command rm -f "$cmd_file"
return "$code"
fi
}
#\builtin alias pkgctl=__pkgctl
#\compdef __pkgctl=pkgctl
# =============================================================================
#
# To initialize pkgctl, add this to your configuration (usually ~/.zshrc):
#
# eval "$(pkgctl init zsh)"

View File

@@ -1,95 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = x86_64_v3 x86_64
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
NoProgressBar
# We cannot check disk space from within a chroot environment
#CheckSpace
VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-staging]
Include = /etc/pacman.d/mirrorlist
[core-testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-staging]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -1,95 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
NoProgressBar
# We cannot check disk space from within a chroot environment
#CheckSpace
VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-staging]
Include = /etc/pacman.d/mirrorlist
[core-testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-staging]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -1,89 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
NoProgressBar
# We cannot check disk space from within a chroot environment
#CheckSpace
VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -1,89 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = x86_64_v3 x86_64
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
NoProgressBar
# We cannot check disk space from within a chroot environment
#CheckSpace
VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[core-testing]
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
#[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[extra]
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[core-testing]
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
#[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[extra]
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -73,16 +73,19 @@ LocalFileSigLevel = Optional
[gnome-unstable]
Include = /etc/pacman.d/mirrorlist
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
[extra]
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -73,16 +73,19 @@ LocalFileSigLevel = Optional
[kde-unstable]
Include = /etc/pacman.d/mirrorlist
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
[extra]
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -70,24 +70,27 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-staging]
[staging]
Include = /etc/pacman.d/mirrorlist
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-staging]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community-staging]
Include = /etc/pacman.d/mirrorlist
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
[multilib-staging]

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
[extra]
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[core-testing]
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
#[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[extra]
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,

View File

@@ -70,24 +70,27 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-staging]
[staging]
Include = /etc/pacman.d/mirrorlist
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-staging]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community-staging]
Include = /etc/pacman.d/mirrorlist
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]

View File

@@ -70,24 +70,27 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-staging]
[staging]
Include = /etc/pacman.d/mirrorlist
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-staging]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
[community-staging]
Include = /etc/pacman.d/mirrorlist
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
[extra]
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -70,16 +70,19 @@ LocalFileSigLevel = Optional
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
[core-testing]
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra-testing]
[extra]
Include = /etc/pacman.d/mirrorlist
[extra]
[community-testing]
Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for

View File

@@ -135,7 +135,6 @@ _pkgctl_cmds=(
release
repo
version
workspace
)
_pkgctl_args=(
-V --version
@@ -169,7 +168,6 @@ _pkgctl_build_args=(
-t --testing
-o --offload
-c --clean
-w --worker
--pkgver
--pkgrel
@@ -184,8 +182,6 @@ _pkgctl_build_args=(
)
_pkgctl_build_args__arch_opts() { _devtools_completions_arch; }
_pkgctl_build_args__repo_opts() { _devtools_completions_repo; }
_pkgctl_build_args__worker_opts() { :; }
_pkgctl_build_args_w_opts() { _pkgctl_build_args__worker_opts; }
_pkgctl_build_args__pkgver_opts() { :; }
_pkgctl_build_args__pkgrel_opts() { :; }
_pkgctl_build_args__message_opts() { :; }
@@ -259,37 +255,24 @@ _pkgctl_repo_cmds=(
clone
configure
create
switch
web
)
_pkgctl_repo_clone_args=(
-m --maintainer
--protocol
--switch
-u --unprivileged
--universe
-j --jobs
-h --help
)
_pkgctl_repo_clone_args__maintainer_opts() { :; }
_pkgctl_repo_clone_args_m_opts() { _pkgctl_repo_clone_args__maintainer_opts; }
_pkgctl_repo_clone_args__protocol_opts() { _devtools_completions_protocol; }
_pkgctl_repo_clone_args__switch_opts() { :; }
_pkgctl_repo_clone_args__jobs_opts() { :; }
_pkgctl_repo_clone_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
_pkgctl_repo_clone_opts() { _devtools_completions_all_packages; }
_pkgctl_repo_configure_args=(
--protocol
-j --jobs
-h --help
)
_pkgctl_repo_configure_args__protocol_opts() { _devtools_completions_protocol; }
_pkgctl_repo_configure_args__jobs_opts() { :; }
_pkgctl_repo_configure_args_j_opts() { _pkgctl_repo_clone_args__jobs_opts; }
_pkgctl_repo_configure_opts() { _filedir -d; }
@@ -299,127 +282,12 @@ _pkgctl_repo_create_args=(
)
_pkgctl_repo_switch_args=(
--discard-changes
-f --force
-h --help
)
_pkgctl_repo_switch_opts() {
local subcommand args
subcommand=(repo switch)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
:
elif (( args >= 1 )); then
_filedir -d;
fi
}
_pkgctl_repo_web_args=(
-h --help
)
_pkgctl_repo_web_opts() { _filedir -d; }
_pkgctl_workspace_cmds=(
add
cd
list
remove
show
switch
)
_pkgctl_workspace_add_args=(
-f --force
-s --switch
-c --cd
-h --help
)
_pkgctl_workspace_add_opts() {
local subcommand args
subcommand=(workspace add)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
:
elif (( args == 1 )); then
_filedir -d;
fi
}
_pkgctl_workspace_cd_args=(
-h --help
)
_pkgctl_workspace_cd_opts() {
local subcommand args
subcommand=(workspace cd)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
_devtools_completions_all_workspaces
fi
}
_pkgctl_workspace_list_args=(
-n --name
-p --path
-l --local
-h --help
)
_pkgctl_workspace_remove_args=(
-h --help
)
_pkgctl_workspace_remove_opts() {
local subcommand args
subcommand=(workspace remove)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
_devtools_completions_local_workspaces
fi
}
_pkgctl_workspace_show_args=(
-n --name
-p --path
-h --help
)
_pkgctl_workspace_show_opts() {
local subcommand args
subcommand=(workspace show)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
_devtools_completions_all_workspaces
fi
}
_pkgctl_workspace_switch_args=(
-i --interactive
-c --cd
-h --help
)
_pkgctl_workspace_switch_opts() {
local subcommand args
subcommand=(workspace switch)
args=$(__pkgctl_word_count_after_subcommand "${subcommand[@]}")
if (( args == 0 )); then
_devtools_completions_all_workspaces
fi
}
_pkgctl_diff_args=(
-l --list
-d --diffoscope
@@ -465,15 +333,6 @@ _devtools_completions_build_repo() {
_devtools_completions_all_packages() {
mapfile -t COMPREPLY < <(compgen -W "$(pacman -Sql)" -- "$cur")
}
_devtools_completions_all_workspaces() {
mapfile -t COMPREPLY < <(compgen -W "$(pkgctl workspace list --name)" -- "$cur")
}
_devtools_completions_local_workspaces() {
mapfile -t COMPREPLY < <(compgen -W "$(pkgctl workspace list --local --name)" -- "$cur")
}
_devtools_completions_protocol() {
mapfile -t COMPREPLY < <(compgen -W "https" -- "$cur")
}
__devtools_complete() {
local service=$1

View File

@@ -42,7 +42,6 @@ _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]'
'(-I --install)'{-I,--install}'[Install a package into the working copy of the chroot]:target:_files -g "*.pkg.tar.*(.)"'
'(-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:'
'--pkgrel=[Set pkgrel to a given value]:pkgrel:'
@@ -95,30 +94,17 @@ _pkgctl_repo_cmds=(
"clone[Clone a package repository]"
"configure[Configure a clone according to distro specs]"
"create[Create a new GitLab package repository]"
"switch[Switch a package repository to a specified version]"
"web[Open the packaging repository's website]"
)
_pkgctl_repo_switch_args=(
'(-f --force --discard-changes)'{-f,--force,--discard-changes}'[Discard changes if index or working tree is dirty]'
'(-h --help)'{-h,--help}'[Display usage]'
'1:version'
'*:git_dir:_files -/'
)
_pkgctl_repo_clone_args=(
'(-m --maintainer=)'{-m,--maintainer=}'[Clone all packages of the named maintainer]:maintainer:'
'--protocol[Clone the repository over https]:proto:(https)'
'--switch=[Switch the current working tree to a specified version]'
'--universe[Clone all existing packages, useful for cache warming]'
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
'(-h --help)'{-h,--help}'[Display usage]'
'*:packages:_devtools_completions_all_packages'
)
_pkgctl_repo_configure_args=(
'--protocol[Configure remote url to use https]:proto:(https)'
'(-j --jobs)'{-j,--jobs}'[Run up to N jobs in parallel (default: number of processing units)]:jobs:'
'(-h --help)'{-h,--help}'[Display usage]'
'*:git_dir:_files -/'
)
@@ -134,56 +120,6 @@ _pkgctl_repo_web_args=(
'*:git_dir:_files -/'
)
_pkgctl_workspace_cmds=(
"pkgctl workspace command"
"add[TODO a]"
"cd[TODO a]"
"list[TODO a]"
"remove[TODO a]"
"show[TODOa a]"
"switch[TODO a]"
)
_pkgctl_workspace_add_args=(
'(-f --force)'{-f,--force}'[TODO name]'
'(-s --switch)'{-s,--switch}'[TODO path]'
'(-c --cd)'{-c,--cd}'[TODO path]'
'(-h --help)'{-h,--help}'[Display usage]'
'1:workspace'
'2:path:_files -/'
)
_pkgctl_workspace_cd_args=(
'(-h --help)'{-h,--help}'[Display usage]'
'1:workspace:_devtools_completions_all_workspaces'
)
_pkgctl_workspace_list_args=(
'(-n --name)'{-n,--name}'[TODO name]'
'(-p --path)'{-p,--path}'[TODO path]'
'(-l --local)'{-l,--local}'[TODO path]'
'(-h --help)'{-h,--help}'[Display usage]'
)
_pkgctl_workspace_remove_args=(
'(-h --help)'{-h,--help}'[Display usage]'
'1:workspace:_devtools_completions_local_workspaces'
)
_pkgctl_workspace_show_args=(
'(-n --name)'{-n,--name}'[TODO name]'
'(-p --path)'{-p,--path}'[TODO path]'
'(-h --help)'{-h,--help}'[Display usage]'
'1:workspace:_devtools_completions_all_workspaces'
)
_pkgctl_workspace_switch_args=(
'(-i --interactive)'{-i,--interactive}'[TODO]'
'(-c --cd)'{-c,--cd}'[TODO]'
'(-h --help)'{-h,--help}'[Display usage]'
'1:workspace:_devtools_completions_all_workspaces'
)
_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(.)"'
@@ -287,18 +223,6 @@ _devtools_completions_all_packages() {
compadd - "${(@)packages}"
}
_devtools_completions_all_workspaces() {
typeset -U workspaces
workspaces=($(_call_program workspaces pkgctl workspace list --name))
compadd - "${(@)workspaces}"
}
_devtools_completions_local_workspaces() {
typeset -U local_workspaces
local_workspaces=($(_call_program local_workspaces pkgctl workspace list --local --name))
compadd - "${(@)local_workspaces}"
}
_pkgctl_cmds=(
"pkgctl command"
"auth[Authenticate with services like GitLab]"
@@ -308,7 +232,6 @@ _pkgctl_cmds=(
"release[Release step to commit, tag and upload build artifacts]"
"repo[Manage Git packaging repositories and their configuration]"
"version[Show pkgctl version information]"
"workspace[TODO]"
)
_pkgctl_args=(

View File

@@ -1,5 +1,5 @@
diffpkg(1)
==========
===========
Name
----

View File

@@ -1,5 +1,5 @@
makerepropkg(1)
===============
================
Name
----

View File

@@ -1,5 +1,5 @@
mkarchroot(1)
=============
==============
Name
----

View File

@@ -1,40 +0,0 @@
pkgctl-auth-login(1)
====================
Name
----
pkgctl-auth-login - Authenticate with the GitLab instance
Synopsis
--------
pkgctl auth login [OPTIONS]
Description
-----------
Interactively authenticate with the GitLab instance.
The minimum required scopes for the token are: 'api', 'write_repository'.
The GitLab API token can either be stored in a plaintext file in
'$XDG_CONFIG_HOME/devtools/gitlab.conf', or supplied via the
'DEVTOOLS_GITLAB_TOKEN' environment variable using any command (gpg, vault,
password manager) by declaring a shell alias:
$ alias pkgctl='DEVTOOLS_GITLAB_TOKEN="$(command to obtain token)" pkgctl'
Options
-------
*-g, --gen-access-token*::
Open the URL to generate a new personal access token
*-h, --help*::
Show a help text
See Also
--------
linkman:pkgctl-auth-status[1]
include::include/footer.asciidoc[]

View File

@@ -1,32 +0,0 @@
pkgctl-auth-status(1)
=====================
Name
----
pkgctl-auth-status - View authentication status
Synopsis
--------
pkgctl auth status [OPTIONS]
Description
-----------
Verifies and displays information about your authentication state of
services like the GitLab instance and reports issues if any.
Options
-------
*-t, --show-token*::
Display the auth token
*-h, --help*::
Show a help text
See Also
--------
linkman:pkgctl-auth-login[1]
include::include/footer.asciidoc[]

View File

@@ -1,38 +0,0 @@
pkgctl-auth(1)
==============
Name
----
pkgctl-auth - Authenticate with serivces like GitLab.
Synopsis
--------
pkgctl auth [OPTIONS] [SUBCOMMAND]
Description
-----------
Manage the authorization for the GitLab instance and show its current status.
Options
-------
*-h, --help*::
Show a help text
Subcommands
-----------
pkgctl auth login::
Authenticate with the GitLab instance
pkgctl auth status::
View authentication status
See Also
--------
linkman:pkgctl-auth-login[1]
linkman:pkgctl-auth-status[1]
include::include/footer.asciidoc[]

View File

@@ -38,12 +38,6 @@ Build Options
*-I, --install* 'FILE'::
Install a package into the working copy of the chroot
*-w, --worker* 'SLOT'::
Name of the worker slot, useful for concurrent builds. By default the slot
is automatically assigned to the current tty pts number. In case the caller
is not a tty, choose a random slot between 1 and number of available
processing units.
*--nocheck*::
Do not run the check() function in the PKGBUILD
@@ -66,9 +60,7 @@ Release Options
---------------
*-r, --release*::
Automatically commit, tag and release after building +
Specifying this option is required when using any of the following options
in this section
Automatically commit, tag and release after building
*-m, --message* 'MSG'::
Use the given <msg> as the commit message

View File

@@ -1,5 +1,5 @@
pkgctl-repo-clone(1)
====================
======================
Name
----
@@ -25,21 +25,9 @@ Options
*-m, --maintainer* 'NAME'::
Clone all packages of the named maintainer
*--protocol* 'https'::
Clone the repository over https
*--universe*::
Clone all existing packages, useful for cache warming
*--switch* 'VERSION'::
Switch to a specified version. The working tree and the index are updated to
match the version.
*-j, --jobs* 'N'::
Run up to N jobs in parallel. By default the number of jobs is equal to the
number of available processing units. For sequential processing this option
needs to be passed with 1.
*-h, --help*::
Show a help text
@@ -47,6 +35,5 @@ See Also
--------
linkman:pkgctl-repo-configure[1]
linkman:pkgctl-repo-switch[1]
include::include/footer.asciidoc[]

View File

@@ -25,14 +25,6 @@ read-only HTTPS otherwise.
Options
-------
*--protocol* 'https'::
Configure remote url to use https
*-j, --jobs* 'N'::
Run up to N jobs in parallel. By default the number of jobs is equal to the
number of available processing units. For sequential processing this option
needs to be passed with 1.
*-h, --help*::
Show a help text

View File

@@ -1,5 +1,5 @@
pkgctl-repo-create(1)
=====================
======================
Name
----

View File

@@ -1,36 +0,0 @@
pkgctl-repo-switch(1)
=====================
Name
----
pkgctl-repo-switch - Switch a package repository to a specified version
Synopsis
--------
pkgctl repo switch [OPTIONS] [VERSION] [PKGBASE]...
Description
-----------
Switch a package source repository to a specified version, tag or branch.
The working tree and the index are updated to match the specified ref.
If a version identifier is specified in the pacman version format, that
identifier is automatically translated to the Git tag name accordingly.
The current working directory is used if no PKGBASE is specified.
Options
-------
*--discard-changes*::
Proceed even if the index or the working tree differs from HEAD. Both the
index and working tree are restored to match the switching target.
*-f, --force*::
An alias for '--discard-changes'.
*-h, --help*::
Show a help text
include::include/footer.asciidoc[]

View File

@@ -1,5 +1,5 @@
pkgctl-repo(1)
==============
================
Name
----
@@ -41,9 +41,6 @@ pkgctl repo configure::
pkgctl repo create::
Create a new GitLab package repository
pkgctl repo switch::
Switch a package repository to a specified version
pkgctl repo web::
Open the packaging repository's website
@@ -53,7 +50,6 @@ 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]
include::include/footer.asciidoc[]

46
opts.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
# NOTE: This requires GNU getopt
if ! ARGS=$(getopt --options vdm:D: \
--long verbose,debug,memory:,debugfile: \
--name 'pkgctl foo' -- "$@"); then
exit 1
fi
eval set -- "$ARGS"
echo "${ARGS}"
while (( $# )); do
case "$1" in
-v | --verbose ) echo verbose; shift ;;
-d | --debug ) echo debug; shift ;;
-m | --memory ) echo "memory=$2"; shift 2 ;;
-D | --debugfile ) echo "debugfile=$2"; shift 2 ;;
--)
echo --
shift
break
;;
-*)
echo "invalid argument: %s" "$1"
exit 1
;;
*)
echo STAR "$1"
shift
;;
esac
done
echo main
if (( ! $# )); then
echo missing positional param: version
exit 1
fi
version=$1
shift
echo "version $version"
echo "$@"

View File

@@ -32,9 +32,6 @@ usage() {
exit 1
}
# save all args for check_root
orig_args=("$@")
while getopts 'hC:M:c:f:s' arg; do
case "$arg" in
C) pac_conf="$OPTARG" ;;
@@ -49,7 +46,7 @@ done
shift $((OPTIND - 1))
(( $# < 1 )) && die 'You must specify a directory.'
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
check_root
working_dir=$(readlink -f "$1")
shift 1

View File

@@ -50,7 +50,7 @@ pacman_config="@pkgdatadir@/pacman.conf.d/${repo}.conf"
if [[ -f @pkgdatadir@/pacman.conf.d/${repo}-${arch}.conf ]]; then
pacman_config="@pkgdatadir@/pacman.conf.d/${repo}-${arch}.conf"
fi
makepkg_config="@pkgdatadir@/makepkg.conf.d/${arch}.conf"
makepkg_config="@pkgdatadir@/makepkg.conf.d${arch}.conf"
if [[ -f @pkgdatadir@/makepkg.conf.d/${repo}-${arch}.conf ]]; then
makepkg_config="@pkgdatadir@/makepkg.conf.d/${repo}-${arch}.conf"
fi
@@ -74,7 +74,7 @@ while getopts 'hcr:' arg; do
esac
done
check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME "${BASH_SOURCE[0]}" "$@"
check_root SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER,GNUPGHOME
# Pass all arguments after -- right to makepkg
makechrootpkg_args+=("${@:$OPTIND}")

View File

@@ -89,6 +89,7 @@ if git tag --verify "$gittag" &> /dev/null; then
exit 0
fi
msg "Releasing package"
stat_busy "Releasing package"
git tag --sign --message="Package release ${pkgver}" "$gittag" || abort
git push --tags --set-upstream origin main || abort
stat_done

View File

@@ -129,10 +129,6 @@ done
# assert that they really are controlled by git
if (( ${#needsversioning[*]} )); then
for file in "${needsversioning[@]}"; do
# skip none existing files
if [[ ! -f "${file}" ]]; then
continue
fi
if ! git ls-files --error-unmatch "$file"; then
die "%s is not under version control" "$file"
fi
@@ -177,15 +173,7 @@ done
# check for PKGBUILD standards
check_pkgbuild_validity
# auto generate .SRCINFO if present
if [[ -f .SRCINFO ]]; then
stat_busy 'Generating .SRCINFO'
makepkg --printsrcinfo > .SRCINFO
git add .SRCINFO
stat_done
fi
if [[ -n $(git status --porcelain --untracked-files=no) ]]; then
if [[ -n $(git status --short --untracked-files=no) ]]; then
stat_busy 'Staging files'
for f in $(git ls-files --modified); do
git add "$f"

View File

@@ -215,8 +215,7 @@ diff_pkgs() {
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
local -a diffoptions
diffoptions=("${DIFFOPTIONS[@]}" --label "${oldpkg}" --label "${newpkg}")
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/old"
@@ -237,7 +236,7 @@ diff_pkgs() {
# Resolve dynamic auto width one we know the content to diff
if [[ $DIFFWIDTH == --width=auto ]]; then
AUTOLENGTH=$(file_diff_columns "$TMPDIR/old" "$TMPDIR/new")
diffoptions+=("--width=${AUTOLENGTH}")
DIFFOPTIONS+=("--width=${AUTOLENGTH}")
fi
# Print a header for side-by-side view as it lacks labels
@@ -245,7 +244,7 @@ diff_pkgs() {
printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
fi
diff "${diffoptions[@]}" "$TMPDIR/old" "$TMPDIR/new"
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
fi
if (( DIFFOSCOPE )); then

View File

@@ -81,25 +81,15 @@ gitlab_api_get_user() {
return 0
}
# Convert arbitrary project names to GitLab valid path names.
#
# GitLab has several limitations on project and group names and also maintains
# a list of reserved keywords as documented on their docs.
# https://docs.gitlab.com/ee/user/reserved_names.html
#
# 1. replace single '+' between word boundaries with '-'
# 2. replace any other '+' with literal 'plus'
# 3. replace any special chars other than '_', '-' and '.' with '-'
# 4. replace consecutive '_-' chars with a single '-'
# 5. replace 'tree' with 'unix-tree' due to GitLab reserved keyword
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' \
| sed -E 's/[_\-]{2,}/-/g' \
| sed -E 's/^tree$/unix-tree/g'
| sed -E 's/[^a-zA-Z0-9_\-\.]/-/g'
}
gitlab_api_create_project() {

View File

@@ -4,19 +4,18 @@
:
# shellcheck disable=2034
CHROOT_VERSION='v5'
CHROOT_VERSION='v4'
##
# usage : check_root $keepenv
##
orig_argv=("${BASH_SOURCE[0]}" "$@")
check_root() {
local keepenv=$1
shift
local orig_argv=("$@")
(( EUID == 0 )) && return
if type -P sudo >/dev/null; then
exec sudo --preserve-env="${keepenv}" -- "${orig_argv[@]}"
exec sudo --preserve-env=$keepenv -- "${orig_argv[@]}"
else
exec su root -c "$(printf ' %q' "${orig_argv[@]}")"
fi

View File

@@ -23,13 +23,9 @@ pkgctl_auth_login_usage() {
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS]
Interactively authenticate with the GitLab instance.
Authenticate with the GitLab instance.
The minimum required scopes for the token are: 'api', 'write_repository'.
The GitLab API token can either be stored in a plaintext file, or
supplied via the DEVTOOLS_GITLAB_TOKEN environment variable using a
vault, see pkgctl-auth-login(1) for details.
The minimum required scopes for the token are: "api", "write_repository".
OPTIONS
-g, --gen-access-token Open the URL to generate a new personal access token
@@ -63,17 +59,13 @@ pkgctl_auth_login() {
esac
done
personal_access_token_url="https://${GITLAB_HOST}/-/profile/personal_access_tokens?name=pkgctl+token&scopes=api,write_repository"
personal_access_token_url="https://${GITLAB_HOST}/-/profile/personal_access_tokens"
cat <<- _EOF_
Logging into ${BOLD}${GITLAB_HOST}${ALL_OFF}
Tip: you can generate a Personal Access Token here ${personal_access_token_url}
The minimum required scopes are 'api' and 'write_repository'.
If you do not want to store the token in a plaintext file, you can abort
the following prompt and supply the token via the DEVTOOLS_GITLAB_TOKEN
environment variable using a vault, see pkgctl-auth-login(1) for details.
_EOF_
if (( GEN_ACESS_TOKEN )); then

View File

@@ -16,8 +16,6 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
# shellcheck source=src/lib/valid-repos.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
# shellcheck source=src/lib/valid-tags.sh
@@ -27,7 +25,6 @@ source /usr/share/makepkg/util/config.sh
source /usr/share/makepkg/util/message.sh
set -e
set -o pipefail
pkgctl_build_usage() {
@@ -50,7 +47,6 @@ pkgctl_build_usage() {
-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
-w, --worker SLOT Name of the worker slot, useful for concurrent builds (disables automatic names)
--nocheck Do not run the check() function in the PKGBUILD
PKGBUILD OPTIONS
@@ -127,8 +123,9 @@ pkgctl_build() {
local RELEASE_OPTIONS=()
local MAKEPKG_OPTIONS=()
local WORKER=
local WORKER_SLOT=
local PTS
PTS="$(tty | sed 's|/dev/pts/||')"
local WORKER="${USER}-${PTS}"
# variables
local path pkgbase pkgrepo source
@@ -227,11 +224,6 @@ pkgctl_build() {
DB_UPDATE=1
shift
;;
-w|--worker)
(( $# <= 1 )) && die "missing argument for %s" "$1"
WORKER_SLOT=$2
shift 2
;;
--)
shift
break
@@ -246,16 +238,6 @@ pkgctl_build() {
esac
done
# check if any release specific options were specified without releasing
if (( ! RELEASE )); then
if (( DB_UPDATE )); then
die "cannot use --db-update without --release"
fi
if [[ -n "${MESSAGE}" ]]; then
die "cannot use --message without --release"
fi
fi
# check if invoked without any path from within a packaging repo
if (( ${#paths[@]} == 0 )); then
if [[ -f PKGBUILD ]]; then
@@ -266,12 +248,6 @@ pkgctl_build() {
fi
fi
# assign default worker slot
if [[ -z ${WORKER_SLOT} ]] && ! WORKER_SLOT="$(tty | sed 's|/dev/pts/||')"; then
WORKER_SLOT=$(( RANDOM % $(nproc) + 1 ))
fi
WORKER="${USER}-${WORKER_SLOT}"
# Update pacman cache for auto-detection
if [[ -z ${REPO} ]]; then
update_pacman_repo_cache
@@ -280,8 +256,6 @@ pkgctl_build() {
die "Invalid repository target: %s" "${REPO}"
fi
enter_workspace
for path in "${paths[@]}"; do
pushd "${path}" >/dev/null
@@ -302,10 +276,15 @@ pkgctl_build() {
die 'failed to get pacman repo'
fi
if [[ -z "${pkgrepo}" ]]; then
die 'unknown repo, specify --repo for packages not currently in any official repo'
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"
@@ -327,9 +306,8 @@ pkgctl_build() {
fi
# print gathered build modes
msg2 " repo: ${pkgrepo}"
msg2 " arch: ${BUILD_ARCH[*]}"
msg2 "worker: ${WORKER}"
msg2 "repo: ${pkgrepo}"
msg2 "arch: ${BUILD_ARCH[*]}"
# increment pkgrel on rebuild
if (( REBUILD )); then
@@ -399,8 +377,18 @@ pkgctl_build() {
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 "${pkgrepo}" -- "${BUILD_OPTIONS[@]}" -- "${MAKECHROOT_OPTIONS[@]}" -l "${WORKER}" -- "${MAKEPKG_OPTIONS[@]}"
offload-build --repo "${offload_tool}" -- "${BUILD_OPTIONS[@]}" -- "${MAKECHROOT_OPTIONS[@]}" -l "${WORKER}" -- "${MAKEPKG_OPTIONS[@]}"
else
"${BUILDTOOL}" "${BUILD_OPTIONS[@]}" -- "${MAKECHROOT_OPTIONS[@]}" -l "${WORKER}" -- "${MAKEPKG_OPTIONS[@]}"
fi

View File

@@ -22,15 +22,15 @@ export BUILDTOOLVER=@buildtoolver@
# Set common properties
export PACMAN_KEYRING_DIR=/etc/pacman.d/gnupg
export GITLAB_HOST=gitlab.archlinux.org
export GIT_REPO_SPEC_VERSION=1
export GIT_PACKAGING_NAMESPACE=archlinux/packaging/packages
export GIT_PACKAGING_NAMESPACE_ID=11323
export GIT_PACKAGING_URL_SSH="git@${GITLAB_HOST}:${GIT_PACKAGING_NAMESPACE}"
export GIT_REPO_SPEC_VERSION=0
export GIT_PACKAGING_NAMESPACE=bot-test/packages
export GIT_PACKAGING_NAMESPACE_ID=11233
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 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
if [[ -t 2 && "$TERM" != dumb ]] || [[ ${DEVTOOLS_COLOR} == always ]]; then
if [[ -t 2 && "$TERM" != dumb ]]; then
colorize
else
# shellcheck disable=2034

View File

@@ -34,12 +34,8 @@ load_devtools_config() {
save_devtools_config() {
# temporary permission fixup
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
chmod 700 "${XDG_DEVTOOLS_DIR}"
chmod 600 "${XDG_DEVTOOLS_GITLAB_CONFIG}"
(
umask 0077
mkdir -p "${XDG_DEVTOOLS_DIR}"

View File

@@ -25,7 +25,7 @@ pkgctl_db_remove_usage() {
EXAMPLES
$ ${COMMAND} core-testing libfoo libbar
$ ${COMMAND} --arch x86_64 core libyay
$ ${COMMAND} core --arch x86_64 libyay
_EOF_
}

View File

@@ -1,58 +0,0 @@
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_INIT_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_INIT_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
set -e
pkgctl_init_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [SHELL]
TODO
eval "\$(pkgctl init bash)"
OPTIONS
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} clone libfoo linux libbar
_EOF_
}
pkgctl_init() {
if (( $# < 1 )); then
pkgctl_init_usage
exit 0
fi
# option checking
while (( $# )); do
case $1 in
-h|--help)
pkgctl_init_usage
exit 0
;;
zsh)
cat "${_DEVTOOLS_LIBRARY_DIR}"/init.d/init.zsh
shift
;;
bash)
cat "${_DEVTOOLS_LIBRARY_DIR}"/init.d/init.bash
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
die "invalid command: %s" "$1"
;;
esac
done
}

View File

@@ -10,8 +10,6 @@ _DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/db/update.sh
# shellcheck source=src/lib/util/pacman.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/util/pacman.sh
# shellcheck source=src/lib/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
# shellcheck source=src/lib/valid-repos.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/valid-repos.sh
@@ -132,8 +130,6 @@ pkgctl_release() {
die "Invalid repository target: %s" "${REPO}"
fi
enter_workspace
for path in "${PKGBASES[@]}"; do
pushd "${path}" >/dev/null
pkgbase=$(basename "${path}")
@@ -149,6 +145,11 @@ pkgctl_release() {
fi
fi
# TODO: REMOVE AFTER POC
if [[ ${repo} == community ]]; then
repo=extra
fi
if (( TESTING )); then
repo="${repo}-testing"
elif (( STAGING )); then

View File

@@ -27,11 +27,9 @@ pkgctl_repo_usage() {
without SSH access using read-only HTTPS.
COMMANDS
cd Change current working directory into the repository
clone Clone a package repository
configure Configure a clone according to distro specs
create Create a new GitLab package repository
switch Switch a package repository to a specified version
web Open the packaging repository's website
OPTIONS
@@ -42,7 +40,6 @@ pkgctl_repo_usage() {
$ ${COMMAND} clone --maintainer mynickname
$ ${COMMAND} configure *
$ ${COMMAND} create libfoo
$ ${COMMAND} switch 2:1.19.5-1 libfoo
$ ${COMMAND} web linux
_EOF_
}
@@ -60,14 +57,6 @@ pkgctl_repo() {
pkgctl_repo_usage
exit 0
;;
cd)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/repo/cd.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/cd.sh
pkgctl_repo_cd "$@"
exit 0
;;
clone)
_DEVTOOLS_COMMAND+=" $1"
shift
@@ -92,14 +81,6 @@ pkgctl_repo() {
pkgctl_repo_create "$@"
exit 0
;;
switch)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/repo/switch.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/switch.sh
pkgctl_repo_switch "$@"
exit 0
;;
web)
_DEVTOOLS_COMMAND+=" $1"
shift

View File

@@ -1,63 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_REPO_CD_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_REPO_CD_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
set -e
pkgctl_repo_cd_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
OPTIONS
-h, --help Show this help text
EXAMPLES
$ ${COMMAND}
_EOF_
}
pkgctl_repo_cd() {
# options
local pkgbase
# variables
local path
local workspace
while (( $# )); do
case $1 in
-h|--help)
pkgctl_repo_cd_usage
exit 0
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
pkgbase=$1
break
;;
esac
done
if [[ -z ${PKGCTL_OUTCMD} ]]; then
die "setup shell"
fi
workspace=$(get_active_workspace_name)
path=$(get_workspace_path_from_name "${workspace}")
printf "builtin cd -- %s\n" "${path}/${pkgbase}" >> "${PKGCTL_OUTCMD}"
}

View File

@@ -12,8 +12,6 @@ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/api/gitlab.sh
# shellcheck source=src/lib/repo/configure.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/configure.sh
# shellcheck source=src/lib/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
@@ -28,22 +26,18 @@ pkgctl_repo_clone_usage() {
Clone Git packaging repositories from the canonical namespace.
The configure command is subsequently invoked to synchronize the distro
specs and makepkg.conf settings. The protocol option can be used
specs and makepkg.conf settings. The unprivileged option can be used
for cloning packaging repositories without SSH access using read-only
HTTPS.
OPTIONS
-m, --maintainer=NAME Clone all packages of the named maintainer
--protocol https Clone the repository over https
--switch VERSION Switch the current working tree to a specified version
--universe Clone all existing packages, useful for cache warming
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} libfoo linux libbar
$ ${COMMAND} --maintainer mynickname
$ ${COMMAND} --switch 1:1.0-2 libfoo
_EOF_
}
@@ -57,13 +51,10 @@ pkgctl_repo_clone() {
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
local CLONE_ALL=0
local MAINTAINER=
local VERSION=
local CONFIGURE_OPTIONS=()
local jobs=
jobs=$(nproc)
local pkgbases
# variables
local command=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
local project_path
while (( $# )); do
@@ -72,21 +63,11 @@ pkgctl_repo_clone() {
pkgctl_repo_clone_usage
exit 0
;;
--protocol=https)
-u|--unprivileged)
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
CONFIGURE_OPTIONS+=("$1")
shift
;;
--protocol)
(( $# <= 1 )) && die "missing argument for %s" "$1"
if [[ $2 == https ]]; then
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
else
die "unsupported protocol: %s" "$2"
fi
CONFIGURE_OPTIONS+=("$1" "$2")
shift 2
;;
-m|--maintainer)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAINTAINER="$2"
@@ -96,28 +77,10 @@ pkgctl_repo_clone() {
MAINTAINER="${1#*=}"
shift
;;
--switch)
(( $# <= 1 )) && die "missing argument for %s" "$1"
# shellcheck source=src/lib/repo/switch.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/switch.sh
VERSION="$2"
shift 2
;;
--switch=*)
# shellcheck source=src/lib/repo/switch.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/repo/switch.sh
VERSION="${1#*=}"
shift
;;
--universe)
CLONE_ALL=1
shift
;;
-j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2
shift 2
;;
--)
shift
break
@@ -163,43 +126,16 @@ pkgctl_repo_clone() {
stat_done
fi
# parallelization
if [[ ${jobs} != 1 ]] && (( ${#pkgbases[@]} > 1 )); then
# force colors in parallel if parent process is colorized
if [[ -n ${BOLD} ]]; then
export DEVTOOLS_COLOR=always
fi
# assign command options
if [[ -n "${VERSION}" ]]; then
command+=" --switch '${VERSION}'"
fi
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${pkgbases[@]}"; then
die 'Failed to clone some packages, please check the output'
exit 1
fi
exit 0
fi
enter_workspace
for pkgbase in "${pkgbases[@]}"; do
if [[ ! -d ${pkgbase} ]]; then
msg "Cloning ${pkgbase} ..."
project_path=$(gitlab_project_name_to_path "${pkgbase}")
remote_url="${GIT_REPO_BASE_URL}/${project_path}.git"
if ! git clone --origin origin "${remote_url}" "${pkgbase}"; then
die 'failed to clone %s' "${pkgbase}"
fi
git clone --origin origin "${remote_url}" "${pkgbase}"
else
warning "Skip cloning ${pkgbase}: Directory exists"
fi
pkgctl_repo_configure "${CONFIGURE_OPTIONS[@]}" "${pkgbase}"
if [[ -n "${VERSION}" ]]; then
pkgctl_repo_switch "${VERSION}" "${pkgbase}"
fi
done
leave_workspace
}

View File

@@ -33,12 +33,10 @@ pkgctl_repo_configure_usage() {
read-only HTTPS otherwise.
OPTIONS
--protocol https Configure remote url to use https
-j, --jobs N Run up to N jobs in parallel (default: $(nproc))
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} *
$ ${COMMAND} configure *
_EOF_
}
@@ -95,13 +93,9 @@ pkgctl_repo_configure() {
local GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_HTTPS}
local official=0
local proto=https
local proto_force=0
local jobs=
jobs=$(nproc)
local paths=()
# variables
local -r command=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
local path realpath pkgbase remote_url project_path
local PACKAGER GPGKEY packager_name packager_email
@@ -111,24 +105,6 @@ pkgctl_repo_configure() {
pkgctl_repo_configure_usage
exit 0
;;
--protocol=https)
proto_force=1
shift
;;
--protocol)
(( $# <= 1 )) && die "missing argument for %s" "$1"
if [[ $2 == https ]]; then
proto_force=1
else
die "unsupported protocol: %s" "$2"
fi
shift 2
;;
-j|--jobs)
(( $# <= 1 )) && die "missing argument for %s" "$1"
jobs=$2
shift 2
;;
--)
shift
break
@@ -167,10 +143,8 @@ pkgctl_repo_configure() {
fi
if is_packager_email_official "${packager_email}"; then
official=1
if (( ! proto_force )); then
proto=ssh
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
fi
proto=ssh
GIT_REPO_BASE_URL=${GIT_PACKAGING_URL_SSH}
fi
fi
@@ -183,21 +157,10 @@ pkgctl_repo_configure() {
msg2 "protocol: ${YELLOW}${proto}${ALL_OFF}"
fi
# parallelization
if [[ ${jobs} != 1 ]] && (( ${#paths[@]} > 1 )); then
if [[ -n ${BOLD} ]]; then
export DEVTOOLS_COLOR=always
fi
if ! parallel --bar --jobs "${jobs}" "${command}" ::: "${paths[@]}"; then
die 'Failed to configure some packages, please check the output'
exit 1
fi
exit 0
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e "${path}"); then
die "No such directory: ${path}"
error "No such directory: ${path}"
continue
fi
pkgbase=$(basename "${realpath}")
@@ -205,7 +168,8 @@ pkgctl_repo_configure() {
msg "Configuring ${pkgbase}"
if [[ ! -d "${path}/.git" ]]; then
die "Not a Git repository: ${path}"
error "Not a Git repository: ${path}"
continue
fi
pushd "${path}" >/dev/null
@@ -217,7 +181,7 @@ pkgctl_repo_configure() {
fi
# move the master branch to main
if [[ $(git symbolic-ref --quiet --short HEAD) == master ]]; then
if [[ $(git symbolic-ref --short HEAD) == master ]]; then
git branch --move main
git config branch.main.merge refs/heads/main
fi

View File

@@ -1,119 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_REPO_SWITCH_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_REPO_SWITCH_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
# shellcheck source=src/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_repo_switch_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [VERSION] [PKGBASE]...
Switch a package source repository to a specified version, tag or
branch. The working tree and the index are updated to match the
specified ref.
If a version identifier is specified in the pacman version format, that
identifier is automatically translated to the Git tag name accordingly.
The current working directory is used if no PKGBASE is specified.
OPTIONS
--discard-changes Discard changes if index or working tree is dirty
-f, --force An alias for --discard-changes
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} 1.14.6-1 gopass gopass-jsonapi
$ ${COMMAND} --force 2:1.19.5-1
$ ${COMMAND} main
_EOF_
}
pkgctl_repo_switch() {
if (( $# < 1 )); then
pkgctl_repo_switch_usage
exit 0
fi
# options
local VERSION
local GIT_REF
local GIT_CHECKOUT_OPTIONS=()
local paths path realpath pkgbase
while (( $# )); do
case $1 in
-h|--help)
pkgctl_repo_switch_usage
exit 0
;;
-f|--force|--discard-changes)
GIT_CHECKOUT_OPTIONS+=("--force")
shift
;;
--)
shift
break
;;
-*)
# - is special to switch back to previous version
if [[ $1 != - ]]; then
die "invalid argument: %s" "$1"
fi
;;&
*)
if [[ -n ${VERSION} ]]; then
break
fi
VERSION=$1
shift
;;
esac
done
if [[ -z ${VERSION} ]]; then
error "missing positional argument 'VERSION'"
pkgctl_repo_switch_usage
exit 1
fi
GIT_REF="$(get_tag_from_pkgver "${VERSION}")"
paths=("$@")
# check if invoked without any path from within a packaging repo
if (( ${#paths[@]} == 0 )); then
if [[ -f PKGBUILD ]]; then
paths=(".")
else
die "Not a package repository: $(realpath -- .)"
fi
fi
for path in "${paths[@]}"; do
if ! realpath=$(realpath -e -- "${path}"); then
die "No such directory: ${path}"
fi
pkgbase=$(basename "${realpath}")
if [[ ! -d "${path}/.git" ]]; then
error "Not a Git repository: ${path}"
continue
fi
if ! git -C "${path}" checkout "${GIT_CHECKOUT_OPTIONS[@]}" "${GIT_REF}"; then
die "Failed to switch ${pkgbase} to version ${VERSION}"
fi
msg "Successfully switched ${pkgbase} to version ${VERSION}"
done
}

View File

@@ -26,7 +26,7 @@ pkgctl_repo_web_usage() {
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} linux
$ ${COMMAND} web linux
_EOF_
}
@@ -78,7 +78,6 @@ pkgctl_repo_web() {
fi
for pkgbase in "${pkgbases[@]}"; do
path=$(gitlab_project_name_to_path "${pkgbase}")
xdg-open "${GIT_PACKAGING_URL_HTTPS}/${path}"
xdg-open "${GIT_PACKAGING_URL_HTTPS}/${pkgbase}"
done
}

View File

@@ -14,8 +14,7 @@ _repos=(
# shellcheck disable=2034
_build_repos=(
core-staging core-testing
extra extra-staging extra-testing
extra staging testing
multilib multilib-staging multilib-testing
gnome-unstable
kde-unstable

View File

@@ -1,107 +0,0 @@
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
set -e
pkgctl_workspace_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [COMMAND] [OPTIONS]
Manage package workspace locations and settings
COMMANDS
add Add a new workspace
cd Change into the directory of the workspace
list, ls List availiable workspaces
remove, rm Remove a workspace
show Show details about a workspace
switch Switch the current worspace
OPTIONS
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} workspace show
$ ${COMMAND} workspace list
$ ${COMMAND} workspace add test --cd
_EOF_
}
pkgctl_workspace() {
if (( $# < 1 )); then
pkgctl_workspace_usage
exit 0
fi
# option checking
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_usage
exit 0
;;
add)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/add.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/add.sh
pkgctl_workspace_add "$@"
exit 0
;;
cd)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/cd.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/cd.sh
pkgctl_workspace_cd "$@"
exit 0
;;
list|ls)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/list.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/list.sh
pkgctl_workspace_list "$@"
exit 0
;;
remove|rm)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/remove.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/remove.sh
pkgctl_workspace_remove "$@"
exit 0
;;
show)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/show.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/show.sh
pkgctl_workspace_show "$@"
exit 0
;;
switch)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace/switch.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/switch.sh
pkgctl_workspace_switch "$@"
exit 0
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
die "invalid command: %s" "$1"
;;
esac
done
}

View File

@@ -1,124 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_ADD_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_ADD_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_add_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] NAME [PATH]
TODO
OPTIONS
-f, --force Overwrite if the workspace already exists
-s, --switch Switch to the new workspace
-c, --cd Change the current working directory
-h, --help Show this help text
EXAMPLES
$ ${COMMAND} aur
$ ${COMMAND} --force foobar ~/packages
_EOF_
}
pkgctl_workspace_add() {
if (( $# < 1 )); then
pkgctl_workspace_add_usage
exit 0
fi
# options
local force=0
local switch=0
local change_cwd=0
local name
local path
# variables
local full_path
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_add_usage
exit 0
;;
-c|--cd)
# shellcheck source=src/lib/workspace/cd.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/cd.sh
change_cwd=1
shift
;;
-s|--switch)
# shellcheck source=src/lib/workspace/switch.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/switch.sh
switch=1
shift
;;
-f|--force)
force=1
shift
;;
--)
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
if [[ -n ${name} ]]; then
path=$1
break;
fi
name=$1
shift
;;
esac
done
# path fallback inside XDG workspace dir
if [[ -z ${path} ]]; then
path=${name}
fi
if (( ! force )) && get_workspace_path_from_name "${name}" &>/dev/null; then
die "cannot create workspce '%s': Workspace already exists" "${name}"
fi
# TODO: xdg shorthand needs to be resolved into path
# TODO: detect relative paths (no leading /)
full_path=$(get_absolute_workspace_path "${path}")
if ! mkdir -p "${full_path}"; then
die "failed to create workspace path %s" "${full_path}"
fi
if ! [[ -w ${full_path} ]]; then
die "workspace path %s is not writable" "${full_path}"
fi
set_workspace "${name}" "${path}"
if (( switch )); then
pkgctl_workspace_switch "${name}"
fi
if (( change_cwd )); then
pkgctl_workspace_cd "${name}"
fi
}

View File

@@ -1,70 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_CD_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_CD_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_cd_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [NAME]
TODO
OPTIONS
-h, --help Show this help text
EXAMPLES
_EOF_
}
pkgctl_workspace_cd() {
# options
local workspace=
# variables
local path
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_cd_usage
exit 0
;;
--)
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
workspace=$1
shift
break
;;
esac
done
if [[ -z ${PKGCTL_OUTCMD} ]]; then
die "setup shell"
fi
if [[ -z ${workspace} ]]; then
workspace=$(get_active_workspace_name)
fi
path=$(get_workspace_path_from_name "${workspace}")
printf "builtin cd -- %s\n" "${path}" >> "${PKGCTL_OUTCMD}"
}

View File

@@ -1,134 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_LIST_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_LIST_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_list_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS]
TODO
OPTIONS
-n, --name Only list raw workspace names
-p, --path Only list raw workspace paths
-l, --local None default workspaces only
-h, --help Show this help text
EXAMPLES
_EOF_
}
pkgctl_workspace_list_check_option_group() {
local option=$1
local print_mode=$2
if [[ ${print_mode} != pretty ]] && [[ ${print_mode} != "${option}" ]]; then
die "The argument '%s' cannot be used with one or more of the other specified arguments" "${option}"
exit 1
fi
return 0
}
pkgctl_workspace_list() {
# options
local print_mode=pretty
local only_local=0
# variables
local names name path active_workspace marker packages
local pad
local name_len=0
local packages_len=0
local workspaces
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_list_usage
exit 0
;;
-p|--path)
pkgctl_workspace_list_check_option_group --path "${print_mode}"
print_mode=path
shift
;;
-n|--name)
pkgctl_workspace_list_check_option_group --name "${print_mode}"
print_mode=name
shift
;;
-l|--local)
only_local=1
shift
;;
--)
shift
;;
*)
die "invalid argument: %s" "$1"
;;
esac
done
active_workspace=$(get_active_workspace_name)
mapfile -t names < <(get_all_workspace_names "${only_local}")
# cache values for pretty printing
if [[ ${print_mode} == pretty ]]; then
declare -A workspaces
pad=$(printf '%0.1s' " "{1..60})
for name in "${names[@]}"; do
echo "inter $name"
path=$(get_workspace_path_from_name "${name}")
packages=$(workspace_package_count "${name}")
if (( ${#name} > name_len )); then
name_len=${#name}
fi
if (( ${#packages} > packages_len )); then
packages_len=${#packages}
fi
workspaces["${name}->packages"]="${packages}"
workspaces["${name}->path"]="${path}"
done
fi
for name in "${names[@]}"; do
case ${print_mode} in
path)
path=$(get_workspace_path_from_name "${name}")
printf "%s\n" "${path}"
;;
name)
printf "%s\n" "${name}"
;;
pretty)
marker=" "
packages="${workspaces[${name}->packages]}"
path="${workspaces[${name}->path]}"
if [[ $name == "$active_workspace" ]]; then
marker="${GREEN}${BOLD}${ALL_OFF}${BOLD}"
fi
printf '%s %s %*.*s' "${marker}" "${name}" 0 $((name_len - ${#name} )) "${pad}"
printf ' 📦 %*.*s%s' 0 $((packages_len - ${#packages} )) "${pad}" "${packages}"
printf ' 📂 %s%s' "${path}" "${ALL_OFF}"
printf "%s\n" "${ALL_OFF}"
;;
esac
done
}

View File

@@ -1,70 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_REMOVE_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_REMOVE_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_remove_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] NAME
TODO
OPTIONS
-h, --help Show this help text
EXAMPLES
_EOF_
}
pkgctl_workspace_remove() {
if (( $# < 1 )); then
pkgctl_workspace_remove_usage
exit 0
fi
# options
local name current
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_remove_usage
exit 0
;;
--)
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
name=$1
shift
break
;;
esac
done
# TODO: check current
current=$(get_active_workspace_name)
# TODO: check builtin default cwd
if ! remove_workspace "${name}"; then
die 'failed to remove workspace %s' "${name}"
fi
}

View File

@@ -1,101 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_SHOW_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_SHOW_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/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_show_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [NAME]
TODO
OPTIONS
-n, --name Print the workspace name
-p, --path Print the workspace location
-h, --help Show this help text
EXAMPLES
_EOF_
}
pkgctl_workspace_show_check_option_group() {
local option=$1
local print_mode=$2
if [[ ${print_mode} != pretty ]] && [[ ${print_mode} != "${option}" ]]; then
die "The argument '%s' cannot be used with one or more of the other specified arguments" "${option}"
exit 1
fi
return 0
}
pkgctl_workspace_show() {
# options
local print_mode=pretty
local workspace
# variables
local path packages
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_show_usage
exit 0
;;
-p|--path)
pkgctl_workspace_show_check_option_group --path "${print_mode}"
print_mode=path
shift
;;
-n|--name)
pkgctl_workspace_show_check_option_group --name "${print_mode}"
print_mode=name
shift
;;
--)
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
workspace=$1
shift
;;
esac
done
# use the active workspace if none is provided
if [[ -z ${workspace} ]]; then
workspace=$(get_active_workspace_name)
fi
path=$(get_workspace_path_from_name "${workspace}")
packages=$(workspace_package_count "${workspace}")
case ${print_mode} in
path)
printf "%s\n" "${path}"
;;
name)
printf "%s\n" "${workspace}"
;;
pretty)
msg2 "${workspace}: ${packages} packages ${path}"
;;
esac
}

View File

@@ -1,121 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_SWITCH_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_SWITCH_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/workspace/add.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/add.sh
# shellcheck source=src/lib/workspace/cd.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/cd.sh
# shellcheck source=src/lib/workspace/list.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/list.sh
# shellcheck source=src/lib/workspace/util.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace/util.sh
source /usr/share/makepkg/util/message.sh
set -e
pkgctl_workspace_switch_usage() {
local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
cat <<- _EOF_
Usage: ${COMMAND} [OPTIONS] [NAME]
TODO
OPTIONS
-i, --interactive Interactively select the workspace
-c, --create Create a new workspace before switching
--cd Change the working directory to the new workspace
-h, --help Show this help text
EXAMPLES
_EOF_
}
pkgctl_workspace_switch() {
if (( $# < 1 )); then
pkgctl_workspace_switch_usage
exit 0
fi
# options
local name=
local path=
local change_cwd=0
local interactive=0
local create=0
while (( $# )); do
case $1 in
-h|--help)
pkgctl_workspace_switch_usage
exit 0
;;
-c|--create)
create=1
shift
;;
--cd)
change_cwd=1
shift
;;
-i|--interactive)
interactive=1
shift
;;
--)
shift
;;
-*)
die "invalid argument: %s" "$1"
;;
*)
if [[ -z ${name} ]]; then
name=$1
elif [[ -z ${path} ]]; then
path=$1
else
die "invalid argument: %s" "$1"
fi
shift
;;
esac
done
if [[ -z ${name} ]]; then
name=default
fi
if (( interactive )); then
# TODO: check for fzf
name=$(pkgctl_workspace_list --name | sort | \
fzf --exit-0 --ansi --no-multi --keep-right --height=45%)
fi
if (( create )); then
if ! pkgctl_workspace_add "${name}"; then
exit 1
fi
fi
if ! path=$(get_workspace_path_from_name "${name}"); then
die 'workspace does not exist: %s' "${name}"
fi
if ! set_current_workspace "${name}"; then
die 'failed to set current workspace'
fi
msg "Switched to workspace %s" "${name}"
if (( change_cwd )); then
pkgctl_workspace_cd "$@"
fi
}

View File

@@ -1,188 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
[[ -z ${DEVTOOLS_INCLUDE_WORKSPACE_UTIL_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_WORKSPACE_UTIL_SH=1
_DEVTOOLS_LIBRARY_DIR=${_DEVTOOLS_LIBRARY_DIR:-@pkgdatadir@}
# shellcheck source=src/lib/common.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/common.sh
source /usr/share/makepkg/util/message.sh
set -e
is_xdg_workspace() {
local path=$1
[[ $path != */* ]] && [[ $path != . ]]
}
get_all_workspace_names() {
local only_local=$1
local names=()
local builtins=(default cwd)
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/workspace.toml
if (( ! only_local )); then
printf "%s\n" "${builtins[@]}"
fi
mapfile -t names < <(${TOML} get ${CONFIG} . | jq -r 'keys | join("\n")' | grep -v '^$')
if (( ${#names[@]} )); then
printf "%s\n" "${names[@]}"
fi
echo "${#names[@]}" >&2
}
get_workspace_path_from_name() {
local name=$1
local path
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/workspace.toml
case $name in
cwd)
path="${PWD}"
;;
default)
path=$name
;;
*)
if ! path="$(${TOML} get --raw ${CONFIG} -- "${name}.path")"; then
error "unknown workspace name: %s" "${name}"
return 1
fi
;;
esac
get_absolute_workspace_path "${path}"
}
get_absolute_workspace_path() {
local path=$1
# TODO XDG detection
XDG_PKGCTL_WORKSPACES=~/.local/state/pkgctl/workspace
if is_xdg_workspace "${path}"; then
printf "%s/%s" "${XDG_PKGCTL_WORKSPACES}" "${path}"
return
fi
if [[ $path == . ]]; then
printf "%s" "${PWD}"
return
fi
printf "%s" "${path}"
}
get_active_workspace_name() {
local workspace
if [[ -n ${PKGCTL_WORKSPACE} ]]; then
workspace="${PKGCTL_WORKSPACE}"
else
workspace=$(get_current_workspace_name)
fi
printf "%s" "${workspace}"
}
get_current_workspace_name() {
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/config.toml
DEFAULT_WORKSPACE=default
if ! workspace=$(${TOML} get --raw ${CONFIG} -- pkgctl.workspace); then
workspace=${DEFAULT_WORKSPACE}
fi
printf "%s" "${workspace}"
}
# TODO: name should reflect absolute?
get_current_workspace_path() {
:
}
set_workspace() {
local name=$1
local path=${2:-$name}
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/workspace.toml
[[ -z ${WORKDIR:-} ]] && setup_workdir
outfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-workspace.toml.XXXXXXXXXX)
${TOML} set "${CONFIG}" -- "${name}.path" "${path}" > "${outfile}"
mv "${outfile}" "${CONFIG}"
}
remove_workspace() {
local name=$1
local path=${2:-$name}
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/workspace.toml
[[ -z ${WORKDIR:-} ]] && setup_workdir
outfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-workspace.toml.XXXXXXXXXX)
tomlq --toml-output "del(.${name})" "${CONFIG}" > "${outfile}"
mv "${outfile}" "${CONFIG}"
}
set_current_workspace() {
local name=$1
TOML=~/.local/share/cargo/bin/toml
CONFIG=~/.config/devtools/config.toml
[[ -z ${WORKDIR:-} ]] && setup_workdir
outfile=$(mktemp --tmpdir="${WORKDIR}" pkgctl-workspace.toml.XXXXXXXXXX)
${TOML} set "${CONFIG}" -- "pkgctl.workspace" "${name}" > "${outfile}"
mv "${outfile}" "${CONFIG}"
}
# TODO: maybe by path instead?
workspace_package_count() {
local workspace=$1
path=$(get_workspace_path_from_name "${workspace}")
shopt -s nullglob
packages=("${path}/"*/PKGBUILD)
printf "%s" "${#packages[*]}"
}
PKGCTL_START_DIR=$(pwd)
PKGCTL_WORKSPACE_ACTIVE=0
enter_workspace() {
local path
local workspace
(( PKGCTL_WORKSPACE_ACTIVE )) && return
workspace=$(get_active_workspace_name)
path=$(get_workspace_path_from_name "${workspace}")
msg "Entering workspace %s in %s" "${workspace}" "${path}"
PKGCTL_WORKSPACE_ACTIVE=1
cd "${path}"
}
leave_workspace() {
(( ! PKGCTL_WORKSPACE_ACTIVE )) && return
PKGCTL_WORKSPACE_ACTIVE=0
cd "${PKGCTL_START_DIR}"
}

View File

@@ -301,7 +301,7 @@ done
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER "${BASH_SOURCE[0]}" "$@"
check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")

View File

@@ -125,9 +125,6 @@ OPTIONS
__EOF__
}
# save all args for check_root
orig_args=("$@")
while getopts 'dM:c:l:h' arg; do
case "$arg" in
d) diffoscope=1 ;;
@@ -140,7 +137,7 @@ while getopts 'dM:c:l:h' arg; do
done
shift $((OPTIND - 1))
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
check_root
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }

View File

@@ -32,9 +32,6 @@ usage() {
exit 1
}
# save all args for check_root
orig_args=("$@")
while getopts 'hUC:M:c:f:s' arg; do
case "$arg" in
U) umode=U ;;
@@ -55,7 +52,7 @@ shift $((OPTIND - 1))
(( $# < 2 )) && die 'You must specify a directory and one or more packages.'
check_root "" "${BASH_SOURCE[0]}" "${orig_args[@]}"
check_root
working_dir="$(readlink -f "$1")"
shift 1

View File

@@ -102,9 +102,9 @@ mapfile -t files < <(
printf "\t%s\n" "$temp"/*
} >&2 &&
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${arch}"'.conf" &&
if [[ -f /usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg.conf.d/'"${repo}"'-'"${arch}"'.conf"
makepkg_config="/usr/share/devtools/makepkg-'"${arch}"'.conf" &&
if [[ -f /usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf"
fi &&
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
printf "%s\n" "${temp}/PKGBUILD"

View File

@@ -19,19 +19,16 @@ usage() {
Unified command-line frontend for devtools.
COMMANDS
auth Authenticate with services like GitLab
build Build packages inside a clean chroot
db Pacman database modification for packge update, move etc
diff Compare package files using different modes
init Generate and print the shell configuration
release Release step to commit, tag and upload build artifacts
repo Manage Git packaging repositories and their configuration
version Show pkgctl version information
workspace Manage package workspace locations and settings
auth Authenticate with services like GitLab
build Build packages inside a clean chroot
db Pacman database modification for packge 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
version Show pkgctl version information
OPTIONS
-w, --workspace NAME Override the configured workspace to use (default: xdg, cwd)
-h, --help Show this help text
-h, --help Show this help text
_EOF_
}
@@ -41,7 +38,6 @@ if (( $# < 1 )); then
fi
export _DEVTOOLS_COMMAND='pkgctl'
export PKGCTL_WORKSPACE=""
load_devtools_config
@@ -52,11 +48,6 @@ while (( $# )); do
usage
exit 0
;;
-w|--workspace)
(( $# <= 1 )) && die "missing argument for %s" "$1"
PKGCTL_WORKSPACE=$2
shift 2
;;
build)
_DEVTOOLS_COMMAND+=" $1"
shift
@@ -95,18 +86,10 @@ while (( $# )); do
diffpkg "$@"
exit 0
;;
init)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/release.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/init/init.sh
pkgctl_init "$@"
exit 0
;;
release)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/release.sh
# shellcheck source=src/lib/repo.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/release.sh
pkgctl_release "$@"
exit 0
@@ -119,14 +102,6 @@ while (( $# )); do
pkgctl_version "$@"
exit 0
;;
workspace)
_DEVTOOLS_COMMAND+=" $1"
shift
# shellcheck source=src/lib/workspace.sh
source "${_DEVTOOLS_LIBRARY_DIR}"/lib/workspace.sh
pkgctl_workspace "$@"
exit 0
;;
*)
die "invalid command: %s" "$1"
;;