luci icon indicating copy to clipboard operation
luci copied to clipboard

Preparations to switch to APK package manager

Open aparcar opened this issue 1 year ago • 15 comments

Hi all, some fellow developers and me worked for some time now on making APK the new package manager for OpenWrt, replacing the unmaintained OPKG fork we've been using for the longest time.

APK is actively developed and used in multiple other distributions, e.g. Alpine Linux 🎉

While there is till some work ahead, I'd like to prepare everyone who maintains a package to verify that the PKG_VERSION follows ~~Semantic Versioning~~ <major>.<minor>.<fixup>[.<sub1>...]. APK uses a deterministic algorithm to compare versions and does not like random strings, except a valid hash prefixed with a ~.

If in doubt, please use the Docker container below to verify the used version is valid:

docker run --rm -it ghcr.io/aparcar/apk-valid-version <VERSION> [<VERSION> ...]

It will print whatever version is not valid, if you get a zero exit code, you're fine.

Please feel free to reach out for assistance and have a look at the core migration of versions.

aparcar avatar Mar 21 '24 16:03 aparcar

Below packages that would cause trouble. Please bear in mind that PKG_RELEASE is soonish prefixed with an r and may only contain a number.

Naughty list:

  • [x] luci-app-adblock-fast 1.1.1-5
  • [x] luci-app-advanced-reboot 1.0.1-9
  • [ ] luci-app-dockerman v0.5.13-20240317
  • [x] luci-app-https-dns-proxy 2023-11-19-1
  • [x] luci-app-pbr 1.1.1-7
  • [x] luci-proto-nebula 1.6.1-1

aparcar avatar Mar 21 '24 16:03 aparcar

@aparcar I can pre-emptively add r to the revisions, I just wanted to confirm that it will not break opkg upgrade logic. For example, would opkg consider 1.1.1-r6 higher version than 1.1.1-5? Same question for 2023.11.19-r2 and 2023-11-19-1.

stangri avatar Mar 21 '24 17:03 stangri

would opkg consider 1.1.1-r6 higher version than 1.1.1-5? Same question for 2023.11.19-r2 and 2023-11-19-1.

Easiest is to bump the main version to 1.1.2 at the same time

(not sure about the date comparison with a changed separator)

hnyman avatar Mar 21 '24 17:03 hnyman

@aparcar I can pre-emptively add r to the revisions, I just wanted to confirm that it will not break opkg upgrade logic. For example, would opkg consider 1.1.1-r6 higher version than 1.1.1-5? Same question for 2023.11.19-r2 and 2023-11-19-1.

Does opkg even do that? I'm under the impression that it does not compare versions.

See parse_version and compare

You could do away with 1.1.1-r6 altogether and just let git handle semantic versioning (at least for the time being), or use dates instead. For devs, the tip of the master branch is latest, for users, if it is updated, it will show as update available.

systemcrash avatar Mar 21 '24 17:03 systemcrash

@feckert: date format here makes most sense. We won't be updating lua apps (this app is lua) any more so this change should be OK. Alt: update at source? https://github.com/lisaac/luci-app-dockerman

  • [ ] luci-app-dockerman v0.5.13-20240317

systemcrash avatar Mar 21 '24 17:03 systemcrash

docker run --rm -it docker.io/aparcar/apk-version-check <VERSION> [<VERSION> ...]

BTW:

sudo docker run --rm -it docker.io/aparcar/apk-version-check 1.1.1-5
Unable to find image 'aparcar/apk-version-check:latest' locally
latest: Pulling from aparcar/apk-version-check
bca4290a9639: Pull complete
1ae19ff60baf: Pull complete
75e05e2c02ea: Pull complete
28c83907721f: Pull complete
Digest: sha256:e113fde83c649c3dc7cfed9b7e6c2068b94aad61f950cf9f0bfd93d9bcf69c86
Status: Downloaded newer image for aparcar/apk-version-check:latest
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v2) and no specific platform was requested
exec /usr/bin/apk: exec format error

stangri avatar Mar 21 '24 22:03 stangri

@stangri I added a multi arch container here ghcr.io/aparcar/apk-valid-version

aparcar avatar Mar 21 '24 23:03 aparcar

For example, would opkg consider 1.1.1-r6 higher version than 1.1.1-5? Same question for 2023.11.19-r2 and 2023-11-19-1.

root@OpenWrt:~# opkg compare-versions 1.1.1-r6 '>' 1.1.1-5 && echo true || echo false
true
root@OpenWrt:~# opkg compare-versions 2023.11.19-r2 '>' 2023-11-19-1 && echo true || echo false
true
root@OpenWrt:~# opkg compare-versions 1 '>' r1 && echo true || echo false
false
root@OpenWrt:~# opkg compare-versions r1 '>' 1 && echo true || echo false
true
root@OpenWrt:~# 

jow- avatar Mar 21 '24 23:03 jow-

Thank you @aparcar @hnyman @jow-!

PRs with fixes:

  • luci-app-adblock-fast: https://github.com/openwrt/luci/pull/7009
  • luci-app-advanced-reboot: https://github.com/openwrt/luci/pull/7010
  • luci-app-https-dns-proxy: https://github.com/openwrt/luci/pull/7013
  • luci-app-pbr: https://github.com/openwrt/luci/pull/7011
  • luci-proto-nebula: https://github.com/openwrt/luci/pull/7012

stangri avatar Mar 23 '24 01:03 stangri

@feckert - how is dockerman update coming along?

systemcrash avatar Mar 27 '24 18:03 systemcrash