Skip to content
Snippets Groups Projects
Commit fab2c8f6 authored by Simon McVittie's avatar Simon McVittie
Browse files

build: Build the relocatable installation as a "larger" step outside Meson


This is a step towards potentially building pressure-vessel releases
as packages in the scout environment, so that tagged releases can go
through the same latest/beta/stable release pipeline as everything
else.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent eb37e653
No related branches found
No related tags found
No related merge requests found
......@@ -151,9 +151,17 @@ already. Then you can do:
meson --prefix=$(pwd)/_build/relocatable-install -Drelocatable=true _build
ninja -C _build
meson test -v -C _build # optional
rm -fr $(pwd)/_build/relocatable-install
meson test -v -C _build # optional
ninja -C _build install
./build-relocatable-install.py \
--srcdir . \
--builddir _build \
--libcapsuledir /usr/lib/libcapsule/relocatable \
--archive .
./tests/relocatable-install.py \
--srcdir . \
--builddir _build # optional
For more convenient use on a development system, if you have a
SteamRT 1 'scout' SDK tarball or an unpacked sysroot, you can place a
......@@ -163,11 +171,16 @@ tarball at `_build/sysroot.tar.gz` or unpack a sysroot into
./sysroot/run-in-sysroot.py apt-get update
./sysroot/run-in-sysroot.py meson ...
rm -fr $(pwd)/_build/relocatable-install
./sysroot/run-in-sysroot.py ninja ...
./sysroot/run-in-sysroot.py ./build-relocatable-install.py ...
(Or put them in different locations and pass the `--sysroot` and
`--tarball` options to `./sysroot/run-in-sysroot.py`.)
The relocatable install ends up in `_build/relocatable-install`.
The relocatable install goes into`_build/relocatable-install` (or
whatever you used as the `--prefix`), and a compressed version ends
up in the directory passed as an argument to `--archive`.
Instructions for testing
------------------------
......
......@@ -25,6 +25,7 @@
import argparse
import glob
import json
import os
import re
import shutil
......@@ -139,25 +140,40 @@ def main():
'--srcdir', default=os.getenv('MESON_SOURCE_ROOT', '.'))
parser.add_argument(
'--builddir', default=os.getenv('MESON_BUILD_ROOT', '_build'))
parser.add_argument(
'--prefix',
default=os.getenv(
'MESON_INSTALL_PREFIX',
os.path.abspath(os.path.join('_build', 'relocatable-install')),
),
)
parser.add_argument(
'--archive', default=os.getenv('MESON_BUILD_ROOT', '.'))
parser.add_argument('--relocatabledir', default='')
parser.add_argument('--prefix', default=None)
parser.add_argument('--archive', default=None)
parser.add_argument('--libcapsuledir', default='')
parser.add_argument('--set-version', dest='version', default='unknown')
args = parser.parse_args()
if args.destdir:
args.destdir = os.path.abspath(args.destdir)
args.srcdir = os.path.abspath(args.srcdir)
args.builddir = os.path.abspath(args.builddir)
if args.archive is None:
args.archive = args.builddir
else:
args.archive = os.path.abspath(args.archive)
if args.prefix is None:
blob = subprocess.check_output([
'meson', 'introspect', args.builddir, '--buildoptions',
], universal_newlines=True)
for opt in json.loads(blob):
if opt['name'] == 'prefix':
args.prefix = opt['value']
break
else:
raise RuntimeError(
'Unable to determine installation prefix from Meson, '
'please specify --prefix'
)
os.chdir(args.builddir)
destdir_prefix = os.getenv(
'MESON_INSTALL_DESTDIR_PREFIX',
args.destdir + args.prefix,
)
destdir_prefix = args.destdir + args.prefix
os.makedirs(os.path.join(destdir_prefix, 'bin'), exist_ok=True)
os.makedirs(os.path.join(destdir_prefix, 'metadata'), exist_ok=True)
......@@ -186,12 +202,12 @@ def main():
0o644,
)
if args.relocatabledir:
if args.libcapsuledir:
for arch in ARCHS:
for tool in TOOLS:
install_exe(
os.path.join(
args.relocatabledir,
args.libcapsuledir,
'{}-{}'.format(arch.multiarch, tool),
),
os.path.join(destdir_prefix, 'bin'),
......@@ -341,7 +357,7 @@ def main():
for package, source in (
list(DEPENDENCIES.items()) + list(PRIMARY_ARCH_DEPENDENCIES.items())
):
if not args.relocatabledir and source == 'libcapsule':
if not args.libcapsuledir and source == 'libcapsule':
continue
if os.path.exists('/usr/share/doc/{}/copyright'.format(package)):
......@@ -400,7 +416,7 @@ def main():
os.path.join(destdir_prefix, 'sources'),
)
if not args.relocatabledir:
if not args.libcapsuledir:
for dsc in glob.glob(
os.path.join(args.srcdir, 'libcapsule*.dsc')
):
......
......@@ -109,19 +109,30 @@ pipeline {
sh '''
set -eu
cd src
meson --prefix="${WORKSPACE}/src/_build/relocatable-install" -Dpython=python3.5 -Drelocatable=true _build
meson --prefix="${WORKSPACE}/src/_build/relocatable-install" -Dpython=python3.5 _build
ninja -C _build
ninja -C _build install
meson test --verbose -C _build
./build-relocatable-install.py \
--srcdir . \
--builddir _build \
--libcapsuledir /usr/lib/libcapsule/relocatable \
--prefix="${WORKSPACE}/src/_build/relocatable-install" \
--archive "${WORKSPACE}" \
--set-version "$(cat .tarball-version)" \
${NULL+}
prove -v ./tests/relocatable-install.py :: \
--srcdir . \
--builddir _build \
--prefix="${WORKSPACE}/src/_build/relocatable-install" \
${NULL+}
'''
}
}
}
dir('src/_build') {
archiveArtifacts 'pressure-vessel-*-bin.tar.gz'
archiveArtifacts 'pressure-vessel-*-bin+src.tar.gz'
}
archiveArtifacts 'pressure-vessel-*-bin.tar.gz'
archiveArtifacts 'pressure-vessel-*-bin+src.tar.gz'
}
}
}
......
......@@ -117,7 +117,6 @@ tests = [
'mypy.sh',
'pycodestyle.sh',
'pyflakes.sh',
'relocatable-install.py',
'shellcheck.sh',
]
......@@ -188,17 +187,4 @@ executable(
kwargs : rpath_kwargs,
)
if get_option('relocatable')
meson.add_install_script(
python.path(),
join_paths(meson.current_source_dir(), 'build-relocatable-install.py'),
'--srcdir', meson.current_source_dir(),
'--builddir', meson.current_build_dir(),
'--relocatabledir', '/usr/lib/libcapsule/relocatable',
'--prefix', get_option('prefix'),
'--archive', meson.current_build_dir(),
'--set-version', version,
)
endif
# vim:set sw=2 sts=2 et:
......@@ -22,6 +22,8 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import argparse
import json
import os
import subprocess
import sys
......@@ -172,11 +174,42 @@ def check_dependencies(test, relocatable_install, path, is_wrapper=False):
def main():
# type: () -> None
relocatable_install = os.path.join(G_TEST_BUILDDIR, 'relocatable-install')
if not os.path.exists(relocatable_install):
print('1..0 # SKIP relocatable-install not in expected location')
sys.exit(0)
parser = argparse.ArgumentParser()
parser.add_argument('--destdir', default=os.getenv('DESTDIR', ''))
parser.add_argument('--srcdir', default=G_TEST_SRCDIR)
parser.add_argument('--builddir', default=G_TEST_BUILDDIR)
parser.add_argument('--prefix', default=None)
args = parser.parse_args()
if args.destdir:
args.destdir = os.path.abspath(args.destdir)
args.srcdir = os.path.abspath(args.srcdir)
args.builddir = os.path.abspath(args.builddir)
if args.prefix is None:
blob = subprocess.check_output([
'meson', 'introspect', args.builddir, '--buildoptions',
], universal_newlines=True)
for opt in json.loads(blob):
if opt['name'] == 'prefix':
args.prefix = opt['value']
break
else:
raise RuntimeError(
'Unable to determine installation prefix from Meson, '
'please specify --prefix'
)
relocatable_install = args.destdir + args.prefix
if relocatable_install is None:
relocatable_install = os.path.join(args.builddir, 'relocatable-install')
if not os.path.exists(relocatable_install):
print('1..0 # SKIP relocatable-install not in expected location')
sys.exit(0)
test = TapTest()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment