Hi,
On Sat, Jan 30, 2021 at 09:13:07PM +0100, Jochen Sprickerhof wrote:
> Control: tags -1 + patch
> 
> Hi Guido,
> 
> * Guido Günther <a...@sigxcpu.org> [2021-01-27 12:08]:
> > Hi,
> > On Wed, Jan 20, 2021 at 09:37:56PM +0100, Lucas Nussbaum wrote:
> > > Source: git-buildpackage
> > > Version: 0.9.21
> > > Severity: serious
> > > Justification: FTBFS on amd64
> > > Tags: bullseye sid ftbfs
> > > Usertags: ftbfs-20210120 ftbfs-bullseye
> > > 
> > > Hi,
> > > 
> > > During a rebuild of all packages in sid, your package failed to build
> > > on amd64.
> > 
> > That is basically the top of the iceberg. Besides lots of places now
> > returning strings instead of bytes rpm became stricter in spec file
> > parsing breaking the test suite (and usage).
> 
> I fixed those in the attached patches.
> Note that I was not able to reproduce #980256 but explicitly tested on armhf
> and added an extra patch, so that bug should be fine.

Awesome. I had fixed the rpm parts here already
https://github.com/agx/git-buildpackage/tree/rpm but went for your
patches so your work is not lost. The reason i wrote 'tip of the
iceberg' is that the component tests need fixing as well - that's the bit
still missing - so tests still fail when the testdata for the component
tests is there (`git submodule update --init --recursive`).

Cheers,
 -- Guido


> IMHO #914314 could be downgraded again, I did not look into fixing it.
> 
> I can do an NMU as well if you are short on time.
> Would be happy to see a new git-buildpackage transition to testing.
> 
> Cheers Jochen

