git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Build RPMs locally unless overruled in ~/.rpmmacros
@ 2009-03-30 15:10 Niels Basjes
  2009-04-02  6:47 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Niels Basjes @ 2009-03-30 15:10 UTC (permalink / raw)
  To: git; +Cc: Niels Basjes

From: Niels Basjes <niels@basjes.nl>

Signed-off-by: Niels Basjes <niels@basjes.nl>
---
 .gitignore |    1 +
 Makefile   |    8 +++++++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1c57d4c..2f2554b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -173,3 +173,4 @@ configure
 tags
 TAGS
 cscope*
+RPM_BUILDING
diff --git a/Makefile b/Makefile
index 7867eac..ad5a1f7 100644
--- a/Makefile
+++ b/Makefile
@@ -242,7 +242,13 @@ RM = rm -f
 TAR = tar
 FIND = find
 INSTALL = install
-RPMBUILD = rpmbuild
+RPMBUILDOPTS = $(shell if [ "`grep '^%_topdir' $(HOME)/.rpmmacros`" == "" ];        \
+                       then                                                         \
+                           mkdir -p RPM_BUILDING/{BUILD,RPMS,SOURCES,SPECS,SRPMS};  \
+                           echo '--define="_topdir `pwd`/RPM_BUILDING"' ;           \
+                       fi                                                           \
+                )
+RPMBUILD = rpmbuild $(RPMBUILDOPTS)
 TCL_PATH = tclsh
 TCLTK_PATH = wish
 PTHREAD_LIBS = -lpthread
-- 
1.6.1.3

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

* Re: [PATCH] Build RPMs locally unless overruled in ~/.rpmmacros
  2009-03-30 15:10 [PATCH] Build RPMs locally unless overruled in ~/.rpmmacros Niels Basjes
@ 2009-04-02  6:47 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2009-04-02  6:47 UTC (permalink / raw)
  To: Niels Basjes; +Cc: git

Niels Basjes <Niels@basjes.nl> writes:

> From: Niels Basjes <niels@basjes.nl>
>
> Signed-off-by: Niels Basjes <niels@basjes.nl>

I am not opposed to have an option to build RPM binary packages in-tree,
and RPM_BUILDING might be an already accepted name for the directory (even
though it looks too loud to my eyes, you may have chosen it because it is
a common practice in the RPM land---I am not an RPM person so I wouldn't
know).

But I thought somebody already pointed out a possible regression scenario.
If one has been running 'make rpm' with RPMBUILD that invokes rpmbuild
command with a custom yet not $HOME/.rpmmacos file via --macros option, or
has been running it as a user that can write into system-wide rpm
workplaces, this patch would break such an established workflow.

Perhaps something along this line might work just as well, without
breaking things for people?

	ifdef RPM_BUILD_HERE
        RPMBUILDOPTS = --define="_topdir $(pwd)/RPM_BUILDING"
	rpmprep:
        	mkdir RPM_BUILDING
                mkdir RPM_BUILDING/BUILD
        	mkdir RPM_BUILDING/RPMS
        	mkdir RPM_BUILDING/SOURCES
        	mkdir RPM_BUILDING/SPECS
        	mkdir RPM_BUILDING/SRPMS
	else
        RPMBUILDOPTS =
        rpmprep:
		: nothing
        endif

	rpm: dist rpmprep
        	$(RPMBUILD) $(RPMBUILDOPTS) -ta $(GIT_TARNAME).tar.gz

By the way, as far as I can tell, you do not need to have SOURCES
directory in order to run "make rpm" in git.git.

> +RPMBUILDOPTS = $(shell if [ "`grep '^%_topdir' $(HOME)/.rpmmacros`" == "" ];        \
> +                       then                                                         \
> +                           mkdir -p RPM_BUILDING/{BUILD,RPMS,SOURCES,SPECS,SRPMS};  \

Not everybody runs bash.

> +                           echo '--define="_topdir `pwd`/RPM_BUILDING"' ;           \
> +                       fi                                                           \
> +                )
> +RPMBUILD = rpmbuild $(RPMBUILDOPTS)
>  TCL_PATH = tclsh
>  TCLTK_PATH = wish
>  PTHREAD_LIBS = -lpthread

You need to have "make clean" remove RPM_BUILDING.

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

end of thread, other threads:[~2009-04-02  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-30 15:10 [PATCH] Build RPMs locally unless overruled in ~/.rpmmacros Niels Basjes
2009-04-02  6:47 ` Junio C Hamano

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).