Commit Graph

1576 Commits

Author SHA1 Message Date
Natanael Copa 681ef9dfcf tests: add test with invalid version of subpkgs' dependency
Ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10058
2022-01-17 16:17:25 +01:00
Natanael Copa 9a96275d87 abuild: test that subpkg's dependencies versions are valid
Also verify the version of provides

Fixes: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10058
2022-01-17 16:14:58 +01:00
Natanael Copa 8824e43ad9 abuild: verify subpkgnames
Refactor pkgname check and also check subpkgnames

Add tests for invalid subpkgnames
2022-01-17 15:44:10 +01:00
Natanael Copa 070341e21d tests: add tests for invalid pkgname
Add s test for valid pkgnames to verify the testsuite APKBUILD actually
works as intended, and a few tests for invalid pkgnames
2022-01-17 15:36:49 +01:00
Natanael Copa bc71314cc3 ==== release 3.9.0 ==== 2021-11-22 15:03:42 +01:00
Kevin Daudt 6cd337fa9c ==== release 3.9.0_rc2 ==== 2021-10-11 23:32:14 +02:00
Kevin Daudt a1975471ab tests/abuild: skip remote initd tests
This test is flaky and relies on a file hosted remotely, which can be
unreachable. Ideally there should a way to have this file served from
the test suite itself, but this might be challenging to do without
adding dependencies.
2021-10-11 23:13:57 +02:00
Kevin Daudt 2a95c3d50c tests: only generate key when not available yet
Installing a build key requires root permissions, something that is not
possible in all cases, most notably on the builders.

Instead of generating a key each time, which results in many keys being
generated each test suite run, check whether a key is already present by
using `abuild-sign --installed`, and only generate a key when that
returns false.
2021-10-11 23:12:59 +02:00
Kevin Daudt a0d6085e9b tests: don't hardcode sudo implementation
Remove the SUDO environment variable, as it depends on what's installed
and configured on the host what implementation should be used.

It would not suffice to add sudo or doas as a makedepend, as it would
also need to be configured to allow abuild-keygen -ain to be executed
without password.
2021-10-11 22:44:43 +02:00
Kevin Daudt 4f723af7e5 ==== release 3.9.0_rc1 ==== 2021-10-11 20:53:50 +02:00
Ariadne Conill 78e36813d1 functions: add hostspecs for loongarch
Alpine itself will most likely use only the loongarch64 target, but it
makes sense to reserve the others as well.
2021-10-11 18:45:50 +00:00
Ross Younger d0ccbb7c09 abuild: filter out security.selinux xattrs
This patch modifies abuild's behaviour to be independent of
whether SELinux labels are present in the build environment.

This is a workaround for containerised build environments where the
hosting environment has SELinux enabled. Security labels leak into the
container, manifesting as xattrs.

Discussion thread:
https://lists.alpinelinux.org/~alpine/devel/%3CCA%2Bgy4ieuXLuQddxmPuiucyZbut%3D14cR8tgmGrh0qE9qLDBivmg%40mail.gmail.com%3E
2021-10-11 20:43:40 +02:00
Samanta Navarro f2ab775123 abuild: avoid calculations with void pointers
Arithmetic operations with void pointers are an extension by some
compilers and not part of the C standard, which does not specify the
size of void.

