Compare commits

...

63 Commits

Author SHA1 Message Date
Levente Polyak
6dd7be3fd4 Version 20230307 2023-03-07 01:51:40 +01:00
Tobias Powalowski
0365edb264 fix: enable extglob before func definition for bash-5.2 compatibility
The `extglob` option changes the behavior of the shell parser, since
extended glob patterns would otherwise be syntax errors. bash-5.2
changed the way a function definition is processed by calling the parser
instead of relying on the ad-hoc code in bash-5.1 and earlier versions.
This means, in bash-5.2 the shell function was parsed without `extglob`
being enabled because the `shopt` command to enable it was part of the
function body.

Add `shopt` options for `extglob` around function definitions to address
this issue and allow bash-5.2 to correctly parse the function.

Co-authored-by: Frédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
Co-authored-by: Levente Polyak <anthraxx@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-03-06 21:51:27 +01:00
Celeste Liu
4ff7aa0d8a archbuild: add doc for bind mount config
Signed-off-by: Celeste Liu <CoelacanthusHex@gmail.com>
2023-03-06 21:06:59 +01:00
Evangelos Foutras
320c1fd0ac mkarchroot: stop adding C.UTF-8 to locale.gen
Adding such an entry is problematic as it results in locale -a showing:

  C
  C.UTF-8
  C.utf8
  POSIX
  (other locales)

In the above, C.UTF-8 is built-in whereas C.utf8 comes from locale.gen.

The duplicate locale has the potential to expose undesired behavior in
upstream software: https://github.com/sudo-project/sudo/issues/241
2023-02-15 22:51:40 +02:00
Levente Polyak
7b209b63a7 commitpkg: abort execution if msg file editor exits none-successfully
Previously the script execution did not abort if the msg file editor
exited none-successfully leading to undesired commits with a potentially
unfinished message. Instead abort the commit if the msg file editor is
deliberately terminated with a failure code.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-01-17 00:48:24 +01:00
Levente Polyak
d45e77738b commitpkg: properly cleanup commit msg file on abort
Use the workdir location which gets cleaned up automatically. Previously
this was leaking tmpfiles if the commitpkg command got aborted after
file creation.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-01-17 00:47:20 +01:00
Celeste Liu
009c58f7c9 archbuild: add architecture-specific mount config
config path: @pkgdatadir@/mount.d/${arch}

config format:
Each line will start with 'ro' and 'rw' will be used, other lines will
be ignore, rest of line is out/path:in/path. e.g.

```
ro /some/path:/proc/cpuinfo
rw /some/some/path:/var/cache/pacman/pkg
```

For example, in the RISC-V port, if we use qemu-user to build, we need
to pass a parameter to makechrootpkg to map a correct /proc/cpuinfo, so
that software that relies on /proc/cpuinfo to obtain information can be
built normally.

Signed-off-by: Celeste Liu <CoelacanthusHex@gmail.com>
2023-01-06 16:58:29 +01:00
Felix Yan
112026580d makechrootpkg: make /tmp inside nspawn larger
systemd by default limits the /tmp folder to be 10% of the host memory:
6f2cea06bf/src/shared/mount-util.h (L33)

This is problematic to our builds because many toolchains opt to put
build artifacts in /tmp, and expecting the host memory to be 10 times
larger is not optimal or even realistic sometimes.

This MR attempts to enlarge it to 50% memory as the host machine's
default value of /tmp. This should be a fair compromise between being
overly conservative and taking up too much memory to crash the system.
2023-01-06 16:25:46 +01:00
Levente Polyak
f870ab6864 Version 20230105 2023-01-05 16:20:42 +01:00
Levente Polyak
ea782a8ab7 makepkg.conf: enable rust debuginfo
This enables DEBUG_RUSTFLAGS with the appropriate debuginfo settings.

The empty RUSTFLAGS variable is required workaround to avoid double
compilation during package function call. The issue is that the
behavior of the current implementation of buildenv_debugflags is not
idempotent, so consecutive calls will append the same flags again
leading to cargo consider the build inputs to have changed.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2023-01-03 23:23:43 +01:00
Morten Linderud
a510331698 mkarchroot: remove deprecated -d option
It's been deprecated for a few years now.

91562aa99c

Signed-off-by: Morten Linderud <foxboron@archlinux.org>
2022-11-21 21:48:22 +01:00
Hugo Osvaldo Barrera
dca8f91d26 makerepropkg: Use $CARCH instead of hardcoded x86_64
`makerepropkg` has a hardcoded "x86_64", so fails to run on other
[unofficial] architectures, because it tries to use an x86_64-specific
makepkg config, which overrides CARCH=x86_64.

This patch addresses hardcoded half of the problem; ArchLinux derivates
still needs to ship a custom `devtools` package with their own
`makepkg-$CARCH.conf`. Usually, the only thing that really needs to be
changed in the per-architecture custom makepkg.conf is CARCH and CHOST.

See: https://lists.archlinux.org/archives/list/arch-projects@lists.archlinux.org/thread/XEEW5LXYFN3XXI5YXAUY5E4LZLMKOFTL/
2022-11-08 22:25:32 +01:00
Morten Linderud
b64d8ebacf makepkg.conf: Include debug option by default
Signed-off-by: Morten Linderud <foxboron@archlinux.org>
2022-11-07 22:11:35 +01:00
Levente Polyak
248cdf7ff2 Version 20221012 2022-10-12 21:40:39 +02:00
Levente Polyak
04a821dddf common: prevent globbing and word splitting in find_cached_package
We changed the glob in 5d02c6df7f
but we forgot to quote the newly introduced variables.
2022-10-12 21:29:30 +02:00
Mike Yuan
d82bc69716 makechrootpkg: fix short option handling for makepkg_args
Currently, when multiple short options are passed as a single argument,
only the one that matches the first case statement will be parsed. This
shall be fixed by using switch-case resume.
2022-10-13 00:10:17 +08:00
Felix Yan
5d02c6df7f common: improve performance of find_cached_package
find_cached_package was unnecessarily looping over all packages which
uses a lot of CPU and could be exceptionally slow when PKGDEST contains
a lot of packages.

Fix this by adding the target pkgname, pkgver and arch to the glob and
only process potential candidates.
2022-10-11 20:25:08 +02:00
Levente Polyak
20f89df443 Version 20221002 2022-10-02 22:21:36 +02:00
Levente Polyak
fcaf3ecec0 fix: do not set extglob globally to avoid side-effects
Instead only enable it for whatever operation requires them.

Example sides effects:
commitpkg can accidently execute PKGBUILD functions when sourcing the
PKGBUILD that has function names like package_libsigc++()

Fixes #87
2022-09-01 23:40:21 +02:00
Levente Polyak
280ef10d37 make: declare lib files as build dependencies for bash src scripts 2022-09-01 23:40:21 +02:00
Levente Polyak
f8d2ad9a7d diffpkg: pass the --color option appropriately to diffoscope
Diffoscope has a different option, called --text-color which only
understands the verbose options. Hence we extend the --color shorthand
for --color=auto and pass the changed option name to diffoscope.
2022-09-01 23:38:44 +02:00
Levente Polyak
2e4060445a crossrepomove: fix moving debug packages to the target repo
We did not copy over the optional debug packages to the staging
environment before db-updating the moved state. Afterwards the db-remove
call removed the debug packages from the source repo. This lead to
dropping debug packages when using crossrepomove.

This approach ensures we have a uniform shell to avoid shell glob
behavior inconsistencies. The copy of the package path is mandatory and
will error out if missing while the debug package path is optional as
reflected by a subshell that succeeds either way.

Fixes #92
2022-08-31 23:55:05 +02:00
morganamilo
1e23bbc164 makechrootpkg: support -A makepkg flag 2022-08-31 23:38:13 +02:00
Levente Polyak
53be0527e2 fix: properly check for invalid argument in checkpkg and diffpkg
The option switch case only matches by splitting via '|' instead of ','
2022-08-31 02:26:47 +02:00
Levente Polyak
f4e8047d65 diffpkg: prefer to search inside the pool dir if available
On certain packaging machines where the pacman cache gets updated very
infrequently, the behavior of diffpkg may not function correctly as old
packages were to be downloaded as diff target. In such cases we look for
a pool directory first and search via a glob for an available pool
package sorted by version.

The pool search glob has three glob segments each disallowing the dash
delimiter to split across pkgrel, pkgver and arch. This will return the
correct package from the pool without considering overly eager wildcards
that potentially match different pkgnames.

The default pool search directory is /srv/ftp/pool
2022-08-31 02:26:47 +02:00
Levente Polyak
70a3041ff8 diffpkg: allow to set column width for side-by-side view
The magic values `columns` and `auto` allow to set specific aspects,
with 'auto' as the default value:

- auto: Set width to the maximum line length of all input files
- columns: Set width to the shell defined $COLUMNS env var

