Control: tag -1 + patch
Control: retitle -1 git-buildpackage FTBFS when /etc/lsb-release does not exist

Hi,

On Wed, Dec 09, 2020 at 09:59:23AM +0100, Lucas Nussbaum wrote:
> During a rebuild of all packages in sid, your package failed to build
> on ppc64el. At the same time, it did not fail on amd64.
> [...]
> > -------------------- >> begin captured logging << --------------------
> > gbp: info: Failed to read OS release file /etc/lsb-release: [Errno 2] No 
> > such file or directory: '/etc/lsb-release'
> > gbp: debug: ['git', 'rev-parse', '--show-cdup']
> > --------------------- >> end captured logging << ---------------------
> > SKIP: Skipping 'tests.component', since this is not a git checkout.
> > -------------------- >> begin captured logging << --------------------

I was able to reproduce the issue on amd64, so you might want to remove
the ftbfs-ppc64 usertag?  It is sufficient for /etc/lsb-release not to exist.

Please find enclosed 2 patches that solve the issue, at least in my environment.
You might want to check those on Ubuntu, but I believe it should work fine 
there.


Best,

  nicoo
From 21e2cf0c2fd66d2781659bc57b8246faf2a147d7 Mon Sep 17 00:00:00 2001
From: nicoo <ni...@debian.org>
Date: Sun, 20 Dec 2020 23:35:57 +0100
Subject: [PATCH 1/2] tests/11_test_dch_main.py: Don't expect /etc/lsb-release
 on Debian

---
 tests/11_test_dch_main.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
index 14cf593..f88959f 100644
--- a/tests/11_test_dch_main.py
+++ b/tests/11_test_dch_main.py
@@ -9,16 +9,16 @@ from .testutils import (DebianGitTestRepo, OsReleaseFile, skip_without_cmd,
 from gbp.scripts import dch
 
 import os
+import platform
 import re
 
 # Older dch compatibility
 default_urgency = get_dch_default_urgency()
 
 # For Ubuntu compatibility
-os_release = OsReleaseFile('/etc/lsb-release')
-
 # OS release codename and snapshot of version 0.9-2~1
-if os_release['DISTRIB_ID'] == 'Ubuntu':
+if 'Ubuntu' in platform.version():
+    os_release = OsReleaseFile('/etc/lsb-release')
     os_codename = os_release['DISTRIB_CODENAME']
     snap_header_0_9 = r'^test-package\s\(0.9-1ubuntu1~1\.gbp([0-9a-f]{6})\)\sUNRELEASED;\surgency=%s' % default_urgency
     new_version_0_9 = '0.9-1ubuntu1'
-- 
2.29.2

From 971b0a622dcd1bc5ca5f3b4cd97470ff7799c0bc Mon Sep 17 00:00:00 2001
From: nicoo <ni...@debian.org>
Date: Sun, 20 Dec 2020 23:43:27 +0100
Subject: [PATCH 2/2] doctests/test_Changelog: Don't expect /etc/lsb-release

See #976914
---
 tests/doctests/test_Changelog.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/doctests/test_Changelog.py b/tests/doctests/test_Changelog.py
index 1fb8a30..a1e4311 100644
--- a/tests/doctests/test_Changelog.py
+++ b/tests/doctests/test_Changelog.py
@@ -262,7 +262,7 @@ def test_add_section():
     >>> import shutil
     >>> import gbp.deb.changelog
     >>> from ..testutils import OsReleaseFile
-    >>> os_release = OsReleaseFile('/etc/lsb-release')
+    >>> os_release = OsReleaseFile()
     >>> olddir = os.path.abspath(os.path.curdir)
     >>> testdir = tempfile.mkdtemp(prefix='gbp-test-changelog-')
     >>> testdebdir = os.path.join(testdir, 'debian')
@@ -309,7 +309,7 @@ def test_add_entry():
     >>> import shutil
     >>> import gbp.deb.changelog
     >>> from ..testutils import OsReleaseFile
-    >>> os_release = OsReleaseFile('/etc/lsb-release')
+    >>> os_release = OsReleaseFile()
     >>> olddir = os.path.abspath(os.path.curdir)
     >>> testdir = tempfile.mkdtemp(prefix='gbp-test-changelog-')
     >>> testdebdir = os.path.join(testdir, 'debian')
-- 
2.29.2

Attachment: signature.asc
Description: PGP signature

Reply via email to