Menu

#4703 [dev][wip]copr/obs compatible spec generation

2.11
open
nobody
rpm (3) yum (5)
packaging
5
2015-07-02
2015-06-16
Arif Ali
No

Hi all,

as mentioned by Jarrod on the mailing list with respect to building xCAT, and having external repos, I have been trying to buid the src.rpms from the repos on copr, and OBS without any luck.

After delving, I found that the following patch, allowed me to first create the src.rpm, and then use copr to build

diff --git a/makerpm b/makerpm
index 2266e78..224bf44 100755
--- a/makerpm
+++ b/makerpm
@@ -98,6 +98,7 @@ function makexcat {
                        echo "Unrecognized rpm: $RPMNAME"
                        exit 2
                fi

+                cp Version $RPMROOT/SOURCES

                rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm
                echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..."
diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec
index 54bea22..f47dd1c 100644
--- a/xCAT/xCAT.spec
+++ b/xCAT/xCAT.spec
@@ -1,6 +1,6 @@
 Summary: Meta-package for a common, default xCAT setup
 Name: xCAT
-Version: %(cat Version)
+Version: %(cat %_sourcedir/Version)
 Release: snap%(date +"%Y%m%d%H%M")
 License: EPL
 Group: Applications/System
@@ -14,6 +14,7 @@ Source1: xcat.conf
 Source2: postscripts.tar.gz
 Source3: templates.tar.gz
 Source5: xCATMN 
+Source8: Version

 %ifos linux
 Source4: prescripts.tar.gz

After this, doing the makerpm xCAT x86_64 creates the srpm, and allows me to import it correctly into copr, as shown in the build in the URL below

https://copr.fedoraproject.org/coprs/arifali/xcat-org/builds/

If you need me to continue to update the rest, and provide a patch if that makes sense

/cc @jbjohnso

Discussion

  • Arif Ali

    Arif Ali - 2015-06-16

    More updates,

    I have been experimenting on the OBS and trying to build xCAT-server and xCAT-vlan as a test, and they seem to be ok, after a few modifications to the spec files

    You can see the relevant builds, and mods in the following URLs

    https://build.opensuse.org/package/show/home:arif-ali80/xCAT-server
    https://build.opensuse.org/package/show/home:arif-ali80/xCAT-vlan

    I have managed to build the ubuntu RPMs as well, just need to fine tune the debian rules and spec files to build for Debian and SLES, and then we should be good to go on the SuSE's OBS system

     
  • Guang Cheng Li

    Guang Cheng Li - 2015-06-17

    Thanks Arif, the development is working on this based on the discussion on mailing list and the information in this bug.

     
  • Arif Ali

    Arif Ali - 2015-06-17

    Hi Guang,

    Below is a full diff of all the spec files that need to be changed for this to work. This are the 6 packages I have tested and got working. The only issue I faced was with perl-xCAT, as that was grabbing information from git; as there was no easy way of doing that, I temporarily changed the value to obs-build. Also the per-xCAT needed BuildRequires for it to build correctly as well.

    I hope that this is useful

    diff --git a/perl-xCAT/perl-xCAT.spec b/perl-xCAT/perl-xCAT.spec
    index 0cef475..261c3c7 100644
    --- a/perl-xCAT/perl-xCAT.spec
    +++ b/perl-xCAT/perl-xCAT.spec
    @@ -1,11 +1,11 @@
     Summary: xCAT perl libraries
     Name: perl-xCAT
    -Version: %(cat Version)
    +Version: %(cat %_sourcedir/Version)
     Release: snap%(date +"%Y%m%d%H%M")
     Epoch: 4
     License: EPL
     Group: System Environment/Libraries
    -Source: perl-xCAT-%(cat Version).tar.gz
    +Source: perl-xCAT-%{version}.tar.gz
     Packager: IBM Corp.
     Vendor: IBM Corp.
     Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
    @@ -17,14 +17,18 @@ BuildArch: noarch
     #Requires: perl-SOAP-Lite
     %endif
    
    +BuildRequires: perl-Time-HiRes, perl-DBI
    +
    +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7
    +BuildRequires: perl-Sys-Syslog
    +%endif
    +
     Provides: perl-xCAT = %{epoch}:%{version}
    
     %description
     Provides perl xCAT libraries for core functionality.  Required for all xCAT installations.
     Includes xCAT::Table, xCAT::NodeRange, among others.
    
    -%define gitinfo %(git log -n 1 | head -n 1 | cut -f 2 -d ' ')
    -
     %define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
     %define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
    
    @@ -38,7 +42,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others.
     %if %fsm
     %else
     # Modify the Version() function in xCAT/Utils.pm to automatically have the correct version
    -./modifyUtils %{version} %{gitinfo}
    +./modifyUtils %{version} obs-build
    
     # Build the pod version of the man pages for each DB table.  It puts them in the man5 and man7 subdirs.
     # Then convert the pods to man pages and html pages.
    diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec
    index d0a716e..2dccbdd 100644
    --- a/xCAT-client/xCAT-client.spec
    +++ b/xCAT-client/xCAT-client.spec
    @@ -1,11 +1,11 @@
     Summary: Core executables and data of the xCAT management project
     Name: xCAT-client
    -Version: %(cat Version)
    +Version: %(cat %_sourcedir/Version)
     Release: snap%(date +"%Y%m%d%H%M")
     Epoch: 4
     License: EPL
     Group: Applications/System
    -Source: xCAT-client-%(cat Version).tar.gz
    +Source: xCAT-client-%{version}.tar.gz
     Packager: IBM Corp.
     Vendor: IBM Corp.
     Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
    @@ -23,7 +23,7 @@ BuildArch: noarch
    
     Provides: xCAT-client = %{epoch}:%{version}
    
    -Requires: perl-xCAT >= %{epoch}:%(cat Version)
    +Requires: perl-xCAT >= %{epoch}:%{version}
    
     # fping or nmap is needed by pping (in case xCAT-client is installed by itself on a remote client)
     %ifos linux
    diff --git a/xCAT-confluent/xCAT-confluent.spec b/xCAT-confluent/xCAT-confluent.spec
    index b6a4187..7c435ec 100644
    --- a/xCAT-confluent/xCAT-confluent.spec
    +++ b/xCAT-confluent/xCAT-confluent.spec
    @@ -1,11 +1,11 @@
     Summary: xCAT integration with confluent systems management server
     Name: xCAT-confluent
    -Version: %(cat Version)
    +Version: %(cat %_sourcedir/Version)
     Release: snap%(date +"%Y%m%d%H%M")
     Epoch: 4
     License: EPL
     Group: Applications/System
    -Source: xCAT-confluent-%(cat Version).tar.gz
    +Source: xCAT-confluent-%{version}.tar.gz
     Packager: IBM Corp.
     Vendor: IBM Corp.
     Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
    diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec
    index e8833c8..87ec4ef 100644
    --- a/xCAT-server/xCAT-server.spec
    +++ b/xCAT-server/xCAT-server.spec
    @@ -1,11 +1,11 @@
     Summary: Server and configuration utilities of the xCAT management project
     Name: xCAT-server
    -Version: %(cat Version)
    +Version: %(cat %_sourcedir/Version)
     Release: snap%(date +"%Y%m%d%H%M")
     Epoch: 4
     License: EPL
     Group: Applications/System
    -Source: xCAT-server-%(cat Version).tar.gz
    +Source: xCAT-server-%{version}.tar.gz
     Packager: IBM Corp.
     Vendor: IBM Corp.
     Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
    
     
  • Guang Cheng Li

    Guang Cheng Li - 2015-07-02

    xCAT 2.10 is now in restricted mode, moving this bug to 2.11 for further investigation.

     
  • Guang Cheng Li

    Guang Cheng Li - 2015-07-02
    • Milestone: 2.10 --> 2.11
     
MongoDB Logo MongoDB