Furthermore any number can be passed to set a static width.
2022-08-31 02:26:47 +02:00
Levente Polyak
ba070f1ca9 diffpkg: add colored output option with default of auto 2022-08-23 20:23:51 +02:00
Levente Polyak
b9dadc5576 diffpkg: allow to choose between unified context and two columns 2022-08-23 20:23:22 +02:00
Greg Land
6bd7e70e68 doc: Fixed spelling error in devtools man page 2022-08-13 15:23:14 +02:00
Levente Polyak
626aecb472 make: split out man page files into doc/man folder 2022-06-22 01:05:03 +02:00
Levente Polyak
2088244564 make: use GEN message for all generated content 2022-06-22 01:05:03 +02:00
Levente Polyak
37df0765d2 cleanup: move PKGBUILD.proto to contrib folder 2022-06-22 01:05:03 +02:00
Levente Polyak
6d946989f3 doc: update links and references after moving to GitLab 2022-06-22 01:05:03 +02:00
Levente Polyak
5e680513e6 make: automatically collect man pages via wildcard 2022-06-22 01:05:02 +02:00
Levente Polyak
d94badcd0b make: split out source files into src folder 2022-06-22 01:05:02 +02:00
Levente Polyak
e1a51770b2 make: split out config files into conf directory 2022-06-22 01:05:02 +02:00
Levente Polyak
bb1a89a837 make: split out completion scripts from root worktree 2022-06-22 01:05:02 +02:00
Levente Polyak
225bac5a49 make: properly handle build target prerequisites
- Use wildcard for the lib directory for all binprogs
- Fix individual man page prerequisites for asciidoc.conf and footer
- Require all as prerequisite for the install target
2022-06-22 01:05:02 +02:00
Levente Polyak
6f5aa9f438 make: use build dir as target instead of polluting root workdir
This introduces a BUILDDIR make variable that is used as the target
directory. This gives us more flexibility and easier control of a none
dirty worktree by not polluting the main workdirs.
2022-06-22 01:05:02 +02:00
Levente Polyak
b7f2f4935d chore: remove executable bit from *.in source files
Those files should not be executable, its simply a wrong bit on the
files as they are useless without preprocessing.
2022-06-22 01:04:56 +02:00
Levente Polyak
b8d9a2b4fd Version 20220621 2022-06-22 00:58:19 +02:00
Levente Polyak
f386c13142 export-pkgbuild-keys: fix export for packages without validpgpkeys
In case the validpgpkeys array is empty or undefined, the empty printf
line only included a single line break which lead to mapfile -t
consuming it as an array with 1 element consisting of an empty string.

Fix this by only calling the printf in case the validpgpkeys array is
not empty. Without any output, the mapfile -t will simply produce an
empty array.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-22 00:51:22 +02:00
Levente Polyak
49d889cb8d Version 20220620 2022-06-20 22:54:34 +02:00
Levente Polyak
ac222ae004 archrelease: support subdirectories in package directories
We need to support subdirectories for the `keys` directory used to
distribute PGP keys alongside the packaging sources.

This is achieved by using `svn ls` to list the files and directories
in the packaging root and leverage the behavior of `svn copy` to
consider subdirectories inside the root but only copy over files and
directories under the subdirectory that are already tracked by svn.
As a step in between, we now use `svn ls --recursive` to list all
tracked svn files in the current repos directory and remove all tracked
files in the staging area. Hence the `svn copy` in combination with the
`svn rm` will result in a sync behavior from the packaging root to the
repos directory.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-10 16:51:52 +02:00
Allan McRae
cde012d25e Add x86_64_v3 builders
Signed-off-by: Allan McRae <allan@archlinux.org>
2022-06-10 16:31:45 +02:00
Levente Polyak
383cfa7e60 Version 20220609 2022-06-09 21:29:10 +02:00
Levente Polyak
7a8f101498 doc/export-pkgbuild-keys.1: fix filename to detect manpage location
The manpage doc has been added without a suffix which fails during
install.
2022-06-09 21:25:10 +02:00
Levente Polyak
01b6196883 export-pkgbuild-keys: use TEMPDIR while exporting key
This avoids the possibility to pollute the keys directory with temporary
files if the script is aborted in between.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-09 21:10:03 +02:00
Levente Polyak
8d4c46d368 export-pkgbuild-keys: add simple success export messages
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-09 21:06:38 +02:00
Allan McRae
d00a28ea0e Export source PGPs from PKGBUILD on commit
Provide a tool to export keys listed in the PKGBUILDs validpgpkeys to
keys/pgp/$fingerprint.asc.

The presense of the "keys" directory alongside the PKGBUILD in trunk/
is tested during commitpkg.  If the directory is abscent, keys are
exported and added to the commit.  If the directory is present, a
check is made to ensure all valid PGP keys are provided.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-06-09 20:41:18 +02:00
Felix Yan
5e98478344 mkarchroot: generate and use C.UTF-8 by default
systemd >= 251 is forcing nspawns to use LANG=C.UTF-8:
b626f6959b

It makes sense to generate the C.UTF-8 locate here when using it as the
default LANG value.

Related to: https://bugs.archlinux.org/task/74864
2022-06-09 01:07:43 +02:00
Felix Yan
0c61761f33 mkarchroot: unshare mount namespace to avoid broken root chroot creation
While `extra-x86_64-build -c` is running `pacstrap` and has
`/var/lib/archbuild/extra-x86_64/root/run` mounted, another user logs
in, thus creating a new mountpoint `/run/user/$uid` that propagates into
`/var/lib/archbuild/extra-x86_64/root/run/user/$uid` leading to a broken
root chroot.

Successive `extra-x86_64-build -c` calls will result in cleanup errors:

```
$ extra-x86_64-build -c
==> Creating chroot for [extra] (x86_64)...
-> Deleting chroot copy 'root'...
rm: skipping '/var/lib/archbuild/extra-x86_64/root/run', since it's on a different device
rm: skipping '/var/lib/archbuild/extra-x86_64/root/run', since it's on a different device
==> ERROR: Working directory '/var/lib/archbuild/extra-x86_64/root' already exists
==> ERROR: Aborting...
```

Reported by and patch adjusted from archlinuxcn.

Fixes FS#64698
2022-06-09 00:56:41 +02:00
Levente Polyak
c2f163b640 diffpkg: support comparing two given package archives
This adds support similar to diffpkg from the infrastructure repo
that is based on the assumption that two archives can be passed
to the tooling in order to compare them.
2022-05-17 21:03:44 +02:00
Levente Polyak
c339536a37 diffpkg: support multiple diff modes to compare with
This adds support for the following diff modes:

- content list (default)
- diffoscope
- .PKGINFO diff
- .BUILDINFO diff
2022-05-17 21:03:44 +02:00
Jelle van der Waa
11edc45048 diffpkg - diff repo vs. build package
Include a new tool as alternative to checkpkg, this runs diffoscope on a
newly build package and the current repository package. This can be
useful for finding new files / binaries.
2022-05-17 21:03:43 +02:00
Levente Polyak
f42b032c5e make: respect PREFIX for bash completion instead of hardcoded /usr 2022-05-17 21:02:10 +02:00
Levente Polyak
c52fab2562 make: remove bash completion symlinks on uninstall 2022-05-17 20:57:32 +02:00
Leonidas Spyropoulos
54acc5872c build: enable gitlab-ci
Closes #85

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-04-28 19:10:59 +02:00
Haochen Tong
82cb6756aa sogrep: fail if links database cannot be retrieved
If the links database (for some reason) does not exist on the mirror,
curl will save the html 404 page as ${repo}.links.tar.gz in the cache,
and sogrep will later fail with a decompression error from bsdtar.

This patch adds -f to curl so it doesn't save the error page, and exit
after displaying an error in such case.

Fixes !88

Signed-off-by: Haochen Tong <i@hexchain.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
2022-04-06 00:11:16 +02:00
Evangelos Foutras
74164e348b makepkg.conf: set LTOFLAGS="-flto=auto"
For use with pacman 6.0.1-4 which backports support for LTOFLAGS in
order to speed up builds that use gcc as the compiler. This is less
useful when clang is used, though a hack would be to specify in the
PKGBUILD `LTOFLAGS="-flto=thin"` (outside of any function).
2022-03-07 15:41:17 +02:00
Levente Polyak
a17c9c6a70 Version 20220207 2022-02-07 23:28:03 +01:00
Evangelos Foutras
065c00ad8f makepkg.conf: drop -fvar-tracking-assignments flag
According to gcc(1), this flag (like -fvar-tracking) is enabled by
default when compiling with optimization and debugging information.

As an additional benefit, packages building with the clang compiler
will work with the default flags without having to remove this flag
due to not being recognized by clang.
2022-01-31 16:34:07 +02:00
Levente Polyak
ea162ef041 make: use gzip option to get reproducible tar dist like GitLab 2022-01-26 22:44:09 +01:00
56 changed files with 1172 additions and 188 deletions

View File

@@ -1,15 +0,0 @@
on: push
jobs:
test:
runs-on: ubuntu-latest
container: archlinux/archlinux:latest
steps:
- name: Install dependencies
run: pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc shellcheck
- uses: actions/checkout@v2
- name: Run tests
run: |
make PREFIX=/usr
make PREFIX=/usr DESTDIR="$(mktemp -d)" install
make check || true
SHELLCHECK_OPTS="-S error" make check

