pmbootstrap downgrades packages built with --src
@drebrez discovered the following bug (more detailed report in #1672 (comment 116148860)).
This works as expected:
$ pmbootstrap build linux-samsung-klte
(creates ~/.local/var/pmbootstrap/packages/armhf/linux-samsung-klte-3.4.113-r0.apk)
$ pmbootstrap build --src=/path/to/sources linux-samsung-klte
(creates ~/.local/var/pmbootstrap/packages/armhf/linux-samsung-klte-3.4.113_p20181110001756-r0.apk)
$ pmbootstrap zap
$ pmbootstrap chroot -r -- apk add linux-samsung-klte
(installs latest version)
$ pmbootstrap flasher flash_kernel
(installs remaining packages, creates initfs and flashes it)
Now things go south (commands ran after the ones above):
$ pmbootstrap build --src=/path/to/sources linux-samsung-klte
(creates ~/.local/var/pmbootstrap/packages/armhf/linux-samsung-klte-3.4.113_p20181110013854-r0.apk, higher number!)
$ pmbootstrap flasher flash_kernel
(020114) [00:49:23] (rootfs_samsung-klte) calculate depends of device-samsung-klte, device-samsung-klte-kernel-downstream (pmbootstrap -v for details)
(020114) [00:49:25] WARNING: Package 'linux-samsung-klte' in your aports folder has version 3.4.113-r0, but the binary package repositories already already have version 3.4.113_p20181110013854-r0! See also: <https://postmarketos.org/warning-repo2>
(020114) [00:49:25] (rootfs_samsung-klte) install
(020114) [00:49:25] (rootfs_samsung-klte) % apk --no-progress add -u --virtual .pmbootstrap /mnt/pmbootstrap-packages/armhf/linux-samsung-klte-3.4.113-r0.apk
(1/2) Downgrading linux-samsung-klte (3.4.113_p20181110001756-r0 -> 3.4.113-r0)
(2/2) Installing .pmbootstrap (0)
...
@drebrez wrote this patch to fix it:
--- a/pmb/chroot/apk.py
+++ b/pmb/chroot/apk.py
@@ -168,10 +168,9 @@ def replace_aports_packages_with_path(args, packages, suffix, arch):
for package in packages:
aport = pmb.build.find_aport(args, package, False)
if aport:
- apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
+ data_repo = pmb.parse.apkindex.package(args, package, arch, False)
apk_path = ("/mnt/pmbootstrap-packages/" + arch + "/" +
- package + "-" + apkbuild["pkgver"] + "-r" +
- apkbuild["pkgrel"] + ".apk")
+ package + "-" + data_repo["version"] + ".apk")
if os.path.exists(args.work + "/chroot_" + suffix + apk_path):
package = apk_path
ret.append(package)