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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>