Properly support specifying a local folder as --mirror-pmOS

This is required for developing and testing the binary repository
scripts (see #64). Changes:
* When specified, the local folder gets mounted inside the chroots
  as /mnt/postmarketos-mirror
* The apkindex_files() function outputs the correct path to the local
  repository (it does *not* hash the URL in that case, which would
  be wrong)
* /etc/apk/repositories: when the pmOS mirror is a local folder,
  the path "/mnt/postmarketos-mirror" gets added to that file instead
  of the outside path (so apk finds it properly inside the chroot)
This commit is contained in:
Oliver Smith 2017-07-12 21:55:47 +02:00
parent 8e3e296cbd
commit f37367c57c
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 42 additions and 11 deletions

View file

@ -21,6 +21,7 @@ import sys
import pytest
import types
import time
import logging
# Import from parent directory
pmb_src = os.path.abspath(os.path.join(os.path.dirname(__file__) + "/.."))
@ -113,9 +114,16 @@ def test_apkindex_files(args):
# Make sure, that we have a user's APKINDEX.tar.gz
pmb.build.package(args, "hello-world", args.arch_native)
# Reset the cache
del args.cache["apkindex_files"][args.arch_native]
# Fake the upstream folder to be the same as the normal packages folder
args.mirror_postmarketos = args.work + "/packages"
files = pmb.helpers.repo.apkindex_files(args)
for file in files:
assert os.path.exists(file)
logging.info(file)
# Test cache
assert files == pmb.helpers.repo.apkindex_files(args)