Attached are two (orthogonal) patches to make evaluation of
Makefile.common a bit faster.

The first one is possibly contentious.  Currently, early-branching works
by checking for the existence of the other branch, by using 'cvs rlog'.
That kinda sucks, because it means you can't do 'make local' while
disconnected, and even when connected it's not fast.  The patch changes
it to look for the package's name in a new file,
common/early-branched-packages.  By keeping that file together with
Makefile.common we get pretty much the behaviour we're used to: when
build targets change, you have to update common/.  Note that if we apply
this patch we will also need to create that (empty) file.

This would change the cvsadmin procedure for early branching, but
hopefully not by a burdensome amount.

The second one is just a refactoring to only ask rpm for %VERSION and
%RELEASE once.  In principle, for packages that overrode both VERSION
and RELEASE in their Makefile, this would actually make things slower,
since now you'd be forcing rpm to run.  According to my pkgcvs checkout,
no such packages exist.

Tested locally on a 3.2GHz P4.  'time make' baseline was 1.3 seconds.
First patch dropped that to about 0.6 seconds.  Second patch on top of
that dropped down to about 0.38 seconds.

- ajax
From 602511573793dd1a5b5cc5204238bef5cb50df9f Mon Sep 17 00:00:00 2001
From: Adam Jackson <[EMAIL PROTECTED]>
Date: Wed, 30 Jul 2008 11:26:33 -0400
Subject: [PATCH] Redo early branching

---
 Makefile.common |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile.common b/Makefile.common
index aa0a126..faf63ef 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -19,12 +19,15 @@ COMMON_DIR := $(shell $(find-common-dir))
 ifndef HEAD_BRANCH
 HEAD_BRANCH := devel
 endif
-BRANCH:=$(shell pwd | awk -F '/' '{ print $$NF }' )
-# check to see if this is an early branched package; we should make this more
-# generic in the future
-ifeq ($(BRANCH),devel)
-BRANCH:=$(shell cvs rlog rpms/$(NAME)/F-9/$(SPECFILE) >/dev/null 2>&1 && echo "F-10" || echo "devel")
+
+BASEDIR := $(shell basename `pwd`)
+
+ifeq ($(BASEDIR),devel)
+BRANCH := $(shell grep -q '\<$(NAME)\>' $(COMMON_DIR)/early-branched-packages && echo F-11 || echo devel)
+else
+BRANCH := $(BASEDIR)
 endif
+
 BRANCHINFO = $(shell grep ^$(BRANCH): $(COMMON_DIR)/branches | cut -d: --output-delimiter=" " -f2-)
 TARGET := $(word 1, $(BRANCHINFO))
 DIST = $(word 2, $(BRANCHINFO))
-- 
1.5.6

From c7ae6df63a762850507f503bb652186640558252 Mon Sep 17 00:00:00 2001
From: Adam Jackson <[EMAIL PROTECTED]>
Date: Wed, 30 Jul 2008 11:36:20 -0400
Subject: [PATCH] Invoke rpm less

---
 Makefile.common |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Makefile.common b/Makefile.common
index faf63ef..8311bb6 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -85,7 +85,7 @@ SPECDIR := $(shell pwd)
 endif
 
 ifndef RPM_DEFINES
-RPM_DEFINES = --define "_sourcedir $(SOURCEDIR)" \
+RPM_DEFINES := --define "_sourcedir $(SOURCEDIR)" \
 		--define "_specdir $(SPECDIR)" \
 		--define "_builddir $(BUILDDIR)" \
 		--define "_srcrpmdir $(SRCRPMDIR)" \
@@ -95,16 +95,20 @@ endif
 
 # Initialize the variables that we need, but are not defined
 # the version of the package
+
+VER_REL := $(shell rpm $(RPM_DEFINES) -q --qf "%{VERSION} %{RELEASE}\n" --specfile $(SPECFILE)| head -1)
+
 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 := $(word 1, $(VER_REL))
 endif
 # the release of the package
 ifndef RELEASE
-RELEASE := $(shell rpm $(RPM_DEFINES) -q --qf "%{RELEASE}\n" --specfile $(SPECFILE)| head -1)
+RELEASE := $(word 2, $(VER_REL))
 endif
+
 # this is used in make patch, maybe make clean eventually.
 # would be nicer to autodetermine from the spec file...
 RPM_BUILD_DIR ?= $(BUILDDIR)/$(NAME)-$(VERSION)
-- 
1.5.6

Attachment: signature.asc
Description: This is a digitally signed message part

--
Fedora-buildsys-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

Reply via email to