Commit Graph

92 Commits (917698ec1d4c9a79e3580cce4cbeb56fd4fa5a96)

Author SHA1 Message Date
Ariadne Conill 917698ec1d use arch_prefix for this feature instead 2022-03-30 09:17:25 +00:00
Ariadne Conill fee0587660 defines: introduce APK_DEFAULT_ABI_TAG
for most cases, this replaces APK_DEFAULT_ARCH.  if apk-tools is built without
a configured abi-tag, the ABI tag is equivalent to APK_DEFAULT_ARCH, providing
backwards compatibility with apk v2

the /etc/apk/arch configuration file is assumed to actually describe an ABI
tag.
2022-03-30 09:17:25 +00:00
Timo Teräs 6df225eac3 mkpkg, adb: validate version and dependency format
Fail if the package or dependency version format is not valid.

fixes #10807
2022-02-01 14:47:27 +02:00
Ariadne Conill 6df9f0ed59 defines: provide APKE_REMOTE_IO as portable alternative to EREMOTEIO 2021-12-14 18:48:18 +00:00
Ariadne Conill 3fd120db5c applet: rework APK_DEFINE_APPLET to use constructor attribute
this allows the applet registration to work in a portable way, without having to
weird things with the linker.

ref #10794
2021-12-14 12:05:59 -06:00
Timo Teräs a673653200 database: implement uvol support
by adding an abstraction layer to the file system
2021-11-09 21:50:11 +02:00
Timo Teräs 7436193885 mkpkg: add support for scripts and triggers 2021-08-23 17:02:50 +03:00
Timo Teräs 72d8cb8937 remove IS_ERR_OR_NULL
In most places where pointer can be an 'error' it cannot be null
pointer. Further, in those cases just calling PTR_ERR() is not enough
to handle the null case. Simplify code by removing this case.

If NULL case needs to be handled, it's better to add separate check
and return fixed error code in that case.
2021-08-23 17:02:50 +03:00
Timo Teräs 9c843e4ecd Refactor .apk extraction code
This moves and isolates the tar code to tar.c. And the actual
file extraction to disk is moved to extract.c.

A new API is introduced and used for v2 file extraction. This
essentially moves and isolates the apk_sign_ctx_* beast into
extract_v2.c and offers a saner interface to handling packages.

A place holder is added for v3 extraction.
2021-07-27 14:09:38 +03:00
kpcyrd 90228c4d26 io_archive: Use SOURCE_DATE_EPOCH for meta files instead of current time
[TT: minor stylistic changes]
2021-07-25 09:01:52 +03:00
Timo Teräs 3d203e8f5f db: allow read-only operations without cache
fixes #10748
2021-07-23 14:39:38 +03:00
Timo Teräs e6b7fa49ce adb: add a small adb blob header with versions and root object 2021-07-22 16:14:49 +03:00
Timo Teräs 7af34db6cf adb: support seamless de/compression of adb files
Add compression header of adb files. Support uncompressed and
deflate compression at this time.
2021-07-22 15:30:08 +03:00
Ariadne Conill 34162d01fd define APK_DEFAULT_ARCH for loongarch targets
Macros used have been taken from Loongson's work-in-progress GCC 12
port.
2021-07-06 13:29:02 -06:00
Timo Teräs d89c219173 reduce misuse of error codes from errno.h 2021-06-19 16:10:13 +03:00
Timo Teräs 7c9f001cda mkpkg: new applet to create v2 packages with basic functionality 2021-06-11 13:35:32 +03:00
Timo Teräs 1a4f2e94dd db: consider control characters in filename as malicious
Especially a newline can produce havoc in the database file as
the filename is written there as-is. This hardenes the extraction
to consider any control character as malicious. Additional
hardening is added to database loading to better detect corrupt
state and return proper error code about it.

Reported-by: Luca Weiss <luca@z3ntu.xyz>
2021-02-04 22:30:26 +02:00
Timo Teräs 354713d2f7 rename apk_db_options to apk_ctx, rework logging
makes apk_verbosity non-global

fixes #10682
2020-10-09 16:09:19 +03:00
Timo Teräs 7a7eca8670 make apk_flags non-global, make progress printing state non-global
ref #10682
2020-10-09 16:09:19 +03:00
Timo Teräs 9afb4e8fd1 make apk_force non-global, remove left-over apk_arch
ref #10682
2020-10-09 16:09:19 +03:00
Timo Teräs efe0c4afec adb: introduce apk-tools database format, and few applets
This is a flat buffers inspired format that allows fast
mmaped access to the data with low overhead, signature support
and relatively good forward support.
2020-10-09 16:09:19 +03:00
Ariadne Conill 0732976dbe define APK_DEFAULT_ARCH for riscv32 and riscv64 targets 2020-05-17 00:54:51 -06:00
TBK 5d796b5678 use SPDX-License-Identifier in source files 2020-05-07 10:45:42 +03:00
TBK a9916c2d4a fix glibc build
fixes #10677

src/apk_defines.h:152:15: error: unknown type name 'uint32_t'
 static inline uint32_t get_unaligned32(const void *ptr)
               ^~~~~~~~
2020-03-21 17:37:47 +02:00
Timo Teräs c054fbc11e db: fix unaligned memory access in csum_hash() 2020-02-21 09:33:58 +02:00
Timo Teräs d60477751f defines: add typeof() as it's gcc built-in
Related to MR !15
2020-02-04 10:36:05 +02:00
Timo Teräs 45d313c51c remove apk_time() as it is causing problems with shared objects
Instead, to make sure test mode produces same output, redefine
time() for the test mode binary.

