Re: [PATCH] Small script to patch .spec for Suse

9 messages, 6 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Small script to patch .spec for Suse

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:12

Josef Weidendorfer [off-list ref] writes:
Everytime I update and want to generate RPM packages for
my Suse distribution, I have to patch the git-core.spec.in
Here is the current script for patching. It is only about
package names, so a seperate .spec file would
be overkill and a maintenance problem for me.
I've applied the patch from HPA to update it to git.spec already
in my tree, so your script would not work any more ;-)

But seriously, I suspect we should take a hint from the fact
that "git.spec.in" has ".in" in its name already.

Right now, git.spec is generated with this:

    git.spec: git.spec.in Makefile
            sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@

So presumably you could do something like this:

    --- git.spec.in
    +++ git.spec.in
    @@ -9,3 +9,3 @@
     Source:        http://kernel.org/pub/software/scm/git/%{name}-%{...
    -BuildRequires: zlib-devel >= 1.2, openssl-devel, curl-devel, exp...
    +BuildRequires: @@BUILD_REQUIRES@@
     BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(...
    @@ -26,3 +26,3 @@
     Group:         Development/Tools
    -Requires:      zlib >= 1.2, rsync, rcs, curl, less, openssh-clie...
    +Requires:      @@CORE_REQUIRES@@
     %description core
    @@ -40,3 +40,3 @@
     Group:          Development/Tools
    -Requires:       git-core = %{version}-%{release}, subversion
    +Requires:       git-core = %{version}-%{release}, @@SVN_REQUIRES@@
     %description svn
    @@ -47,3 +47,3 @@
     Group:          Development/Tools
    -Requires:       git-core = %{version}-%{release}, cvs, cvsps
    +Requires:       git-core = %{version}-%{release}, @@CVS_REQUIRES@@
    ...

and have something like this in the Makefile when you munge
git.spec.in to produce git.spec for use with rpmbuild?

    RPM_BUILD_REQUIRES = zlib-devel >= 1.2 openssl-devel ...
    RPM_CORE_REQUIRES = zlib >= 1.2 rsync rcs curl less ...
    ifdef SUSE
    include suse.rpm.defs
    endif
    git.spec: git.spec.in Makefile
            sed \
                -e 's/@@VERSION@@/$(GIT_VERSION)/g' \
                -e 's/@@BUILD_REQUIRES@@/$(RPM_BUILD_REQUIRES)/g' \
                -e 's/@@CORE_REQUIRES@@/$(RPM_CORE_REQUIRES)/g' \
                -e 's/@@SVN_REQUIRES@@/$(RPM_SVN_REQUIRES)/g' \
                -e 's/@@CVS_REQUIRES@@/$(RPM_CVS_REQUIRES)/g' \
                -e 's/@@TLA_REQUIRES@@/$(RPM_TLA_REQUIRES)/g' \
                -e 's/@@EMAIL_REQUIRES@@/$(RPM_EMAIL_REQUIRES)/g' \
                -e 's/@@GITK_REQUIRES@@/$(RPM_GITK_REQUIRES)/g' \
	        <$< >$@

Re: [PATCH] Small script to patch .spec for Suse

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:42:12

Junio C Hamano wrote:
I've applied the patch from HPA to update it to git.spec already
in my tree, so your script would not work any more ;-)

But seriously, I suspect we should take a hint from the fact
that "git.spec.in" has ".in" in its name already.
I'd prefer to have just @@OPENSSH_PACKAGE@@ and @@EXPAT_PACKAGE@@ 
instead of completely virtualizing the dependencies.  Less flexible to 
be sure, but it makes it less confusing to read and fix.

	-hpa

Re: [PATCH] Small script to patch .spec for Suse

From: Andreas Ericsson <hidden>
Date: 2016-06-15 22:42:12

H. Peter Anvin wrote:
I'd prefer to have just @@OPENSSH_PACKAGE@@ and @@EXPAT_PACKAGE@@ 
instead of completely virtualizing the dependencies.  Less flexible to 
be sure, but it makes it less confusing to read and fix.
git doesn't, strictly speaking, require openssh, for two reasons;
a. It's been known to work equally well over rsh.
b. ssh is run as an executed command. ssh can be installed later and the 
previously installed git will start working just like magic.

