Commit e0ea3d7
build: fix apk packaging and ABI-versioning
The updated logic for the APK dependencies and provides is as follows:
- If ABI version is defined:
- package is named `package_name-ABI_version`
- package implicitly provides
`package_name-ABI_version=package_version`
this implies that only one version of a package per ABI can be
installed at the same time
- additionally provide `package_name` so multiple packages can be
looked up by its base name
- for each `provides`, provide `provide-ABI_version=package_version`
this implies that only one version of a provide can be installed at
the same time
- else if ABI version is _not_ defined
- package is named `package_name`
- package implicitly provides `package_name=package_version`
this implies that only one version of a package can be installed at
the same time
- if `alternatives` is defined
- for each `provides`, provide `provide`
this implies that multiple versions of a provide can be installed
at the same time
- else if `alternatives` is _not_ defined
- for each `provides`, provide `provide=package_version`
this implies that only one version of a provide can be installed
at the same time
Both cases a package can be looked up by its base name.
ABI version `alternatives`, `conffiles`, `conffiles_static`, `list` and
`rusers` files so multiple versions of the same ABI package can be
installed side by side, and so they don't overwrite each other's
packaging files.
ABI version `EXTRA_DEPENDS` so dependencies can be correctly looked up
using the existing OpenWrt semantics without the ABI specified. This is
needed since ABI-versioned libraries no longer provide
`package_name=package_version`, so that they can be installed side by
side.
Remove duplicate dependencies when `EXTRA_DEPENDS` specifies a versioned
one that is already in `DEPENDS`.
ABI is defined
------------------------------------------------------------------------
`libsqlite3` has `PROVIDES` set to `libfake` and has two different ABI
versions installed. `libfake` is just an example to demonstrate the
mechanics, as the library can already be depended upon using e.g.
`libsqlite3-0=3.51.0-r1`. Note the ABI-versioned lists.
```
root@OpenWrt:/tmp# apk add --allow-untrusted ./libsqlite3-0-3.51.0-r1.apk
(1/1) Installing libsqlite3-0 (3.51.0-r1)
libsqlite3-0-3.51.0-r1.post-install: Executing script...
OK: 22 MiB in 157 packages
root@OpenWrt:/tmp# apk add --allow-untrusted ./libsqlite3-1-4.00.0-r1.apk
(1/1) Installing libsqlite3-1 (4.00.0-r1)
libsqlite3-1-4.00.0-r1.post-install: Executing script...
OK: 23 MiB in 158 packages
root@OpenWrt:/tmp# apk query --fields name,version,contents,provides libsqlite3-0 libsqlite3-1
Name: libsqlite3-0
Version: 3.51.0-r2
Provides: libfake-0=3.51.0-r2 libsqlite3
Contents:
lib/apk/packages/libsqlite3-0.list
usr/lib/libsqlite3.so.0
usr/lib/libsqlite3.so.3.51.0
Name: libsqlite3-1
Version: 4.00.0-r1
Provides: libfake-1=4.00.0-r1 libsqlite3
Contents:
lib/apk/packages/libsqlite3-1.list
usr/lib/libsqlite3.so.1
usr/lib/libsqlite3.so.4.00.0
root@OpenWrt:/tmp# ls -lh /usr/lib/libsqlite3.so.*
lrwxrwxrwx 1 root root 20 Nov 20 00:23 /usr/lib/libsqlite3.so.0 -> libsqlite3.so.3.51.0
lrwxrwxrwx 1 root root 20 Nov 20 00:27 /usr/lib/libsqlite3.so.1 -> libsqlite3.so.4.00.0
-rwxr-xr-x 1 root root 1.0M Nov 6 18:19 /usr/lib/libsqlite3.so.3.51.0
-rwxr-xr-x 1 root root 1.0M Nov 6 18:19 /usr/lib/libsqlite3.so.4.00.0
```
ABI is not defined
------------------------------------------------------------------------
Both `avahi-dbus-daemon` and `avahi-nodbus-daemon` provide `avahi-daemon`,
but have no ABI specified. This results in `avahi-daemon=0.8-r11` provides
for both packages and only one being able to be installed at the same time:
```
root@OpenWrt:/tmp# apk add --allow-untrusted ./avahi-nodbus-daemon-0.8-r11.apk
(1/4) Installing libavahi-nodbus-support (0.8-r10)
libavahi-nodbus-support-0.8-r10.post-install: Executing script...
(2/4) Installing libdaemon (0.14-r5)
libdaemon-0.14-r5.post-install: Executing script...
(3/4) Installing libexpat (2.7.3-r1)
libexpat-2.7.3-r1.post-install: Executing script...
(4/4) Installing avahi-nodbus-daemon (0.8-r11)
avahi-nodbus-daemon-0.8-r11.post-install: Executing script...
23 MiB in 160 packages
root@OpenWrt:/tmp# apk query --fields provides avahi-nodbus-daemon
Provides: avahi-daemon=0.8-r11
root@OpenWrt:/tmp# apk add --allow-untrusted ./avahi-dbus-daemon-0.8-r11.apk
ERROR: unable to select packages:
avahi-dbus-daemon-0.8-r11:
conflicts: avahi-nodbus-daemon-0.8-r11[avahi-daemon=0.8-r11]
satisfies: world[avahi-dbus-daemon><Q1R111s+ke9Vf+eCxDHX2BZVUK54Q=]
avahi-nodbus-daemon-0.8-r11:
conflicts: avahi-dbus-daemon-0.8-r11[avahi-daemon=0.8-r11]
satisfies: world[avahi-nodbus-daemon><Q1BAu7nLI2MgRabpveLTGO2ksQz7E=]
```
Provides and alternatives
------------------------------------------------------------------------
Both `uclient-fetch` and `wget-nossl` provide `wget` and specify
alternatives, so provides are not versioned and both packages can be
installed at the same time:
```
root@OpenWrt:/tmp# apk query --fields name,version,contents,provides uclient-fetch wget-nossl
Name: uclient-fetch
Version: 2025.10.03~dc909ca7-r1
Provides: wget
Contents:
bin/uclient-fetch
lib/apk/packages/uclient-fetch.alternatives
lib/apk/packages/uclient-fetch.list
Name: wget-nossl
Version: 1.25.0-r1
Provides: gnu-wget wget
Contents:
lib/apk/packages/wget-nossl.alternatives
lib/apk/packages/wget-nossl.list
usr/libexec/wget-nossl
```
Fixes: openwrt/openwrt#20582
Fixes: openwrt/openwrt#20802
Signed-off-by: George Sapkin <[email protected]>
Link: openwrt/openwrt#20819
(cherry picked from commit 1802997)
Link: openwrt/openwrt#21253
Signed-off-by: Robert Marko <[email protected]>1 parent 2da3942 commit e0ea3d7
1 file changed
+57
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
| 202 | + | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
205 | 241 | | |
206 | 242 | | |
| 243 | + | |
| 244 | + | |
207 | 245 | | |
208 | 246 | | |
209 | 247 | | |
| |||
320 | 358 | | |
321 | 359 | | |
322 | 360 | | |
323 | | - | |
| 361 | + | |
324 | 362 | | |
325 | 363 | | |
326 | 364 | | |
| |||
345 | 383 | | |
346 | 384 | | |
347 | 385 | | |
348 | | - | |
| 386 | + | |
349 | 387 | | |
350 | 388 | | |
351 | 389 | | |
352 | 390 | | |
353 | 391 | | |
354 | 392 | | |
355 | | - | |
356 | | - | |
357 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
358 | 396 | | |
359 | 397 | | |
360 | | - | |
361 | | - | |
| 398 | + | |
| 399 | + | |
362 | 400 | | |
363 | 401 | | |
364 | | - | |
| 402 | + | |
365 | 403 | | |
366 | 404 | | |
367 | 405 | | |
368 | 406 | | |
369 | 407 | | |
370 | 408 | | |
371 | | - | |
| 409 | + | |
372 | 410 | | |
373 | 411 | | |
374 | 412 | | |
375 | | - | |
| 413 | + | |
376 | 414 | | |
377 | 415 | | |
378 | 416 | | |
| |||
394 | 432 | | |
395 | 433 | | |
396 | 434 | | |
397 | | - | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
407 | 442 | | |
408 | 443 | | |
409 | 444 | | |
| |||
0 commit comments