From 2e7664bc49cf4b711aaa257e27ad05858c61334e Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 7 Jun 2021 16:01:11 +0100
Subject: [PATCH] build-relocatable-install: Separate copyright files for
 util-linux

Unusually, libblkid1 and libmount1 have different copyright files
despite being from the same package. Ship both.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/THIRD-PARTY.md               |  2 +-
 pressure-vessel/build-relocatable-install.py | 33 +++++++++++++++-----
 2 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/pressure-vessel/THIRD-PARTY.md b/pressure-vessel/THIRD-PARTY.md
index 54d79303c..a45aedbe7 100644
--- a/pressure-vessel/THIRD-PARTY.md
+++ b/pressure-vessel/THIRD-PARTY.md
@@ -29,7 +29,7 @@ programs and libraries:
 - bubblewrap: [LGPL-2.0-or-later][]. See bubblewrap.txt.
 
 - libblkid.so.1, libmount.so.1 from util-linux: [LGPL-2.1-or-later][].
-  See util-linux.txt.
+  See libblkid1.txt, libmount1.txt.
 
 - libffi.so.6 from libffi: [MIT][]. See libffi.txt.
 
diff --git a/pressure-vessel/build-relocatable-install.py b/pressure-vessel/build-relocatable-install.py
index aa19dcdbc..159916879 100755
--- a/pressure-vessel/build-relocatable-install.py
+++ b/pressure-vessel/build-relocatable-install.py
@@ -85,6 +85,7 @@ DEPENDENCIES = {
 WRAPPED_PROGRAMS = {
     'bwrap': 'bubblewrap',
 }
+# same as DEPENDENCIES
 PRIMARY_ARCH_DEPENDENCIES = {
     'bubblewrap': 'bubblewrap',
     'libblkid1': 'util-linux',
@@ -97,9 +98,15 @@ PRIMARY_ARCH_DEPENDENCIES = {
     'libselinux1': 'libselinux',
     'libxau6': 'libxau',
 }
+# executable => binary package in DEPENDENCIES
 HELPERS = {
     'wflinfo': 'waffle-utils-multiarch',
 }
+# Packages where different binary packages can have different copyright
+# files
+DIFFERENT_COPYRIGHT_FILES = [
+    'util-linux',
+]
 SCRIPTS = [
     'pressure-vessel-locale-gen',
     'pressure-vessel-test-ui',
@@ -522,14 +529,24 @@ def main():
             if os.path.exists('/usr/share/doc/{}/copyright'.format(package)):
                 installed_binaries.add(package)
 
-                install(
-                    '/usr/share/doc/{}/copyright'.format(package),
-                    os.path.join(
-                        installation,
-                        'metadata',
-                        '{}.txt'.format(source),
-                    ),
-                )
+                if source in DIFFERENT_COPYRIGHT_FILES:
+                    install(
+                        '/usr/share/doc/{}/copyright'.format(package),
+                        os.path.join(
+                            installation,
+                            'metadata',
+                            '{}.txt'.format(package),
+                        ),
+                    )
+                else:
+                    install(
+                        '/usr/share/doc/{}/copyright'.format(package),
+                        os.path.join(
+                            installation,
+                            'metadata',
+                            '{}.txt'.format(source),
+                        ),
+                    )
 
                 for expr in set(
                     v_check_output([
-- 
GitLab