linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Hoogerhuis <alexh@ihatent.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: [PATCH] RPM build target fixes
Date: 09 Mar 2002 22:03:36 +0100	[thread overview]
Message-ID: <m3u1rpa1xz.fsf@lapper.ihatent.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 666 bytes --]

Attached is a patch to make life easier for building RPMs from the
source.

Basically it adds:

* .spec files are named with version included
* a .spec file is placed in %_topdir/SPECS on sucessful build so you
  can do a rpm -bb kernel-x.y.z.spec to recreate the packages.
* a tarball with current source and config is placed in
  %_topdir/SOURCE after a sucessful build, and also contains a .spec
  file so anyone can do a rpm -ta tarball.tar.gz.
* a source RPM is left in %_topdir/SRPMS after a successful build.
* a binary RPM is left in %_topdir/RPMS/%_arch for easy install.

Created against 2.4.19-pre2-ac3, but should apply cleanly to any
2.4.18 or better.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Quick hack for RPM build target --]
[-- Type: text/x-patch, Size: 2424 bytes --]

--- linux-2.4-clean/Makefile	Sat Mar  9 21:53:28 2002
+++ linux-2.4-ac/Makefile	Sat Mar  9 20:42:56 2002
@@ -522,7 +522,13 @@
 #	If you do a make spec before packing the tarball you can rpm -ta it
 #
 spec:
-	. scripts/mkspec >kernel.spec
+	RPMDIR=$(shell rpm --eval \%_topdir) ; \
+	[ -f $(TOPDIR)/kernel-*.spec ] && \
+		rm $(TOPDIR)/kernel-*.spec ; \
+	[ -f $$RPMDIR/SPECS/kernel-$(VERSION).$(PATCHLEVEL).*$(EXTRAVERSION).spec ] && \
+		rm $$RPMDIR/SPECS/kernel-$(VERSION).$(PATCHLEVEL).*$(EXTRAVERSION).spec ; \
+	. scripts/mkspec >$(TOPDIR)/kernel-$(KERNELRELEASE).spec ; \
+	. scripts/mkspec >$$RPMDIR/SPECS/kernel-$(KERNELRELEASE).spec ; 
 
 #
 #	Build a tar ball, generate an rpm from it and pack the result
@@ -533,12 +539,26 @@
 #
 rpm:	clean spec
 	find . \( -size 0 -o -name .depend -o -name .hdepend \) -type f -print | xargs rm -f
-	set -e; \
-	cd $(TOPDIR)/.. ; \
-	ln -sf $(TOPDIR) $(KERNELPATH) ; \
-	tar -cvz --exclude CVS -f $(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
-	rm $(KERNELPATH) ; \
-	cd $(TOPDIR) ; \
-	. scripts/mkversion > .version ; \
-	rpm -ta $(TOPDIR)/../$(KERNELPATH).tar.gz ; \
-	rm $(TOPDIR)/../$(KERNELPATH).tar.gz
+	RPMDIR=$(shell rpm --eval \%_topdir) ; \
+	. scripts/mkversion > .version.tmp ; \
+	mv .version.tmp .version ; \
+        cd $$RPMDIR/SOURCES ; \
+        ln -sf $(TOPDIR) $(KERNELPATH) ; \
+        tar -cz --exclude CVS -f $$RPMDIR/SOURCES/$(KERNELPATH).tar.gz $(KERNELPATH)/. ; \
+        rm $(KERNELPATH) ; \
+        rm $(TOPDIR)/kernel-$(KERNELRELEASE).spec ; \
+        cd $(TOPDIR) ; \
+        rpm -ba $$RPMDIR/SPECS/kernel-$(KERNELRELEASE).spec ; \
+        if [ $$? -ne 0 ]; then \
+                RPMARCH=(shell rpm --eval \%_arch) ; \
+                [ -f $$RPMDIR/SPECS/kernel-$(KERNELRELEASE).spec ] && \
+                        rm $$RPMDIR/SPECS/kernel-$(KERNELRELEASE).spec ; \
+                [ -f $$RPMDIR/SRPMS/$(KERNELPATH).src.rpm ] && \
+                        rm $$RPMDIR/SRPMS/$(KERNELPATH).src.rpm ; \
+                [ -f $$RPMDIR/RPMS/$$RPMARCH/$(KERNELPATH).$$RPMARCH.rpm ] && \
+                        rm $$RPMDIR/RPMS/$$RPMARCH/$(KERNELPATH).$$RPMARCH.rpm ; \
+                [ -f $$RPMDIR/SOURCES/$(KERNELPATH).tar.gz ] && \
+                        rm $$RPMDIR/SOURCES/$(KERNELPATH).tar.gz ; \
+                [ -d $$RPMDIR/BUILD/$(KERNELPATH) ] && \
+                        rm -rf $$RPMDIR/BUILD/$(KERNELPATH) ; \
+        fi ;

[-- Attachment #3: Type: text/plain, Size: 214 bytes --]


ttfn,
A
-- 
Alexander Hoogerhuis                               | alexh@ihatent.com
CCNP - CCDP - MCNE - CCSE                          | +47 908 21 485
"You have zero privacy anyway. Get over it."  --Scott McNealy

             reply	other threads:[~2002-03-09 21:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-09 21:03 Alexander Hoogerhuis [this message]
2002-03-09 21:35 ` [PATCH] RPM build target fixes Alan Cox
2002-03-10  9:31   ` Alexander Hoogerhuis
2002-03-10 12:59     ` Alan Cox
2002-03-10 17:17       ` Alexander Hoogerhuis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3u1rpa1xz.fsf@lapper.ihatent.com \
    --to=alexh@ihatent.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).