From ea250de412abc397621ab97b056c5a32db27b84e Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 4 Dec 2019 14:04:52 +0000
Subject: [PATCH] Add Build-Conflicts on libsteam-runtime-tools-0-helpers

Since steam-runtime-tools was made relocatable in c3a06cce, its build
will fail with the Steam Runtime 1 'scout' version of dpkg if it is
already installed system-wide.

If the SDK container where steam-runtime-tools is built has our
$(pkglibexecdir) populated with symbolic links to the dependency
libraries, then dpkg-shlibdeps will look there to convert DT_NEEDED
dependencies into Debian dependencies. Unfortunately, the version of
dpkg in SteamRT 1 'scout' has Debian bug #843073, which means it assumes
all libraries are found via their canonical names as listed in the dpkg
database, not a symlink-based alias. This results in the build failing
with an error similar to:

    dpkg-shlibdeps: error: no dependency information found for
    /usr/lib/x86_64-linux-gnu/steam-runtime-tools-0/libglib-2.0.so.0
    (used by
    debian/libsteam-runtime-tools-0-helpers/usr/libexec/steam-runtime-tools-0/x86_64-linux-gnu-check-locale)

Until we get a newer Docker image with a newer version of this
package that works around this issue, we will have to remove it
explicitly before running CI. Adding Build-Conflicts is not enough:
autopkgtest installs build-dependencies, but does not remove
Build-Conflicts.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/control       | 2 ++
 debian/gitlab-ci.yml | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/debian/control b/debian/control
index 8b638e821..393211d94 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,8 @@ Build-Depends:
  zlib1g <!nocheck>,
 Build-Depends-Indep:
  libglib2.0-dev,
+Build-Conflicts:
+ libsteam-runtime-tools-0-helpers,
 Vcs-Git: https://gitlab.steamos.cloud/steam/steam-runtime-tools.git
 Vcs-Browser: https://gitlab.steamos.cloud/steam/steam-runtime-tools
 
diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml
index 0ca4ddeaa..86a69d6c1 100644
--- a/debian/gitlab-ci.yml
+++ b/debian/gitlab-ci.yml
@@ -34,6 +34,9 @@ autopkgtest:
     stage: test
     variables:
         BUILD_IMAGE: docker.internal.steamos.cloud/steamrt/sdk:scout-latest
+        STEAM_CI_INSTALL_SCRIPT: |
+            # Workaround for the build regression described in !88
+            apt-get -y remove libsteam-runtime-tools-0-helpers
 
 ubsan:
     stage: test
-- 
GitLab