From: Junio C Hamano Date: Tue, 15 Nov 2005 18:50:35 GMT Subject: Re: [PATCH] Small script to patch .spec for Suse Message-ID: <7vfypxlp8k.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <200511151230.30030.Josef.Weidendorfer@gmx.de> Josef Weidendorfer 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' \ <$< >$@