Commit Graph

16 Commits

Author SHA1 Message Date
Robert Marko
fc2ba10108 include/package-pack: add support for postrm with APK
Currently, postrm scripts are not being executed when package is removed
with APK since they are not being included at all.

So, lets use APK-s support for post-deinstall scripts and ship our postrm
scripts if packages define them.

Fixes: d788ab376f ("build: add APK package build capabilities")
Link: https://github.com/openwrt/openwrt/pull/17023
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-21 17:20:43 +01:00
Robert Marko
5b6f8353fe include/package-pack: actually call default_postinist/prerm when using APK
Currently, when you install a package that ships uci-defaults scripts they
are not getting executed during package installation.

For example, if you install a new LuCI theme it ships a uci-defaults script
to add it to the UCI LuCI config so the theme is actually selectable but
that does not happen until the device is rebooted so that uci-defaults
script is actually executed.

It turns out that the recipe for post-install is the issue since it will
include contents of postinst-pkg before the call to default_postinist.
This is an issue since postinst-pkg will exit with code 0 before we ever
reach the call to default_postinist.

So, lets simply make the call to default_postinist before postinst-pkg
inclusion which is what OPKG based installation does.

The same issue affects pre-deinstall script but its not actually being hit
since we dont seem to be actually even generating prerm-pkg scripts but
lets fix this theoretical issue as well.

Fixes: #16987
Fixes: d788ab376f ("build: add APK package build capabilities")
Link: https://github.com/openwrt/openwrt/pull/17023
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-21 17:20:43 +01:00
Robert Marko
0d0a5eb4b5 include/package-pack: translate PKGARCH for APK
We have a lot of script-only packages that are universal for all arch-s
and those set PKGARCH:=all to indicate it.

Unfortunately, APK expects architecture to be set to "noarch" instead to
indicate that its universal so instead of having to update all packages
that set PKGARCH:=all and thus break OPKG lets simply translate "all" to
"noarch" when generating the APK package.

This will be required as soon we update APK to include [1] as it will start
enforcing package architecture checks.

[1] c1a3e69f24

Suggested-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17015
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-19 19:52:03 +01:00
Robert Marko
dea839773c include/package-pack: add default 'provider_priority' for APK packages
Currently, trying to use APK to install a package that has a dependency on
a virtual package that needs to be resolved via 'provides' it will fail if
package does not have 'DEFAULT_VARIANT:=1' like:
apk add usbutils
ERROR: unable to select packages:
  libudev (virtual):
    note: please select one of the 'provided by' packages explicitly
    provided by: libudev-zero
    required by: usbutils-017-r1[libudev]

Issue is that we dont set 'provider_priority' that APK uses to break ties
when choosing a virtual package to satisfy a dependency and thus despite
only one package providing the dependency it will still end up with a tie
and just error out.

So, lets simply fix this by providing a default value for
'provider_priority' when 'DEFAULT_VARIANT' is not set and then APK will
be able to resolve dependencies.

Fixes: #16976
Link: https://github.com/openwrt/openwrt/pull/17008
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-19 11:24:07 +01:00
Christian Marangi
43455f1075
include/package-pack: escape package description for APK mkpkg
Escape special char for package description for APK mkpkg as the
description is passed as an args to mkpkg with --info option and can
easily escape from the "".

Currently escaped char `, $, ", \.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-17 19:09:31 +01:00
Paul Spooren
559df6cb99
build: Honor DEFAULT_VARIANT for APK packages
Previously APK would complain as it wasn't sure which package to
install by default when multiple packages would provide the same name.

Now, give the package a higher provider priority to make APK
automatically select the "default" package.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2024-10-30 14:17:33 +01:00
Paul Spooren
03e0525325
include/package-pack: drop version from provides
Adding a version to the provides causes it to conflict with other
packages that provides the same package, further details are available
here: https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/doc/apk-package.5.scd#L199

This was intitally done, if I remember correctly, to support depending
on the specific kernel modules. Due to patches to APK, versions
containing hashes work now, too, so this is no longer required.

Only add the version to packages that define an ABI version since other
packages depend against the package name plus ABI version.

While at it, format the now rather complex call.

Fixes: https://github.com/openwrt/openwrt/issues/16795

Signed-off-by: Paul Spooren <mail@aparcar.org>
2024-10-29 00:07:55 +01:00
Christian Marangi
6835ff8cbc
include/package-pack: Set missing Maintainer and URL for APK
Set missing Maintainer and URL info for .apk creation.

Fixes: d788ab376f ("build: add APK package build capabilities")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-10-24 12:46:47 +02:00
Christian Marangi
abeaf8df5c
include/package-pack: remove whitespace for Description info for APK
Remove whitespace for Description info for .apk creation

Fixes: b6bbc76c0b ("include/package-pack: set missing Description on .apk creation")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-10-24 12:46:26 +02:00
Christian Marangi
b6bbc76c0b
include/package-pack: set missing Description on .apk creation
Set missing description info on .apk creation. This was probably a TODO
that wasn't notice when the final implementation was pushed.

Fixes: d788ab376f ("build: add APK package build capabilities")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-10-23 00:11:55 +02:00
Christian Marangi
cf2b689d03
Revert "apk: limit CONFIG_IPK_FILES_CHECKSUMS config to OPKG"
This reverts commit 25bbefcdd9.

Only the Config-build.in change needed to be merged and this contains
leftover from previous revision of the feature.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-20 05:52:05 +02:00
Christian Marangi
25bbefcdd9
apk: limit CONFIG_IPK_FILES_CHECKSUMS config to OPKG
Limit CONFIG_IPK_FILES_CHECKSUMS config to OPKG as APK have different
way to validate package integrity (apk audit)

Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-11 23:58:19 +02:00
Christian Marangi
93d49529a1
apk: provide csum for static conffiles
For non-overlay configuration we need checksum for config file that
weren't modified by the user. For OPKG in sysupgrade we check the status
file for the Conffiles: entry of every package. this entry contains
checksum for every static file that the package contains.

Provide the same info for APK by creating a conffiles_static file and
parse this file on sysupgrade for non-overlay configurations.

This is also used by the sysupgrade -u option to exclude non-changed
files from the final backup.

Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-11 23:58:17 +02:00
Christian Marangi
52e9431731
include/package-pack: add special handling for CONTROL conffiles
Add special handling for CONTROL conffiles. Some packages (base-files)
manually append stuff to the CONTROL directory.

The CONTROL directory is something for OPKG that is added in the root of
the ipkg directory and usually contains postinst, list, and conffiles
file. For APK the implementation is different, to keep compatibility
with this and maybe other packages, apply manual fixup and check for
these corner case.

Also check if the CONTROL directory is present and is empty to make sure
we don't drop other special file while removing any pending CONTROL
directory in the ipkg directory.

Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-11 23:58:13 +02:00
Christian Marangi
ba7305c3e4
include/package-pack: remove APK files before building package
As done for OPKG, correctly remove APK files before building package to
make sure we don't work on dirty files.

Link: https://github.com/openwrt/openwrt/pull/15543
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-06-11 23:58:13 +02:00
Paul Spooren
d788ab376f build: add APK package build capabilities
A new option called `USE_APK` is added which generated APK packages
(.apk) instead of OPKG packages (.ipk).

Some features like fstools `snapshot` command are not yet ported

Signed-off-by: Paul Spooren <mail@aparcar.org>
2024-05-17 23:21:26 +03:00