CFLAGS with -pedantic reveals this during compile time. I have adjusted
the usage of ?: so CFLAGS can contain -pedantic now.
2021-10-11 18:34:27 +00:00
Rodrigo Lourenço 0db2d3397a Convert man pages to scdoc
Closes #9986.
2021-10-11 18:31:29 +00:00
kpcyrd f550705177 abuild-sign: Do not record uid and user name in index 2021-10-11 20:08:51 +02:00
Alex Xu (Hello71) 3ad93d9a83 abuild: default_dbg: various fixes
- fix symlinks
- fix hard links
- fix dbg not first
- fix scan race condition
- fix (non-extended) attrs
- general refactoring
2021-10-11 15:33:01 +00:00
Ariadne Conill 02652f5dd6 abuild: version cmd: providers
The default provider priority is 0, which disables the normal way apk
selects an unversioned virtual dependency.  Instead, version the
provider so that cmd: dependencies can be robustly used like normal
dependencies.
2021-10-11 15:27:28 +00:00
Alex D. ba127ff45c abuild: use sourced filename instead of whole line for initd checks 2021-10-11 14:46:43 +00:00
Kevin Daudt ff913b4907 tests: generate and install keys
abuild requires that a build key is present, so make sure a key is
generated.
2021-10-07 17:25:03 +02:00
Kevin Daudt 789fca23db tests: add project dir to PATH
abuild and abump call a few helpers that are expected to be available in
PATH. As abuild is not installed yet, they are not in the default PATH
locations.

Add the project root dir to $PATH to make sure these helpers can be found.
2021-10-07 17:25:03 +02:00
Kevin Daudt 12ba0a14a2 tests: set APORTSDIR for abuild tests
If `APORTSDIR` is not set, abuild tries to find it. One way it does this
is by trying to look at the url for the git remote 'origin'. This fails
either if there is no git repository, or the git repository has no
remote called 'origin'.

Instead of having abuild guess the location, provide it by exporting
APORTSDIR.
2021-10-07 17:25:01 +02:00
Kevin Daudt d4af7cd4e2 ci: add job to run tests
This uses the alpinelinux/abuild-ci image to run the test suite, which
has all the required dependencies already installed.
2021-10-07 17:24:10 +02:00
Natanael Copa 1c00caaddb abuild: make sure to not get colors in git_last_commit
git log may return color codes if users colored output forcibly enabled
with:

[color]
	ui = always

Use `git rev-list` instead of `git log` to make sure that we don't get
any color codes.

fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10042
2021-10-07 13:06:06 +02:00
Natanael Copa 3d9918f14d tests: enable colors in git config
Force colors in git config so we can test that we don't get color codes
in our last commit.

ref https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10042
2021-10-07 13:02:25 +02:00
Natanael Copa e510181626 abuild-keygen: make cp non-interactive with -n
only use interactive copy when -n is omitted, so abuild-keygen --install
becomes non-interactive.

Add tests for both ineractive and non-interactive --install.

Fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10049
2021-09-27 20:08:30 +02:00
Natanael Copa 62066fa2b9 abuild-keygen: allow run without any sudo
make it possible to skip the sudo invocation for testing
2021-09-27 20:01:32 +02:00
Natanael Copa f35682d086 ==== release 3.8.0 ==== 2021-09-21 11:29:47 +02:00
Natanael Copa 272c1e4780 abuild-tar: load engines on openssl < 3 2021-09-21 11:29:13 +02:00
Samanta Navarro dc99ce423a abuild: fix typos
Typos found with codespell
2021-09-21 09:15:34 +00:00
Ariadne Conill a590096e30 abuild-tar: remove openssl engine registration, deprecated in OpenSSL 3 2021-09-20 10:02:26 -06:00
Natanael Copa 10ad48d1fe ==== release 3.8.0_rc4 ==== 2021-06-10 16:44:46 +02:00
Kaarle Ritvanen 91c4bc018d rootbld: foreign arch build with QEMU user mode 2021-06-10 14:40:55 +00:00
Natanael Copa 22ff0df215 abump: fix check for clean git of APKBUILD 2021-06-10 16:37:26 +02:00
Sören Tempel 33957133ec newapkbuild: automatically add perl to $depends
The same thing is already done for other scripting languages (e.g.
python).
2021-06-10 14:32:52 +00:00
Timothy Legge e0e6ee0d14 apkbuild-cpan.in: prevent inserting extra new line before checksum on upgrade 2021-06-10 14:31:02 +00:00
Timothy Legge fbd28a76f0 apkbuild-cpan.in: don't change arch on an upgrade of package 2021-06-10 14:31:02 +00:00
Timothy Legge 474edd8fd9 Fix issue with incorrectly inserted newline 2021-06-10 14:31:02 +00:00
Leo 74b32d03db fix(abuild): use -print0 **after** the print commands 2021-06-10 14:28:44 +00:00
Natanael Copa dee82f764c tests: skip lock test on s390x
the sleep(0) trick does not appear to work on s390x. which is okish as
worst case we end up with lock file leftovers. skip the test
2021-05-14 12:53:11 +02:00
Natanael Copa fa0a2511d6 ==== release 3.8.0_rc3 ==== 2021-05-14 12:00:17 +02:00
Natanael Copa 241743073a tests: abump: configure git user 2021-05-14 11:49:38 +02:00
Leo 2ed215fa32 tests(abuild): test whether pyX.Y providers work 2021-05-06 10:50:57 -03:00
Leo ac3ee42458 feat(abuild): add support for pyX.Y providers
Now all python packages that install python modules under
/usr/lib/pythonX.Y/site-packages will have a provider that indicates
their MAJOR (X) and MINOR (Y) versions.