21
.gitignore vendored
View File

@@ -1,22 +1,3 @@
*~ *~
devtools-*.tar.gz* devtools-*.tar.gz*
archbuild build/
archco
archrelease
bash_completion
checkpkg
commitpkg
finddeps
lddd
makechrootpkg
makerepropkg
mkarchroot
offload-build
rebuildpkgs
zsh_completion
find-libdeps
crossrepomove
arch-nspawn
sogrep
doc/*.1
doc/*.7

21
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,21 @@
image: "archlinux:latest"
stages:
- build
- test
build:
stage: build
needs: []
script:
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc
- make PREFIX=/usr
- make PREFIX=/usr DESTDIR=build install
check:
stage: test
needs: []
script:
- pacman -Syu --noconfirm m4 make openssh subversion rsync arch-install-scripts git bzr mercurial diffutils asciidoc shellcheck
- make check || true
- SHELLCHECK_OPTS="-S error" make check

142
Makefile
View File

@@ -1,42 +1,16 @@
V=20220126 V=20230307
BUILDTOOLVER ?= $(V) BUILDTOOLVER ?= $(V)
PREFIX = /usr/local PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man MANDIR = $(PREFIX)/share/man
BUILDDIR = build
IN_PROGS = \ BINPROGS = $(addprefix $(BUILDDIR)/,$(patsubst src/%,bin/%,$(patsubst %.in,%,$(wildcard src/*.in))))
archco \ LIBUTILS = $(wildcard lib/*)
arch-nspawn \ MAKEPKG_CONFIGS=$(wildcard config/makepkg/*)
archrelease \ PACMAN_CONFIGS=$(wildcard config/pacman/*)
archbuild \ SETARCH_ALIASES = $(wildcard config/setarch-aliases.d/*)
checkpkg \ MANS = $(addprefix $(BUILDDIR)/,$(patsubst %.asciidoc,%,$(wildcard doc/man/*.asciidoc)))
commitpkg \
crossrepomove\
finddeps \
find-libdeps \
lddd \
makerepropkg \
mkarchroot \
makechrootpkg \
offload-build \
rebuildpkgs \
sogrep
BINPROGS = \
$(IN_PROGS)
CONFIGFILES = \
makepkg-x86_64.conf \
pacman-extra.conf \
pacman-testing.conf \
pacman-staging.conf \
pacman-multilib.conf \
pacman-multilib-testing.conf \
pacman-multilib-staging.conf \
pacman-kde-unstable.conf \
pacman-gnome-unstable.conf
SETARCH_ALIASES = \
COMMITPKG_LINKS = \ COMMITPKG_LINKS = \
extrapkg \ extrapkg \
@@ -53,8 +27,11 @@ COMMITPKG_LINKS = \
ARCHBUILD_LINKS = \ ARCHBUILD_LINKS = \
extra-x86_64-build \ extra-x86_64-build \
extra-x86_64_v3-build \
testing-x86_64-build \ testing-x86_64-build \
testing-x86_64_v3-build \
staging-x86_64-build \ staging-x86_64-build \
staging-x86_64_v3-build \
multilib-build \ multilib-build \
multilib-testing-build \ multilib-testing-build \
multilib-staging-build \ multilib-staging-build \
@@ -65,79 +42,90 @@ CROSSREPOMOVE_LINKS = \
extra2community \ extra2community \
community2extra community2extra
COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*)))
BASHCOMPLETION_LINKS = \ BASHCOMPLETION_LINKS = \
archco \ archco \
communityco communityco
MANS = \ all: binprogs completion man
doc/archbuild.1 \ binprogs: $(BINPROGS)
doc/arch-nspawn.1 \ completion: $(COMPLETIONS)
doc/makechrootpkg.1 \
doc/lddd.1 \
doc/checkpkg.1 \
doc/offload-build.1 \
doc/sogrep.1 \
doc/makerepropkg.1 \
doc/mkarchroot.1 \
doc/find-libdeps.1 \
doc/find-libprovides.1 \
doc/devtools.7
all: $(BINPROGS) bash_completion zsh_completion man
man: $(MANS) man: $(MANS)
ifneq ($(wildcard *.in),)
$(error Legacy in prog file found: $(wildcard *.in) - please migrate to src/*)
endif
ifneq ($(wildcard pacman-*.conf),)
$(error Legacy pacman config file found: $(wildcard pacman-*.conf) - please migrate to config/pacman/*)
endif
ifneq ($(wildcard makepkg-*.conf),)
$(error Legacy makepkg config files found: $(wildcard makepkg-*.conf) - please migrate to config/makepkg/*)
endif
ifneq ($(wildcard setarch-aliases.d/*),)
$(error Legacy setarch aliase found: $(wildcard setarch-aliases.d/*) - please migrate to config/setarch-aliases.d/*)
endif
edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g" edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
GEN_MSG = @echo "GEN $(patsubst $(BUILDDIR)/%,%,$@)"
%: %.in Makefile lib/common.sh define buildInScript
@echo "GEN $@" $(1)/%: $(2)%.in $(LIBUTILS)
@$(RM) "$@" $$(GEN_MSG)
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P --define=m4_devtools_version=$(BUILDTOOLVER) | $(edit) >$@ @mkdir -p $$(dir $$@)
@chmod a-w "$@" @$(RM) "$$@"
@chmod +x "$@" @{ echo -n 'm4_changequote([[[,]]])'; cat $$<; } | m4 -P --define=m4_devtools_version=$$(BUILDTOOLVER) | $(edit) >$$@
@bash -O extglob -n "$@" @chmod $(3) "$$@"
@bash -O extglob -n "$$@"
endef
$(MANS): doc/asciidoc.conf doc/footer.asciidoc $(eval $(call buildInScript,build/bin,src/,555))
$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,444)))
doc/%: doc/%.asciidoc $(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc
a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage -D doc -a pkgdatadir=$(PREFIX)/share/devtools $< $(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=$(PREFIX)/share/devtools $<
clean: clean:
rm -f $(IN_PROGS) bash_completion zsh_completion $(MANS) rm -rf $(BUILDDIR)
install: install: all
install -dm0755 $(DESTDIR)$(PREFIX)/bin install -dm0755 $(DESTDIR)$(PREFIX)/bin
install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d install -dm0755 $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d
install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin install -m0755 ${BINPROGS} $(DESTDIR)$(PREFIX)/bin
install -m0644 ${CONFIGFILES} $(DESTDIR)$(PREFIX)/share/devtools for conf in ${MAKEPKG_CONFIGS}; do install -Dm0644 $$conf $(DESTDIR)$(PREFIX)/share/devtools/makepkg-$${conf##*/}; done
for a in ${SETARCH_ALIASES}; do install -m0644 setarch-aliases.d/$$a $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d; done for conf in ${PACMAN_CONFIGS}; do install -Dm0644 $$conf $(DESTDIR)$(PREFIX)/share/devtools/pacman-$${conf##*/}; done
for a in ${SETARCH_ALIASES}; do install -m0644 $$a -t $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d; done
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; 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 for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 bash_completion $(DESTDIR)/usr/share/bash-completion/completions/devtools install -Dm0644 $(BUILDDIR)/contrib/completion/bash/devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)/usr/share/bash-completion/completions/$$l; done for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done
install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools install -Dm0644 $(BUILDDIR)/contrib/completion/zsh/_devtools $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco
for manfile in $(MANS); do \ for manfile in $(MANS); do \
install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \ install -Dm644 $$manfile -t $(DESTDIR)$(MANDIR)/man$${manfile##*.}; \
done; done;
uninstall: uninstall:
for f in ${BINPROGS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done for f in $(notdir $(BINPROGS)); do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
for f in ${CONFIGFILES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/$$f; done for conf in ${MAKEPKG_CONFIGS}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/makepkg-$${conf##*/}; done
for f in ${SETARCH_ALIASES}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d/$$f; done for conf in ${PACMAN_CONFIGS}; do rm -f $(DESTDIR)$(PREFIX)/share/devtools/pacman-$${conf##*/}; done
for f in $(notdir $(SETARCH_ALIASES)); do rm -f $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d/$$f; done
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; 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 for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
rm $(DESTDIR)/usr/share/bash-completion/completions/devtools for l in ${BASHCOMPLETION_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done
rm $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
rm -f $(DESTDIR)$(PREFIX)/bin/communityco rm -f $(DESTDIR)$(PREFIX)/bin/communityco
rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides
for manfile in $(MANS); do \ for manfile in $(notdir $(MANS)); do rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile}; done;
rm -f $(DESTDIR)$(MANDIR)/man$${manfile##*.}/$${manfile#doc/}; \ rmdir --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)/share/devtools/setarch-aliases.d $(DESTDIR)$(PREFIX)/share/devtools
done;
TODAY=$(shell date +"%Y%m%d") TODAY=$(shell date +"%Y%m%d")
tag: tag:
@@ -146,14 +134,14 @@ tag:
@git tag --sign --message "Version $(TODAY)" $(TODAY) @git tag --sign --message "Version $(TODAY)" $(TODAY)
dist: dist:
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip -9 > 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 gpg --detach-sign --use-agent devtools-$(V).tar.gz
upload: upload:
scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/ scp devtools-$(V).tar.gz devtools-$(V).tar.gz.sig repos.archlinux.org:/srv/ftp/other/devtools/
check: $(BINPROGS) bash_completion makepkg-x86_64.conf PKGBUILD.proto check: $(BINPROGS) $(BUILDDIR)/contrib/completion/bash/devtools config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
shellcheck $^ shellcheck $^
.PHONY: all clean install uninstall dist upload check tag .PHONY: all completion man clean install uninstall dist upload check tag
.DELETE_ON_ERROR: .DELETE_ON_ERROR:

View File

@@ -3,17 +3,6 @@
This repository contains tools for the Arch Linux distribution for building This repository contains tools for the Arch Linux distribution for building
and maintaining official repository packages. and maintaining official repository packages.
## Patches
Patches can be send to arch-projects@archlinux.org or via a pull request on
Github. When sending patches to the mailing list make sure to set a valid
subjectprefix otherwise the email is denied by mailman. Git can be configured
as following.
```
git config format.subjectprefix 'devtools] [PATCH'
```
## Building ## Building
When building official distro packages the `BUILDTOOLVER` needs to be set to the When building official distro packages the `BUILDTOOLVER` needs to be set to the

View File

@@ -45,13 +45,14 @@ CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-fstack-clash-protection -fcf-protection" -fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS" CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
#RUSTFLAGS="-C opt-level=2" LTOFLAGS="-flto=auto"
RUSTFLAGS=""
#-- Make Flags: change this for DistCC/SMP systems #-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2" #MAKEFLAGS="-j2"
#-- Debugging flags #-- Debugging flags
DEBUG_CFLAGS="-g -fvar-tracking-assignments" DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
#DEBUG_RUSTFLAGS="-C debuginfo=2" DEBUG_RUSTFLAGS="-C debuginfo=2"
######################################################################### #########################################################################
# BUILD ENVIRONMENT # BUILD ENVIRONMENT
@@ -93,7 +94,7 @@ BUILDENV=(!distcc color !ccache check !sign)
#-- debug: Add debugging flags as specified in DEBUG_* variables #-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization #-- lto: Add compile flags for building with link time optimization
# #
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug lto) OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge debug lto)
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2 #-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(sha256) INTEGRITY_CHECK=(sha256)

View File

@@ -0,0 +1,162 @@
#!/hint/bash
# shellcheck disable=2034
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')
# Other common tools:
# /usr/bin/snarf
# /usr/bin/lftpget -c
# /usr/bin/wget
#-- The package required by makepkg to download VCS sources
# Format: 'protocol::package'
VCSCLIENTS=('bzr::bzr'
'fossil::fossil'
'git::git'
'hg::mercurial'
'svn::subversion')
#########################################################################
# ARCHITECTURE, COMPILE FLAGS
#########################################################################
#
CARCH="x86_64_v3"
CHOST="x86_64-pc-linux-gnu"
#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64-v3 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
LTOFLAGS="-flto=auto"
RUSTFLAGS=""
#-- Make Flags: change this for DistCC/SMP systems
#MAKEFLAGS="-j2"
#-- Debugging flags
DEBUG_CFLAGS="-g"
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
DEBUG_RUSTFLAGS="-C debuginfo=2"
#########################################################################
# BUILD ENVIRONMENT
#########################################################################
#
# Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)
# A negated environment option will do the opposite of the comments below.
#
#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#-- sign: Generate PGP signature file
#
BUILDENV=(!distcc color !ccache check !sign)
#
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""
#
#-- Specify a directory for package building.
#BUILDDIR=/tmp/makepkg
#########################################################################
# GLOBAL PACKAGE OPTIONS
# These are default values for the options=() settings
#########################################################################
#
# Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)
# A negated option will do the opposite of the comments below.
#
#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization
#
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge debug lto)
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(sha256)
#-- Options to be used when stripping binaries. See `man strip' for details.
STRIP_BINARIES="--strip-all"
#-- Options to be used when stripping shared libraries. See `man strip' for details.
STRIP_SHARED="--strip-unneeded"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="--strip-debug"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
#########################################################################
# PACKAGE OUTPUT
#########################################################################
#
# Default: put built package and cached source in build directory
#
#-- Destination: specify a fixed directory where all packages will be placed
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>"
#-- Specify a key to use for package signing
#GPGKEY=""
#########################################################################
# COMPRESSION DEFAULTS
#########################################################################
#
COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -T0 --ultra -20 -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)
#########################################################################
# EXTENSION DEFAULTS
#########################################################################
#
PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'
#########################################################################
# OTHER
#########################################################################
#
#-- Command used to run pacman as root, instead of trying sudo and su
#PACMAN_AUTH=()
# vim: set ft=sh ts=2 sw=2 et:

View File

@@ -0,0 +1,92 @@
#
# /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.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
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]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -0,0 +1,98 @@
#
# /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.
[staging]
Include = /etc/pacman.d/mirrorlist
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
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]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -0,0 +1,92 @@
#
# /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.
[testing]
Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
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]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View File

