#24 Add patch from upstream pull-request to add a flatpak-build subcommand
Merged 5 years ago by cqi. Opened 5 years ago by otaylor.
rpms/ otaylor/rpkg flatpak-build  into  f29

file added
+1110
The added file is too large to be shown here, see it at: add-flatpak-build.patch
file modified
+30 -2
@@ -4,7 +4,7 @@ 

  

  Name:           rpkg

  Version:        1.56

- Release:        1%{?dist}

+ Release:        2%{?dist}

  

  Summary:        Python library for interacting with rpm+git

  License:        GPLv2+ and LGPLv2
@@ -22,6 +22,8 @@ 

  # and there is only old rpm-python package in EL6 and 7, so just simply to

  # remove rpm-py-installer for now.

  Patch0:         remove-koji-and-rpm-py-installer-from-requires.patch

+ # https://pagure.io/rpkg/pull-request/361

+ Patch1:         add-flatpak-build.patch

  

  %if 0%{?fedora} || 0%{?rhel} > 7

  # Enable python3 build by default
@@ -52,6 +54,7 @@ 

  BuildRequires:  python2-koji >= 1.15

  BuildRequires:  python2-cccolutils

  BuildRequires:  python2-openidc-client

+ BuildRequires:  PyYAML

  

  %if 0%{?rhel}

  BuildRequires:  GitPython
@@ -60,11 +63,16 @@ 

  BuildRequires:  python-six >= 1.9.0

  %else

  BuildRequires:  python2-GitPython

+ BuildRequires:  python2-gobject-base

  BuildRequires:  python2-pycurl

  BuildRequires:  python2-requests

  BuildRequires:  python2-six >= 1.9.0

  %endif

  

+ %if 0%{?rhel} && 0%{?rhel} == 7

+ BuildRequires:  python-gobject-base

+ %endif

+ 

  %if 0%{?rhel} && 0%{?rhel} < 7

  BuildRequires:  python-argparse

  BuildRequires:  python-mock
@@ -75,6 +83,7 @@ 

  BuildRequires:  python2-mock

  BuildRequires:  python2-nose

  BuildRequires:  python2-setuptools

+ BuildRequires:  libmodulemd

  %endif

  

  BuildRequires:  rpmlint
@@ -86,6 +95,7 @@ 

  

  Requires:       python2-cccolutils

  Requires:       python2-koji >= 1.15

+ Requires:       PyYAML

  

  %if 0%{?rhel}

  Requires:       GitPython >= 0.2.0
@@ -98,10 +108,18 @@ 

  Requires:       python2-rpm

  Requires:       python2-pycurl

  Requires:       python2-six >= 1.9.0

+ Requires:       python2-gobject-base

+ 

+ Requires:       libmodulemd

  %endif

  

  %if 0%{?rhel} && 0%{?rhel} < 7

- Requires:  python-argparse

+ Requires:       python-argparse

+ %endif

+ 

+ %if 0%{?rhel} && 0%{?rhel} == 7

+ Requires:       python-gobject-base

+ Requires:       libmodulemd

  %endif

  

  Requires:       %{name}-common = %{version}-%{release}
@@ -135,6 +153,8 @@ 

  BuildRequires:  python3-requests

  BuildRequires:  python3-setuptools

  BuildRequires:  python3-nose

+ BuildRequires:  python3-gobject-base

+ BuildRequires:  python3-PyYAML

  

  BuildRequires:  rpmlint

  
@@ -149,6 +169,9 @@ 

  Requires:       python3-rpm

  Requires:       python3-pycurl

  Requires:       python3-six >= 1.9.0

+ Requires:       python3-gobject-base

+ Requires:       python3-PyYAML

+ Requires:       libmodulemd

  

  Requires:       %{name}-common = %{version}-%{release}

  
@@ -173,6 +196,7 @@ 

  %prep

  %setup -q

  %patch0 -p1

+ %patch1 -p1

  

  

  %build
@@ -246,6 +270,10 @@ 

  

  

  %changelog

+ * Fri Sep  7 2018 Owen Taylor <otaylor@redhat.com> - 1.56-2

+ - Add patch from upstream pull-request to add a flatpak-build subcommand

+ - Add PyYAML dependencies so that the spec file at least builds on epel6/epel7

+ 

  * Tue Aug 21 2018 Chenxiong Qi <cqi@redhat.com> - 1.56-1

  - Validate greenwave policy early in Commands.build (cqi)

  - Refine error message for failure gating.yaml validation (cqi)

See https://pagure.io/rpkg/pull-request/361

This also adds PyYAML dependencies - without this, the spec file didn't
work on EPEL6/EPEL7 and it was hard to test the conditionalization.


Now that upstream flatpak-build PR is agreed upon, here's a patch to add it to Fedora packaging.

I think I have the conditionals right for el targets.

EPEL7 scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=29524820
EPEL6 scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=29524884

Looks good to me :thumbsup:

In these two paragraphs (this and previous one) there is different indentation than in rest of file.

Except that one minor comment I am OK with it.

rebased onto 33cc0deb6bb38105eefdb100f8a2106edb83d9f3

5 years ago

Pushed a new version that fixes the indentation on those Requires. Thanks for the review!

Good, thank you. I do not have proper rights, @cqi could merge it.

Since flatpat-build is not available for EL6 only, should this be %if 0%{?rhel} && 0%{?rhel} >= 7?

Since flatpat-build is not available for EL6 only, should this be %if 0%{?rhel} && 0%{?rhel} >= 7?

If yes, python-gobject-basecould move to below %if condition.

I wouldn't change that, since we don't really know what exactly rhel > 7 will look like.

F27 build fails with error No matching package to install: 'python2-pyyaml'.

Task ID: https://koji.fedoraproject.org/koji/taskinfo?taskID=29642710

This is detected by building rpkg and fedpkg in chain in epel-7-x86_64 chroot. It seems libmodulemd is not listed in Requires: for EL7.

+ /usr/bin/python2 doc/fedpkg_man_page.py
BUILDSTDERR: Traceback (most recent call last):
BUILDSTDERR:   File "doc/fedpkg_man_page.py", line 19, in <module>
BUILDSTDERR:     import pyrpkg.man_gen
BUILDSTDERR:   File "/usr/lib/python2.7/site-packages/pyrpkg/__init__.py", line 55, in <module>
BUILDSTDERR:     gi.require_version('Modulemd', '1.0')  # raises ValueError
BUILDSTDERR:   File "/usr/lib64/python2.7/site-packages/gi/__init__.py", line 99, in require_version
BUILDSTDERR:     raise ValueError('Namespace %s not available' % namespace)
BUILDSTDERR: ValueError: Namespace Modulemd not available
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.Bmd9V0 (%build)
BUILDSTDERR:     Bad exit status from /var/tmp/rpm-tmp.Bmd9V0 (%build)

I had 0%{?rhel} == 7, from the guess that the naming python-gobject-base (as opposed to python2-gobject-base, as in Fedora currently), won't be found in future rhel.

F27 build fails with error No matching package to install: 'python2-pyyaml'.

Sorry - I didn't think of testing with F27. I think the best thing to do would be to require PyYAML on all distros instead of python2-pyyaml - since python2-pyyaml Provides: PyYAML. Considering that python2 in general is deprecated in Fedora, I don't think there's a lot of benefit of using the newer python2-pyyaml name. Does that sound good?

This is detected by building rpkg and fedpkg in chain in epel-7-x86_64 chroot. It seems libmodulemd is not listed in Requires: for EL7.

I'm not understanding this. The spec file has:

%if 0%{?rhel} && 0%{?rhel} < 7
[...]
%else
[...]
BuildRequires:  libmodulemd
%endif

and the scratch build referred to above installed libmodulemd as a BuildRequires and worked. Are you sure the 'rhel' macro was set right for your build?

@otaylor I didn't change this patch before build. The error is about Requires:. That is because while building fedpkg, it imports pyrpkg.man_gen in order to generate man page, the latter then imports libmodulemd.

Requires: libmodulemd should be added to %if 0%{?rhel} && 0%{?rhel} == 7.

Sorry - I didn't think of testing with F27. I think the best thing to do would be to require PyYAML on all distros instead of python2-pyyaml - since python2-pyyaml Provides: PyYAML. Considering that python2 in general is deprecated in Fedora, I don't think there's a lot of benefit of using the newer python2-pyyaml name. Does that sound good?

Sorry, I don't understand. Do you mean to use PyYAML or not? Currently, f27 is still an active release, we have to build f27 package. In f27, only name PyYAML is available.

Following changes fixes both issues.

diff --git a/rpkg.spec b/rpkg.spec
index 58d41ef..6e40138 100644
--- a/rpkg.spec
+++ b/rpkg.spec
@@ -67,7 +67,7 @@ BuildRequires:  python2-gobject-base
 BuildRequires:  python2-pycurl
 BuildRequires:  python2-requests
 BuildRequires:  python2-six >= 1.9.0
-BuildRequires:  python2-pyyaml
+BuildRequires:  PyYAML
 %endif

 %if 0%{?rhel} && 0%{?rhel} == 7
@@ -109,7 +109,7 @@ Requires:       python2-rpm
 Requires:       python2-pycurl
 Requires:       python2-six >= 1.9.0
 Requires:       python2-gobject-base
-Requires:       python2-pyyaml
+Requires:       PyYAML

 Requires:       libmodulemd
 %endif
@@ -121,6 +121,7 @@ Requires:       python-argparse
 %if 0%{?rhel} && 0%{?rhel} == 7
 Requires:       python-gobject-base
 Requires:       PyYAML
+Requires:       libmodulemd
 %endif

 Requires:       %{name}-common = %{version}-%{release}

rebased onto 05492ac

5 years ago

@otaylor I didn't change this patch before build. The error is about Requires:. That is because while building fedpkg, it imports pyrpkg.man_gen in order to generate man page, the latter then imports libmodulemd.

I agree that the Requires is missing. I'll fix that. But I don't see how that affects the build - Requires: has no effect at build time. It only affects the generated RPMs.

Do you mean to use PyYAML or not? Currently, f27 is still an active release, we have to build f27 package. In f27, only name PyYAML is available.

I don't care if flatpak-build is added for f27 or not. But I understand that you want to use the same spec file across all releases. I've pushed an updated version of my patch that should work on all releases.

But I understand that you want to use the same spec file across all releases

This what I did in the past. After f27 reaches its EOL, it doesn't need to care about it.

Sorry for late response. I have succeeded to build rpkg with this patch and fedpkg together. I'll test to install it and schedule a flatpak build tomorrow.

Looks good to me. Install f28 package successfully and scheduled a scratch build https://koji.stg.fedoraproject.org/koji/taskinfo?taskID=90004294

What's next? Can we land this and push out an update for Fedora 28 and Fedora 29?

Pull-Request has been merged by cqi

5 years ago