[Ovirt-devel] [PATCH] Use $(srcdir)/version, so this works from non-srcdir build, too.

Jim Meyering jim at meyering.net
Mon Sep 8 12:49:37 UTC 2008


"Perry N. Myers" <pmyers at redhat.com> wrote:
> Jim Meyering wrote:
>> Without this, a non-srcdir build in ovirt-node would fail.
>> (btw, there are already significant differences in the various
>> */release.mk files -- my guess is that this change can safely be
>> applied to all)
>
> Hmm.  release.mk should be identical in all repos with the exception
> of ovirt-docs which has sections of it commented out to prevent build
> failures (temp hack while ovirt-docs lacks a spec file)
>
> Does this patch work where there is no srcdir?  i.e. ovirt-node-image,
> ovirt-appliance, etc?

Good catch.
It'll need a srcdir definition in cases like that,
so I'll add a conditional one here.  It's not needed
in this (node) directory, but would be in the others.

This adjusted patch adds it:

>From b967f6ed51500f846d5f076979b1b181014f7c65 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 8 Sep 2008 13:33:07 +0200
Subject: [PATCH] Use $(srcdir)/version, so this works from non-srcdir build, too.

Use '=', not ':=', so that VERSION can use the non-:= definition of srcdir.
Provide a default definition of srcdir, for use in directories that
haven't yet been autoconfiscated.
---
 release.mk |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/release.mk b/release.mk
index b89bd86..7d9ddd0 100644
--- a/release.mk
+++ b/release.mk
@@ -2,13 +2,14 @@
 # It expects the including Makefile to define the "pkg_name"
 # variable, as well as a file named "version" in the current directory.

-ARCH		:= $(shell uname -i)
-VERSION		:= $(shell awk '{ print $$1 }' version)
-RELEASE		:= $(shell awk '{ print $$2 }' version)
+srcdir		?= .
+ARCH		= $(shell uname -i)
+VERSION		= $(shell awk '{ print $$1 }' $(srcdir)/version)
+RELEASE		= $(shell awk '{ print $$2 }' $(srcdir)/version)
 NEWVERSION	= $$(awk 'BEGIN { printf "%.2f", $(VERSION) + .01 }')
 NEWRELEASE	= $$(($(RELEASE) + 1))
 X		= $$(awk '{ split($$2,r,"."); \
-                            printf("%d.%d\n", r[1], r[2]+1) }' version)
+			  printf("%d.%d\n", r[1], r[2]+1) }' $(srcdir)/version)
 git_head	= $$(git log -1 --pretty=format:%h)
 GITRELEASE	= $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head)
 DIST		= $$(rpm --eval '%{dist}')
--
1.6.0.1.196.g01914




More information about the ovirt-devel mailing list