If you really *want* an openssh requirement, you should just go with
Requires: /usr/bin/ssh
It's the most accurate one after all, since git doesn't really care 
which package it came from so long as it's there.

As for BuildRequires, I think package maintainers can be trusted to 
figure those out for themselves. It's not as if they'll be producing 
flawed RPM's after all.

If you want one for expat anyways, then go with
BuildRequires: expat
since that's true for both dists (and FC maintainers will then happily 
figure out that they need expat-devel to build it).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Re: [PATCH] Small script to patch .spec for Suse

From: Petr Baudis <hidden>
Date: 2016-06-15 22:42:12

Dear diary, on Tue, Nov 15, 2005 at 09:36:52PM CET, I got a letter
where "H. Peter Anvin" [off-list ref] said that...
Junio C Hamano wrote:
quoted
I've applied the patch from HPA to update it to git.spec already
in my tree, so your script would not work any more ;-)

But seriously, I suspect we should take a hint from the fact
that "git.spec.in" has ".in" in its name already.
I'd prefer to have just @@OPENSSH_PACKAGE@@ and @@EXPAT_PACKAGE@@ 
instead of completely virtualizing the dependencies.  Less flexible to 
be sure, but it makes it less confusing to read and fix.
Actually, can you have some kind of %if in specfiles? Then you could
keep everything in the specfile and just pass it whatever system you
want to build for.

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

Re: [PATCH] Small script to patch .spec for Suse

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:42:12

Petr Baudis wrote:
Actually, can you have some kind of %if in specfiles? Then you could
keep everything in the specfile and just pass it whatever system you
want to build for.
Sure.  It's called %if.  There is also %ifdef and %define.

	-hpa

Re: [PATCH] Small script to patch .spec for Suse

From: Josef Weidendorfer <hidden>
Date: 2016-06-15 22:42:12

On Tuesday 15 November 2005 23:22, H. Peter Anvin wrote:
Sure.  It's called %if.  There is also %ifdef and %define.
So by replacing @@FOR_SUSE@@ to 0 or 1 in the Makefile, this: 

 %if @@FOR_SUSE@@
 BuildRequires: openssh ...
 %else
 BuildRequires: openssh-clients ...
 %endif

would work?

Josef

Re: [PATCH] Small script to patch .spec for Suse

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:42:12

Josef Weidendorfer wrote:
On Tuesday 15 November 2005 23:22, H. Peter Anvin wrote:
quoted
Sure.  It's called %if.  There is also %ifdef and %define.

So by replacing @@FOR_SUSE@@ to 0 or 1 in the Makefile, this: 

 %if @@FOR_SUSE@@
 BuildRequires: openssh ...
 %else
 BuildRequires: openssh-clients ...
 %endif

would work?
SuSE might even have defined a distribution-specific macro that one can 
key off of.  Some SuSE expert would have to comment.

	-hpa

Re: [PATCH] Small script to patch .spec for Suse

From: "H. Peter Anvin" <hpa@zytor.com>
Date: 2016-06-15 22:42:12

A Large Angry SCM wrote:
Attached is the output of 'rpm --showrc' on my Suse 9.3 system.

-14: _vendor	suse
... looks promising.

	-hpa

Re: [PATCH] Small script to patch .spec for Suse

From: A Large Angry SCM <hidden>
Date: 2016-06-15 22:42:12

H. Peter Anvin wrote:
Josef Weidendorfer wrote:
quoted
On Tuesday 15 November 2005 23:22, H. Peter Anvin wrote:
quoted
Sure.  It's called %if.  There is also %ifdef and %define.

So by replacing @@FOR_SUSE@@ to 0 or 1 in the Makefile, this:
 %if @@FOR_SUSE@@
 BuildRequires: openssh ...
 %else
 BuildRequires: openssh-clients ...
 %endif

would work?
SuSE might even have defined a distribution-specific macro that one can 
key off of.  Some SuSE expert would have to comment.
Attached is the output of 'rpm --showrc' on my Suse 9.3 system.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help