From 04848c48700bc1c96a559f3379191bc3629b3e8f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 2 Jul 2019 15:36:20 +0100
Subject: [PATCH] build: Add a list of included packages to relocatable builds

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 build-relocatable-install.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/build-relocatable-install.py b/build-relocatable-install.py
index ecf9cfb98..d283a7dc2 100755
--- a/build-relocatable-install.py
+++ b/build-relocatable-install.py
@@ -336,6 +336,7 @@ def main():
             )
 
     source_to_download = set()      # type: typing.Set[str]
+    binaries = set()                # type: typing.Set[str]
 
     for package, source in (
         list(DEPENDENCIES.items()) + list(PRIMARY_ARCH_DEPENDENCIES.items())
@@ -343,6 +344,8 @@ def main():
         if not args.relocatabledir and source == 'libcapsule':
             continue
 
+        binaries.add(package)
+
         if os.path.exists('/usr/share/doc/{}/copyright'.format(package)):
             install(
                 '/usr/share/doc/{}/copyright'.format(package),
@@ -373,6 +376,19 @@ def main():
             )
             source_to_download.add(source)
 
+    with open(
+        os.path.join(destdir_prefix, 'metadata', 'packages.txt'), 'w'
+    ) as writer:
+        writer.write(
+            '#Package[:Architecture]\t#Version\t#Source\t#Installed-Size\n'
+        )
+        v_check_call([
+            'dpkg-query',
+            '-W',
+            '-f',
+            r'${binary:Package}\t${Version}\t${Source}\t${Installed-Size}\n',
+        ] + sorted(binaries), stdout=writer)
+
     with open(
         os.path.join(destdir_prefix, 'metadata', 'VERSION.txt'),
         'w',
-- 
GitLab