pmbootstrap/test
Oliver Smith b8f35d45b8
aportgen: Gracefully handle old aports_upstream (#1291)
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.

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).

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).
2018-03-11 14:18:21 +00:00
..
testdata Skip virtual packages when parsing APKINDEX (#1278) 2018-03-10 13:15:30 +00:00
check_checksums.py check_checksums.py: Non-zero exit on build error 2018-02-14 00:12:46 +01:00
static_code_analysis.sh static_code_analysis.sh: Find CHANGEMEs in APKBUILDs (#1161) 2018-01-24 21:31:07 +00:00
test_apk_static.py Index parser: support multiple package providers (#1202) 2018-02-20 19:52:28 +00:00
test_aportgen.py aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
test_aportgen_device_wizard.py deviceinfo: remove external_disk_install and external_disk, use external_storage instead (#1301) 2018-03-07 22:35:02 +00:00
test_aports.py Make nonfree depends optional part 2: device pkgs (#1268) 2018-02-26 22:11:44 +00:00
test_bootimg.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
test_build_is_necessary.py Index parser: support multiple package providers (#1202) 2018-02-20 19:52:28 +00:00
test_build_package.py Properly escape commands in pmb.chroot.user() (#1316) 2018-03-10 22:58:39 +00:00
test_buildroot_aarch64_init.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
test_chroot_interactive_shell.py aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
test_config_user.py Remove timestamp based rebuilds (#1174) 2018-01-28 23:27:33 +00:00
test_file.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
test_folder_size.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
test_frontend.py pmbootstrap build --src: override source for any package (#1210) 2018-02-19 22:04:01 +00:00
test_install.py Make proprietary drivers optional (1/2): pmbootstrap changes (#1254) 2018-02-24 21:49:10 +00:00
test_keys.py Index parser: support multiple package providers (#1202) 2018-02-20 19:52:28 +00:00
test_mount.py Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
test_newapkbuild.py Wrap Alpine's newapkbuild (#894) 2018-01-15 22:00:11 +00:00
test_parse_apkbuild.py Make proprietary drivers optional (1/2): pmbootstrap changes (#1254) 2018-02-24 21:49:10 +00:00
test_parse_apkindex.py Skip virtual packages when parsing APKINDEX (#1278) 2018-03-10 13:15:30 +00:00
test_parse_depends.py Index parser: support multiple package providers (#1202) 2018-02-20 19:52:28 +00:00
test_pkgrel_bump.py Remove timestamp based rebuilds (#1174) 2018-01-28 23:27:33 +00:00
test_qemu_running_processes.py Testsuite: Run UIs in Qemu and check running processes and more (#982) 2018-02-02 00:16:29 +00:00
test_questions.py Make proprietary drivers optional (1/2): pmbootstrap changes (#1254) 2018-02-24 21:49:10 +00:00
test_repo.py aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
test_shell_escape.py Properly escape commands in pmb.chroot.user() (#1316) 2018-03-10 22:58:39 +00:00
test_soname_bump.py Gracefully handle packages breaking because of soname bumps (#1116) 2018-01-14 01:26:42 +00:00
test_upstream_compatibility.py aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00
test_version.py Testsuite: Run UIs in Qemu and check running processes and more (#982) 2018-02-02 00:16:29 +00:00
test_version_validate.py version.py: fix validation of 6.0_0002 (#1160) 2018-01-25 18:23:55 +00:00
testcases_fast.sh aportgen: Gracefully handle old aports_upstream (#1291) 2018-03-11 14:18:21 +00:00