public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RPM build target fixes
@ 2002-03-09 21:03 Alexander Hoogerhuis
  2002-03-09 21:35 ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Hoogerhuis @ 2002-03-09 21:03 UTC (permalink / raw)
  To: Alan Cox, linux-kernel

[-- 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RPM build target fixes
  2002-03-09 21:03 [PATCH] RPM build target fixes Alexander Hoogerhuis
@ 2002-03-09 21:35 ` Alan Cox
  2002-03-10  9:31   ` Alexander Hoogerhuis
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2002-03-09 21:35 UTC (permalink / raw)
  To: Alexander Hoogerhuis; +Cc: Alan Cox, linux-kernel

> * .spec files are named with version included

Thats exactly the opposite of what is expected

Alan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RPM build target fixes
  2002-03-09 21:35 ` Alan Cox
@ 2002-03-10  9:31   ` Alexander Hoogerhuis
  2002-03-10 12:59     ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Hoogerhuis @ 2002-03-10  9:31 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> > * .spec files are named with version included
> 
> Thats exactly the opposite of what is expected
> 

How so? Given that it actually cleans up after itself you are not left
with multiple .spec files in any directory? Or have I missed something?

> Alan

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RPM build target fixes
  2002-03-10  9:31   ` Alexander Hoogerhuis
@ 2002-03-10 12:59     ` Alan Cox
  2002-03-10 17:17       ` Alexander Hoogerhuis
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2002-03-10 12:59 UTC (permalink / raw)
  To: Alexander Hoogerhuis; +Cc: Alan Cox, linux-kernel

> > Thats exactly the opposite of what is expected
> 
> How so? Given that it actually cleans up after itself you are not left
> with multiple .spec files in any directory? Or have I missed something?

Most source rpm packages come with a [packagename.spec] file without a 
version.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] RPM build target fixes
  2002-03-10 12:59     ` Alan Cox
@ 2002-03-10 17:17       ` Alexander Hoogerhuis
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Hoogerhuis @ 2002-03-10 17:17 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox <alan@lxorguk.ukuu.org.uk> writes:

> > > Thats exactly the opposite of what is expected
> > 
> > How so? Given that it actually cleans up after itself you are not left
> > with multiple .spec files in any directory? Or have I missed something?
> 
> Most source rpm packages come with a [packagename.spec] file without a 
> version.
> 

OK, so the .spec in the tarball should be without (for rpm -ta), and
the one left in %_topdir/SPECS should carry it?

Basically why I made the .spec files carry the version was that I have
several trees (linux-2.4-[ac|plain|clean|mystuff] and
linux-2.5-[dj|plain|clean]) and that way I can build the trees without
interfering with eachoter, as all the .spec files, tarballs, RPMs and
SRPMs will actually be named something like
kernel-$version-$extraversion. That way, if you build two trees they
wont stamp on eachother.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-03-10 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-09 21:03 [PATCH] RPM build target fixes Alexander Hoogerhuis
2002-03-09 21:35 ` Alan Cox
2002-03-10  9:31   ` Alexander Hoogerhuis
2002-03-10 12:59     ` Alan Cox
2002-03-10 17:17       ` Alexander Hoogerhuis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox