pmb/build/_package.py: create .git symlink (!1831)

Make /home/pmos/build/.git point to the .git dir from pmaports.git, with
a symlink so abuild does not fail.

abuild expects the current working directory to be a subdirectory of a
cloned git repository (e.g. main/openrc from aports.git). If git is
installed, it will try to get the last git commit from that repository,
and place it in the resulting apk (.PKGINFO) as well as use the date
from that commit as SOURCE_DATE_EPOCH (for reproducible builds).

With that symlink, we actually make it use the last git commit from
pmaports.git for SOURCE_DATE_EPOCH and have that in the resulting apk's
.PKGINFO.

Fixes: #1841
This commit is contained in:
Oliver Smith 2019-11-10 11:20:00 +01:00
parent 46a65e1bb9
commit 16166874a5
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 51 additions and 4 deletions

View file

@ -24,6 +24,7 @@ This file tests pmb.helper.pkgrel_bump
import glob
import os
import pytest
import shutil
import sys
# Import from parent directory
@ -57,6 +58,11 @@ def pmbootstrap(args, tmpdir, parameters, zero_exit=True):
aports = tmpdir + "/_aports"
config = tmpdir + "/_pmbootstrap.cfg"
# Copy .git dir to fake pmaports
dot_git = tmpdir + "/_aports/.git"
if not os.path.exists(dot_git):
shutil.copytree(args.aports + "/.git", dot_git)
try:
pmb.helpers.run.user(args, ["./pmbootstrap.py", "--work=" + tmpdir,
"--mirror-pmOS=", "--aports=" + aports,