@@ -0,0 +1 @@
x86_64

View File

@@ -1,4 +1,4 @@
#compdef archbuild archco arch-nspawn archrelease commitpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco checkpkg sogrep offload-build makerepropkg #compdef archbuild archco arch-nspawn archrelease commitpkg diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco checkpkg sogrep offload-build makerepropkg
# #
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
@@ -6,6 +6,7 @@ m4_include(lib/valid-tags.sh)
m4_include(lib/valid-repos.sh) m4_include(lib/valid-repos.sh)
_binary_arch=${_arch[*]:0:-1} _binary_arch=${_arch[*]:0:-1}
_colors=(never always auto)
_archbuild_args=( _archbuild_args=(
'-c[Recreate the chroot before building]' '-c[Recreate the chroot before building]'
@@ -41,6 +42,22 @@ _commitpkg_args=(
'1:commit_msg' '1:commit_msg'
) )
_diffpkg_args=(
'(-l --list)'{-l,--list}'[Tar content list diff mode]'
'(-d --diffoscope)'{-d,--diffoscope}'[Diffoscope diff mode]'
'(-p --pkginfo)'{-p,--pkginfo}'[.PKGINFO diff mode]'
'(-b --buildinfo)'{-b,--buildinfo}'[.BUILDINFO diff mode]'
'(-m --makepkg-config)'{-m,--makepkg-config}'[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
'(-u -U --unified)'{-u,-U,--unified}'[Output 3 lines of unified context]'
'(-y --side-by-side)'{-y,--side-by-side}'[Output in two columns]'
'--color=[Color output]:when:($_colors[*])'
'(-W --width=)'{-W,--width=}'[Output at most NUM print columns]:num:(auto columns)'
'(-P --pool=)'{-P,--pool=}'[pool directory]:dir:_files -/'
'(-v --verbose)'{-v,--verbose}'[Provide more detailed/unfiltered output]'
'(-h --help)'{-h,--help}'[Display usage]'
'*:packages:_devtools_completions_all_packages'
)
_finddeps_args=( _finddeps_args=(
'1:packages:_devtools_completions_all_packages' '1:packages:_devtools_completions_all_packages'
) )

View File

@@ -37,4 +37,4 @@ Options
*-h*:: *-h*::
Show this usage message Show this usage message
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -25,6 +25,7 @@ Description
The symlink used to run it will be inspected by archbuild, to determine which target you want it to use. It will load the available pacman configuration from 'pacman-reponame-arch.conf' with a fallback to 'pacman-reponame.conf' from {pkgdatadir}. The makepkg configuration is loaded from 'makepkg-repo-arch.conf' with a fallback to 'makepkg-reponame.conf' from {pkgdatadir}. The symlink used to run it will be inspected by archbuild, to determine which target you want it to use. It will load the available pacman configuration from 'pacman-reponame-arch.conf' with a fallback to 'pacman-reponame.conf' from {pkgdatadir}. The makepkg configuration is loaded from 'makepkg-repo-arch.conf' with a fallback to 'makepkg-reponame.conf' from {pkgdatadir}.
It will also load the bind mount configuration from 'mount.d/arch' in {pkgdatadir}. The file format is that each line starting with ro and rw will be used, other lines will be ignored, and the rest of the used line is out/path:in/path preceded by a space as a separator. ro means it is a read-only mount, rw means a read-write mount.
Options Options
------- -------
@@ -44,4 +45,4 @@ See Also
linkman:devtools[7] linkman:devtools[7]
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -40,4 +40,4 @@ See Also
linkman:find-libprovides[1] linkman:find-libprovides[1]
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -25,7 +25,7 @@ linkman:arch-nspawn[1]
Run a command or OS in a light-weight namespace container Run a command or OS in a light-weight namespace container
linkman:checkpkg[1] linkman:checkpkg[1]
Compare the current build pakcage with the repository version Compare the current build package with the repository version
linkman:find-libdeps[1] linkman:find-libdeps[1]
Find soname dependencies for a package Find soname dependencies for a package
@@ -52,4 +52,4 @@ linkman:offload-build[1]
linkman:sogrep[1] linkman:sogrep[1]
Find packages using a linked to a given shared library Find packages using a linked to a given shared library
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -0,0 +1,77 @@
diffpkg(1)
===========
Name
----
diffpkg - Compare package files using different modes.
Synopsis
--------
diffpkg [OPTIONS] [MODES] [FILE|PKGNAME...]
Description
-----------
Searches for a locally built package corresponding to the PKGBUILD, and
downloads the last version of that package from the Pacman repositories.
It then compares the package archives using different modes while using
simple tar content list by default.
When given one package, use it to diff against the locally built one.
When given two packages, diff both packages against each other.
In either case, a package name will be converted to a filename from the
cache or pool, and diffpkg will proceed as though this filename was initially
specified.
Options
-------
*-M, --makepkg-config*::
Set an alternate makepkg configuration file
*-P, --pool*='DIR'::
Search diff target in pool dir (default `'/srv/ftp/pool'`)
*-v, --verbose*::
Provide more detailed/unfiltered output
*-h, --help*::
Show a help text
Output Options
--------------
*--color*[='WHEN']::
Color output; 'WHEN' is `'never'`, `'always'`, or `'auto'`; Plain *--color* means *--color='auto'*
*-u, -U, --unified*::
Output 3 lines of unified context
*-y, --side-by-side*::
Output in two columns
*-W, --width*[='NUM']::
Output at most 'NUM' (default `'auto'`) print columns; 'NUM' can be `'auto'`, `'columns'` or a number.
`'auto'` will be resolved to the maximum line length of both files, guaranteeing the diff to be uncut.
Modes
-----
*-l, --list*::
Activate tar content list diff mode (default)
*-d, --diffoscope*::
Activate diffoscope diff mode
*-p, --pkginfo*::
Activate .PKGINFO diff mode
*-b, --buildinfo*::
Activate .BUILDINFO diff mode
See Also
--------
include::include/footer.asciidoc[]

View File

@@ -0,0 +1,25 @@
export-pkgbuild-keys(1)
=======================
Name
----
export-pkgbuild-keys - Export valid source signing keys from a PKGBUILD
Synopsis
--------
export-pkgbuild-keys
Description
-----------
Export the PGP keys from a PKGBUILDs validpgpkeys array into the keys/pgp/
subdirectory. Useful for distributing packager validated source signing
keys alongside PKGBUILDs.
Options
-------
*-h, --help*::
Show a help text.
include::include/footer.asciidoc[]

View File

@@ -21,4 +21,4 @@ Options
Ignore internal libraries. Ignore internal libraries.
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -21,4 +21,4 @@ Options
*--ignore-internal*:: *--ignore-internal*::
Ignore internal libraries. Ignore internal libraries.
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -1,9 +1,7 @@
Bugs Bugs
---- ----
Bugs can be reported on the bug tracker 'https://bugs.archlinux.org' in the Arch Bugs can be reported on the project's GitLab bug tracker 'https://gitlab.archlinux.org/archlinux/devtools'
Linux category and title prefixed with [devtools] or via
mailto:arch-projects@archlinux.org[].
Authors Authors

View File

@@ -22,4 +22,4 @@ See Also
linkman:ldd[1] linkman:ldd[1]
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -73,4 +73,4 @@ Options
*-U*:: *-U*::
Run makepkg as a specified user Run makepkg as a specified user
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -56,4 +56,4 @@ Options
*-h*:: *-h*::
Show this usage message Show this usage message
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -46,4 +46,4 @@ See Also
linkman:pacman[1] linkman:pacman[1]
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -49,4 +49,4 @@ Example: To use a second `testing-x86_64-build` instance with another copydir:
`offload-build -r testing -- -- -l <chroot_copy>` `offload-build -r testing -- -- -l <chroot_copy>`
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -45,4 +45,4 @@ Environment Variables
directory set by the **XDG_CACHE_HOME** environment variable or the directory set by the **XDG_CACHE_HOME** environment variable or the
**HOME** environment variable if **XDG_CACHE_HOME** is not set. **HOME** environment variable if **XDG_CACHE_HOME** is not set.
include::footer.asciidoc[] include::include/footer.asciidoc[]

View File

@@ -19,8 +19,6 @@ export LANG=C
export BUILDTOOL=devtools export BUILDTOOL=devtools
export BUILDTOOLVER=m4_devtools_version export BUILDTOOLVER=m4_devtools_version
shopt -s extglob
# check if messages are to be printed using color # check if messages are to be printed using color
if [[ -t 2 && "$TERM" != dumb ]]; then if [[ -t 2 && "$TERM" != dumb ]]; then
colorize colorize
@@ -139,15 +137,20 @@ pkgver_equal() {
# $pkgver can be supplied with or without a pkgrel appended. # $pkgver can be supplied with or without a pkgrel appended.
# If not supplied, any pkgrel will be matched. # If not supplied, any pkgrel will be matched.
## ##
shopt -s extglob
find_cached_package() { find_cached_package() {
local searchdirs=("$PWD" "$PKGDEST") results=() local searchdirs=("$PWD" "$PKGDEST") results=()
local targetname=$1 targetver=$2 targetarch=$3 local targetname=$1 targetver=$2 targetarch=$3
local dir pkg pkgbasename name ver rel arch r results local dir pkg packages pkgbasename name ver rel arch r results
for dir in "${searchdirs[@]}"; do for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue [[ -d $dir ]] || continue
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do shopt -s extglob nullglob
mapfile -t packages < <(printf "%s\n" "$dir"/"${targetname}"-"${targetver}"-*"${targetarch}".pkg.tar?(.!(sig|*.*)))
shopt -u extglob nullglob
for pkg in "${packages[@]}"; do
[[ -f $pkg ]] || continue [[ -f $pkg ]] || continue
# avoid adding duplicates of the same inode # avoid adding duplicates of the same inode
@@ -189,7 +192,7 @@ find_cached_package() {
return 1 return 1
esac esac
} }
shopt -u extglob
check_package_validity(){ check_package_validity(){
local pkgfile=$1 local pkgfile=$1

View File

@@ -23,6 +23,22 @@ if [[ -f "@pkgdatadir@/setarch-aliases.d/${arch}" ]]; then
else else
set_arch="${arch}" set_arch="${arch}"
fi fi
# Architecture-specific Mount
arch_mounts=()
if [[ -f "@pkgdatadir@/mount.d/${arch}" ]]; then
mapfile -t arch_mounts < "@pkgdatadir@/mount.d/${arch}"
fi
for arch_mount in "${arch_mounts[@]}"; do
if [[ $arch_mount = rw* ]]; then
arch_mount=${arch_mount#rw }
in_array "$arch_mount" "${makechrootpkg_args[@]}" || makechrootpkg_args+=("-d" "$arch_mount")
elif [[ $arch_mount = ro* ]]; then
arch_mount=${arch_mount#ro }
in_array "$arch_mount" "${makechrootpkg_args[@]}" || makechrootpkg_args+=("-D" "$arch_mount")
fi
done
chroots='/var/lib/archbuild' chroots='/var/lib/archbuild'
clean_first=false clean_first=false

View File

@@ -51,11 +51,6 @@ fi
pushd .. >/dev/null pushd .. >/dev/null
mapfile -t known_files < <(svn ls -r HEAD "$trunk") mapfile -t known_files < <(svn ls -r HEAD "$trunk")
wait $! || die "failed to discover committed files" wait $! || die "failed to discover committed files"
for file in "${known_files[@]}"; do
if [[ ${file:(-1)} = '/' ]]; then
die "archrelease: subdirectories are not supported in package directories!"
fi
done
# gracefully handle files containing an "@" character # gracefully handle files containing an "@" character
known_files=("${known_files[@]/%/@}") known_files=("${known_files[@]/%/@}")
@@ -67,7 +62,7 @@ for tag in "$@"; do
stat_busy "Copying %s to %s" "${trunk}" "${tag}" stat_busy "Copying %s to %s" "${trunk}" "${tag}"
if [[ -d repos/$tag ]]; then if [[ -d repos/$tag ]]; then
mapfile -t trash < <(svn ls "repos/$tag") mapfile -t trash < <(svn ls --recursive "repos/$tag")
wait $! || die "failed to discover existing files" wait $! || die "failed to discover existing files"
if (( ${#trash[@]} )); then if (( ${#trash[@]} )); then
trash=("${trash[@]/#/repos/$tag/}") trash=("${trash[@]/#/repos/$tag/}")

View File

@@ -2,8 +2,6 @@
# #
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
shopt -s extglob
m4_include(lib/common.sh) m4_include(lib/common.sh)
usage() { usage() {
@@ -52,7 +50,7 @@ while (( $# )); do
shift shift
break break
;; ;;
-*,--*) -*|--*)
die "invalid argument: %s" "$1" die "invalid argument: %s" "$1"
;; ;;
*) *)
@@ -63,7 +61,7 @@ done
# Source makepkg.conf; fail if it is not found # Source makepkg.conf; fail if it is not found
if [[ -r "${MAKEPKG_CONF}" ]]; then if [[ -r "${MAKEPKG_CONF}" ]]; then
# shellcheck source=makepkg-x86_64.conf # shellcheck source=config/makepkg/x86_64.conf
source "${MAKEPKG_CONF}" source "${MAKEPKG_CONF}"
else else
die "${MAKEPKG_CONF} not found!" die "${MAKEPKG_CONF} not found!"
@@ -82,7 +80,7 @@ if [[ ! -f PKGBUILD ]]; then
die 'This must be run in the directory of a built package.' die 'This must be run in the directory of a built package.'
fi fi
# shellcheck source=PKGBUILD.proto # shellcheck source=contrib/makepkg/PKGBUILD.proto
. ./PKGBUILD . ./PKGBUILD
if [[ ${arch[0]} == 'any' ]]; then if [[ ${arch[0]} == 'any' ]]; then
CARCH='any' CARCH='any'

View File

@@ -6,7 +6,7 @@ m4_include(lib/common.sh)
# Source makepkg.conf; fail if it is not found # Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then if [[ -r '/etc/makepkg.conf' ]]; then
# shellcheck source=makepkg-x86_64.conf # shellcheck source=config/makepkg/x86_64.conf
source '/etc/makepkg.conf' source '/etc/makepkg.conf'
else else
die '/etc/makepkg.conf not found!' die '/etc/makepkg.conf not found!'
@@ -28,7 +28,7 @@ if [[ ! -f PKGBUILD ]]; then
fi fi
source=() source=()
# shellcheck source=PKGBUILD.proto # shellcheck source=contrib/makepkg/PKGBUILD.proto
. ./PKGBUILD . ./PKGBUILD
pkgbase=${pkgbase:-$pkgname} pkgbase=${pkgbase:-$pkgname}
@@ -48,6 +48,21 @@ case "$cmd" in
;; ;;
esac esac
if (( ${#validpgpkeys[@]} != 0 )); then
if [[ -d keys ]]; then
for key in "${validpgpkeys[@]}"; do
if [[ ! -f keys/pgp/$key.asc ]]; then
export-pkgbuild-keys || die 'Failed to export valid PGP keys for source files'
fi
done
else
export-pkgbuild-keys || die 'Failed to export valid PGP keys for source files'
fi
svn add --parents --force keys/pgp/*
fi
# find files which should be under source control # find files which should be under source control
needsversioning=() needsversioning=()
for s in "${source[@]}"; do for s in "${source[@]}"; do
@@ -60,6 +75,9 @@ for i in 'changelog' 'install'; do
needsversioning+=("$file") needsversioning+=("$file")
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD) done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
done done
for key in "${validpgpkeys[@]}"; do
needsversioning+=("keys/pgp/$key.asc")
done
# assert that they really are controlled by SVN # assert that they really are controlled by SVN
if (( ${#needsversioning[*]} )); then if (( ${#needsversioning[*]} )); then
@@ -114,16 +132,17 @@ if [[ -n $(svn status -q) ]]; then
svn commit -q -m "${msgtemplate}: ${1}" || die svn commit -q -m "${msgtemplate}: ${1}" || die
stat_done stat_done
else else
msgfile="$(mktemp)" [[ -z ${WORKDIR:-} ]] && setup_workdir
msgfile=$(mktemp --tmpdir="${WORKDIR}" commitpkg.XXXXXXXXXX)
echo "$msgtemplate" > "$msgfile" echo "$msgtemplate" > "$msgfile"
if [[ -n $SVN_EDITOR ]]; then if [[ -n $SVN_EDITOR ]]; then
$SVN_EDITOR "$msgfile" $SVN_EDITOR "$msgfile" || die
elif [[ -n $VISUAL ]]; then elif [[ -n $VISUAL ]]; then
$VISUAL "$msgfile" $VISUAL "$msgfile" || die
elif [[ -n $EDITOR ]]; then elif [[ -n $EDITOR ]]; then
$EDITOR "$msgfile" $EDITOR "$msgfile" || die
else else
vi "$msgfile" vi "$msgfile" || die
fi fi
[[ -s $msgfile ]] || die [[ -s $msgfile ]] || die
stat_busy 'Committing changes to trunk' stat_busy 'Committing changes to trunk'

View File

@@ -45,7 +45,7 @@ msg "Downloading sources for %s" "${pkgbase}"
svn -q checkout -N "${target_svn}" target_checkout svn -q checkout -N "${target_svn}" target_checkout
mkdir -p "target_checkout/${pkgbase}/repos" mkdir -p "target_checkout/${pkgbase}/repos"
svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die svn -q export "${source_svn}/${pkgbase}/trunk" "target_checkout/${pkgbase}/trunk" || die
# shellcheck source=PKGBUILD.proto # shellcheck source=contrib/makepkg/PKGBUILD.proto
. "target_checkout/${pkgbase}/trunk/PKGBUILD" . "target_checkout/${pkgbase}/trunk/PKGBUILD"
msg "Downloading packages for %s" "${pkgbase}" msg "Downloading packages for %s" "${pkgbase}"
@@ -57,9 +57,14 @@ for _arch in "${arch[@]}"; do
fi fi
for _pkgname in "${pkgname[@]}"; do for _pkgname in "${pkgname[@]}"; do
fullver=$(get_full_version "$_pkgname") fullver=$(get_full_version "$_pkgname")
pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*" pkgpath="/srv/ftp/${source_repo}/os/${repo_arch}/${_pkgname}-${fullver}-${_arch}.pkg.tar.*"
debugpath="/srv/ftp/${source_repo}-debug/os/${repo_arch}/${_pkgname}-debug-${fullver}-${_arch}.pkg.tar.*"
# Fail if $pkgpath doesn't match but keep $debugpath optional
# shellcheck disable=2029 # shellcheck disable=2029
ssh "$server" "cp $pkgpath staging/$target_repo" || die ssh "${server}" "bash -c '
install ${pkgpath} -Dt staging/${target_repo} &&
(install ${debugpath} -Dt staging/${target_repo} 2>/dev/null || true)
'" || die
done done
done done

335
src/diffpkg.in Normal file
View File

@@ -0,0 +1,335 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/common.sh)
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS] [MODES] [FILE|PKGNAME...]
Searches for a locally built package corresponding to the PKGBUILD, and
downloads the last version of that package from the Pacman repositories.
It then compares the package archives using different modes while using
simple tar content list by default.
When given one package, use it to diff against the locally built one.
When given two packages, diff both packages against each other.
In either case, a package name will be converted to a filename from the
cache, and diffpkg will proceed as though this filename was initially
specified.
OPTIONS
-M, --makepkg-config Set an alternate makepkg configuration file
-P, --pool=DIR Search diff target in pool dir (default '/srv/ftp/pool')
-v, --verbose Provide more detailed/unfiltered output
-h, --help Show this help text
OUTPUT OPTIONS
--color[=WHEN] Color output; WHEN is 'never', 'always', or 'auto';
Plain --color means --color='auto'
-u, -U, --unified Output 3 lines of unified context
-y, --side-by-side Output in two columns
-W, --width=NUM Output at most NUM (default 'auto') print columns
NUM can be 'auto', 'columns' or a number
MODES
-l, --list Activate content list diff mode (default)
-d, --diffoscope Activate diffoscope diff mode
-p, --pkginfo Activate .PKGINFO diff mode
-b, --buildinfo Activate .BUILDINFO diff mode
_EOF_
}
MAKEPKG_CONF=/etc/makepkg.conf
POOLDIR=/srv/ftp/pool
VERBOSE=0
TARLIST=0
DIFFOSCOPE=0
PKGINFO=0
BUILDINFO=0
DIFFMODE=--side-by-side
DIFFCOLOR=--color=auto
DIFFWIDTH=--width=auto
DIFFOPTIONS=(--expand-tabs)
# option checking
while (( $# )); do
case $1 in
-h|--help)
usage
exit 0
;;
-M|--makepkg-config)
(( $# <= 1 )) && die "missing argument for %s" "$1"
MAKEPKG_CONF="$2"
shift 2
;;
-l|--list)
TARLIST=1
shift
;;
-d|--diffoscope)
DIFFOSCOPE=1
shift
;;
-p|--pkginfo)
PKGINFO=1
shift
;;
-b|--buildinfo)
BUILDINFO=1
shift
;;
-v|--verbose)
VERBOSE=1
shift
;;
-u|-U|--unified)
DIFFMODE=--unified
shift
;;
-y|--side-by-side)
DIFFMODE=--side-by-side
shift
;;
--color|--color=*)
if [[ $2 == never || $2 == always || $2 == auto ]]; then
DIFFCOLOR="--color=$2"
shift 2
continue
fi
if [[ $1 == --color ]]; then
DIFFCOLOR="--color=auto"
else
DIFFCOLOR="$1"
fi
shift
;;
-W|--width)
(( $# <= 1 )) && die "missing argument for %s" "$1"
DIFFWIDTH="--width=$2"
shift 2
;;
--width=*)
DIFFWIDTH="$1"
shift
;;
-P|--pool)
(( $# <= 1 )) && die "missing argument for %s" "$1"
POOLDIR="$2"
shift 2
;;
--pool=*)
POOLDIR="${1#*=}"
shift
;;
--)
shift
break
;;
-*|--*)
die "invalid argument: %s" "$1"
;;
*)
break
;;
esac
done
# Set options based on flags or magic values
if (( VERBOSE )); then
if [[ $DIFFMODE == --unified ]]; then
DIFFMODE="--unified=99999"
fi
else
DIFFOPTIONS+=(--suppress-common-lines)
fi
if [[ $DIFFWIDTH == --width=columns ]]; then
DIFFWIDTH="--width=${COLUMNS:-130}"
fi
if [[ $DIFFWIDTH != --width=auto ]]; then
DIFFOPTIONS+=("${DIFFWIDTH}")
fi
DIFFOPTIONS+=("${DIFFMODE}" "${DIFFCOLOR}")
if ! (( DIFFOSCOPE || TARLIST || PKGINFO || BUILDINFO )); then
TARLIST=1
fi
# Source makepkg.conf; fail if it is not found
if [[ -r "${MAKEPKG_CONF}" ]]; then
# shellcheck source=config/makepkg/x86_64.conf
source "${MAKEPKG_CONF}"
else
die "${MAKEPKG_CONF} not found!"
fi
# Source user-specific makepkg.conf overrides
if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
# shellcheck source=/dev/null
source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
elif [[ -r "$HOME/.makepkg.conf" ]]; then
# shellcheck source=/dev/null
source "$HOME/.makepkg.conf"
fi
STARTDIR=$(pwd)
trap 'rm -rf $TMPDIR' EXIT INT TERM QUIT
TMPDIR=$(mktemp -d --tmpdir diffpkg-script.XXXXXXXX)
export TMPDIR
tar_list() {
bsdtar tf "$*" | if (( VERBOSE )); then
cat
else
sed -E 's|^usr/lib/modules/[0-9][^/]+|usr/lib/modules/[…]|g'
fi | sort
}
file_line_length() {
path="$1"
wc -L "${path}" | tail -n1 | sed -E 's/^ +//g' | cut -d' ' -f1
}
file_diff_columns() {
file1="$1"
file2="$2"
file1_length=$(file_line_length "$file1")
file2_length=$(file_line_length "$file2")
echo $(( file1_length + file2_length + 3 ))
}
diff_pkgs() {
local oldpkg newpkg
oldpkg=$(readlink -m "$1")
newpkg=$(readlink -m "$2")
[[ -f $oldpkg ]] || die "No such file: %s" "${oldpkg}"
[[ -f $newpkg ]] || die "No such file: %s" "${newpkg}"
DIFFOPTIONS+=(--label "${oldpkg}" --label "${newpkg}")
if (( TARLIST )); then
tar_list "$oldpkg" > "$TMPDIR/old"
tar_list "$newpkg" > "$TMPDIR/new"
fi
if (( PKGINFO )); then
bsdtar xOqf "$oldpkg" .PKGINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .PKGINFO > "$TMPDIR/new"
fi
if (( BUILDINFO )); then
bsdtar xOqf "$oldpkg" .BUILDINFO > "$TMPDIR/old"
bsdtar xOqf "$newpkg" .BUILDINFO > "$TMPDIR/new"
fi
if (( TARLIST || PKGINFO || BUILDINFO )); then
# 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}")
fi
# Print a header for side-by-side view as it lacks labels
if [[ $DIFFMODE == --side-by-side ]]; then
printf -- "--- %s\n+++ %s\n" "${oldpkg}" "${newpkg}"
fi
diff "${DIFFOPTIONS[@]}" "$TMPDIR/old" "$TMPDIR/new"
fi
if (( DIFFOSCOPE )); then
diffoscope "${DIFFCOLOR/--color/--text-color}" "$oldpkg" "$newpkg"
fi
}
shopt -s extglob
fetch_pkg() {
local pkg pkgdest pkgurl
case $1 in
*://*)
pkgurl=$1 ;;
/*|*/*)
pkgurl=$(readlink -m "$1") ;;
*.pkg.tar*)
pkgurl=$1 ;;
'')
;;
*)
pkg=$1 ;;
esac
if [[ -z ${pkgurl} ]]; then
# Try to find latest package in pool dir
if [[ -d ${POOLDIR} ]]; then
shopt -s extglob nullglob
pkgurl=$(printf "%s\n" "${POOLDIR}"/*/"${_pkgname}"-!(*-*)-!(*-*)-!(*-*).pkg.tar!(*.sig)|sort -Vr|head -1)
shopt -u extglob nullglob
fi
# Search via pacman database if no pool file exists
if [[ ! -f ${pkgurl} ]]; then
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$pkg") ||
die "Couldn't download previous package for %s." "$pkg"
fi
fi
pkg=${pkgurl##*/}
pkgdest=$(mktemp -t -d "${pkg}-XXXXXX")/${pkg}
if [[ $pkgurl = file://* || ( $pkgurl = /* && -f $pkgurl ) ]]; then
ln -sf "${pkgurl#file://}" "$pkgdest"
elif [[ -f "$PKGDEST/$pkg" ]]; then
ln -sf "$PKGDEST/$pkg" "$pkgdest"
elif [[ -f "$STARTDIR/$pkg" ]]; then
ln -sf "$STARTDIR/$pkg" "$pkgdest"
elif [[ $pkgurl = *://* ]]; then
curl -fsLC - --retry 3 --retry-delay 3 -o "$pkgdest" "$pkgurl" || \
die "Couldn't download %s" "$pkgurl"
else
die "File not found: %s" "$pkgurl"
fi
echo "$pkgdest"
}
shopt -u extglob
if (( $# < 2 )); then
if [[ ! -f PKGBUILD ]]; then
die "This must be run in the directory of a built package.\nTry '$(basename "$0") --help' for more information."
fi
# shellcheck source=contrib/makepkg/PKGBUILD.proto
. ./PKGBUILD
if [[ ${arch[0]} == 'any' ]]; then
CARCH='any'
fi
for _pkgname in "${pkgname[@]}"; do
comparepkg=$_pkgname
pkgurl=
target_pkgver=$(get_full_version "$_pkgname")
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
fi
ln -s "$pkgfile" "$TMPDIR"
if (( $# )); then
comparepkg="$1"
fi
oldpkg=$(fetch_pkg "$comparepkg") || exit 1
diff_pkgs "$oldpkg" "$pkgfile"
done
else
file1=$(fetch_pkg "$1") || exit 1
file2=$(fetch_pkg "$2") || exit 1
diff_pkgs "$file1" "$file2"
fi

View File

@@ -0,0 +1,75 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/common.sh)
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/}
Export the PGP keys from a PKGBUILDs validpgpkeys array into the keys/pgp/
subdirectory. Useful for distributing packager validated source signing
keys alongside PKGBUILDs.
OPTIONS
-h, --help Show this help text
_EOF_
}
# option checking
while (( $# )); do
case $1 in
-h|--help)
usage
exit 0
;;
*)
die "invalid argument: %s" "$1"
;;
esac
done
if [[ ! -f PKGBUILD ]]; then
die "This must be run a directory containing a PKGBUILD."
fi
mapfile -t validpgpkeys < <(
# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
if (( ${#validpgpkeys[@]} )); then
printf "%s\n" "${validpgpkeys[@]}"
fi
)
msg "Exporting ${#validpgpkeys[@]} PGP keys..."
if (( ${#validpgpkeys[@]} == 0 )); then
exit 0
fi
trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
TEMPDIR=$(mktemp -d --tmpdir export-pkgbuild-keys.XXXXXXXXXX)
mkdir -p keys/pgp
error=0
for key in "${validpgpkeys[@]}"; do
gpg --output "$TEMPDIR/$key.asc" --armor --export --export-options export-minimal "$key" 2>/dev/null
# gpg does not give a non-zero return value if it fails to export...
if [[ -f $TEMPDIR/$key.asc ]]; then
msg2 "Exported $key"
mv "$TEMPDIR/$key.asc" "keys/pgp/$key.asc"
else
if [[ -f keys/pgp/$key.asc ]]; then
warning "Failed to update key: $key"
else
error "Key unavailable: $key"
error=1
fi
fi
done
if (( error )); then
die "Failed to export all \'validpgpkeys\' entries."
fi

View File

@@ -5,7 +5,6 @@
m4_include(lib/common.sh) m4_include(lib/common.sh)
set -e set -e
shopt -s extglob
IGNORE_INTERNAL=0 IGNORE_INTERNAL=0
@@ -41,9 +40,12 @@ else
pushd "$WORKDIR" >/dev/null pushd "$WORKDIR" >/dev/null
fi fi
shopt -s extglob
process_sofile() { process_sofile() {
# extract the library name: libfoo.so # extract the library name: libfoo.so
shopt -s extglob nullglob
soname="${sofile%.so?(+(.+([0-9])))}".so soname="${sofile%.so?(+(.+([0-9])))}".so
shopt -u extglob nullglob
# extract the major version: 1 # extract the major version: 1
soversion="${sofile##*\.so\.}" soversion="${sofile##*\.so\.}"
if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then if [[ "$soversion" = "$sofile" ]] && ((IGNORE_INTERNAL)); then
@@ -55,6 +57,7 @@ process_sofile() {
soobjects+=("${soname}=${soversion}-${soarch}") soobjects+=("${soname}=${soversion}-${soarch}")
fi fi
} }
shopt -u extglob
case $script_mode in case $script_mode in
deps) find_args=(-perm -u+x);; deps) find_args=(-perm -u+x);;

View File

@@ -20,7 +20,7 @@ fi
find . -type d -print0 2>/dev/null| while read -r -d '' d; do find . -type d -print0 2>/dev/null| while read -r -d '' d; do
if [[ -f "$d/PKGBUILD" ]]; then if [[ -f "$d/PKGBUILD" ]]; then
pkgname=() depends=() makedepends=() optdepends=() pkgname=() depends=() makedepends=() optdepends=()
# shellcheck source=PKGBUILD.proto # shellcheck source=contrib/makepkg/PKGBUILD.proto
. "$d/PKGBUILD" . "$d/PKGBUILD"
for dep in "${depends[@]}"; do for dep in "${depends[@]}"; do
# lose the version comparator, if any # lose the version comparator, if any

View File

@@ -24,6 +24,7 @@ clean_first=0
run_namcap=0 run_namcap=0
run_checkpkg=0 run_checkpkg=0
temp_chroot=0 temp_chroot=0
tmp_opts="nosuid,nodev,size=50%,nr_inodes=2m"
bindmounts_ro=() bindmounts_ro=()
bindmounts_rw=() bindmounts_rw=()
@@ -311,13 +312,14 @@ fi
# Pass all arguments after -- right to makepkg # Pass all arguments after -- right to makepkg
makepkg_args+=("${@:$OPTIND}") makepkg_args+=("${@:$OPTIND}")
# See if -R or -e was passed to makepkg # See if -R, -e or -A was passed to makepkg
for arg in "${@:$OPTIND}"; do for arg in "${@:$OPTIND}"; do
case ${arg%%=*} in case ${arg%%=*} in
--skip*|--holdver) verifysource_args+=("$arg") ;; --skip*|--holdver|--ignorearch) verifysource_args+=("$arg") ;;
--repackage|--noextract) keepbuilddir=1 ;; --repackage|--noextract) keepbuilddir=1 ;;
--*) ;; --*) ;;
-*R*|-*e*) keepbuilddir=1 ;; -*A*) verifysource_args+=(-A) ;;&
-*R*|-*e*) keepbuilddir=1 ;;&
esac esac
done done
@@ -364,6 +366,7 @@ prepare_chroot
if arch-nspawn "$copydir" \ if arch-nspawn "$copydir" \
--bind="${PWD//:/\\:}:/startdir" \ --bind="${PWD//:/\\:}:/startdir" \
--bind="${SRCDEST//:/\\:}:/srcdest" \ --bind="${SRCDEST//:/\\:}:/srcdest" \
--tmpfs="/tmp:${tmp_opts}" \
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \ "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
/chrootbuild "${makepkg_args[@]}" /chrootbuild "${makepkg_args[@]}"
then then

13
makerepropkg.in → src/makerepropkg.in Executable file → Normal file
View File

@@ -86,13 +86,14 @@ get_pkgfile() {
get_makepkg_conf() { get_makepkg_conf() {
local fname=${1} local fname=${1}
local makepkg_conf="${2}" local arch="${2}"
local makepkg_conf="${3}"
if ! buildtool_file=$(get_pkgfile "${fname}"); then if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}" error "failed to retrieve ${fname}"
return 1 return 1
fi fi
msg2 "using makepkg.conf from ${fname}" msg2 "using makepkg.conf from ${fname}"
bsdtar xOqf "${buildtool_file/file:\/\//}" usr/share/devtools/makepkg-x86_64.conf > "${makepkg_conf}" bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}"
return 0 return 0
} }
@@ -213,17 +214,17 @@ TEMPDIR=$(mktemp -d --tmpdir makerepropkg.XXXXXXXXXX)
makepkg_conf="${TEMPDIR}/makepkg.conf" makepkg_conf="${TEMPDIR}/makepkg.conf"
# anything before buildtool support is pinned to the last none buildtool aware release # anything before buildtool support is pinned to the last none buildtool aware release
if [[ -z "${BUILDTOOL}" ]]; then if [[ -z "${BUILDTOOL}" ]]; then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}" || exit 1 get_makepkg_conf "devtools-20210202-3-any" "${CARCH}" "${makepkg_conf}" || exit 1
# prefere to assume devtools up until matching makepkg version so repository packages remain reproducible # prefere to assume devtools up until matching makepkg version so repository packages remain reproducible
elif [[ "${BUILDTOOL}" = makepkg ]] && (( $(vercmp "${BUILDTOOLVER}" 6.0.1) <= 0 )); then elif [[ "${BUILDTOOL}" = makepkg ]] && (( $(vercmp "${BUILDTOOLVER}" 6.0.1) <= 0 )); then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}" || exit 1 get_makepkg_conf "devtools-20210202-3-any" "${CARCH}" "${makepkg_conf}" || exit 1
# all devtools builds # all devtools builds
elif [[ "${BUILDTOOL}" = devtools ]] && get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${makepkg_conf}"; then elif [[ "${BUILDTOOL}" = devtools ]] && get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${CARCH}" "${makepkg_conf}"; then
true true
# fallback to current makepkg.conf # fallback to current makepkg.conf
else else
warning "Unknown buildtool (${BUILDTOOL}-${BUILDTOOLVER}), using fallback" warning "Unknown buildtool (${BUILDTOOL}-${BUILDTOOLVER}), using fallback"
makepkg_conf=@pkgdatadir@/makepkg-x86_64.conf makepkg_conf=@pkgdatadir@/makepkg-${CARCH}.conf
fi fi
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M "${makepkg_conf}" -U "${archroot_args[@]}" "${namespace}/root" - || exit 1 printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M "${makepkg_conf}" -U "${archroot_args[@]}" "${namespace}/root" - || exit 1

View File

@@ -81,11 +81,11 @@ for file in "${files[@]}"; do
cp "$file" "$working_dir$file" cp "$file" "$working_dir$file"
done done
pacstrap -${umode}Mcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ unshare --mount pacstrap -${umode}Mc ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen" printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf" echo 'LANG=C.UTF-8' > "$working_dir/etc/locale.conf"
echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot" echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
systemd-machine-id-setup --root="$working_dir" systemd-machine-id-setup --root="$working_dir"

0
offload-build.in → src/offload-build.in Executable file → Normal file
View File

View File

@@ -22,7 +22,7 @@ fi
# Source makepkg.conf; fail if it is not found # Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then if [[ -r '/etc/makepkg.conf' ]]; then
# shellcheck source=makepkg-x86_64.conf # shellcheck source=config/makepkg/x86_64.conf
source '/etc/makepkg.conf' source '/etc/makepkg.conf'
else else
die '/etc/makepkg.conf not found!' die '/etc/makepkg.conf not found!'
@@ -54,7 +54,7 @@ bump_pkgrel() {
pkg_from_pkgbuild() { pkg_from_pkgbuild() {
# we want the sourcing to be done in a subshell so we don't pollute our current namespace # we want the sourcing to be done in a subshell so we don't pollute our current namespace
export CARCH PKGEXT export CARCH PKGEXT
# shellcheck source=PKGBUILD.proto # shellcheck source=contrib/makepkg/PKGBUILD.proto
(source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT") (source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
} }

7
sogrep.in → src/sogrep.in Executable file → Normal file
View File

@@ -36,8 +36,11 @@ recache() {
local dbpath=${SOCACHE_DIR}/${arch}/${repo}.links.tar.gz local dbpath=${SOCACHE_DIR}/${arch}/${repo}.links.tar.gz
mkdir -p "${dbpath%/*}" mkdir -p "${dbpath%/*}"
(( VERBOSE )) && echo "Fetching ${repo}.links.tar.gz..." (( VERBOSE )) && echo "Fetching ${repo}.links.tar.gz..."
curl -LR "${verbosity}" -o "${dbpath}" -z "${dbpath}" \ if ! curl -fLR "${verbosity}" -o "${dbpath}" -z "${dbpath}" \
"${SOLINKS_MIRROR}/${repo}/os/${arch}/${repo}.links.tar.gz" "${SOLINKS_MIRROR}/${repo}/os/${arch}/${repo}.links.tar.gz"; then
echo "error: failed to download links database for repo ${repo}"
exit 1
fi
done done
done done
} }