common branches,NONE,1.1 Makefile.common,1.11,1.12

Jeremy Katz (katzj) fedora-extras-commits at redhat.com
Mon May 9 19:11:32 UTC 2005


Author: katzj

Update of /cvs/extras/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv30901/common

Modified Files:
	Makefile.common 
Added Files:
	branches 
Log Message:
add patch to auto-set the build target based on the branch dir you're in.  also
handles the dist when tagging.

Patch from ignacio, cleaned up by spot



--- NEW FILE branches ---
RHL-7:rhl7:.rhl7:rhl:7
RHL-8:rhl8:.rhl8:rhl:8
RHL-9:rhl9:.rhl9:rhl:9
FC-1:fc1:.fc1:fedora:1
FC-2:fc2:.fc2:fedora:2
FC-3:fc3:.fc3:fedora:3
devel:devel:.fc4:fedora:4
RHL-7:rhl7:.rhl7:rhl:7
RHL-8:rhl8:.rhl8:rhl:8
RHL-9:rhl9:.rhl9:rhl:9
FC-1:fc1:.fc1:fedora:1
FC-2:fc2:.fc2:fedora:2
FC-3:fc3:.fc3:fedora:3
devel:devel:.fc4:fedora:4


Index: Makefile.common
===================================================================
RCS file: /cvs/extras/common/Makefile.common,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Makefile.common	5 May 2005 18:54:45 -0000	1.11
+++ Makefile.common	9 May 2005 19:11:30 -0000	1.12
@@ -4,17 +4,34 @@
 #
 # $Id$
 
+# Define the common dir.
+# This needs to happen first.
+define find-common-dir
+for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
+endef
+COMMON_DIR := $(shell $(find-common-dir))
+
+# Branch and disttag definitions
+# These need to happen second.
+BRANCH = $(shell basename $(shell pwd))
+BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
+TARGET ?= $(word 1, $(BRANCHINFO))
+DIST = $(word 2, $(BRANCHINFO))
+DISTVAR = $(word 3, $(BRANCHINFO))
+DISTVAL = $(word 4, $(BRANCHINFO))
+DIST_DEFINES = --define "dist $(DIST)" --define "$(DISTVAR) $(DISTVAL)"
+
 # Initialize the variables that we need, but are not defined
 # the version of the package
 ifndef NAME
 $(error "You can not run this Makefile without having NAME defined")
 endif
 ifndef VERSION
-VERSION := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION}\n" --specfile $(SPECFILE)| head -1)
+VERSION := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{VERSION}\n" --specfile $(SPECFILE)| head -1)
 endif
 # the release of the package
 ifndef RELEASE
-RELEASE := $(shell rpm $(RPM_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)
+RELEASE := $(shell rpm $(RPM_DEFINES) $(DIST_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)
 endif
 # this is used in make patch, maybe make clean eventually.
 # would be nicer to autodetermine from the spec file...
@@ -270,23 +287,18 @@
 
 # If you build a new version into the tree, first do "make tag",
 # then "make srpm", then build the package.  
-tag::    $(SPECFILE)
+tag::    $(SPECFILE) $(COMMON_DIR)/branches
 	cvs tag $(TAG_OPTS) -c $(TAG)
 	@echo "Tagged with: $(TAG)"
 	@echo
 
-define find-common-dir
-for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then echo "$$d"; break ; fi ; done
-endef
-COMMON_DIR := $(shell $(find-common-dir))
-
 define find-user
 if [ `cat CVS/Root |grep -c @` -ne 0 ]; then cat CVS/Root  |cut -d @ -f 1 |  sed 's/:.*://' ; else echo $(USER); fi
 endef
 USER := $(shell $(find-user))
 
-build: 
-	@if [ -z "$(TARGET)" ]; then echo "Must specify a target to build into"; exit 1; fi
+build:   $(COMMON_DIR)/branches
+	@if [ -z "$(TARGET)" -a ! -d CVS ]; then echo "Must be in a branch subdirectory"; exit 1; fi
 	@(pushd $(COMMON_DIR) >/dev/null ;\
 	cvs -Q update ;\
 	echo -e "$(USER)\t$(CVS_REPOSITORY)\t$(TAG)\t$(TARGET)" >> tobuild ;\




More information about the fedora-extras-commits mailing list