Patchwork [12,of,22] Makefile: replace platform specific rpm build targets with rpm and rpm-py

login
register
mail settings
Submitter Mads Kiilerich
Date May 20, 2014, 2:10 a.m.
Message ID <75c1b9ca364425224584.1400551807@mk-desktop>
Download mbox | patch
Permalink /patch/4834/
State Changes Requested
Headers show

Comments

Mads Kiilerich - May 20, 2014, 2:10 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1400551681 -7200
#      Tue May 20 04:08:01 2014 +0200
# Node ID 75c1b9ca3644252245840f7276f8223803805a4e
# Parent  b71a9c09bdc9b2a04679a34e0ef0765ffbbbb933
Makefile: replace platform specific rpm build targets with rpm and rpm-py

Builds for other revisions can be done with:
  make rpm REV=stable

build/rpm/ will be used as rpm build dir and the produces binaries can be found
there. This change might break docker builds - we will fix that soon.
Matt Mackall - May 20, 2014, 4:20 p.m.
On Tue, 2014-05-20 at 04:10 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1400551681 -7200
> #      Tue May 20 04:08:01 2014 +0200
> # Node ID 75c1b9ca3644252245840f7276f8223803805a4e
> # Parent  b71a9c09bdc9b2a04679a34e0ef0765ffbbbb933
> Makefile: replace platform specific rpm build targets with rpm and rpm-py

It's quite intentional that there's a "make fedora" target (regardless
of how redundant it currently appears). I don't think it's a safe
assumption that the package contents and build process for Fedora vs
Centos 6 are constant, and we haven't even brought SuSE or any of the
other RPM-based distros into the mix.
Mads Kiilerich - May 20, 2014, 6:51 p.m.
On 05/20/2014 06:20 PM, Matt Mackall wrote:
> On Tue, 2014-05-20 at 04:10 +0200, Mads Kiilerich wrote:
>> # HG changeset patch
>> # User Mads Kiilerich <madski@unity3d.com>
>> # Date 1400551681 -7200
>> #      Tue May 20 04:08:01 2014 +0200
>> # Node ID 75c1b9ca3644252245840f7276f8223803805a4e
>> # Parent  b71a9c09bdc9b2a04679a34e0ef0765ffbbbb933
>> Makefile: replace platform specific rpm build targets with rpm and rpm-py
> It's quite intentional that there's a "make fedora" target (regardless
> of how redundant it currently appears). I don't think it's a safe
> assumption that the package contents and build process for Fedora vs
> Centos 6 are constant, and we haven't even brought SuSE or any of the
> other RPM-based distros into the mix.

I agree that there might be differences in some details. Currently there 
is no significant differences.

Most of the difference will be inside the spec file where it usually is 
handled using macros and conditionals. One such difference is in how 
Python 2.4 currently has to be handled slightly different.

I doubt there will be differences where the best abstraction is at the 
Makefile level and exposed as different make targets. I would imagine 
that it would be something that is handled inside rpmbuild or 
dockerbuild, similar to how we now "dispatch" to different docker files.

The current Makefile already have differences between the fedora and the 
centos6 target - I assume that is a "bug". Would you prefer to add yet 
another similar section for centos5 and fedora19 and fedorarawhide?

/Mads
Matt Mackall - May 20, 2014, 9:14 p.m.
On Tue, 2014-05-20 at 20:51 +0200, Mads Kiilerich wrote:
> On 05/20/2014 06:20 PM, Matt Mackall wrote:
> > On Tue, 2014-05-20 at 04:10 +0200, Mads Kiilerich wrote:
> >> # HG changeset patch
> >> # User Mads Kiilerich <madski@unity3d.com>
> >> # Date 1400551681 -7200
> >> #      Tue May 20 04:08:01 2014 +0200
> >> # Node ID 75c1b9ca3644252245840f7276f8223803805a4e
> >> # Parent  b71a9c09bdc9b2a04679a34e0ef0765ffbbbb933
> >> Makefile: replace platform specific rpm build targets with rpm and rpm-py
> > It's quite intentional that there's a "make fedora" target (regardless
> > of how redundant it currently appears). I don't think it's a safe
> > assumption that the package contents and build process for Fedora vs
> > Centos 6 are constant, and we haven't even brought SuSE or any of the
> > other RPM-based distros into the mix.
> 
> I agree that there might be differences in some details. Currently there 
> is no significant differences.

The fact that the two such targets that current exists are nearly
identical is not an accident. It's simply evidence that adding a second
RPM-based target was trivial and adding 'gentoo' or 'windows' targets
was not. RPM-based packages are simply the easiest, least interesting
piece of what I'm trying to do here.

In the bigger picture of all the OSes we might ever want to support
building on, Fedora being able to share build rules with Centos is a
local, possibly temporary quirk and a distraction from the stated goal
of making package building on <OS> be as easy as typing "make <os>".

So there will be "make <os>" targets, end of story. If you want to
factor out some rule commonality, great. I'm also open to tweaking the
names (as there's already obviously some tension with version numbers)
and adding options. You can even add a generic 'rpm' target. But leave
the OS-specific targets in place.

(I'm also not keen on changing the docker-* target names. I don't want
to rule out alternate future (non-Linux? VM-based?) cross-build
solutions, nor do I want to force people building native packages to
have to use Docker.)

Patch

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -134,27 +134,20 @@  i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n
 
 # Packaging targets
 
-fedora:
-	mkdir -p build/fedora
-	contrib/buildrpm
-	cp rpmbuild/RPMS/*/* build/fedora
-	cp rpmbuild/SRPMS/* build/fedora
-	rm -rf rpmbuild
+rpm:
+	contrib/buildrpm --rpmbuilddir $(PWD)/build/rpm
+
+rpm-py:
+	contrib/buildrpm --rpmbuilddir $(PWD)/build/rpm --withpython --suffix -py
 
 docker-fedora:
 	mkdir -p build/fedora
 	contrib/dockerrpm fedora
 
-centos6:
-	mkdir -p build/centos6
-	contrib/buildrpm
-	cp rpmbuild/RPMS/*/* build/centos6
-	cp rpmbuild/SRPMS/* build/centos6
-
 docker-centos6:
 	mkdir -p build/centos6
 	contrib/dockerrpm centos6
 
 .PHONY: help all local build doc clean install install-bin install-doc \
 	install-home install-home-bin install-home-doc dist dist-notests tests \
-	update-pot fedora docker-fedora
+	update-pot rpm rpm-py docker-fedora