From 41fd4d94f082c7ff1b1451424333ee3c146a229e Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Tue, 2 Jul 2019 15:28:31 +0100 Subject: [PATCH] wrap, build: Make pressure-vessel version more discoverable Signed-off-by: Simon McVittie <smcv@collabora.com> --- build-relocatable-install.py | 17 +++++++++++++++++ src/wrap.c | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/build-relocatable-install.py b/build-relocatable-install.py index 04070ab9b..ecf9cfb98 100755 --- a/build-relocatable-install.py +++ b/build-relocatable-install.py @@ -373,6 +373,12 @@ def main(): ) source_to_download.add(source) + with open( + os.path.join(destdir_prefix, 'metadata', 'VERSION.txt'), + 'w', + ) as writer: + writer.write('{}\n'.format(args.version)) + shutil.copytree( os.path.join(destdir_prefix, 'metadata'), os.path.join(destdir_prefix, 'sources'), @@ -472,6 +478,17 @@ def main(): cmd=git_archive.args, ) + with open( + os.path.join( + destdir_prefix, + 'sources', + 'pressure-vessel', + '.tarball-version', + ), + 'w', + ) as writer: + writer.write('{}\n'.format(args.version)) + bin_tar = 'pressure-vessel-{}-bin.tar.gz'.format(args.version) src_tar = 'pressure-vessel-{}-bin+src.tar.gz'.format(args.version) diff --git a/src/wrap.c b/src/wrap.c index 080dc2bc5..3d3d2f381 100644 --- a/src/wrap.c +++ b/src/wrap.c @@ -1447,6 +1447,7 @@ static GPtrArray *opt_ld_preload = NULL; static char *opt_runtime = NULL; static gboolean opt_share_home = TRUE; static gboolean opt_verbose = FALSE; +static gboolean opt_version = FALSE; static gboolean opt_xterm = FALSE; static gboolean @@ -1503,6 +1504,8 @@ static GOptionEntry options[] = "must be installed in the RUNTIME, if used.", NULL }, { "verbose", 0, 0, G_OPTION_ARG_NONE, &opt_verbose, "Be more verbose.", NULL }, + { "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, + "Print version number and exit.", NULL }, { NULL } }; @@ -1576,6 +1579,13 @@ main (int argc, if (!g_option_context_parse (context, &argc, &argv, error)) goto out; + if (opt_version) + { + g_print ("pressure-vessel version %s\n", VERSION); + ret = 0; + goto out; + } + if (argc < 2) { g_printerr ("%s: An executable to run is required\n", -- GitLab