Commit Graph

643 Commits

Author SHA1 Message Date
Piraty a45d12d4c3
abuild-rootbld: copy SRCDEST value from host to chroot
Otherwise the default hardcoded in abuild-fetch (var/cache/distfiles) is
used.

(in the same vein as 6864df03aa)

Fixes: 1582617 ("abuild-rootbld: clear environment for bwrap container")
2024-04-26 00:24:09 +02:00
Natanael Copa 68d6aa65f4 abuild: skip /var/run in fhs check
We have many package containing directories under /var/run. Allow those
for now.

Partially reverts commit 08d2d81587 (abuild: extend fhs check)
2024-04-21 10:37:44 +02:00
Natanael Copa c48f8498e7 abuild: allow packages to install under run
I have some vauge memory that it is conveinent for Docker users that the
state dir under /run exists.

Allow this for alpine 3.20 and revisit later.
2024-04-20 08:20:18 +02:00
Natanael Copa eeca95d195 abuild: pass APORTS_BOOTSTRAP to bubblewrap 2024-04-19 23:41:45 +02:00
Natanael Copa 645c3c07a7 abuild: exclude provides for commans with @
the '@' characted serves as a repository separator (eg. pkg@repo) so we
should not add a cmd: provides for binaries having this character.

This avoids conflicts with for example `who` from coreutils and `who@`
from ucspi-tpc6.

fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10074
2024-04-17 08:35:27 +02:00
Sertonix 855992822d abuild: update cachedir logic for rootbld
Closes [#10111]

[#10111]: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10111
2024-04-12 11:59:04 +00:00
Sertonix 7276042237 abuild: always use $APK instead of apk 2024-04-12 11:59:04 +00:00
Sertonix 6aa8fcc012 abuild: remove libc specific logic
Last use of the '!libc_*' option has been removed in [61cb57cda98].
libpthread special casing only triggers on uclibc.

[61cb57cda98]: https://git.alpinelinux.org/aports/commit/?id=61cb57cda98923032f7ff15f7a0f057bb35aae6d
2024-04-12 11:56:05 +00:00
Sertonix 20b1f47c63 abuild: fix ~ splitting pkgname and pkgver 2024-04-12 11:51:48 +00:00
Sertonix 0e325a2354 abuild: fix python3 depending on python3 2024-04-03 14:09:03 +02:00
Sertonix 141da52d19 abuild: warn on go packages without net option 2024-03-29 11:15:43 +00:00
Sertonix 21b5a2298d abuild: fix help message 2024-03-29 11:14:35 +00:00
Sertonix 20c0a15856 functions.sh: fix ABUILD_USERDIR overwrite in ABUILD_CONF 2024-03-29 11:14:35 +00:00
Sertonix 1804361f61 abuild: error on digit+letter+digit version format 2024-03-29 11:12:51 +00:00
Sertonix 17648366cc abuild: invalidate pkgver ending with -r# 2024-03-28 22:41:30 +00:00
Sertonix 2e27c5b202 abuild: sanitycheck pkgver regardless of -d flag 2024-03-28 22:41:30 +00:00
Sertonix a9053617db abuild: stricter pkgname check 2024-03-28 22:40:14 +00:00
Sertonix 73cc75b3e0 abuild: amove: allow spaces in pattern 2024-03-28 18:40:25 +00:00
Sertonix 08d2d81587 abuild: extend fhs check 2024-03-27 14:53:58 +01:00
Timo Teräs ec11f495cd abuild: add an option to keep all directories
This is mainly needed for alpine-baselayout which creates all
directories, and most of them are empty. The code in question
would remove directories we explicitly want alpine-baselayout
to create and own.
2024-03-22 21:56:14 +02:00
Natanael Copa 8da2501613 abuild: warn for more version suffixes
give a warning when version suffix a<digit>/b<digit> probably should be
_alpha<digit>/_beta<digit>.

ref: https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10972#note_380899
2024-03-13 11:57:50 +01:00
Sertonix 648529aa35 abuild: remove duplicate SOURCE_DATE_EPOCH from .PKGINFO 2024-03-06 13:05:10 +00:00
Sertonix f63c117df6 abuild: avoid variables in sed pattern 2024-03-05 11:59:10 +00:00
Jingyun Hua e3ba1238d3 abuild.in: update autoconf test for loongarch64 2024-03-05 11:56:33 +00:00
Sertonix 4ae1b39910 abuild: fix quote handling in check_license 2024-02-12 12:39:17 +01:00
Sertonix cd32e245e2 abuild: fix subpackage setting arch to all explicitly 2024-01-12 18:28:09 +01:00
Natanael Copa a6a95ad633 abuild: set filetype sh for abuild.in 2023-10-17 16:33:15 +00:00
ptrcnull f688130443 abuild: simplify finding repo_template
related to #10069, this keeps the original behaviour when
running in aports and allows for using rootbld in other package repositories
2023-10-12 15:39:09 +00:00
psykose fc575e8361 abuild: fix a mistake in 0e333003df
the prefix was dropped from the check so it always says it's unregistered
no actual breakage happened as this just prints a warning
2023-07-03 04:45:13 +02:00
psykose 3e5cbbee13 abuild: unset default_lang depends unless set
for consistency with every default split
2023-06-22 20:03:32 +02:00
Sören Tempel c9b4146aaa Revert "rootbld: run mkusers inside the chroot and don't affect host users"
We can't run mkusers inside the chroot because of bwrap peculiarities.
Presently, rootbld does therefore not work at all for APKBUILDs which
use $pkggroups/$pkguser. While not polluting the host is a noble goal
it isn't really useful if it causes rootbld to be incapable of building
certain packages (i.e. those using $pkggroups/$pkguser with groups
not existent on the host).

This commit therefore restores the original behavior for now. While at
it, I also added a comment to the mkusers invocation.

See: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10094

This reverts commit 84d7b7693d.
2023-06-22 21:53:46 +02:00
Jakub Panek c26043748e abuild: fix completions to vendor dir, warn on incorrect dir
Signed-off-by: Jakub Panek <me@panekj.dev>
2023-06-22 04:08:05 +00:00
psykose 38e84f9016 abuild: simplify et_dyn/et_exec check 2023-06-22 03:37:06 +00:00
Dimitry Andric 76ff15a7b1 abuild: unset option variables to prevent environment leaking in
In abuild's getopts loop, option variables such as "keep", "verbose",
etc are only set if the corresponding option is found. If such an option
is *not* found, any environment variable with the same name will leak
in, instead. Prevent this by explicitly unsetting almost all of them.
2023-06-22 03:35:46 +00:00
ptrcnull d27b635768 abuild: set cache directories to a temporary directory if MOVE_CACHES is set
this allows for isolating cache directories per package
2023-06-22 05:33:59 +02:00
psykose 8d11e9f410 abuild: refactor duplicate python detection to not use find(1)
the previous implementation used -regex, which is subtly different between busybox and findutils

[0-9]\+ matches on busybox, but doesn't match with gnu findutils
[0-9]+ matches with findutils, but doesn't match on busybox

this means python deps were subtly broken when findutils was installed
(sometimes pulled via makedeps) vs not
2023-06-15 12:54:00 +00:00
psykose 8f41a924e3 abuild: fix cmd: provides to not provide directory names
/usr/bin/somedirectory/ was providing cmd:somedirectory, because dirs
have +x.
2023-06-15 14:37:24 +02:00
Sören Tempel 4a2a0337d0 abuild: Scan for binaries with extra setcap(8) capabilities
Similar to suid binaries, abuild will now error out if the package
includes binaries with setcap(8) capabilities but doesn't have `setcap`
in `$options`. This eases identifying package which ship binaries
with extra capabilities.

Furthermore, if these binaries are executable by others a warning is
emitted. This warning could be changed to an error in the future.
The recommendation is to make such binaries only executable by owner
and group, thereby requiring the system administrator to explicitly
add users to a specific group in order to give them accesses to these
capabilities.

See: https://gitlab.alpinelinux.org/alpine/tsc/-/issues/45

Discussion: This change requires abuild to depend on the `libcap`
package for the `getcap` binary. It does not seem to be possible
at the moment to use scanelf(1) to identify these binaries.
2022-07-03 14:30:15 +02:00
Haelwenn (lanodan) Monnier 446a2a66e3 abuild. Use date -u instead of date --utc 2023-06-04 20:10:22 +02:00
Sören Tempel e2ab6219d3 abuild: Warn if -doc subpackage exceeds a certain threshold
In the warning, suggest splitting the -doc subpackage into additional
smaller packages (which are not pulled in by the `docs` meta package).

Fixes https://gitlab.alpinelinux.org/alpine/tsc/-/issues/16
2023-06-03 10:55:12 +00:00
psykose 0e333003df abuild: downgrade binfmt-registration error to a warning
strictly speaking, it is possible for an x86_64 cpu to run 32-bit
userspace binaries without qemu emulation. it is also possible for an
aarch64 cpu to run armhf/armv7 binaries (as long as the cpu implements
it, most do). rather than check for every possible combination of when
this is allowed (host cpu + emulated target, does cpu support it, ...),
just downgrade this case to a warning, to permit non-emulated use.

ref https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/117#note_255174
2023-06-01 09:29:59 +02:00
psykose 72fa67ca7f abuild: do not use cache in rootbld when cross-building
ref https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10111
2023-06-01 06:11:43 +02:00
psykose b99565a722 abuild: also set CARCH for rootbld root
otherwise it's set to the default host one, and things that use CARCH in rootbld see the wrong one
2023-05-26 23:19:28 +02:00
psykose b5c25f1b62 abuild: use $git in rootbld symbolic-ref
missed git call, compared to the others
2023-04-28 08:42:29 +00:00
psykose 69b3e82296 abuild: .. but silence only errors, not output
fixes previous commit
2023-04-19 15:27:51 +02:00
psykose 633353b265 abuild: silence pycache postcheck
otherwise every package prints

 >>> gotosocial-openrc*: Running postcheck for gotosocial-openrc
 find: /builds/raspbeguy/aports/testing/gotosocial/pkg/gotosocial-openrc/usr/lib/python*: No such file or directory

the other postchecks already conditionalise on if [ -d, but we use a wildcard here

no actual package change
2023-04-19 15:26:05 +02:00
psykose 91e6e0b542 abuild: set *-pyc as noarch
the files are noarch themselves
2023-04-18 18:36:23 +02:00
Natanael Copa b24bc33446 abuild: warn if pycache is found
and add tests for -pyc package split
2023-04-18 13:27:51 +00:00
Dominique Martinet dd07911cbf abuild: add default_pyc helper
Python by default pre-compiles cache files in __pycache__ directories,
which we currently happily install along in python packages.

Theses .pyc files are rather big and the time/space tradeoff could be
left to users if we just split these out to a -pyc subpackage.

With this default_pyc helper, one can add $pkgname-pyc to their
package's subpackages and it will automatically split off the pyc files
in a package that will be automatically installed if the virtual 'pyc'
package is installed.
Note that this does not work so easily if there already were python
subpackages, the function could be adjusted to strip off the last dash
if required but that seems rather rare.

Random data, sizes:
 - python3: currently 47MiB, split into 23M (main package) / 24M (pyc)
 - py3-markdown: currently 700KiB, 368K (main) / 288K (pyc)

Random benchmark, with python3-pyc:
hyperfine --warmup 5 -m 100 \
    "python3 -c 'import time; print(time.strftime(\"%T\"))'"
  Time (mean ± σ):      24.5 ms ±   2.5 ms    [User: 18.4 ms, System: 6.0 ms]
  Range (min … max):    19.4 ms …  28.9 ms    148 runs

without python3-pyc (same as user without root permissions, root would
generate files on first root, for reference this command generates 184KB
of pyc files):
hyperfine --warmup 5 -m 100 \
    -p 'rm -rf /usr/lib/python3.10/__pycache__ /usr/lib/python3.10/encodings/__pycache__' \
    "python3 -c 'import time; print(time.strftime(\"%T\"))'"
  Time (mean ± σ):      53.7 ms ±   4.3 ms    [User: 39.3 ms, System: 14.3 ms]
  Range (min … max):    47.0 ms …  65.6 ms    100 runs

Link: https://gitlab.alpinelinux.org/alpine/aports/-/issues/11906
Suggested-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
2023-04-18 13:22:14 +00:00
Marian Buschsieweke 6806a0d39b abuild: scan for python3 version requirements
Packages installing python3 site packages for python3 in version 3.x.y
depend on python3~3.x. This automatically adds the required
dependencies.

Unit test cases have been added by reusing the `py3-foo-and-bar` test
package. However, the path of that has been renamed to contain spaces
to be extra sure the logic is safe in regrade to spaces in path
names.
2023-04-18 09:26:12 +00:00