Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2024-04-21 10:18:55 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2024-04-21 10:18:55 +0200
commit2dc7a161a09518edae9e04a77fca569460d6a560 (patch)
tree5c893311826fc1ae7090352fb2f17a2d3d3a560e
parenta1ca197bc99c2d5c2977630cc4c9dbfd5461d9c1 (diff)
parent05bea3e922aa7aec5cba3242d3f34b5c10fad24e (diff)
merged with upstream
-rw-r--r--.gitlab-ci.yml29
-rw-r--r--Makefile24
-rw-r--r--README.md3
-rw-r--r--contrib/completion/bash/devtools.in12
-rw-r--r--contrib/completion/zsh/_devtools.in10
-rw-r--r--doc/asciidoc.conf37
-rw-r--r--doc/man/archbuild.1.asciidoc2
-rw-r--r--doc/man/checkpkg.1.asciidoc2
-rw-r--r--doc/man/devtools.7.asciidoc28
-rw-r--r--doc/man/lddd.1.asciidoc2
-rw-r--r--doc/man/makerepropkg.1.asciidoc2
-rw-r--r--doc/man/mkarchroot.1.asciidoc2
-rw-r--r--doc/man/pkgctl-aur-drop-from-repo.1.asciidoc2
-rw-r--r--doc/man/pkgctl-aur.1.asciidoc2
-rw-r--r--doc/man/pkgctl-auth-login.1.asciidoc2
-rw-r--r--doc/man/pkgctl-auth-status.1.asciidoc2
-rw-r--r--doc/man/pkgctl-auth.1.asciidoc4
-rw-r--r--doc/man/pkgctl-build.1.asciidoc4
-rw-r--r--doc/man/pkgctl-db-update.1.asciidoc2
-rw-r--r--doc/man/pkgctl-release.1.asciidoc2
-rw-r--r--doc/man/pkgctl-repo-clone.1.asciidoc4
-rw-r--r--doc/man/pkgctl-repo-create.1.asciidoc6
-rw-r--r--doc/man/pkgctl-repo.1.asciidoc10
-rw-r--r--doc/man/pkgctl-search.1.asciidoc2
-rw-r--r--doc/man/pkgctl-version-check.1.asciidoc8
-rw-r--r--doc/man/pkgctl-version-setup.1.asciidoc120
-rw-r--r--doc/man/pkgctl-version-upgrade.1.asciidoc8
-rw-r--r--doc/man/pkgctl-version.1.asciidoc15
-rw-r--r--doc/man/pkgctl.1.asciidoc18
-rw-r--r--src/lib/aur/drop-from-repo.sh13
-rw-r--r--src/lib/build/build.sh4
-rw-r--r--src/lib/common.sh6
-rw-r--r--src/lib/repo/configure.sh7
-rw-r--r--src/lib/repo/switch.sh13
-rw-r--r--src/lib/version.sh10
-rw-r--r--src/lib/version/check.sh6
-rw-r--r--src/lib/version/setup.sh528
-rw-r--r--src/lib/version/upgrade.sh4
-rw-r--r--test/case/version-setup.bats127
-rw-r--r--test/fixture/version/setup/.gitignore1
-rw-r--r--test/fixture/version/setup/codeberg-tarball/PKGBUILD18
-rw-r--r--test/fixture/version/setup/codeberg-tarball/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/cpan.org/PKGBUILD14
-rw-r--r--test/fixture/version/setup/cpan.org/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/crates.io/PKGBUILD17
-rw-r--r--test/fixture/version/setup/crates.io/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/files.pythonhosted.org/PKGBUILD15
-rw-r--r--test/fixture/version/setup/files.pythonhosted.org/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/git-custom/PKGBUILD14
-rw-r--r--test/fixture/version/setup/git-custom/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/github-git-as-platform/PKGBUILD17
-rw-r--r--test/fixture/version/setup/github-git-as-platform/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/github-git-v-prefix-as-platform/PKGBUILD17
-rw-r--r--test/fixture/version/setup/github-git-v-prefix-as-platform/nvchecker.assert.toml5
-rw-r--r--test/fixture/version/setup/github-git-v-prefix/PKGBUILD17
-rw-r--r--test/fixture/version/setup/github-git-v-prefix/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/github-git/PKGBUILD17
-rw-r--r--test/fixture/version/setup/github-git/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/github-tarball-as-platform/PKGBUILD29
-rw-r--r--test/fixture/version/setup/github-tarball-as-platform/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/github-tarball/PKGBUILD25
-rw-r--r--test/fixture/version/setup/github-tarball/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/PKGBUILD57
-rw-r--r--test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/nvchecker.assert.toml6
-rw-r--r--test/fixture/version/setup/gitlab-archlinux-tarball/PKGBUILD57
-rw-r--r--test/fixture/version/setup/gitlab-archlinux-tarball/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/gitlab-git-multi-group-as-platform/PKGBUILD30
-rw-r--r--test/fixture/version/setup/gitlab-git-multi-group-as-platform/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/gitlab-git-multi-group/PKGBUILD30
-rw-r--r--test/fixture/version/setup/gitlab-git-multi-group/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/PKGBUILD24
-rw-r--r--test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/nvchecker.assert.toml4
-rw-r--r--test/fixture/version/setup/gitlab-tarball-multi-group/PKGBUILD24
-rw-r--r--test/fixture/version/setup/gitlab-tarball-multi-group/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/hackage-tarball/PKGBUILD16
-rw-r--r--test/fixture/version/setup/hackage-tarball/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/opt-no-force/PKGBUILD57
-rw-r--r--test/fixture/version/setup/opt-url/PKGBUILD25
-rw-r--r--test/fixture/version/setup/opt-url/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/pkgbase-with-dot/PKGBUILD27
-rw-r--r--test/fixture/version/setup/pkgbase-with-dot/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/pypi.io/PKGBUILD17
-rw-r--r--test/fixture/version/setup/pypi.io/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/pypi.org/PKGBUILD23
-rw-r--r--test/fixture/version/setup/pypi.org/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/registry.npmjs.org/PKGBUILD16
-rw-r--r--test/fixture/version/setup/registry.npmjs.org/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/rubygems.org/PKGBUILD16
-rw-r--r--test/fixture/version/setup/rubygems.org/nvchecker.assert.toml3
-rw-r--r--test/fixture/version/setup/static.crates.io/PKGBUILD16
-rw-r--r--test/fixture/version/setup/static.crates.io/nvchecker.assert.toml3
91 files changed, 1688 insertions, 116 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3a75540..960f5f0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,14 +8,37 @@ build:
stage: build
needs: []
script:
- - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc
+ - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor
- make PREFIX=/usr
- make PREFIX=/usr DESTDIR=build install
-check:
+lint:
stage: test
needs: []
script:
- - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc shellcheck
+ - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoctor shellcheck
- make check || true
- SHELLCHECK_OPTS="-S error" make check
+
+test:
+ stage: test
+ needs: []
+ script:
+ - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils coreutils asciidoctor shellcheck nvchecker bats
+ - make test BATS_EXTRA_ARGS='--formatter junit'
+ artifacts:
+ reports:
+ junit: build/coverage/bats-report.xml
+
+coverage:
+ stage: test
+ needs: []
+ script:
+ - pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils coreutils asciidoctor shellcheck nvchecker bats kcov jq
+ - make coverage
+ coverage: '/Percent covered\s+\d+\.\d+/'
+ artifacts:
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: build/coverage/bats.*/cobertura.xml
diff --git a/Makefile b/Makefile
index b468a75..46e0e6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
V=$(shell git describe)
-SHELL=/bin/bash
+SHELL=/bin/bash -o pipefail
BUILDTOOLVER ?= $(V)
# builds with relf-referencing wildcards are not deterministic, switch of parallel builds
@@ -123,6 +123,13 @@ ARCHBUILD_LINKS = \
COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*)))
+CASES ?= test/case
+JOBS ?= $(shell nproc)
+BATS_EXTRA_ARGS ?=
+BATS_ARGS ?= --jobs $(JOBS) $(BATS_EXTRA_ARGS) --verbose-run
+COVERAGE_DIR ?= $(BUILDDIR)/coverage
+
+
all: binprogs library conf completion man configfiles
binprogs: $(BINPROGS)
library: $(LIBRARY)
@@ -223,10 +230,10 @@ $(eval $(call buildInScript,build/bin,src/,.in,755))
$(eval $(call buildInScript,build/lib,src/lib/,,644))
$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,.in,444)))
-$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc
+$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/man/include/footer.asciidoc
$(GEN_MSG)
@mkdir -p $(BUILDDIR)/doc/man
- @a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $<
+ @asciidoctor --backend=manpage --destination-dir=$(BUILDDIR)/doc/man --attribute pkgdatadir=$(DATADIR) $<
conf:
@install -d $(BUILDDIR)/makepkg.conf.d
@@ -306,8 +313,17 @@ dist:
upload:
scp devtools32-$(V).tar.gz devtools32-$(V).tar.gz.sig sources.archlinux32.org:httpdocs/sources/
+test: binprogs library conf completion man
+ @mkdir -p $(COVERAGE_DIR)
+ bats $(BATS_ARGS) $(CASES) | tee $(COVERAGE_DIR)/bats-report.xml
+
+coverage: binprogs library conf completion man
+ kcov --include-path=src $(COVERAGE_DIR) bats $(BATS_ARGS) $(CASES)
+ jq -r '. | ["Percent covered", .percent_covered], ["Covered lines", .covered_lines], ["Total lines", .total_lines], ["Percent low", .percent_low], ["Percent high", .percent_high] | @tsv' \
+ $(COVERAGE_DIR)/bats.*/coverage.json
+
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
shellcheck $^
-.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload check
+.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload test coverage check
.DELETE_ON_ERROR:
diff --git a/README.md b/README.md
index 193d5b0..6b6b372 100644
--- a/README.md
+++ b/README.md
@@ -95,9 +95,10 @@ Component: pkgctl db remove
### Development Dependencies
-- asciidoc
+- asciidoctor
- make
- shellcheck
+- bats
## License
diff --git a/contrib/completion/bash/devtools.in b/contrib/completion/bash/devtools.in
index 11fa234..136c80f 100644
--- a/contrib/completion/bash/devtools.in
+++ b/contrib/completion/bash/devtools.in
@@ -350,6 +350,7 @@ _pkgctl_repo_switch_opts() {
_pkgctl_version_cmds=(
check
+ setup
upgrade
)
@@ -360,6 +361,17 @@ _pkgctl_version_check_args=(
_pkgctl_version_check_opts() { _filedir -d; }
+_pkgctl_version_setup_args=(
+ --prefer-platform-api
+ --url
+ --no-check
+ -f --force
+ -h --help
+)
+
+_pkgctl_version_setup_opts() { _filedir -d; }
+_pkgctl_version_setup_args__url_opts() { :; }
+
_pkgctl_version_upgrade_args=(
-v --verbose
-h --help
diff --git a/contrib/completion/zsh/_devtools.in b/contrib/completion/zsh/_devtools.in
index ee6da85..f430dae 100644
--- a/contrib/completion/zsh/_devtools.in
+++ b/contrib/completion/zsh/_devtools.in
@@ -291,6 +291,7 @@ _pkgctl_args=(
_pkgctl_version_cmds=(
"pkgctl version command"
"check[Compares local package versions against upstream versions]"
+ "setup[Automatically detect and setup a basic nvchecker config]"
"upgrade[Adjust the PKGBUILD to match the latest upstream version]"
)
@@ -300,6 +301,15 @@ _pkgctl_version_check_args=(
'*:git_dir:_files -/'
)
+_pkgctl_version_setup_args=(
+ '(-f --force)'{-f,--force}'[Do not prompt before overwriting]'
+ '--prefer-platform-api[Prefer platform specific GitHub/GitLab API for complex cases]'
+ '--url[Derive check target from URL instead of source array]:url:'
+ '--no-check[Do not run version check after setup]'
+ '(-h --help)'{-h,--help}'[Display usage]'
+ '*:git_dir:_files -/'
+)
+
_pkgctl_version_upgrade_args=(
'(-v --verbose)'{-v,--verbose}'[Display results including up-to-date versions]'
'(-h --help)'{-h,--help}'[Display usage]'
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
deleted file mode 100644
index c675a20..0000000
--- a/doc/asciidoc.conf
+++ /dev/null
@@ -1,37 +0,0 @@
-## linkman: macro
-# Inspired by/borrowed from the GIT source tree at Documentation/asciidoc.conf
-#
-# Usage: linkman:command[manpage-section]
-#
-# Note, {0} is the manpage section, while {target} is the command.
-#
-# Show man link as: <command>(<section>); if section is defined, else just show
-# the command.
-
-[macros]
-(?su)[\\]?(?P<name>linkman):(?P<target>\S*?)\[(?P<attrlist>.*?)\]=
-
-[attributes]
-asterisk=&#42;
-plus=&#43;
-caret=&#94;
-startsb=&#91;
-endsb=&#93;
-backslash=&#92;
-tilde=&#126;
-apostrophe=&#39;
-backtick=&#96;
-litdd=&#45;&#45;
-
-ifdef::backend-docbook[]
-[linkman-inlinemacro]
-{0%{target}}
-{0#<citerefentry>}
-{0#<refentrytitle>{target}</refentrytitle><manvolnum>{0}</manvolnum>}
-{0#</citerefentry>}
-endif::backend-docbook[]
-
-ifdef::backend-xhtml11[]
-[linkman-inlinemacro]
-<a href="{target}.{0}.html">{target}{0?({0})}</a>
-endif::backend-xhtml11[]
diff --git a/doc/man/archbuild.1.asciidoc b/doc/man/archbuild.1.asciidoc
index 2a2d843..9c1973d 100644
--- a/doc/man/archbuild.1.asciidoc
+++ b/doc/man/archbuild.1.asciidoc
@@ -43,6 +43,6 @@ Options
See Also
--------
-linkman:devtools[7]
+devtools(7)
include::include/footer.asciidoc[]
diff --git a/doc/man/checkpkg.1.asciidoc b/doc/man/checkpkg.1.asciidoc
index bd41416..4be3ae8 100644
--- a/doc/man/checkpkg.1.asciidoc
+++ b/doc/man/checkpkg.1.asciidoc
@@ -38,6 +38,6 @@ Options
See Also
--------
-linkman:find-libprovides[1]
+find-libprovides(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/devtools.7.asciidoc b/doc/man/devtools.7.asciidoc
index 4ed11cf..9156d50 100644
--- a/doc/man/devtools.7.asciidoc
+++ b/doc/man/devtools.7.asciidoc
@@ -21,47 +21,47 @@ Programs
The list below gives a short overview; see the respective documentation
for details.
-linkman:pkgctl[1]
+pkgctl(1)
Unified command-line frontend for devtools
-linkman:archbuild[1]
+archbuild(1)
Build an Arch Linux package inside a clean chroot
-linkman:arch-nspawn[1]
+arch-nspawn(1)
Run a command or OS in a light-weight namespace container
-linkman:checkpkg[1]
+checkpkg(1)
Compare the current build package with the repository version
-linkman:diffpkg[1]
+diffpkg(1)
Compare package files using different modes
-linkman:export-pkgbuild-keys[1]
+export-pkgbuild-keys(1)
Export valid source signing keys from a PKGBUILD
-linkman:find-libdeps[1]
+find-libdeps(1)
Find soname dependencies for a package
-linkman:find-libprovides[1]
+find-libprovides(1)
Find soname's which are provided by a package
-linkman:lddd[1]
+lddd(1)
Find broken library links on your system
-linkman:mkarchroot[1]
+mkarchroot(1)
Creates an arch chroot in a specified location with a specified set of
packages
-linkman:makechrootpkg[1]
+makechrootpkg(1)
Build a PKGBUILD in a given chroot environment
-linkman:makerepropkg[1]
+makerepropkg(1)
Rebuild a package to see if it is reproducible
-linkman:offload-build[1]
+offload-build(1)
Build a PKGBUILD on a remote server using makechrootpkg
-linkman:sogrep[1]
+sogrep(1)
Find packages using a linked to a given shared library
include::include/footer.asciidoc[]
diff --git a/doc/man/lddd.1.asciidoc b/doc/man/lddd.1.asciidoc
index c6bff26..f3eed9d 100644
--- a/doc/man/lddd.1.asciidoc
+++ b/doc/man/lddd.1.asciidoc
@@ -20,6 +20,6 @@ collected data is written to a temporary directory created by mktemp.
See Also
--------
-linkman:ldd[1]
+ldd(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/makerepropkg.1.asciidoc b/doc/man/makerepropkg.1.asciidoc
index 51a81ff..e2a0bbb 100644
--- a/doc/man/makerepropkg.1.asciidoc
+++ b/doc/man/makerepropkg.1.asciidoc
@@ -16,7 +16,7 @@ Given the path to a built pacman package(s), attempt to rebuild it using the
PKGBUILD in the current directory. The package will be built in an environment
as closely matching the environment of the initial package as possible, by
building up a chroot to match the information exposed in the package's
-linkman:BUILDINFO[5] manifest. On success, the resulting package will be
+BUILDINFO(5) manifest. On success, the resulting package will be
compared to the input package, and makerepropkg will report whether the
artifacts are identical.
diff --git a/doc/man/mkarchroot.1.asciidoc b/doc/man/mkarchroot.1.asciidoc
index a435852..99905c8 100644
--- a/doc/man/mkarchroot.1.asciidoc
+++ b/doc/man/mkarchroot.1.asciidoc
@@ -44,6 +44,6 @@ Options
See Also
--------
-linkman:pacman[1]
+pacman(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-aur-drop-from-repo.1.asciidoc b/doc/man/pkgctl-aur-drop-from-repo.1.asciidoc
index a9d39c6..0b17f3b 100644
--- a/doc/man/pkgctl-aur-drop-from-repo.1.asciidoc
+++ b/doc/man/pkgctl-aur-drop-from-repo.1.asciidoc
@@ -36,6 +36,6 @@ Options
See Also
--------
-linkman:pkgctl-db-remove[1]
+pkgctl-db-remove(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-aur.1.asciidoc b/doc/man/pkgctl-aur.1.asciidoc
index d69124a..a42f611 100644
--- a/doc/man/pkgctl-aur.1.asciidoc
+++ b/doc/man/pkgctl-aur.1.asciidoc
@@ -32,6 +32,6 @@ pkgctl aur drop-from-repo::
See Also
--------
-linkman:pkgctl-aur-drop-from-repo[1]
+pkgctl-aur-drop-from-repo(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-auth-login.1.asciidoc b/doc/man/pkgctl-auth-login.1.asciidoc
index eeeec4e..0383c7e 100644
--- a/doc/man/pkgctl-auth-login.1.asciidoc
+++ b/doc/man/pkgctl-auth-login.1.asciidoc
@@ -35,6 +35,6 @@ Options
See Also
--------
-linkman:pkgctl-auth-status[1]
+pkgctl-auth-status(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-auth-status.1.asciidoc b/doc/man/pkgctl-auth-status.1.asciidoc
index e23ee2e..e71d5ac 100644
--- a/doc/man/pkgctl-auth-status.1.asciidoc
+++ b/doc/man/pkgctl-auth-status.1.asciidoc
@@ -27,6 +27,6 @@ Options
See Also
--------
-linkman:pkgctl-auth-login[1]
+pkgctl-auth-login(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-auth.1.asciidoc b/doc/man/pkgctl-auth.1.asciidoc
index 4912b02..d4ecf50 100644
--- a/doc/man/pkgctl-auth.1.asciidoc
+++ b/doc/man/pkgctl-auth.1.asciidoc
@@ -32,7 +32,7 @@ pkgctl auth status::
See Also
--------
-linkman:pkgctl-auth-login[1]
-linkman:pkgctl-auth-status[1]
+pkgctl-auth-login(1)
+pkgctl-auth-status(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-build.1.asciidoc b/doc/man/pkgctl-build.1.asciidoc
index f7abdeb..d36daff 100644
--- a/doc/man/pkgctl-build.1.asciidoc
+++ b/doc/man/pkgctl-build.1.asciidoc
@@ -107,7 +107,7 @@ Options
See Also
--------
-linkman:pkgctl-release[1]
-linkman:pkgctl-db-update[1]
+pkgctl-release(1)
+pkgctl-db-update(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-db-update.1.asciidoc b/doc/man/pkgctl-db-update.1.asciidoc
index ce73c01..02f92a3 100644
--- a/doc/man/pkgctl-db-update.1.asciidoc
+++ b/doc/man/pkgctl-db-update.1.asciidoc
@@ -1,5 +1,5 @@
pkgctl-db-update(1)
-=================
+===================
Name
----
diff --git a/doc/man/pkgctl-release.1.asciidoc b/doc/man/pkgctl-release.1.asciidoc
index 01a0c9e..b114b01 100644
--- a/doc/man/pkgctl-release.1.asciidoc
+++ b/doc/man/pkgctl-release.1.asciidoc
@@ -46,6 +46,6 @@ Options
See Also
--------
-linkman:pkgctl-db-update[1]
+pkgctl-db-update(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-repo-clone.1.asciidoc b/doc/man/pkgctl-repo-clone.1.asciidoc
index 421c71f..3ed218c 100644
--- a/doc/man/pkgctl-repo-clone.1.asciidoc
+++ b/doc/man/pkgctl-repo-clone.1.asciidoc
@@ -46,7 +46,7 @@ Options
See Also
--------
-linkman:pkgctl-repo-configure[1]
-linkman:pkgctl-repo-switch[1]
+pkgctl-repo-configure(1)
+pkgctl-repo-switch(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-repo-create.1.asciidoc b/doc/man/pkgctl-repo-create.1.asciidoc
index 7c58776..f2606cc 100644
--- a/doc/man/pkgctl-repo-create.1.asciidoc
+++ b/doc/man/pkgctl-repo-create.1.asciidoc
@@ -33,8 +33,8 @@ Options
See Also
--------
-linkman:pkgctl-auth[1]
-linkman:pkgctl-repo-clone[1]
-linkman:pkgctl-repo-configure[1]
+pkgctl-auth(1)
+pkgctl-repo-clone(1)
+pkgctl-repo-configure(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-repo.1.asciidoc b/doc/man/pkgctl-repo.1.asciidoc
index 57be170..3d0f3f1 100644
--- a/doc/man/pkgctl-repo.1.asciidoc
+++ b/doc/man/pkgctl-repo.1.asciidoc
@@ -50,10 +50,10 @@ pkgctl repo web::
See Also
--------
-linkman:pkgctl-repo-clone[1]
-linkman:pkgctl-repo-configure[1]
-linkman:pkgctl-repo-create[1]
-linkman:pkgctl-repo-switch[1]
-linkman:pkgctl-repo-web[1]
+pkgctl-repo-clone(1)
+pkgctl-repo-configure(1)
+pkgctl-repo-create(1)
+pkgctl-repo-switch(1)
+pkgctl-repo-web(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-search.1.asciidoc b/doc/man/pkgctl-search.1.asciidoc
index 8172b00..4df8db1 100644
--- a/doc/man/pkgctl-search.1.asciidoc
+++ b/doc/man/pkgctl-search.1.asciidoc
@@ -66,6 +66,6 @@ Output Options
See Also
--------
-linkman:pkgctl-auth[1]
+pkgctl-auth(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-version-check.1.asciidoc b/doc/man/pkgctl-version-check.1.asciidoc
index 2543bcb..53e80db 100644
--- a/doc/man/pkgctl-version-check.1.asciidoc
+++ b/doc/man/pkgctl-version-check.1.asciidoc
@@ -28,8 +28,8 @@ required to track version changes from upstream sources.
Configuration
-------------
-Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
-PKGBUILD. Refer to the configuration section in linkman:pkgctl-version[1].
+Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
+PKGBUILD. Refer to the configuration section in pkgctl-version(1).
Options
-------
@@ -60,7 +60,7 @@ On exit, return one of the following codes:
See Also
--------
-linkman:pkgctl-version[1]
-linkman:nvchecker[1]
+pkgctl-version(1)
+nvchecker(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-version-setup.1.asciidoc b/doc/man/pkgctl-version-setup.1.asciidoc
new file mode 100644
index 0000000..81ef008
--- /dev/null
+++ b/doc/man/pkgctl-version-setup.1.asciidoc
@@ -0,0 +1,120 @@
+pkgctl-version-setup(1)
+=======================
+
+Name
+----
+pkgctl-version-setup - Automatically detect and setup a basic nvchecker config
+
+Synopsis
+--------
+pkgctl version setup [OPTIONS] [PKGBASE...]
+
+Description
+-----------
+
+This subcommand automates the creation of a basic nvchecker(1) configuration
+file by analyzing the source array specified in the PKGBUILD(1) file of a
+package. This command intelligently detects various platforms and APIs (e.g.,
+GitHub, GitLab, PyPI) used by the package sources and generates a corresponding
+`.nvchecker.toml` configuration based on its best guess.
+
+This is particularly useful for initializing nvchecker(1) settings for a
+package without manually crafting the `.nvchecker.toml` file. It simplifies the
+process of setting up version checks, especially when transitioning a package's
+monitoring from one source platform to another or starting version checks for a
+new package.
+
+If no `PKGBASE` is specified, the command defaults to using the current working
+directory.
+
+To obtain a list of supported sources and their expected URL formats, please
+consult the sources section.
+
+Options
+-------
+
+*-f, --force*::
+ Overwrite existing nvchecker(1) configuration
+
+*--prefer-platform-api*::
+ Prefer platform specific GitHub/GitLab API over git for complex cases
+
+*--url* 'URL'::
+ Derive check target from the given URL instead of the source array entries
+
+
+*--no-check*::
+ Do not run pkgctl-version-check(1) after setup
+
+*-h, --help*::
+ Show a help text
+
+Sources
+-------
+
+Here are the currently supported platforms and sources, along with examples of
+URL formats that enable their automatic detection as specific source types:
+
+*Git*::
+ * https://github.com/example/project
+ * https://gitlab.com/example/group/project
+ * git://git.foobar.org/example
+ * git+https://git.foobar.org/example
+
+*GitHub*::
+ * https://github.com/example/project
+ * https://github.com/example/project/archive/v1.0/project-v1.0.tar.gz
+
+*GitLab*::
+ * https://gitlab.com/example/group/project
+ * https://gitlab.archlinux.org/archlinux/devtools.git
+ * https://gitlab.archlinux.org/archlinux/devtools/-/releases/v1.1.0/downloads/devtools-v1.1.0.tar.gz
+
+*Hackage*::
+ * https://hackage.haskell.org/package/xmonad
+ * https://hackage.haskell.org/package/xmonad-0.18.0/xmonad-0.18.0.tar.gz
+ * https://hackage.haskell.org/packages/archive/xmonad/0.18.0/xmonad-0.18.0.tar.gz
+
+*NPM*::
+ * https://registry.npmjs.org/node-gyp/-/node-gyp-10.0.1.tgz
+ * https://www.npmjs.com/package/node-gyp
+
+*PyPI*::
+ * https://pypi.io/packages/source/p/pyflakes
+ * https://pypi.org/packages/source/b/bleach
+ * https://files.pythonhosted.org/packages/source/p/pyflakes
+ * https://pypi.org/project/SQLAlchemy/
+
+*RubyGems*::
+ * https://rubygems.org/downloads/diff-lcs-1.5.1.gem
+ * https://rubygems.org/gems/diff-lcs
+
+*CPAN*::
+ * https://search.cpan.org/CPAN/authors/id/C/CO/COSIMO/Locale-PO-0.27.tar.gz
+ * https://cpan.metacpan.org/authors/id/C/CO/COSIMO/Locale-PO-0.27.tar.gz
+
+*crates.io*::
+ * https://static.crates.io/crates/shotgun/shotgun-1.0.crate
+ * https://crates.io/api/v1/crates/shotgun/1.0/download
+ * https://crates.io/crates/git-smash
+
+Examples
+--------
+
+*pkgctl version setup*::
+ Detects the source from the current directory's PKGBUILD(1) and
+ sets up a basic `.nvchecker.toml`.
+
+*pkgctl version setup --url https://github.com/example/project*::
+ Generates an `.nvchecker.toml` for the current PKGBUILD(1) but
+ overrides the source URL with the specified GitHub project.
+
+See Also
+--------
+
+pkgctl-version(1)
+pkgctl-version-check(1)
+nvchecker(1)
+PKGBUILD(5)
+
+include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-version-upgrade.1.asciidoc b/doc/man/pkgctl-version-upgrade.1.asciidoc
index 68e6369..044545d 100644
--- a/doc/man/pkgctl-version-upgrade.1.asciidoc
+++ b/doc/man/pkgctl-version-upgrade.1.asciidoc
@@ -29,8 +29,8 @@ required to track and implement version changes from upstream sources.
Configuration
-------------
-Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
-PKGBUILD. Refer to the configuration section in linkman:pkgctl-version[1].
+Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
+PKGBUILD. Refer to the configuration section in pkgctl-version(1).
Options
-------
@@ -44,7 +44,7 @@ Options
See Also
--------
-linkman:pkgctl-version[1]
-linkman:nvchecker[1]
+pkgctl-version(1)
+nvchecker(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl-version.1.asciidoc b/doc/man/pkgctl-version.1.asciidoc
index fa83314..a72173b 100644
--- a/doc/man/pkgctl-version.1.asciidoc
+++ b/doc/man/pkgctl-version.1.asciidoc
@@ -15,7 +15,7 @@ Description
Commands related to package versions, including checks for outdated packages.
-Uses linkman:nvchecker[1] and a `.nvchecker.toml` file located alongside the
+Uses nvchecker(1) and a `.nvchecker.toml` file located alongside the
PKGBUILD.
Configuration
@@ -26,9 +26,12 @@ package's pkgbase. The pkgbase section within the `.nvchecker.toml` file
specifies the source and method for checking the latest version of the
corresponding package.
+Use pkgctl-version-setup(1) to automatically detect and setup a basic nvchecker
+config based on the source array of the package PKGBUILD.
+
For detailed information on the various configuration options available for the
`.nvchecker.toml` file, refer to the configuration files section in
-linkman:nvchecker[1]. This documentation provides insights into the possible
+nvchecker(1). This documentation provides insights into the possible
options that can be utilized to customize the version checking process.
To supply GitHub or GitLab tokens to nvchecker, a `keyfile.toml` should be
@@ -48,13 +51,17 @@ Subcommands
pkgctl version check::
Compares local package versions against upstream
+pkgctl version setup::
+ Automatically detect and setup a basic nvchecker config
+
pkgctl version upgrade::
Adjust the PKGBUILD to match the latest upstream version
See Also
--------
-linkman:pkgctl-version-check[1]
-linkman:pkgctl-version-upgrade[1]
+pkgctl-version-check(1)
+pkgctl-version-setup(1)
+pkgctl-version-upgrade(1)
include::include/footer.asciidoc[]
diff --git a/doc/man/pkgctl.1.asciidoc b/doc/man/pkgctl.1.asciidoc
index d9a1d8c..e028e84 100644
--- a/doc/man/pkgctl.1.asciidoc
+++ b/doc/man/pkgctl.1.asciidoc
@@ -56,14 +56,14 @@ pkgctl version::
See Also
--------
-linkman:pkgctl-aur[1]
-linkman:pkgctl-auth[1]
-linkman:pkgctl-build[1]
-linkman:pkgctl-db[1]
-linkman:pkgctl-diff[1]
-linkman:pkgctl-release[1]
-linkman:pkgctl-repo[1]
-linkman:pkgctl-search[1]
-linkman:pkgctl-version[1]
+pkgctl-aur(1)
+pkgctl-auth(1)
+pkgctl-build(1)
+pkgctl-db(1)
+pkgctl-diff(1)
+pkgctl-release(1)
+pkgctl-repo(1)
+pkgctl-search(1)
+pkgctl-version(1)
include::include/footer.asciidoc[]
diff --git a/src/lib/aur/drop-from-repo.sh b/src/lib/aur/drop-from-repo.sh
index 6ebe12a..0e9cab4 100644
--- a/src/lib/aur/drop-from-repo.sh
+++ b/src/lib/aur/drop-from-repo.sh
@@ -92,14 +92,19 @@ pkgctl_aur_drop_from_repo() {
fi
for path in "${paths[@]}"; do
- if ! realpath=$(realpath -e "${path}"); then
+ # resolve symlink for basename
+ if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
die "No such directory: ${path}"
fi
+ # skip paths that are not directories
+ if [[ ! -d "${realpath}" ]]; then
+ continue
+ fi
pkgbase=$(basename "${realpath}")
pkgbase=${pkgbase%.git}
- if [[ ! -d "${path}/.git" ]]; then
+ if [[ ! -d "${realpath}/.git" ]]; then
die "Not a Git repository: ${path}"
fi
@@ -136,9 +141,9 @@ pkgctl_aur_drop_from_repo() {
if (( FORCE )); then
AUR_OVERWRITE=1 \
GIT_SSH_COMMAND="ssh -o SendEnv=AUR_OVERWRITE" \
- git push --force origin master
+ git push --force --no-follow-tags origin master
else
- git push origin master
+ git push --no-follow-tags origin master
fi
# update the local default branch in case this clone is used in the future
diff --git a/src/lib/build/build.sh b/src/lib/build/build.sh
index 171bb9a..c35d70f 100644
--- a/src/lib/build/build.sh
+++ b/src/lib/build/build.sh
@@ -319,6 +319,10 @@ pkgctl_build() {
fi
for path in "${paths[@]}"; do
+ # skip paths that are not directories
+ if [[ ! -d "${path}" ]]; then
+ continue
+ fi
pushd "${path}" >/dev/null
if [[ ! -f PKGBUILD ]]; then
diff --git a/src/lib/common.sh b/src/lib/common.sh
index ff767c6..00ece97 100644
--- a/src/lib/common.sh
+++ b/src/lib/common.sh
@@ -342,3 +342,9 @@ is_debug_package() {
pkgdesc="$(getpkgdesc "${pkgfile}")"
[[ ${pkgdesc} == "Detached debugging symbols for "* && ${pkgbase}-debug = "${pkgname}" ]]
}
+
+join_by() {
+ local IFS="$1"
+ shift
+ echo "$*"
+}
diff --git a/src/lib/repo/configure.sh b/src/lib/repo/configure.sh
index b3c188c..0980fd1 100644
--- a/src/lib/repo/configure.sh
+++ b/src/lib/repo/configure.sh
@@ -207,9 +207,14 @@ pkgctl_repo_configure() {
fi
for path in "${paths[@]}"; do
- if ! realpath=$(realpath -e "${path}"); then
+ # resolve symlink for basename
+ if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
die "No such directory: ${path}"
fi
+ # skip paths that aren't directories
+ if [[ ! -d "${realpath}" ]]; then
+ continue
+ fi
pkgbase=$(basename "${realpath}")
pkgbase=${pkgbase%.git}
diff --git a/src/lib/repo/switch.sh b/src/lib/repo/switch.sh
index f411ac2..d8ba9df 100644
--- a/src/lib/repo/switch.sh
+++ b/src/lib/repo/switch.sh
@@ -101,16 +101,21 @@ pkgctl_repo_switch() {
fi
for path in "${paths[@]}"; do
- if ! realpath=$(realpath -e -- "${path}"); then
+ # resolve symlink for basename
+ if ! realpath=$(realpath --canonicalize-existing -- "${path}"); then
die "No such directory: ${path}"
fi
- pkgbase=$(basename "${realpath}")
-
- if [[ ! -d "${path}/.git" ]]; then
+ # skip paths that are not directories
+ if [[ ! -d "${realpath}" ]]; then
+ continue
+ fi
+ # skip paths that are not git repositories
+ if [[ ! -d "${realpath}/.git" ]]; then
error "Not a Git repository: ${path}"
continue
fi
+ pkgbase=$(basename "${realpath}")
if ! git -C "${path}" checkout "${GIT_CHECKOUT_OPTIONS[@]}" "${GIT_REF}"; then
die "Failed to switch ${pkgbase} to version ${VERSION}"
fi
diff --git a/src/lib/version.sh b/src/lib/version.sh
index ac810ae..a18da83 100644
--- a/src/lib/version.sh
+++ b/src/lib/version.sh
@@ -19,6 +19,7 @@ pkgctl_version_usage() {
COMMANDS
check Compares local package versions against upstream
+ setup Automatically detect and setup a basic nvchecker config
upgrade Adjust the PKGBUILD to match the latest upstream version
OPTIONS
@@ -26,6 +27,7 @@ pkgctl_version_usage() {
EXAMPLES
$ ${COMMAND} check libfoo linux libbar
+ $ ${COMMAND} setup libfoo
_EOF_
}
@@ -57,6 +59,14 @@ pkgctl_version() {
pkgctl_version_upgrade "$@"
exit $?
;;
+ setup)
+ _DEVTOOLS_COMMAND+=" $1"
+ shift
+ # shellcheck source=src/lib/version/setup.sh
+ source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/setup.sh
+ pkgctl_version_setup "$@"
+ exit 0
+ ;;
*)
die "invalid argument: %s" "$1"
;;
diff --git a/src/lib/version/check.sh b/src/lib/version/check.sh
index 35d07e2..ec90eb4 100644
--- a/src/lib/version/check.sh
+++ b/src/lib/version/check.sh
@@ -108,6 +108,10 @@ pkgctl_version_check() {
term_spinner_start "${status_dir}"
for path in "${pkgbases[@]}"; do
+ # skip paths that are not directories
+ if [[ ! -d "${path}" ]]; then
+ continue
+ fi
pushd "${path}" >/dev/null
if [[ ! -f "PKGBUILD" ]]; then
@@ -219,7 +223,7 @@ get_upstream_version() {
opts+=(--keyfile "${keyfile}")
fi
- if ! output=$(nvchecker --file "${config}" --logger json "${opts[@]}" 2>&1 | \
+ if ! output=$(GIT_TERMINAL_PROMPT=0 nvchecker --file "${config}" --logger json "${opts[@]}" 2>&1 | \
jq --raw-output 'select(.level != "debug")'); then
printf "failed to run nvchecker: %s" "${output}"
return 1
diff --git a/src/lib/version/setup.sh b/src/lib/version/setup.sh
new file mode 100644
index 0000000..123862c
--- /dev/null
+++ b/src/lib/version/setup.sh
@@ -0,0 +1,528 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+[[ -z ${DEVTOOLS_INCLUDE_VERSION_SETUP_SH:-} ]] || return 0
+DEVTOOLS_INCLUDE_VERSION_SETUP_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/version/check.sh
+source "${_DEVTOOLS_LIBRARY_DIR}"/lib/version/check.sh
+
+source /usr/share/makepkg/util/message.sh
+source /usr/share/makepkg/util/source.sh
+
+set -eo pipefail
+
+
+pkgctl_version_setup_usage() {
+ local -r COMMAND=${_DEVTOOLS_COMMAND:-${BASH_SOURCE[0]##*/}}
+ cat <<- _EOF_
+ Usage: ${COMMAND} [OPTIONS] [PKGBASE]...
+
+ Automate the creation of a basic nvchecker configuration file by
+ analyzing the source array specified in the PKGBUILD file of a package.
+
+ If no PKGBASE is specified, the command defaults to using the current
+ working directory.
+
+ OPTIONS
+ -f, --force Overwrite existing nvchecker configuration
+ --prefer-platform-api Prefer platform specific GitHub/GitLab API for complex cases
+ --url URL Derive check target from URL instead of source array
+ --no-check Do not run version check after setup
+ -h, --help Show this help text
+
+ EXAMPLES
+ $ ${COMMAND} neovim vim
+_EOF_
+}
+
+pkgctl_version_setup() {
+ local pkgbases=()
+ local override_url=
+ local run_check=1
+ local force=0
+ local prefer_platform_api=0
+
+ local path ret
+ local checks=()
+
+ while (( $# )); do
+ case $1 in
+ -h|--help)
+ pkgctl_version_setup_usage
+ exit 0
+ ;;
+ -f|--force)
+ force=1
+ shift
+ ;;
+ --prefer-platform-api)
+ prefer_platform_api=1
+ shift
+ ;;
+ --url)
+ (( $# <= 1 )) && die "missing argument for %s" "$1"
+ override_url=$2
+ shift 2
+ ;;
+ --no-check)
+ run_check=0
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "invalid argument: %s" "$1"
+ ;;
+ *)
+ pkgbases=("$@")
+ break
+ ;;
+ esac
+ done
+
+ # Check if used without pkgbases in a packaging directory
+ if (( ${#pkgbases[@]} == 0 )); then
+ if [[ -f PKGBUILD ]]; then
+ pkgbases=(".")
+ else
+ pkgctl_version_setup_usage
+ exit 1
+ fi
+ fi
+
+ ret=0
+ for path in "${pkgbases[@]}"; do
+ # skip paths that are not directories
+ if [[ ! -d "${path}" ]]; then
+ continue
+ fi
+
+ pushd "${path}" >/dev/null
+ if nvchecker_setup "${path}" "${force}" "${prefer_platform_api}" "${override_url}"; then
+ checks+=("${path}")
+ else
+ ret=1
+ fi
+ popd >/dev/null
+ done
+
+ # run checks on the setup targets
+ if (( run_check )) && (( ${#checks[@]} >= 1 )); then
+ echo
+ pkgctl_version_check --verbose "${checks[@]}" || true
+ fi
+
+ return $ret
+}
+
+nvchecker_setup() {
+ local path=$1
+ local force=$2
+ local prefer_platform_api=$3
+ local override_url=$4
+ local pkgbase pkgname source source_url proto domain url_parts section body
+
+ if [[ ! -f PKGBUILD ]]; then
+ msg_error "${BOLD}${path}:${ALL_OFF} no PKGBUILD found"
+ return 1
+ fi
+
+ unset body pkgbase pkgname source url
+ # shellcheck source=contrib/makepkg/PKGBUILD.proto
+ if ! . ./PKGBUILD; then
+ msg_error "${BOLD}${path}:${ALL_OFF} failed to source PKGBUILD"
+ return 1
+ fi
+ pkgbase=${pkgbase:-$pkgname}
+
+ # try to guess from url as last try
+ if [[ -n ${url} ]]; then
+ source+=("${url}")
+ fi
+
+ # handle overwrite of existing config
+ if [[ -f .nvchecker.toml ]] && (( ! force )); then
+ msg_warn "${BOLD}${pkgbase}:${ALL_OFF} nvchecker already configured"
+ return 1
+ fi
+
+ # override the source array with a passed URL
+ if [[ -n ${override_url} ]]; then
+ source=("${override_url}")
+ fi
+
+ # skip empty source array
+ if (( ${#source[@]} == 0 )); then
+ msg_error "${BOLD}${pkgbase}:${ALL_OFF} PKGBUILD has no source array"
+ return 1
+ fi
+
+ for source_url in "${source[@]}"; do
+ # Strips out filename::http for example
+ source_url=$(get_url "${source_url}")
+ # discard query fragments
+ source_url=${source_url%\?*}
+ source_url=${source_url%#*}
+
+ # skip patches
+ if [[ ${source_url} == *.patch ]]; then
+ continue
+ fi
+ # skip signatures
+ if [[ ${source_url} == *.asc ]] || [[ ${source_url} == *.sig ]]; then
+ continue
+ fi
+ # skip local files
+ if [[ ${source_url} != *://* ]]; then
+ continue
+ fi
+
+ # split URL segments while avoiding empty element after protocol and newline at the end
+ mapfile -td / url_parts <<< "${source_url/:\/\//\/}/"
+ unset "url_parts[-1]"
+
+ # extract protocol and domain to select the configuration type
+ proto=${url_parts[0]}
+ domain=${url_parts[1]}
+
+ case "${domain}" in
+ gitlab.*)
+ if (( prefer_platform_api )); then
+ body=$(nvchecker_setup_gitlab "${url_parts[@]}")
+ else
+ body=$(nvchecker_setup_git "${url_parts[@]}")
+ fi
+ break
+ ;;
+ github.com)
+ if (( prefer_platform_api )); then
+ body=$(nvchecker_setup_github "${url_parts[@]}")
+ else
+ body=$(nvchecker_setup_git "${url_parts[@]}")
+ fi
+ break
+ ;;
+ codeberg.org)
+ body=$(nvchecker_setup_git "${url_parts[@]}")
+ break
+ ;;
+ pypi.org|pypi.io|files.pythonhosted.org)
+ body=$(nvchecker_setup_pypi "${url_parts[@]}")
+ break
+ ;;
+ hackage.haskell.org)
+ body=$(nvchecker_setup_hackage "${url_parts[@]}")
+ break
+ ;;
+ registry.npmjs.org|npmjs.com|www.npmjs.com)
+ body=$(nvchecker_setup_npm "${url_parts[@]}")
+ break
+ ;;
+ rubygems.org)
+ body=$(nvchecker_setup_rubygems "${url_parts[@]}")
+ break
+ ;;
+ *.cpan.org|*.mcpan.org|*.metacpan.org)
+ body=$(nvchecker_setup_cpan "${url_parts[@]}")
+ break
+ ;;
+ crates.io|*.crates.io)
+ body=$(nvchecker_setup_crates_io "${url_parts[@]}")
+ break
+ ;;
+ *)
+ if [[ ${proto} == git ]] || [[ ${proto} == git+https ]]; then
+ body=$(nvchecker_setup_git "${url_parts[@]}")
+ fi
+ ;;
+ esac
+ done
+
+ if [[ -z "${body}" ]]; then
+ msg_error "${BOLD}${pkgbase}:${ALL_OFF} unable to automatically setup nvchecker"
+ return 1
+ fi
+
+ # escape the section if it contains toml subsection chars
+ section="${pkgbase}"
+ if [[ ${section} == *.* ]]; then
+ section="\"${section}\""
+ fi
+
+ msg_success "${BOLD}${pkgbase}:${ALL_OFF} successfully configured nvchecker"
+ cat > .nvchecker.toml << EOF
+[${section}]
+${body}
+EOF
+}
+
+get_git_url_from_parts() {
+ local url_parts=("$@")
+ local proto=${url_parts[0]#*+}
+ local domain=${url_parts[1]}
+ local url
+ url="${proto}://$(join_by / "${url_parts[@]:1}")"
+
+ case "${domain}" in
+ gitlab.*)
+ url=${url%/-/*/*}
+ [[ ${url} != *.git ]] && url+=.git
+ ;;
+ github.com|codeberg.org)
+ url="${proto}://$(join_by / "${url_parts[@]:1:3}")"
+ [[ ${url} != *.git ]] && url+=.git
+ ;;
+ esac
+
+ printf '%s' "${url}"
+}
+
+# PyPI
+#
+# As Arch python packages don't necessarily match the pypi name, when the
+# provided source url comes from pypi.io or pypi.org try to extract the package
+# name from the (predictable) tarball download url for example:
+#
+# https://pypi.io/packages/source/p/pyflakes/pyflakes-3.1.0.tar.gz
+# https://pypi.io/packages/source/p/pyflakes
+# https://pypi.org/packages/source/b/bleach
+# https://files.pythonhosted.org/packages/source/p/pyflakes
+# https://pypi.org/project/SQLAlchemy/
+nvchecker_setup_pypi() {
+ local url_parts=("$@")
+ local pypi
+
+ if [[ ${url_parts[2]} == packages ]]; then
+ pypi=${url_parts[5]}
+ elif [[ ${url_parts[2]} == project ]]; then
+ pypi=${url_parts[3]}
+ else
+ return 1
+ fi
+
+ cat << EOF
+source = "pypi"
+pypi = "${pypi}"
+EOF
+}
+
+# Git
+#
+# Set up a generic Git source, while removing the proto specific part from makepkg
+#
+# git+https://github.com/prometheus/prometheus.git
+# https://git.foobar.com/some/path/group/project.git
+# https://gitlab.com/sub/group/project/-/archive/8.0.0/packages-8.0.0.tar.gz
+nvchecker_setup_git() {
+ local url_parts=("$@")
+ local url
+ url=$(get_git_url_from_parts "${url_parts[@]}")
+
+ cat << EOF
+source = "git"
+git = "${url}"
+EOF
+
+ # best effort check if the tags are prefixed with v
+ if git_tags_have_version_prefix "${url}"; then
+ echo 'prefix = "v"'
+ fi
+}
+
+git_tags_have_version_prefix() {
+ local url=$1
+ # best effort check if the tags are prefixed with v
+ if ! grep --max-count=1 --quiet --extended-regex 'refs/tags/v[0-9]+[\.0-9]*$' \
+ <(GIT_TERMINAL_PROMPT=0 git ls-remote --quiet --tags "${url}" 2>/dev/null); then
+ return 1
+ fi
+ return 0
+}
+
+# Github
+#
+# We want to know the $org/$project name from the url
+#
+# https://github.com/prometheus/prometheus/archive/v2.49.1.tar.gz
+nvchecker_setup_github() {
+ local url_parts=("$@")
+ local url project
+ if ! url=$(get_git_url_from_parts "${url_parts[@]}"); then
+ return 1
+ fi
+ project=${url#*://*/}
+ project=${project%.git}
+
+ cat << EOF
+source = "github"
+github = "${project}"
+use_max_tag = true
+EOF
+
+ # best effort check if the tags are prefixed with v
+ if git_tags_have_version_prefix "${url}"; then
+ echo 'prefix = "v"'
+ fi
+}
+
+# GitLab
+#
+# We want to know the $org/$project name from the url
+#
+# git+https://gitlab.com/inkscape/inkscape.git#tag=091e20ef0f204eb40ecde54436e1ef934a03d894
+nvchecker_setup_gitlab() {
+ local url_parts=("$@")
+ local url project host
+ if ! url=$(get_git_url_from_parts "${url_parts[@]}"); then
+ return 1
+ fi
+ project=${url#*://*/}
+ project=${project%.git}
+ cat << EOF
+source = "gitlab"
+gitlab = "${project}"
+EOF
+
+ host=${url#*://}
+ host=${host%%/*}
+ if [[ ${host} != gitlab.com ]]; then
+ echo "host = \"${host}\""
+ fi
+
+ echo "use_max_tag = true"
+
+ # best effort check if the tags are prefixed with v
+ if git_tags_have_version_prefix "${url}"; then
+ echo 'prefix = "v"'
+ fi
+}
+
+# Hackage
+#
+# We want to know the project name
+#
+# https://hackage.haskell.org/package/xmonad
+# https://hackage.haskell.org/package/xmonad-0.18.0/xmonad-0.18.0.tar.gz
+# https://hackage.haskell.org/packages/archive/digits/0.3.1/digits-0.3.1.tar.gz
+nvchecker_setup_hackage() {
+ local url_parts=("$@")
+ local hackage
+
+ if [[ ${url_parts[2]} == packages ]]; then
+ hackage=${url_parts[4]}
+ elif [[ ${url_parts[2]} == package ]] && (( ${#url_parts[@]} == 4 )); then
+ hackage=${url_parts[3]}
+ elif [[ ${url_parts[2]} == package ]] && (( ${#url_parts[@]} >= 5 )); then
+ hackage=${url_parts[3]%-*}
+ else
+ return 1
+ fi
+
+ cat << EOF
+source = "hackage"
+hackage = "${hackage}"
+EOF
+}
+
+# NPM
+#
+# We want to know the project name
+#
+# https://registry.npmjs.org/eslint_d/-/eslint_d-12.1.0.tgz
+# https://www.npmjs.com/package/node-gyp
+nvchecker_setup_npm() {
+ local url_parts=("$@")
+ local npm
+
+ if [[ ${url_parts[1]} == registry.npmjs.org ]]; then
+ npm=${url_parts[2]}
+ elif [[ ${url_parts[2]} == package ]] && (( ${#url_parts[@]} == 4 )); then
+ npm=${url_parts[3]}
+ else
+ return 1
+ fi
+
+ cat << EOF
+source = "npm"
+npm = "${npm}"
+EOF
+}
+
+# RubyGems
+#
+# We want to know the project name
+#
+# https://rubygems.org/downloads/polyglot-0.3.5.gem
+# https://rubygems.org/gems/diff-lcs
+nvchecker_setup_rubygems() {
+ local url_parts=("$@")
+ local gem
+
+ if [[ ${url_parts[2]} == downloads ]]; then
+ gem=${url_parts[-1]%-*}
+ elif [[ ${url_parts[2]} == gems ]]; then
+ gem=${url_parts[3]}
+ else
+ return 1
+ fi
+
+ cat << EOF
+source = "gems"
+gems = "${gem}"
+EOF
+}
+
+# CPAN
+#
+# We want to know the project name
+#
+# source = https://search.cpan.org/CPAN/authors/id/C/CO/COSIMO/Locale-PO-1.2.3.tar.gz
+nvchecker_setup_cpan() {
+ local url_parts=("$@")
+ local cpan=${url_parts[-1]}
+ cpan=${cpan%-*}
+
+ cat << EOF
+source = "cpan"
+cpan = "${cpan}"
+EOF
+}
+
+# crates.io
+#
+# We want to know the crate name
+#
+# https://crates.io/api/v1/crates/${pkgname}/${pkgver}/download
+# https://static.crates.io/crates/${pkgname}/$pkgname-$pkgver.crate
+# https://crates.io/crates/git-smash
+nvchecker_setup_crates_io() {
+ local url_parts=("$@")
+ local crate
+
+ if [[ ${url_parts[2]} == crates ]]; then
+ crate=${url_parts[3]}
+ elif [[ ${url_parts[4]} == crates ]]; then
+ crate=${url_parts[5]}
+ else
+ return 1
+ fi
+
+
+ for i in "${!url_parts[@]}"; do
+ if [[ ${url_parts[i]} == crates ]]; then
+ crate=${url_parts[(( i + 1 ))]}
+ fi
+ done
+
+ cat << EOF
+source = "cratesio"
+cratesio = "${crate}"
+EOF
+}
diff --git a/src/lib/version/upgrade.sh b/src/lib/version/upgrade.sh
index e217532..df3b77d 100644
--- a/src/lib/version/upgrade.sh
+++ b/src/lib/version/upgrade.sh
@@ -99,6 +99,10 @@ pkgctl_version_upgrade() {
term_spinner_start "${status_dir}"
for path in "${pkgbases[@]}"; do
+ # skip paths that aren't directories
+ if [[ ! -d "${path}" ]]; then
+ continue
+ fi
pushd "${path}" >/dev/null
if [[ ! -f "PKGBUILD" ]]; then
diff --git a/test/case/version-setup.bats b/test/case/version-setup.bats
new file mode 100644
index 0000000..fd50a87
--- /dev/null
+++ b/test/case/version-setup.bats
@@ -0,0 +1,127 @@
+bats_require_minimum_version 1.5.0
+
+export _DEVTOOLS_LIBRARY_DIR="${PWD}/src"
+
+_pkgctl_version_setup() {
+ source ${_DEVTOOLS_LIBRARY_DIR}/lib/version/setup.sh
+ pkgctl_version_setup "$@"
+}
+
+setup_and_check_config() {
+ pushd "test/fixture/version/setup/$1"
+ shift
+ _pkgctl_version_setup --force --no-check "$@"
+ diff .nvchecker.toml nvchecker.assert.toml
+ popd
+}
+
+@test "opt-no-force" {
+ pushd test/fixture/version/setup/opt-no-force
+ touch .nvchecker.toml
+ run ! _pkgctl_version_setup --no-check "$@"
+ popd
+}
+
+@test "opt-url" {
+ pushd test/fixture/version/setup/opt-url
+ _pkgctl_version_setup --no-check --force --url \
+ "https://crates.io/api/v1/crates/shotgun/1.0/download" "$@"
+ diff .nvchecker.toml nvchecker.assert.toml
+ popd
+}
+
+@test "codeberg-tarball" {
+ setup_and_check_config codeberg-tarball
+}
+
+@test "files.pythonhosted.org" {
+ setup_and_check_config files.pythonhosted.org
+}
+
+@test "github-git" {
+ setup_and_check_config github-git
+}
+
+@test "github-git-as-platform" {
+ setup_and_check_config github-git-as-platform --prefer-platform-api
+}
+
+@test "github-git-v-prefix" {
+ setup_and_check_config github-git-v-prefix
+}
+
+@test "github-git-v-prefix-as-platform" {
+ setup_and_check_config github-git-v-prefix-as-platform --prefer-platform-api
+}
+
+@test "github-tarball" {
+ setup_and_check_config github-tarball
+}
+
+@test "github-tarball-as-platform" {
+ setup_and_check_config github-tarball-as-platform --prefer-platform-api
+}
+
+@test "gitlab-archlinux-tarball" {
+ setup_and_check_config gitlab-archlinux-tarball
+}
+
+@test "gitlab-archlinux-tarball-as-platform" {
+ setup_and_check_config gitlab-archlinux-tarball-as-platform --prefer-platform-api
+}
+
+@test "gitlab-git-multi-group" {
+ setup_and_check_config gitlab-git-multi-group
+}
+
+@test "gitlab-git-multi-group-as-platform" {
+ setup_and_check_config gitlab-git-multi-group-as-platform --prefer-platform-api
+}
+
+@test "gitlab-tarball-multi-group" {
+ setup_and_check_config gitlab-tarball-multi-group
+}
+
+@test "gitlab-tarball-multi-group-as-platform" {
+ setup_and_check_config gitlab-tarball-multi-group-as-platform --prefer-platform-api
+}
+
+@test "hackage-tarball" {
+ setup_and_check_config hackage-tarball
+}
+
+@test "pkgbase-with-dot" {
+ setup_and_check_config pkgbase-with-dot
+}
+
+@test "pypi.io" {
+ setup_and_check_config pypi.io
+}
+
+@test "pypi.org" {
+ setup_and_check_config pypi.org
+}
+
+@test "registry.npmjs.org" {
+ setup_and_check_config registry.npmjs.org
+}
+
+@test "git-custom" {
+ setup_and_check_config git-custom
+}
+
+@test "rubygems.org" {
+ setup_and_check_config rubygems.org
+}
+
+@test "cpan.org" {
+ setup_and_check_config cpan.org
+}
+
+@test "crates.io" {
+ setup_and_check_config crates.io
+}
+
+@test "static.crates.io" {
+ setup_and_check_config static.crates.io
+}
diff --git a/test/fixture/version/setup/.gitignore b/test/fixture/version/setup/.gitignore
new file mode 100644
index 0000000..fa5ad32
--- /dev/null
+++ b/test/fixture/version/setup/.gitignore
@@ -0,0 +1 @@
+*/.nvchecker.toml
diff --git a/test/fixture/version/setup/codeberg-tarball/PKGBUILD b/test/fixture/version/setup/codeberg-tarball/PKGBUILD
new file mode 100644
index 0000000..0f5853c
--- /dev/null
+++ b/test/fixture/version/setup/codeberg-tarball/PKGBUILD
@@ -0,0 +1,18 @@
+pkgname=xmobar
+pkgver=1.0
+pkgrel=1
+pkgdesc=''
+url='https://codeberg.org/xmobar/xmobar'
+arch=(any)
+source=(
+ dynamic-compilation.patch
+ ${pkgname}-${pkgver}.tar.gz::https://codeberg.org/xmobar/xmobar/archive/${pkgver}.tar.gz
+)
+sha512sums=('319f3a77d500c505826ab487e4011bb1a22b8cae70c17b964574a09a6488a864a1aaabb6a298468d121110dd485f179bc712a5106e49eb8ae638e02b5115190a'
+ '15db3e27d1ff957e26e706e4c67cec6e43d89f5a39cd6d81ddb5ae8426e32d938494fbba39fa322461d992a95d2e522c10b186a1ca2c5c3e996f944b6e6ef7c4')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/codeberg-tarball/nvchecker.assert.toml b/test/fixture/version/setup/codeberg-tarball/nvchecker.assert.toml
new file mode 100644
index 0000000..773bcd0
--- /dev/null
+++ b/test/fixture/version/setup/codeberg-tarball/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[xmobar]
+source = "git"
+git = "https://codeberg.org/xmobar/xmobar.git"
diff --git a/test/fixture/version/setup/cpan.org/PKGBUILD b/test/fixture/version/setup/cpan.org/PKGBUILD
new file mode 100644
index 0000000..d972d86
--- /dev/null
+++ b/test/fixture/version/setup/cpan.org/PKGBUILD
@@ -0,0 +1,14 @@
+pkgname=perl-locale-po
+pkgver=0.3.5
+pkgrel=1
+pkgdesc=''
+arch=(any)
+url='http://polyglot.rubyforge.org/'
+source=("https://search.cpan.org/CPAN/authors/id/C/CO/COSIMO/Locale-PO-$pkgver.tar.gz")
+sha256sums=('59d66ef5e3c166431c39cb8b7c1d02af419051352f27912f6a43981b3def16af')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/cpan.org/nvchecker.assert.toml b/test/fixture/version/setup/cpan.org/nvchecker.assert.toml
new file mode 100644
index 0000000..d2ca368
--- /dev/null
+++ b/test/fixture/version/setup/cpan.org/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[perl-locale-po]
+source = "cpan"
+cpan = "Locale-PO"
diff --git a/test/fixture/version/setup/crates.io/PKGBUILD b/test/fixture/version/setup/crates.io/PKGBUILD
new file mode 100644
index 0000000..c2ed37f
--- /dev/null
+++ b/test/fixture/version/setup/crates.io/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=shotgun
+pkgver=0.3.5
+pkgrel=1
+pkgdesc='Minimal X screenshot utility'
+arch=('any')
+url='https://github.com/neXromancers/shotgun'
+license=('MIT')
+depends=('cargo')
+options=('!emptydirs')
+source=("https://crates.io/api/v1/crates/${pkgname}/${pkgver}/download")
+sha256sums=('59d66ef5e3c166431c39cb8b7c1d02af419051352f27912f6a43981b3def16af')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/crates.io/nvchecker.assert.toml b/test/fixture/version/setup/crates.io/nvchecker.assert.toml
new file mode 100644
index 0000000..234be6c
--- /dev/null
+++ b/test/fixture/version/setup/crates.io/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[shotgun]
+source = "cratesio"
+cratesio = "shotgun"
diff --git a/test/fixture/version/setup/files.pythonhosted.org/PKGBUILD b/test/fixture/version/setup/files.pythonhosted.org/PKGBUILD
new file mode 100644
index 0000000..b6eba1e
--- /dev/null
+++ b/test/fixture/version/setup/files.pythonhosted.org/PKGBUILD
@@ -0,0 +1,15 @@
+_pyname=ipyparallel
+pkgname=python-$_pyname
+pkgver=8.6.1
+pkgrel=1
+pkgdesc='Interactive Parallel Computing in Python'
+url='https://pypi.org/project/ipyparallel/'
+arch=(any)
+license=(BSD)
+source=(https://files.pythonhosted.org/packages/source/${_pyname::1}/$_pyname/$_pyname-$pkgver.tar.gz)
+depends=(python)
+sha256sums=('a39aa5ef9560170bf0e9afedca9ff045e1b9c1832c49303377edcc91cea9fb77')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/files.pythonhosted.org/nvchecker.assert.toml b/test/fixture/version/setup/files.pythonhosted.org/nvchecker.assert.toml
new file mode 100644
index 0000000..815b717
--- /dev/null
+++ b/test/fixture/version/setup/files.pythonhosted.org/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[python-ipyparallel]
+source = "pypi"
+pypi = "ipyparallel"
diff --git a/test/fixture/version/setup/git-custom/PKGBUILD b/test/fixture/version/setup/git-custom/PKGBUILD
new file mode 100644
index 0000000..3c70d5f
--- /dev/null
+++ b/test/fixture/version/setup/git-custom/PKGBUILD
@@ -0,0 +1,14 @@
+pkgname=libfakekey
+pkgver=0.3
+pkgrel=1
+pkgdesc='X virtual keyboard library.'
+arch=('x86_64')
+url='https://www.yoctoproject.org/tools-resources/projects/matchbox'
+license=('GPL')
+depends=('libxtst')
+source=("git://git.yoctoproject.org/libfakekey")
+sha256sums=('d282fa6481a5b85f71e36e8bad4cfa938cc8eaac4c42ffa27f9203ac634813f4')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/git-custom/nvchecker.assert.toml b/test/fixture/version/setup/git-custom/nvchecker.assert.toml
new file mode 100644
index 0000000..ddcdcd1
--- /dev/null
+++ b/test/fixture/version/setup/git-custom/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[libfakekey]
+source = "git"
+git = "git://git.yoctoproject.org/libfakekey"
diff --git a/test/fixture/version/setup/github-git-as-platform/PKGBUILD b/test/fixture/version/setup/github-git-as-platform/PKGBUILD
new file mode 100644
index 0000000..18e30bc
--- /dev/null
+++ b/test/fixture/version/setup/github-git-as-platform/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=minisign
+pkgver=0.11
+pkgrel=1
+pkgdesc="A dead-simple tool to sign files and verify digital signatures"
+arch=('x86_64')
+url="https://github.com/jedisct1/minisign"
+license=('custom:ISC')
+depends=('libsodium')
+makedepends=('cmake' 'git')
+_commit=feefda7af87f64342bd07bf446ceb0467cbd0fb4 # git rev-parse $pkgver
+source=("git+https://github.com/jedisct1/minisign.git?signed#tag=$_commit")
+sha512sums=('SKIP')
+validpgpkeys=(54A2B8892CC3D6A597B92B6C210627AABA709FE1) # Frank Denis
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/github-git-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/github-git-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..2be1de8
--- /dev/null
+++ b/test/fixture/version/setup/github-git-as-platform/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[minisign]
+source = "github"
+github = "jedisct1/minisign"
+use_max_tag = true
diff --git a/test/fixture/version/setup/github-git-v-prefix-as-platform/PKGBUILD b/test/fixture/version/setup/github-git-v-prefix-as-platform/PKGBUILD
new file mode 100644
index 0000000..386d0c1
--- /dev/null
+++ b/test/fixture/version/setup/github-git-v-prefix-as-platform/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=vim
+pkgver=9.1.0131
+pkgrel=1
+pkgdesc="A dead-simple tool to sign files and verify digital signatures"
+arch=('x86_64')
+url="https://github.com/jedisct1/minisign"
+license=('custom:ISC')
+depends=('libsodium')
+makedepends=('cmake' 'git')
+_commit=feefda7af87f64342bd07bf446ceb0467cbd0fb4 # git rev-parse $pkgver
+source=("git+https://github.com/vim/vim.git?signed#tag=v${pkgver}")
+sha512sums=('SKIP')
+validpgpkeys=(54A2B8892CC3D6A597B92B6C210627AABA709FE1) # Frank Denis
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/github-git-v-prefix-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/github-git-v-prefix-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..a6c7da1
--- /dev/null
+++ b/test/fixture/version/setup/github-git-v-prefix-as-platform/nvchecker.assert.toml
@@ -0,0 +1,5 @@
+[vim]
+source = "github"
+github = "vim/vim"
+use_max_tag = true
+prefix = "v"
diff --git a/test/fixture/version/setup/github-git-v-prefix/PKGBUILD b/test/fixture/version/setup/github-git-v-prefix/PKGBUILD
new file mode 100644
index 0000000..386d0c1
--- /dev/null
+++ b/test/fixture/version/setup/github-git-v-prefix/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=vim
+pkgver=9.1.0131
+pkgrel=1
+pkgdesc="A dead-simple tool to sign files and verify digital signatures"
+arch=('x86_64')
+url="https://github.com/jedisct1/minisign"
+license=('custom:ISC')
+depends=('libsodium')
+makedepends=('cmake' 'git')
+_commit=feefda7af87f64342bd07bf446ceb0467cbd0fb4 # git rev-parse $pkgver
+source=("git+https://github.com/vim/vim.git?signed#tag=v${pkgver}")
+sha512sums=('SKIP')
+validpgpkeys=(54A2B8892CC3D6A597B92B6C210627AABA709FE1) # Frank Denis
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/github-git-v-prefix/nvchecker.assert.toml b/test/fixture/version/setup/github-git-v-prefix/nvchecker.assert.toml
new file mode 100644
index 0000000..169d24b
--- /dev/null
+++ b/test/fixture/version/setup/github-git-v-prefix/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[vim]
+source = "git"
+git = "https://github.com/vim/vim.git"
+prefix = "v"
diff --git a/test/fixture/version/setup/github-git/PKGBUILD b/test/fixture/version/setup/github-git/PKGBUILD
new file mode 100644
index 0000000..18e30bc
--- /dev/null
+++ b/test/fixture/version/setup/github-git/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=minisign
+pkgver=0.11
+pkgrel=1
+pkgdesc="A dead-simple tool to sign files and verify digital signatures"
+arch=('x86_64')
+url="https://github.com/jedisct1/minisign"
+license=('custom:ISC')
+depends=('libsodium')
+makedepends=('cmake' 'git')
+_commit=feefda7af87f64342bd07bf446ceb0467cbd0fb4 # git rev-parse $pkgver
+source=("git+https://github.com/jedisct1/minisign.git?signed#tag=$_commit")
+sha512sums=('SKIP')
+validpgpkeys=(54A2B8892CC3D6A597B92B6C210627AABA709FE1) # Frank Denis
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/github-git/nvchecker.assert.toml b/test/fixture/version/setup/github-git/nvchecker.assert.toml
new file mode 100644
index 0000000..6d54f48
--- /dev/null
+++ b/test/fixture/version/setup/github-git/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[minisign]
+source = "git"
+git = "https://github.com/jedisct1/minisign.git"
diff --git a/test/fixture/version/setup/github-tarball-as-platform/PKGBUILD b/test/fixture/version/setup/github-tarball-as-platform/PKGBUILD
new file mode 100644
index 0000000..cf66024
--- /dev/null
+++ b/test/fixture/version/setup/github-tarball-as-platform/PKGBUILD
@@ -0,0 +1,29 @@
+pkgname=git-smash
+pkgver=0.1.0
+pkgrel=1
+pkgdesc='Smash staged changes into previous commits to support your Git workflow'
+url='https://github.com/anthraxx/git-smash'
+arch=('x86_64')
+license=('MIT')
+depends=('glibc' 'gcc-libs' 'git')
+makedepends=('cargo' 'scdoc')
+optdepends=(
+ 'skim: selection menu alternative'
+ 'fzf: selection menu alternative'
+)
+source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
+ ${url}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz.sig)
+options=('!makeflags')
+sha512sums=('64a8b6e2afa7007966245a4888e51251e8c35f0b82421f3cee634a3e7b82256a24459cba2941800a6e50a047766a0f8de20b435904d17df3fd456b6c09ac4c5f'
+ 'SKIP')
+b2sums=('acc46b7a87135380fe36c378e9055b8b7c9b88a818c955f04677161f50d5ccd5699ac05f0a858dd11ca7b42b3505c0ac037f50efcd690f9e5a76be395d5d6590'
+ 'SKIP')
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak
+)
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/github-tarball-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/github-tarball-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..b3c5db2
--- /dev/null
+++ b/test/fixture/version/setup/github-tarball-as-platform/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[git-smash]
+source = "github"
+github = "anthraxx/git-smash"
+use_max_tag = true
diff --git a/test/fixture/version/setup/github-tarball/PKGBUILD b/test/fixture/version/setup/github-tarball/PKGBUILD
new file mode 100644
index 0000000..935ac0d
--- /dev/null
+++ b/test/fixture/version/setup/github-tarball/PKGBUILD
@@ -0,0 +1,25 @@
+pkgname=git-smash
+pkgver=0.1.0
+pkgrel=1
+pkgdesc='Smash staged changes into previous commits to support your Git workflow'
+url='https://github.com/anthraxx/git-smash'
+arch=('x86_64')
+license=('MIT')
+depends=('glibc' 'gcc-libs' 'git')
+makedepends=('cargo' 'scdoc')
+source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
+ ${url}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz.sig)
+options=('!makeflags')
+sha512sums=('64a8b6e2afa7007966245a4888e51251e8c35f0b82421f3cee634a3e7b82256a24459cba2941800a6e50a047766a0f8de20b435904d17df3fd456b6c09ac4c5f'
+ 'SKIP')
+b2sums=('acc46b7a87135380fe36c378e9055b8b7c9b88a818c955f04677161f50d5ccd5699ac05f0a858dd11ca7b42b3505c0ac037f50efcd690f9e5a76be395d5d6590'
+ 'SKIP')
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak
+)
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/github-tarball/nvchecker.assert.toml b/test/fixture/version/setup/github-tarball/nvchecker.assert.toml
new file mode 100644
index 0000000..65877ac
--- /dev/null
+++ b/test/fixture/version/setup/github-tarball/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[git-smash]
+source = "git"
+git = "https://github.com/anthraxx/git-smash.git"
diff --git a/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/PKGBUILD b/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/PKGBUILD
new file mode 100644
index 0000000..adcd790
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/PKGBUILD
@@ -0,0 +1,57 @@
+pkgname=devtools
+epoch=1
+pkgver=1.1.1
+pkgrel=1
+pkgdesc='Tools for Arch Linux package maintainers'
+arch=('any')
+license=('GPL-3.0-or-later')
+url='https://gitlab.archlinux.org/archlinux/devtools'
+depends=(
+ arch-install-scripts
+ awk
+ bash
+ binutils
+ coreutils
+ curl
+ diffutils
+ fakeroot
+ findutils
+ grep
+ jq
+ openssh
+ parallel
+ rsync
+ sed
+ util-linux
+
+ breezy
+ git
+ mercurial
+ subversion
+)
+makedepends=(
+ asciidoc
+ shellcheck
+)
+optdepends=(
+ 'btrfs-progs: btrfs support'
+ 'bat: pretty printing for pkgctl search'
+ 'nvchecker: pkgctl version subcommand'
+ 'pacman-contrib: support for the --update-checksums option'
+)
+replaces=(devtools-git-poc)
+source=(https://gitlab.archlinux.org/archlinux/devtools/-/releases/v${pkgver}/downloads/devtools-${pkgver}.tar.gz{,.sig})
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak <anthraxx@archlinux.org>
+ 'F00B96D15228013FFC9C9D0393B11DAA4C197E3D' # Christian Heusel (gromit packager key) <gromit@archlinux.org>
+)
+sha256sums=('b2a12bb8b4b568110b055ccec903c9a0b0b979ab44f0cba574c026d243d5ce36'
+ 'SKIP')
+b2sums=('be9601a4fcbb576b9a8637abdaec70f8ec730cf5752793c2f8fdce20e489b74555f624d0a0b5f8bb58c0914413a29d51698c8474430010502ab80d6c18c4332e'
+ 'SKIP')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..1a91eb4
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-archlinux-tarball-as-platform/nvchecker.assert.toml
@@ -0,0 +1,6 @@
+[devtools]
+source = "gitlab"
+gitlab = "archlinux/devtools"
+host = "gitlab.archlinux.org"
+use_max_tag = true
+prefix = "v"
diff --git a/test/fixture/version/setup/gitlab-archlinux-tarball/PKGBUILD b/test/fixture/version/setup/gitlab-archlinux-tarball/PKGBUILD
new file mode 100644
index 0000000..adcd790
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-archlinux-tarball/PKGBUILD
@@ -0,0 +1,57 @@
+pkgname=devtools
+epoch=1
+pkgver=1.1.1
+pkgrel=1
+pkgdesc='Tools for Arch Linux package maintainers'
+arch=('any')
+license=('GPL-3.0-or-later')
+url='https://gitlab.archlinux.org/archlinux/devtools'
+depends=(
+ arch-install-scripts
+ awk
+ bash
+ binutils
+ coreutils
+ curl
+ diffutils
+ fakeroot
+ findutils
+ grep
+ jq
+ openssh
+ parallel
+ rsync
+ sed
+ util-linux
+
+ breezy
+ git
+ mercurial
+ subversion
+)
+makedepends=(
+ asciidoc
+ shellcheck
+)
+optdepends=(
+ 'btrfs-progs: btrfs support'
+ 'bat: pretty printing for pkgctl search'
+ 'nvchecker: pkgctl version subcommand'
+ 'pacman-contrib: support for the --update-checksums option'
+)
+replaces=(devtools-git-poc)
+source=(https://gitlab.archlinux.org/archlinux/devtools/-/releases/v${pkgver}/downloads/devtools-${pkgver}.tar.gz{,.sig})
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak <anthraxx@archlinux.org>
+ 'F00B96D15228013FFC9C9D0393B11DAA4C197E3D' # Christian Heusel (gromit packager key) <gromit@archlinux.org>
+)
+sha256sums=('b2a12bb8b4b568110b055ccec903c9a0b0b979ab44f0cba574c026d243d5ce36'
+ 'SKIP')
+b2sums=('be9601a4fcbb576b9a8637abdaec70f8ec730cf5752793c2f8fdce20e489b74555f624d0a0b5f8bb58c0914413a29d51698c8474430010502ab80d6c18c4332e'
+ 'SKIP')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-archlinux-tarball/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-archlinux-tarball/nvchecker.assert.toml
new file mode 100644
index 0000000..4e3d43f
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-archlinux-tarball/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[devtools]
+source = "git"
+git = "https://gitlab.archlinux.org/archlinux/devtools.git"
+prefix = "v"
diff --git a/test/fixture/version/setup/gitlab-git-multi-group-as-platform/PKGBUILD b/test/fixture/version/setup/gitlab-git-multi-group-as-platform/PKGBUILD
new file mode 100644
index 0000000..1e2d35b
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-git-multi-group-as-platform/PKGBUILD
@@ -0,0 +1,30 @@
+pkgbase=kicad-library
+pkgname=($pkgbase{,-3d})
+pkgver=7.0.10
+pkgrel=1
+pkgdesc='Assorted libraries for KiCad'
+arch=('any')
+url='http://kicad.org/'
+license=('GPL')
+makedepends=('git' 'cmake')
+options=('!strip')
+source=(
+ 'git+https://gitlab.com/kicad/libraries/kicad-packages3D.git#commit=f1af95360976e66472b13897a1f3f5c2a77c0461'
+ 'git+https://gitlab.com/kicad/libraries/kicad-symbols.git#commit=5efa35abf67b4734a8e04cf83e31514be3329ce4'
+ 'git+https://gitlab.com/kicad/libraries/kicad-templates.git#commit=ff6e3193e6ff6029f65e7cce8ab39fafeafecdd6'
+ 'git+https://gitlab.com/kicad/libraries/kicad-footprints.git#commit=9fb460d078b55f2bb08c459cddd184833a853167'
+)
+sha512sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP')
+
+package_kicad-library() {
+ :
+}
+
+package_kicad-library-3d() {
+ :
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-git-multi-group-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-git-multi-group-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..d2cf1b1
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-git-multi-group-as-platform/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[kicad-library]
+source = "gitlab"
+gitlab = "kicad/libraries/kicad-packages3D"
+use_max_tag = true
diff --git a/test/fixture/version/setup/gitlab-git-multi-group/PKGBUILD b/test/fixture/version/setup/gitlab-git-multi-group/PKGBUILD
new file mode 100644
index 0000000..1e2d35b
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-git-multi-group/PKGBUILD
@@ -0,0 +1,30 @@
+pkgbase=kicad-library
+pkgname=($pkgbase{,-3d})
+pkgver=7.0.10
+pkgrel=1
+pkgdesc='Assorted libraries for KiCad'
+arch=('any')
+url='http://kicad.org/'
+license=('GPL')
+makedepends=('git' 'cmake')
+options=('!strip')
+source=(
+ 'git+https://gitlab.com/kicad/libraries/kicad-packages3D.git#commit=f1af95360976e66472b13897a1f3f5c2a77c0461'
+ 'git+https://gitlab.com/kicad/libraries/kicad-symbols.git#commit=5efa35abf67b4734a8e04cf83e31514be3329ce4'
+ 'git+https://gitlab.com/kicad/libraries/kicad-templates.git#commit=ff6e3193e6ff6029f65e7cce8ab39fafeafecdd6'
+ 'git+https://gitlab.com/kicad/libraries/kicad-footprints.git#commit=9fb460d078b55f2bb08c459cddd184833a853167'
+)
+sha512sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP')
+
+package_kicad-library() {
+ :
+}
+
+package_kicad-library-3d() {
+ :
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-git-multi-group/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-git-multi-group/nvchecker.assert.toml
new file mode 100644
index 0000000..c8e7186
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-git-multi-group/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[kicad-library]
+source = "git"
+git = "https://gitlab.com/kicad/libraries/kicad-packages3D.git"
diff --git a/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/PKGBUILD b/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/PKGBUILD
new file mode 100644
index 0000000..4a40842
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/PKGBUILD
@@ -0,0 +1,24 @@
+pkgbase=kicad-library
+pkgname=($pkgbase{,-3d})
+pkgver=7.0.10
+pkgrel=1
+pkgdesc='Assorted libraries for KiCad'
+arch=('any')
+url='http://kicad.org/'
+license=('GPL')
+makedepends=('git' 'cmake')
+options=('!strip')
+source=(
+ https://gitlab.com/kicad/libraries/kicad-packages3D/-/archive/8.0.0/kicad-packages3D-8.0.0.tar.gz
+)
+sha512sums=('SKIP')
+
+package_kicad-library() {
+ :
+}
+
+package_kicad-library-3d() {
+ :
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/nvchecker.assert.toml
new file mode 100644
index 0000000..d2cf1b1
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-tarball-multi-group-as-platform/nvchecker.assert.toml
@@ -0,0 +1,4 @@
+[kicad-library]
+source = "gitlab"
+gitlab = "kicad/libraries/kicad-packages3D"
+use_max_tag = true
diff --git a/test/fixture/version/setup/gitlab-tarball-multi-group/PKGBUILD b/test/fixture/version/setup/gitlab-tarball-multi-group/PKGBUILD
new file mode 100644
index 0000000..4a40842
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-tarball-multi-group/PKGBUILD
@@ -0,0 +1,24 @@
+pkgbase=kicad-library
+pkgname=($pkgbase{,-3d})
+pkgver=7.0.10
+pkgrel=1
+pkgdesc='Assorted libraries for KiCad'
+arch=('any')
+url='http://kicad.org/'
+license=('GPL')
+makedepends=('git' 'cmake')
+options=('!strip')
+source=(
+ https://gitlab.com/kicad/libraries/kicad-packages3D/-/archive/8.0.0/kicad-packages3D-8.0.0.tar.gz
+)
+sha512sums=('SKIP')
+
+package_kicad-library() {
+ :
+}
+
+package_kicad-library-3d() {
+ :
+}
+
+# vim:set ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/gitlab-tarball-multi-group/nvchecker.assert.toml b/test/fixture/version/setup/gitlab-tarball-multi-group/nvchecker.assert.toml
new file mode 100644
index 0000000..c8e7186
--- /dev/null
+++ b/test/fixture/version/setup/gitlab-tarball-multi-group/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[kicad-library]
+source = "git"
+git = "https://gitlab.com/kicad/libraries/kicad-packages3D.git"
diff --git a/test/fixture/version/setup/hackage-tarball/PKGBUILD b/test/fixture/version/setup/hackage-tarball/PKGBUILD
new file mode 100644
index 0000000..d6ae5d2
--- /dev/null
+++ b/test/fixture/version/setup/hackage-tarball/PKGBUILD
@@ -0,0 +1,16 @@
+_hkgname=implicit-hie
+pkgname=haskell-implicit-hie
+pkgver=0.1.2.7
+pkgrel=114
+pkgdesc="Auto generate hie-bios cradles & hie.yaml"
+url="https://github.com/Avi-D-coder/implicit-hie#readme"
+license=("custom:BSD3")
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-attoparsec' 'haskell-filepattern' 'haskell-yaml')
+makedepends=('ghc' 'haskell-hspec' 'haskell-hspec-attoparsec')
+source=("https://hackage.haskell.org/packages/archive/$_hkgname/$pkgver/$_hkgname-$pkgver.tar.gz")
+sha512sums=('b0746867352b29dd2d4c4535ce6f4d61c3cc61ed31f3f18d49e3f657b12d470a9a53a7ef8a785a9e19b8ff12fb8d8b1cfa80c5c22c90af65bf4b39ab62bbd768')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/hackage-tarball/nvchecker.assert.toml b/test/fixture/version/setup/hackage-tarball/nvchecker.assert.toml
new file mode 100644
index 0000000..1f00b99
--- /dev/null
+++ b/test/fixture/version/setup/hackage-tarball/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[haskell-implicit-hie]
+source = "hackage"
+hackage = "implicit-hie"
diff --git a/test/fixture/version/setup/opt-no-force/PKGBUILD b/test/fixture/version/setup/opt-no-force/PKGBUILD
new file mode 100644
index 0000000..adcd790
--- /dev/null
+++ b/test/fixture/version/setup/opt-no-force/PKGBUILD
@@ -0,0 +1,57 @@
+pkgname=devtools
+epoch=1
+pkgver=1.1.1
+pkgrel=1
+pkgdesc='Tools for Arch Linux package maintainers'
+arch=('any')
+license=('GPL-3.0-or-later')
+url='https://gitlab.archlinux.org/archlinux/devtools'
+depends=(
+ arch-install-scripts
+ awk
+ bash
+ binutils
+ coreutils
+ curl
+ diffutils
+ fakeroot
+ findutils
+ grep
+ jq
+ openssh
+ parallel
+ rsync
+ sed
+ util-linux
+
+ breezy
+ git
+ mercurial
+ subversion
+)
+makedepends=(
+ asciidoc
+ shellcheck
+)
+optdepends=(
+ 'btrfs-progs: btrfs support'
+ 'bat: pretty printing for pkgctl search'
+ 'nvchecker: pkgctl version subcommand'
+ 'pacman-contrib: support for the --update-checksums option'
+)
+replaces=(devtools-git-poc)
+source=(https://gitlab.archlinux.org/archlinux/devtools/-/releases/v${pkgver}/downloads/devtools-${pkgver}.tar.gz{,.sig})
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak <anthraxx@archlinux.org>
+ 'F00B96D15228013FFC9C9D0393B11DAA4C197E3D' # Christian Heusel (gromit packager key) <gromit@archlinux.org>
+)
+sha256sums=('b2a12bb8b4b568110b055ccec903c9a0b0b979ab44f0cba574c026d243d5ce36'
+ 'SKIP')
+b2sums=('be9601a4fcbb576b9a8637abdaec70f8ec730cf5752793c2f8fdce20e489b74555f624d0a0b5f8bb58c0914413a29d51698c8474430010502ab80d6c18c4332e'
+ 'SKIP')
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/opt-url/PKGBUILD b/test/fixture/version/setup/opt-url/PKGBUILD
new file mode 100644
index 0000000..935ac0d
--- /dev/null
+++ b/test/fixture/version/setup/opt-url/PKGBUILD
@@ -0,0 +1,25 @@
+pkgname=git-smash
+pkgver=0.1.0
+pkgrel=1
+pkgdesc='Smash staged changes into previous commits to support your Git workflow'
+url='https://github.com/anthraxx/git-smash'
+arch=('x86_64')
+license=('MIT')
+depends=('glibc' 'gcc-libs' 'git')
+makedepends=('cargo' 'scdoc')
+source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
+ ${url}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz.sig)
+options=('!makeflags')
+sha512sums=('64a8b6e2afa7007966245a4888e51251e8c35f0b82421f3cee634a3e7b82256a24459cba2941800a6e50a047766a0f8de20b435904d17df3fd456b6c09ac4c5f'
+ 'SKIP')
+b2sums=('acc46b7a87135380fe36c378e9055b8b7c9b88a818c955f04677161f50d5ccd5699ac05f0a858dd11ca7b42b3505c0ac037f50efcd690f9e5a76be395d5d6590'
+ 'SKIP')
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak
+)
+
+package() {
+ :
+}
+
+# vim: ts=2 sw=2 et:
diff --git a/test/fixture/version/setup/opt-url/nvchecker.assert.toml b/test/fixture/version/setup/opt-url/nvchecker.assert.toml
new file mode 100644
index 0000000..89e8dad
--- /dev/null
+++ b/test/fixture/version/setup/opt-url/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[git-smash]
+source = "cratesio"
+cratesio = "shotgun"
diff --git a/test/fixture/version/setup/pkgbase-with-dot/PKGBUILD b/test/fixture/version/setup/pkgbase-with-dot/PKGBUILD
new file mode 100644
index 0000000..d4ab22c
--- /dev/null
+++ b/test/fixture/version/setup/pkgbase-with-dot/PKGBUILD
@@ -0,0 +1,27 @@
+pkgname=git.smash
+pkgver=0.1.0
+pkgrel=1
+pkgdesc='Smash staged changes into previous commits to support your Git workflow'
+url='https://github.com/anthraxx/git-smash'
+arch=('x86_64')
+license=('MIT')
+depends=('glibc' 'gcc-libs' 'git')
+makedepends=('cargo' 'scdoc')
+optdepends=(
+ 'skim: selection menu alternative'
+ 'fzf: selection menu alternative'
+)
+source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz
+ ${url}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.gz.sig)
+options=('!makeflags')
+sha512sums=('64a8b6e2afa7007966245a4888e51251e8c35f0b82421f3cee634a3e7b82256a24459cba2941800a6e50a047766a0f8de20b435904d17df3fd456b6c09ac4c5f'
+ 'SKIP')
+b2sums=('acc46b7a87135380fe36c378e9055b8b7c9b88a818c955f04677161f50d5ccd5699ac05f0a858dd11ca7b42b3505c0ac037f50efcd690f9e5a76be395d5d6590'
+ 'SKIP')
+validpgpkeys=(
+ 'E240B57E2C4630BA768E2F26FC1B547C8D8172C8' # Levente Polyak
+)
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/pkgbase-with-dot/nvchecker.assert.toml b/test/fixture/version/setup/pkgbase-with-dot/nvchecker.assert.toml
new file mode 100644
index 0000000..38e881b
--- /dev/null
+++ b/test/fixture/version/setup/pkgbase-with-dot/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+["git.smash"]
+source = "git"
+git = "https://github.com/anthraxx/git-smash.git"
diff --git a/test/fixture/version/setup/pypi.io/PKGBUILD b/test/fixture/version/setup/pypi.io/PKGBUILD
new file mode 100644
index 0000000..8b95c5f
--- /dev/null
+++ b/test/fixture/version/setup/pypi.io/PKGBUILD
@@ -0,0 +1,17 @@
+pkgname=python-pyaml
+pkgver=23.9.0
+pkgrel=1
+pkgdesc="PyYAML-based module to produce pretty and readable YAML-serialized data"
+url="https://pypi.python.org/pypi/pyaml"
+license=('BSD')
+arch=('any')
+depends=('python-yaml')
+makedepends=('python-setuptools')
+checkdepends=('python-unidecode')
+optdepends=('python-unidecode: Needed if same-id objects or recursion is used within serialized data')
+source=("https://pypi.io/packages/source/p/pyaml/pyaml-$pkgver.tar.gz")
+sha512sums=('1ff23e07e45d6530b6666a26947362a6bb2125b731dd03501aafe9096766a38fec7906a36666c7974e49cedf9a91f5af0973827151c746933e7b969aeec56ab8')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/pypi.io/nvchecker.assert.toml b/test/fixture/version/setup/pypi.io/nvchecker.assert.toml
new file mode 100644
index 0000000..b02c68e
--- /dev/null
+++ b/test/fixture/version/setup/pypi.io/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[python-pyaml]
+source = "pypi"
+pypi = "pyaml"
diff --git a/test/fixture/version/setup/pypi.org/PKGBUILD b/test/fixture/version/setup/pypi.org/PKGBUILD
new file mode 100644
index 0000000..c849968
--- /dev/null
+++ b/test/fixture/version/setup/pypi.org/PKGBUILD
@@ -0,0 +1,23 @@
+pkgname=python-bleach
+pkgver=6.1.0
+pkgrel=1
+
+pkgdesc="An easy whitelist-based HTML-sanitizing tool"
+url="https://pypi.org/project/bleach/"
+arch=('any')
+license=('Apache')
+depends=('python-packaging'
+ 'python-six'
+ 'python-webencodings')
+makedepends=('python'
+ 'python-setuptools')
+checkdepends=('python-pytest')
+optdepends=('python-tinycss2: for CSS sanitisation')
+
+source=(https://pypi.org/packages/source/b/bleach/bleach-$pkgver.tar.gz)
+
+sha256sums=('0a31f1837963c41d46bbf1331b8778e1308ea0791db03cc4e7357b97cf42a8fe')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/pypi.org/nvchecker.assert.toml b/test/fixture/version/setup/pypi.org/nvchecker.assert.toml
new file mode 100644
index 0000000..c067d86
--- /dev/null
+++ b/test/fixture/version/setup/pypi.org/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[python-bleach]
+source = "pypi"
+pypi = "bleach"
diff --git a/test/fixture/version/setup/registry.npmjs.org/PKGBUILD b/test/fixture/version/setup/registry.npmjs.org/PKGBUILD
new file mode 100644
index 0000000..ede2264
--- /dev/null
+++ b/test/fixture/version/setup/registry.npmjs.org/PKGBUILD
@@ -0,0 +1,16 @@
+pkgname=node-gyp
+pkgver=10.0.1
+pkgrel=1
+pkgdesc='Node.js native addon build tool'
+arch=('any')
+url='https://github.com/nodejs/node-gyp'
+license=('MIT')
+depends=('nodejs' 'nodejs-nopt' 'python' 'semver')
+makedepends=('npm')
+source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
+noextract=("$pkgname-$pkgver.tgz")
+sha512sums=('820dff6c77a141f662bd055fa88cb2f304dd4b2985f724f23f808989f2bbde29b234c53c008190136a546bb74d59f98c786f5c0d517679e86244cbf42c2d6202')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/registry.npmjs.org/nvchecker.assert.toml b/test/fixture/version/setup/registry.npmjs.org/nvchecker.assert.toml
new file mode 100644
index 0000000..672a3e1
--- /dev/null
+++ b/test/fixture/version/setup/registry.npmjs.org/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[node-gyp]
+source = "npm"
+npm = "node-gyp"
diff --git a/test/fixture/version/setup/rubygems.org/PKGBUILD b/test/fixture/version/setup/rubygems.org/PKGBUILD
new file mode 100644
index 0000000..0d95861
--- /dev/null
+++ b/test/fixture/version/setup/rubygems.org/PKGBUILD
@@ -0,0 +1,16 @@
+pkgname=ruby-diff-lcs
+pkgver=0.3.5
+pkgrel=8
+pkgdesc='Allows custom language loaders to be hooked into require'
+arch=('any')
+url='http://polyglot.rubyforge.org/'
+license=('MIT')
+depends=('ruby')
+options=('!emptydirs')
+source=("https://rubygems.org/downloads/${pkgname#*-}-${pkgver}.gem")
+noextract=("${pkgname#*-}-${pkgver}.gem")
+sha256sums=('59d66ef5e3c166431c39cb8b7c1d02af419051352f27912f6a43981b3def16af')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/rubygems.org/nvchecker.assert.toml b/test/fixture/version/setup/rubygems.org/nvchecker.assert.toml
new file mode 100644
index 0000000..197fe21
--- /dev/null
+++ b/test/fixture/version/setup/rubygems.org/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[ruby-diff-lcs]
+source = "gems"
+gems = "diff-lcs"
diff --git a/test/fixture/version/setup/static.crates.io/PKGBUILD b/test/fixture/version/setup/static.crates.io/PKGBUILD
new file mode 100644
index 0000000..d249f29
--- /dev/null
+++ b/test/fixture/version/setup/static.crates.io/PKGBUILD
@@ -0,0 +1,16 @@
+pkgname=shotgun
+pkgver=0.3.5
+pkgrel=8
+pkgdesc='Allows custom language loaders to be hooked into require'
+arch=('any')
+url='http://polyglot.rubyforge.org/'
+license=('MIT')
+depends=('ruby')
+options=('!emptydirs')
+source=("https://static.crates.io/crates/shotgun/shotgun-$pkgver.crate")
+noextract=("${pkgname#*-}-${pkgver}.gem")
+sha256sums=('59d66ef5e3c166431c39cb8b7c1d02af419051352f27912f6a43981b3def16af')
+
+package() {
+ :
+}
diff --git a/test/fixture/version/setup/static.crates.io/nvchecker.assert.toml b/test/fixture/version/setup/static.crates.io/nvchecker.assert.toml
new file mode 100644
index 0000000..234be6c
--- /dev/null
+++ b/test/fixture/version/setup/static.crates.io/nvchecker.assert.toml
@@ -0,0 +1,3 @@
+[shotgun]
+source = "cratesio"
+cratesio = "shotgun"