Skip to contentSkip to conversation

add git.spec and adapt Makefile for RPM build

PATCH In review Kay Sievers 4 participants 8 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add git.spec and adapt Makefile for RPM build

Add support for building the rpm package directly from the git tree.

---

Makefile +9 -1
@@ -7,6 +7,10 @@
 # BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
 # break unless your underlying filesystem supports those sub-second times
 # (my ext3 doesn't).
+
+prefix=$(HOME)
+bindir=$(prefix)/bin
+
 CFLAGS=-g -O2 -Wall
 
 CC=gcc
@@ -26,7 +30,11 @@ PROG=   git-update-cache git-diff-files 
 all: $(PROG)
 
 install: $(PROG) $(SCRIPTS)
-	install $(PROG) $(SCRIPTS) $(HOME)/bin/
+	install -m755 -d $(DESTDIR)$(bindir)
+	install $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
+
+uninstall:
+	cd $(DESTDIR)$(bindir) && rm $(PROG) $(SCRIPTS)
 
 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 	 tag.o date.o

Created: git.spec (mode:100644)

git.spec new file +44 -0

44 lines not on this page · raw message

#1 lore raw
Quoted 1 line · Kay Sievers

Add support for building the rpm package directly from the git tree.

This version creates the git.spec from a git.spec.in with the version number from the Makefile.

---

Makefile +15 -2
@@ -7,6 +7,12 @@
 # BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely randomly
 # break unless your underlying filesystem supports those sub-second times
 # (my ext3 doesn't).
+
+VERSION = 0.7
+
+prefix=$(HOME)
+bindir=$(prefix)/bin
+
 CFLAGS=-g -O2 -Wall
 
 CC=gcc
@@ -25,8 +31,15 @@ PROG=   git-update-cache git-diff-files 
 
 all: $(PROG)
 
+git.spec: git.spec.in Makefile
+	sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
+
 install: $(PROG) $(SCRIPTS)
-	install $(PROG) $(SCRIPTS) $(HOME)/bin/
+	install -m755 -d $(DESTDIR)$(bindir)
+	install $(PROG) $(SCRIPTS) $(DESTDIR)$(bindir)
+
+uninstall:
+	cd $(DESTDIR)$(bindir) && rm $(PROG) $(SCRIPTS)
 
 LIB_OBJS=read-cache.o sha1_file.o usage.o object.o commit.o tree.o blob.o \
 	 tag.o date.o
@@ -110,7 +123,7 @@ diff.o: $(LIB_H)
 strbuf.o: $(LIB_H)
 
 clean:
-	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE)
+	rm -f *.o mozilla-sha1/*.o ppc/*.o $(PROG) $(LIB_FILE) git.spec
 
 backup: clean
 	cd .. ; tar czvf dircache.tar.gz dir-cache

Created: git.spec.in (mode:100644)

git.spec.in new file +44 -0

44 lines not on this page · raw message

#2 lore raw
Quoted 5 lines · Kay Sievers
Quoted 1 line · Kay Sievers

Add support for building the rpm package directly from the git tree.

This version creates the git.spec from a git.spec.in with the version number from the Makefile.

Please don't. The spec file /controls/ the building of the package, it can't be generated as part of the build process.

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#3 lore raw
Quoted 9 lines · * Horst von Brand ([email protected]) wrote:
Quoted 5 lines · Kay Sievers
Quoted 1 line · Kay Sievers

Add support for building the rpm package directly from the git tree.

This version creates the git.spec from a git.spec.in with the version number from the Makefile.

Please don't. The spec file /controls/ the building of the package, it can't be generated as part of the build process.

It certainly can. It simply means a structured release process. IOW, the git.spec would be generated for a release tarball.

thanks,
-chris

#4 lore raw
Quoted 11 lines · Chris Wright
Quoted 8 lines · * Horst von Brand ([email protected]) wrote:
Quoted 4 lines · Kay Sievers

On Mon, May 02, 2005 at 12:23:03PM +0200, Kay Sievers wrote:

This version creates the git.spec from a git.spec.in with the version number from the Makefile.

Please don't. The spec file /controls/ the building of the package, it can't be generated as part of the build process.

It certainly can.

Yep. Maybe "can't" was a bit too strong. "Should never be" is right.

Quoted 2 lines

It simply means a structured release process. IOW,
the git.spec would be generated for a release tarball.

Come on, you have to fix the spec file for the changelog and version by hand anyway, autoconfiscating it doesn't help one iota there.

And yes, I've seen quite a few packages autogenerating the spec file. As a result, you /can't/ build the package from pristine sources, you have to unpack and configure to get enough for building. For me that just isn't acceptable, as it completely misses the point of RPM.

(You can go "rpmbuild -ta whatever-2.3.1.tar.bz2" if the tarball is set up correctly, your idea prevents that).

Signature · 4 lines
Dr. Horst H. von Brand                   User #22616 counter.li.org
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
#5 lore raw
Quoted 6 lines · * Horst von Brand ([email protected]) wrote:
Quoted 2 lines · Chris Wright

It simply means a structured release process. IOW,
the git.spec would be generated for a release tarball.

Come on, you have to fix the spec file for the changelog and version by hand anyway, autoconfiscating it doesn't help one iota there.

That's the point, you don't _have_ to do that.

Quoted 7 lines

And yes, I've seen quite a few packages autogenerating the spec file. As a result, you /can't/ build the package from pristine sources, you have to unpack and configure to get enough for building. For me that just isn't acceptable, as it completely misses the point of RPM.

(You can go "rpmbuild -ta whatever-2.3.1.tar.bz2" if the tarball is set up correctly, your idea prevents that).

You just place the generated spec file in a release tarball. IOW, your 'release' Makefile target depends on foo.spec, and creates a clean release tarball with all you need to do an -ta build.

thanks,
-chris

#6 lore raw
In reply to Horst von Brand
Quoted 1 line · Horst von Brand

And yes, I've seen quite a few packages autogenerating the spec file. As a result, you /can't/ build the package from pristine sources, you have to unpack and configure to get enough for building. For me that just isn't acceptable, as it completely misses the point of RPM.

I think maybe you're missing the point of what is sometimes known as a 'make dist' target. (eg in autoconf type build systems).

Quoted 2 lines

(You can go "rpmbuild -ta whatever-2.3.1.tar.bz2" if the tarball is set up correctly, your idea prevents that).

Then the tarball wasn't of distributable (ie end-user buildable) source.

regards,

Signature · 4 lines
Paul Jakma	[email protected]	[email protected]	Key ID: 64A2FF6A
Fortune:
"Now this is a totally brain damaged algorithm.  Gag me with a smurfette."
		-- P. Buhr, Computer Science 354
#7 lore raw
Quoted 1 line · Paul Jakma

I think maybe you're missing the point of what is sometimes known as a 'make dist' target. (eg in autoconf type build systems).

Apologies: /Or/ the project which provided such a tarball missed the point.

regards,

Signature · 5 lines
Paul Jakma	[email protected]	[email protected]	Key ID: 64A2FF6A
Fortune:
"MacDonald has the gift on compressing the largest amount of words into
the smallest amount of thoughts."
		-- Winston Churchill