pyX maps to the MAJOR version of the package, its objective is to allow
users to quickly install a python module without having to search around
for the correct package, doing `apk add py3.9:foo` will install whatever
packages provides the foo module.

The directories checked only go one level deep, so
'/usr/lib/python3.9/site-packages/date' will generate
py3:date=$pkgver-r$pkgrel.

files ending with .py also count and are added with their .py prefix
stripped away. so '/usr/lib/python3.9/site-packages/six.py' will
generate py3:six=$pkgver-r$pkgrel.

The reason for doing this is the same as creating pc:, so: and cmd:, it
is more reliable and robust to depened on what we known of what the package
provides than to try to guess via the pkgname.

Co-authored-by: Chloe Kudryavtsev <toast@toast.cafe>
2021-05-06 10:50:42 -03:00
Natanael Copa d3845277bc ==== release 3.8.0_rc2 ==== 2021-05-06 15:34:58 +02:00
Wolf 29557a4a54 Set non-zero size if there are any files in the package
If there are only empty files in the pkgdir, on some filesystems
(discovered on btrfs), du might return 0 for the sum size of the files.
But apk-tools considers packages with size = 0 to be virtual and skips
extraction of any files contained.

To work around that (until it is resolved in apk-tools 3), settings the
size to 1 when it is zero AND some files are present should work fine.
2021-05-06 13:32:08 +00:00
Natanael Copa 5f15ae8360 tests: abuild-keygen: test PACKAGER set 2021-05-06 15:30:10 +02:00
Natanael Copa b4816004a1 tests: abuild-keygen: create a fake git
test what happens when git has no user.email configured
2021-05-06 15:30:10 +02:00
Tom Lebreux e520288df5 abuild-keygen: Fix crash on unknown git user.email 2021-05-06 08:17:00 -04:00
Natanael Copa 3da770ce35 abuild-fetch: simplify and fix locking
Simplify locking by using lockf(3). It is POSIX compatible and should
work over NFS.

Fix download race condition when:
1) host A creates lockfile and aquire lock to fetch from distfiles
   mirror
2) host B opens the lockfile and waits for lock
3) host A gets 404 from distfiles, releases lock and deletes the
   lockfile, which host A has an open file handle for
4) host B gets lock of the deleted file and downloads file
5) host A retries download and creates a new lockfile, but is not
   blocked by host B, even if it should

Solve this by releaseing the lock, give the other processes a chance
to aquire it (using sleep(0)), and then only delete the lockfile if:
a) download was successful (no 404) or b) no-one else has a lock.

This reverts commit 281720ec39 (abuild-fetch: aquire a second lock
using flock(2))

fixes #10026
2021-05-06 13:03:14 +02:00
Natanael Copa 6a6145b9b3 tests: improve abuild-fetch locking test
make sure that we cover the issue #10026
2021-05-05 17:17:54 +02:00