forked from Mirror/pmbootstrap
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:
commit
3a3dd8063f
10 changed files with 286 additions and 4 deletions
|
@ -21,6 +21,7 @@ import logging
|
|||
|
||||
import pmb.build
|
||||
import pmb.build.autodetect
|
||||
import pmb.build.buildinfo
|
||||
import pmb.build.crosscompiler
|
||||
import pmb.chroot
|
||||
import pmb.chroot.apk
|
||||
|
@ -29,11 +30,12 @@ import pmb.parse
|
|||
import pmb.parse.arch
|
||||
|
||||
|
||||
def package(args, pkgname, carch, force=False, recurse=True):
|
||||
def package(args, pkgname, carch, force=False, recurse=True, buildinfo=False):
|
||||
"""
|
||||
Build a package with Alpine Linux' abuild.
|
||||
|
||||
:param force: even build, if not necessary
|
||||
:returns: output path relative to the packages folder
|
||||
"""
|
||||
# Get aport, skip upstream only packages
|
||||
aport = pmb.build.find_aport(args, pkgname, False)
|
||||
|
@ -109,6 +111,14 @@ def package(args, pkgname, carch, force=False, recurse=True):
|
|||
if not os.path.exists(path):
|
||||
raise RuntimeError("Package not found after build: " + path)
|
||||
|
||||
# Create .buildinfo.json file
|
||||
if buildinfo:
|
||||
logging.info("(" + suffix + ") generate " + output + ".buildinfo.json")
|
||||
pmb.build.buildinfo.write(args, output, carch_buildenv, suffix,
|
||||
apkbuild)
|
||||
|
||||
# Symlink noarch packages
|
||||
if "noarch" in apkbuild["arch"]:
|
||||
pmb.build.symlink_noarch_package(args, output)
|
||||
|
||||
return output
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue