Merge branch 'lazy-reproducible-builds'

We have "lazy reproducible builds" now. What I mean by that is, that
the resulting "apk" archive is not fully reproducible, but all binaries
inside it are. This is necessary to kick-off the binary repo, which is
in turn required to get the testsuite going on Travis. Read #64 for more
information.

Usage:
```
pmbootstrap build hello-world --buildinfo
pmbootstrap challenge /tmp/path/to/hello-world-1-r2.apk
```

The "--buildinfo" parameter generates a "buildinfo.json", which contains
the versions of all dependencies. It is not very optimizied, so this
is a performance bottleneck and takes 10 seconds (which is quite much
considering that the hello-world package builds in less than a second).
This can be improved in the future, and then the buildinfo parameter
may become the default.
This commit is contained in:
Oliver Smith 2017-06-11 14:19:57 +02:00
commit 3a3dd8063f
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
10 changed files with 286 additions and 4 deletions

View file

@ -37,7 +37,7 @@ def replace_variables(apkbuild):
replaced.append(subpackage.replace("$pkgname", ret["pkgname"]))
ret["subpackages"] = replaced
# makedepend: $makedepends_host, $makedepends_build, $_llvmver
# makedepends: $makedepends_host, $makedepends_build, $_llvmver
replaced = []
for makedepend in ret["makedepends"]:
if makedepend.startswith("$"):

View file

@ -74,6 +74,17 @@ def read(args, package, path, must_exist=True):
if not ret or compare_version(current["version"],
ret["version"]) == 1:
ret = current
if "provides" in current:
for alias in current["provides"]:
split = alias.split("=")
if len(split) == 1:
continue
name = split[0]
version = split[1]
if name == package:
if not ret or compare_version(current["version"],
version) == 1:
ret = current
current = {}
if line.startswith("P:"): # package
current["pkgname"] = line[2:-1]
@ -85,8 +96,17 @@ def read(args, package, path, must_exist=True):
current["depends"] = depends.split(" ")
else:
current["depends"] = []
if line.startswith("p:"): # provides
provides = line[2:-1]
current["provides"] = provides.split(" ")
if not ret and must_exist:
raise RuntimeError("Package " + package + " not found in " + path)
if ret:
for key in ["depends", "provides"]:
if key not in ret:
ret[key] = []
return ret

View file

@ -61,7 +61,9 @@ def arguments_initfs(subparser):
# ls, build, extract
ls = sub.add_parser("ls", help="list initramfs contents")
build = sub.add_parser("build", help="(re)build the initramfs")
extract = sub.add_parser("extract", help="extract the initramfs to a temporary folder")
extract = sub.add_parser(
"extract",
help="extract the initramfs to a temporary folder")
for action in [ls, build, extract]:
action.add_argument(
"--flavor",
@ -164,9 +166,15 @@ def arguments():
" specific architecture")
build.add_argument("--arch")
build.add_argument("--force", action="store_true")
build.add_argument("--buildinfo", action="store_true")
for action in [checksum, build, menuconfig, parse_apkbuild, aportgen]:
action.add_argument("package")
# Action: challenge
challenge = sub.add_parser("challenge",
help="rebuild a package and diff its contents")
challenge.add_argument("apk")
# Use defaults from the user's config file
args = parser.parse_args()
cfg = pmb.config.load(args)