> From bce1d5f6d2e94788aea48731bb0c426e648dd673 Mon Sep 17 00:00:00 2001
> From: Jochen Sprickerhof <jspri...@debian.org>
> Date: Sat, 30 Jan 2021 15:02:58 +0100
> Subject: [PATCH 1/5] Stop decoding strings (not needed in Python 3)
> 
> ---
>  gbp/rpm/__init__.py | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
> index 61d9d35..1d7a9ef 100644
> --- a/gbp/rpm/__init__.py
> +++ b/gbp/rpm/__init__.py
> @@ -34,11 +34,6 @@ from gbp.rpm.linkedlist import LinkedList
>  from gbp.rpm.lib_rpm import librpm, get_librpm_log
>  
>  
> -def _decode(s):
> -    if s is not None:
> -        return s.decode()
> -
> -
>  class NoSpecError(Exception):
>      """Spec file parsing error"""
>      pass
> @@ -79,8 +74,8 @@ class SrcRpmFile(object):
>      @property
>      def version(self):
>          """Get the (downstream) version of the RPM package"""
> -        version = 
> dict(upstreamversion=self.rpmhdr[librpm.RPMTAG_VERSION].decode(),
> -                       release=self.rpmhdr[librpm.RPMTAG_RELEASE].decode())
> +        version = dict(upstreamversion=self.rpmhdr[librpm.RPMTAG_VERSION],
> +                       release=self.rpmhdr[librpm.RPMTAG_RELEASE])
>          if self.rpmhdr[librpm.RPMTAG_EPOCH] is not None:
>              version['epoch'] = str(self.rpmhdr[librpm.RPMTAG_EPOCH])
>          return version
> @@ -88,17 +83,17 @@ class SrcRpmFile(object):
>      @property
>      def name(self):
>          """Get the name of the RPM package"""
> -        return self.rpmhdr[librpm.RPMTAG_NAME].decode()
> +        return self.rpmhdr[librpm.RPMTAG_NAME]
>  
>      @property
>      def upstreamversion(self):
>          """Get the upstream version of the RPM package"""
> -        return self.rpmhdr[librpm.RPMTAG_VERSION].decode()
> +        return self.rpmhdr[librpm.RPMTAG_VERSION]
>  
>      @property
>      def packager(self):
>          """Get the packager of the RPM package"""
> -        return _decode(self.rpmhdr[librpm.RPMTAG_PACKAGER])
> +        return self.rpmhdr[librpm.RPMTAG_PACKAGER]
>  
>      def unpack(self, dest_dir):
>          """
> @@ -168,13 +163,13 @@ class SpecFile(object):
>  
>          # Other initializations
>          source_header = self._specinfo.packages[0].header
> -        self.name = source_header[librpm.RPMTAG_NAME].decode()
> -        self.upstreamversion = source_header[librpm.RPMTAG_VERSION].decode()
> -        self.release = source_header[librpm.RPMTAG_RELEASE].decode()
> +        self.name = source_header[librpm.RPMTAG_NAME]
> +        self.upstreamversion = source_header[librpm.RPMTAG_VERSION]
> +        self.release = source_header[librpm.RPMTAG_RELEASE]
>          # rpm-python returns epoch as 'long', convert that to string
>          self.epoch = str(source_header[librpm.RPMTAG_EPOCH]) \
>              if source_header[librpm.RPMTAG_EPOCH] is not None else None
> -        self.packager = _decode(source_header[librpm.RPMTAG_PACKAGER])
> +        self.packager = source_header[librpm.RPMTAG_PACKAGER]
>          self._tags = {}
>          self._special_directives = defaultdict(list)
>          self._gbp_tags = defaultdict(list)
> -- 
> 2.30.0
> 

> From 9b24dba68476ffac638bfba9561a810528519646 Mon Sep 17 00:00:00 2001
> From: Jochen Sprickerhof <jspri...@debian.org>
> Date: Sat, 30 Jan 2021 15:03:25 +0100
> Subject: [PATCH 2/5] Open tempfile in text mode
> 
> ---
>  gbp/rpm/lib_rpm.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gbp/rpm/lib_rpm.py b/gbp/rpm/lib_rpm.py
> index 5fc0354..4ef741d 100644
> --- a/gbp/rpm/lib_rpm.py
> +++ b/gbp/rpm/lib_rpm.py
> @@ -31,7 +31,7 @@ except ImportError:
>      import rpm as librpm
>  
>  # Module initialization
> -_rpmlog = tempfile.NamedTemporaryFile(prefix='gbp_rpmlog')
> +_rpmlog = tempfile.NamedTemporaryFile(mode='w+', prefix='gbp_rpmlog')
>  _rpmlogfd = _rpmlog.file
>  librpm.setVerbosity(librpm.RPMLOG_INFO)
>  librpm.setLogFile(_rpmlogfd)
> -- 
> 2.30.0
> 

> From 212d784e14382e3e0f6198fb530db266557c2afe Mon Sep 17 00:00:00 2001
> From: Jochen Sprickerhof <jspri...@debian.org>
> Date: Sat, 30 Jan 2021 16:02:59 +0100
> Subject: [PATCH 3/5] Fix tags in rpm spec files
> 
> Patches are named similar to sources, counting from 0.
> 
> https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s03s04.html
> ---
>  tests/20_test_rpm.py                       | 4 ++--
>  tests/data/rpm/specs/gbp-test-tags.spec    | 2 +-
>  tests/data/rpm/specs/gbp-test-updates.spec | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/20_test_rpm.py b/tests/20_test_rpm.py
> index a2cd5e0..c261c45 100644
> --- a/tests/20_test_rpm.py
> +++ b/tests/20_test_rpm.py
> @@ -231,7 +231,7 @@ class TestSpecFile(RpmTestBase):
>          spec.protected('_delete_tag')('source', 0)
>          eq_(spec.sources(), {})
>          spec.protected('_delete_tag')('patch', 0)
> -        spec.protected('_delete_tag')('patch', -1)
> +        spec.protected('_delete_tag')('patch', 1)
>          eq_(spec.protected('_patches')(), {})
>          prev = spec.protected('_delete_tag')('invalidtag', None)
>  
> @@ -314,7 +314,7 @@ class TestSpecFile(RpmTestBase):
>              for patch in spec.protected('_tags')['patch']['lines']:
>                  patches[patch['num']] = patch['linevalue']
>  
> -            eq_(patches, {0: 'my_patch0', -1: 'my_patch'})
> +            eq_(patches, {0: 'my_patch0', 1: 'my_patch'})
>  
>      def test_patch_series(self):
>          """Test the getting the patches as a patchseries"""
> diff --git a/tests/data/rpm/specs/gbp-test-tags.spec 
> b/tests/data/rpm/specs/gbp-test-tags.spec
> index d0f2e9e..19efe9f 100644
> --- a/tests/data/rpm/specs/gbp-test-tags.spec
> +++ b/tests/data/rpm/specs/gbp-test-tags.spec
> @@ -33,7 +33,7 @@ Packager:       my_packager
>  Url:            my_url
>  Vcs:            my_vcs
>  Source:         my_source
> -Patch:          my_%patch_fn_base
> +Patch1:         my_%patch_fn_base
>  Patch0:         my_%{patch_fn_base}0
>  Nosource:       0
>  Nopatch:        0
> diff --git a/tests/data/rpm/specs/gbp-test-updates.spec 
> b/tests/data/rpm/specs/gbp-test-updates.spec
> index e68f4b2..30ccb30 100644
> --- a/tests/data/rpm/specs/gbp-test-updates.spec
> +++ b/tests/data/rpm/specs/gbp-test-updates.spec
> @@ -17,7 +17,7 @@ Packager:       my_packager
>  Url:            my_url
>  Vcs:            my_vcs
>  Source:         my_source
> -Patch:          my_%patch_fn_base
> +Patch1:         my_%patch_fn_base
>  Patch0:         my_%{patch_fn_base}0
>  Nosource:       0
>  Nopatch:        0
> -- 
> 2.30.0
> 

> From 8d8e05f91a13a0fc717625cb0d9c86a0c706d831 Mon Sep 17 00:00:00 2001
> From: Jochen Sprickerhof <jspri...@debian.org>
> Date: Sat, 30 Jan 2021 16:18:10 +0100
> Subject: [PATCH 4/5] Define %python_sitelib for autopkgtest
> 
> The rpm package no longer defines this, instead there is python3_sitelib
> in /usr/lib/rpm/macros.d/macros.python3 provided by the
> python3-rpm-macros package (not in Debian).
> ---
>  debian/tests/smoke-rpm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/debian/tests/smoke-rpm b/debian/tests/smoke-rpm
> index 0380479..257bcf8 100755
> --- a/debian/tests/smoke-rpm
> +++ b/debian/tests/smoke-rpm
> @@ -25,5 +25,6 @@ if python3 -c "import setuptools"; then
>                         --git-export-dir="$GBP_TEMPDIR" \
>                         -D'%__python3 /usr/bin/python3' \
>                         -D'%__python /usr/bin/python3' \
> +                       -D'%python_sitelib %(%{__python3} -Ic "from 
> distutils.sysconfig import get_python_lib; print(get_python_lib())")' \
>                         -bb --nodeps
>  fi
> -- 
> 2.30.0
> 

> From 4dd262be810a08354dca21217227659edf5bb9a6 Mon Sep 17 00:00:00 2001
> From: Jochen Sprickerhof <jspri...@debian.org>
> Date: Sat, 30 Jan 2021 20:38:05 +0100
> Subject: [PATCH 5/5] Set %_arch in autopkgtest
> 
> Seems to be needed on armhf.
> ---
>  debian/tests/smoke-rpm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/debian/tests/smoke-rpm b/debian/tests/smoke-rpm
> index 257bcf8..b348160 100755
> --- a/debian/tests/smoke-rpm
> +++ b/debian/tests/smoke-rpm
> @@ -26,5 +26,6 @@ if python3 -c "import setuptools"; then
>                         -D'%__python3 /usr/bin/python3' \
>                         -D'%__python /usr/bin/python3' \
>                         -D'%python_sitelib %(%{__python3} -Ic "from 
> distutils.sysconfig import get_python_lib; print(get_python_lib())")' \
> +                       -D'%_arch noarch' \
>                         -bb --nodeps
>  fi
> -- 
> 2.30.0
> 

Reply via email to