Skip to content

aportgen: Gracefully handle old aports_upstream git checkout

Created by: ollieparanoid

Introduction

In order to get cross-compilers, we generate a few aports (e.g. binutils-armhf, gcc-armhf) automatically from Alpine's aports. pmbootstrap was already able to perform a git checkout of Alpine's aports repository. But it needed to be manually updated. Otherwise the pmbootstrap aportgen command could actually downgrade the aport instead of updating it to the current version.

Git wrapper?

After thinking about adding a dedicated pmbootstrap command for updating git repositories, I thought it would be better to not open that can of worms (pmbootstrap as general git wrapper? no thanks).

Comparing versions!

The solution implemented here compares the upstream aport version of the git checkout of a certain package (e.g. gcc for gcc-armhf) with the version in Alpine's binary package APKINDEX. When the aport version is lower than the binary package version, it shows the user how to update the git repository with just one command:

pmbootstrap chroot --add=git --user -- git -C /mnt/pmbootstrap-git/aports_upstream pull

Changes:

  • pmb.aportgen.core.get_upstream_aport(): new function, that returns the absolute path to the upstream aport on disk, after checking the version of the aport against the binary package.
  • Use that new function in pmb.aportgen.gcc and pmb.aportgen.binutils
  • New function pmb.helpers.repo.alpine_apkindex_path(): updates the APKINDEX if necessary and returns the absolute path to the APKINDEX. This code was basically present already, but not as function, so now we have a bit less overhead there.
  • pmbootstrap chroot: new --user argument
  • pmb.parse.apkbuild: make pkgname check optional, as it fails with the official gcc APKBUILD before we modify it (the current APKBUILD parser is not meant to be perfect, as this would require a full shell parsing implementation).
  • Extended test_aportgen.py and enabled it by default in testcases_fast.sh. Previously it was disabled due to traffic concerns (cloning the aports repo, but then again we do a full KDE plasma mobile installation in Travis now, so that shouldn't matter too much).
  • testcases_fast.sh: With "test_aport_in_sync_with_git" removed from the disabled-by-default list (left over from timestamp based rebuilds), there were no more test cases disabled by default. I've changed it, so now the qemu_running_processes test case is disabled, and added an --all parameter to the script to disable no test cases. Travis runs with the --all parameter while it's useful to do a quick local test without --all in roughly 2 minutes instead of 10.
  • aports/cross/binutils-*: Fix _mirror variable to point to current default Alpine mirror (so the aportgen testcase runs through).

Fixes #1272 (closed).

Merge request reports