Reverts parts of 0b82bcc53e.
2020-02-04 10:31:10 +02:00
Timo Teräs 1c47f37443 use fixed system time in test mode to have fixed test output
fixes test suite regression from previous commit
2019-06-03 16:19:17 +03:00
Timo Teräs 8a28c6d0d4 enable automatic update of indexes controlled by --cache-max-age
This modifies apk cache for indexes to be automatically refreshed
periodically without explicit 'update' or '--update-cache' usage.

The default is to do if-modified-since request if the local copy
is older than 4 hours. This age can be changed with --cache-max-age.
Using --update-cache will change this age to 60 seconds to make
sure the cached copy is relatively new. The small age is in order
to try to avoid downloading indexes second time when apk-tools is
upgraded and apk re-execs after self-upgrade.

Accordingly using explicitly 'apk update' will now enforce
--force-refresh and request the very latest index by requesting
any potential http proxy to do refresh too.
2018-01-04 10:56:09 +02:00
Timo Teräs 039ff3bd46 split --force to several --force-[type] options
This unloads --force as several of the things are really not wanted
together. E.g. --force-refresh is a lot different from --force-broken-world
and doing --force to get the other might introduce unwanted behaviour.

--force is still kept for backwards compatibility and it enables
most things --force was used for.
2018-01-03 16:00:38 +02:00
Henrik Riomar 23cb104775 add new flag --no-commit-hooks
This flag skips running hook scripts

This flag *must* be used during initramfs tmpfs initial install.
The reason that this new flag is needed is that the hooks will currently
always fail as musl and /bin/sh is missing at this stage on diskless.
2018-01-03 14:20:58 +02:00
Nils Andreas Svee ac1681247f fix typo in MIPS byte-order apk_defines.h 2017-12-15 10:08:36 +02:00
Nils Andreas Svee 0700e8318f add detection of mips archs 2017-12-11 09:02:50 +02:00
William Pitcock 40aee5f1d0 apk_defines: implement mulmod() 2017-06-01 04:24:15 +00:00
Breno Leitao 28a9dcda56 Add ppc64le entry in apk defines.
Currently apk only knows about powerpc and ppc64. I am adding support for ppc64le.
ppc64le is the based on the ABI v2, which defines the endianess as little,
while ppc64 is based on the first 64-bits ABI.
2017-01-17 08:39:06 +02:00
Tuan M. Hoang ce72c8498e add s390x headers 2016-11-21 09:43:37 +02:00
Timo Teräs 06ae5fdfdc detect aarch64 architecture and assign default name for it 2016-07-08 11:10:32 +03:00
Natanael Copa c43bfed8de db: add support for --no-cache
Implement --no-cache. The index is read directly from network and not
cached. This is useful for docker, where you install a set of packages
and directly after purge the cache. (see
1fc9e59d16/builder/scripts/apk-install)

fixes #4905
2015-12-07 12:50:32 +00:00
Timo Teräs 5a59c73ffd add armv7 target 2015-11-12 09:24:02 +02:00
Timo Teräs fd98e9c718 modifications for the previous commit in error message handling
forgot to --amend my changes
2015-04-24 09:32:22 +03:00
Alex Dowad 74dc8e232f print.c: provide more detailed error messages if retrieving a package fails
fetch_maperror() translates error codes returned by libfetch to our error
codes. Handle those in apk_error_str(), returning error messages which
advise the user of the most likely fix.

A custom error code, EAPKSTALEINDEX, has been added for cases where
retrieving a package fails due to a HTTP error 404 or similar.

[TimoT: add also EAPKBADURL, as well as organize a bit better where the
EAPKSTALEINDEX is generated]
2015-04-22 20:08:16 +03:00
Timo Teräs 32627939f5 io,url,db: support for if-modified-since 2014-10-08 11:13:21 +03:00
Timo Teräs 1c4223124d apk: new option --no-scripts
to not run any per-package scripts. useful for managing buildroot
when cross-compiling.
2013-09-10 13:51:30 +03:00
Timo Teräs 0fe8507f9d arch: use armhf for arm hardfloat eabi
at least debian and musl do this, so let's go along with that.
2013-09-05 11:52:12 +03:00
Timo Teräs e184571feb defines: detect endianess on arm, for armel 2013-07-02 11:01:05 +03:00
Timo Teräs 656190b0a0 io: get rid of APK_PROGRESS_SCALE
no need to muldiv all the time, just pass the current amount of bytes
done, and let callbacks use that directly.
2013-06-17 17:28:03 +03:00
Timo Teräs e51232e710 errors: rewrite the logic how errors are reported
Instead of the dependency oriented logic, switch to print them
for each package or name needed. Might give a bit more readable
errors now. There's still few corner cases that proper error is
not output, which are cought by the test cases.
2013-06-13 18:22:00 +03:00
Timo Teräs b8c44536ca solver: rewrite as deductive solver -- core features
Implementing basic dependency handling, install_if and awareness
of pinning.
2013-06-13 18:22:00 +03:00
Timo Teräs aec93ee730 db: unify handling of special packages
make cache a special kind of repository, and automatically cache
special packages (virtual packages, or ones installed from command
line). add test cases for handling virtual packages. fixes #1617.
2013-05-30 08:48:32 +03:00
Timo Teräs bf82e2e5fd db, solver, io: scan cache items at startup
It is faster to just scan the cache directory for existing packages
at startup than trying to faccessat() them on demand. It also makes
quite a few parts of the code more readable and simpler.
2012-02-22 08:45:40 +02:00