work dir v4: delete invalid armhf triplet pkgs (!1801)
Alpine's abuild has a arch_to_hostspec function, which translates an architecture name ("x86_64") to a hostspec triplet ("x86_64-alpine-linux-musl"). We are using this function in some APKBUILDs in pmaports.git. The triplet had been changed in [1] and now we must rebuild all relevant packages, or we will run into weird issues like [2]. As some of these packages are generated with "pmbootstrap aportgen", we can't simply bump the pkgrel and force a rebuild. That would break the upstream compatibility checks, which rely on pkgver and pkgrel being the same as the originating packages from Alpine. Create a new workdir version with a migration that zaps the chroots and deletes the affected package versions from the cache. Before this gets merged, I will rebuild the affected packages in the binary package repository, so pmbootstrap will always use the fixed packages after the migration. [1] https://github.com/alpinelinux/abuild/pull/56 [2] https://gitlab.com/postmarketOS/pmaports/issues/295
This commit is contained in:
parent
2c4dae736a
commit
a9abfb66f9
|
@ -45,7 +45,7 @@ pmaports_min_version = "4"
|
||||||
# Version of the work folder (as asked during 'pmbootstrap init'). Increase
|
# Version of the work folder (as asked during 'pmbootstrap init'). Increase
|
||||||
# this number, whenever migration is required and provide the migration code,
|
# this number, whenever migration is required and provide the migration code,
|
||||||
# see migrate_work_folder()).
|
# see migrate_work_folder()).
|
||||||
work_version = 3
|
work_version = 4
|
||||||
|
|
||||||
# Keys saved in the config file (mostly what we ask in 'pmbootstrap init')
|
# Keys saved in the config file (mostly what we ask in 'pmbootstrap init')
|
||||||
config_keys = ["ccache_size", "device", "extra_packages", "hostname", "jobs",
|
config_keys = ["ccache_size", "device", "extra_packages", "hostname", "jobs",
|
||||||
|
|
|
@ -16,6 +16,7 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -75,6 +76,24 @@ def check_binfmt_misc(args):
|
||||||
" armhf on x86_64):\n See: <" + link + ">")
|
" armhf on x86_64):\n See: <" + link + ">")
|
||||||
|
|
||||||
|
|
||||||
|
def delete_apk(args, pkgname, version):
|
||||||
|
"""
|
||||||
|
Remove a cached binary package for all arches.
|
||||||
|
|
||||||
|
:param pkgname: package name (e.g. "binutils-armhf")
|
||||||
|
:param version: $pkgver-r$pkgrel (e.g. "1.0.0-r2")
|
||||||
|
"""
|
||||||
|
pattern = args.work + "/cache_apk_*/" + pkgname + "-" + version + ".*.apk"
|
||||||
|
matches = glob.glob(pattern)
|
||||||
|
logging.info("(native) Removing package: " + pkgname + "-" + version)
|
||||||
|
if not matches:
|
||||||
|
logging.info("(native) (Package not found, nothing to do.)")
|
||||||
|
return
|
||||||
|
for match in matches:
|
||||||
|
logging.info("(native) % rm " + match)
|
||||||
|
pmb.helpers.run.root(args, ["rm", match])
|
||||||
|
|
||||||
|
|
||||||
def migrate_success(args, version):
|
def migrate_success(args, version):
|
||||||
logging.info("Migration to version " + str(version) + " done")
|
logging.info("Migration to version " + str(version) + " done")
|
||||||
with open(args.work + "/version", "w") as handle:
|
with open(args.work + "/version", "w") as handle:
|
||||||
|
@ -154,6 +173,31 @@ def migrate_work_folder(args):
|
||||||
migrate_success(args, 3)
|
migrate_success(args, 3)
|
||||||
current = 3
|
current = 3
|
||||||
|
|
||||||
|
if current == 3:
|
||||||
|
logging.info("Changelog:")
|
||||||
|
logging.info("* armhf triplet was changed in abuild (pmaports#295)")
|
||||||
|
logging.info("Migration will do the following:")
|
||||||
|
logging.info("* Zap your chroots")
|
||||||
|
logging.info("* Delete invalid armhf packages from cache")
|
||||||
|
logging.info("Note:")
|
||||||
|
logging.info("* If you are getting strange compiling errors when")
|
||||||
|
logging.info(" compiling to armhf (and other arches work fine!),")
|
||||||
|
logging.info(" then the invalid packages are probably still")
|
||||||
|
logging.info(" cached in your network. In that case, ask in the chat")
|
||||||
|
logging.info(" for advice: https://postmarketos.org/chat")
|
||||||
|
if not pmb.helpers.cli.confirm(args):
|
||||||
|
raise RuntimeError("Aborted.")
|
||||||
|
|
||||||
|
pmb.chroot.zap(args, False)
|
||||||
|
delete_apk(args, "binutils-armhf", "2.31.1-r2")
|
||||||
|
delete_apk(args, "busybox-static-armhf", "1.30.1-r2")
|
||||||
|
delete_apk(args, "gcc-armhf", "8.3.0-r0")
|
||||||
|
delete_apk(args, "gcc4-armhf", "9999-r1")
|
||||||
|
delete_apk(args, "gcc6-armhf", "9999-r6")
|
||||||
|
delete_apk(args, "musl-armhf", "1.1.22-r2")
|
||||||
|
migrate_success(args, 4)
|
||||||
|
current = 4
|
||||||
|
|
||||||
# Can't migrate, user must delete it
|
# Can't migrate, user must delete it
|
||||||
if current != required:
|
if current != required:
|
||||||
raise RuntimeError("Sorry, we can't migrate that automatically. Please"
|
raise RuntimeError("Sorry, we can't migrate that automatically. Please"
|
||||||
|
|
Loading…
Reference in New Issue