[Ovirt-devel] [PATCH 1/4] Makefile, build-all adjustments
Jim Meyering
jim at meyering.net
Mon Jun 16 16:55:59 UTC 2008
Alan Pevec <apevec at redhat.com> wrote:
...
> make bumpversion
> echo "$(awk 'BEGIN { printf "%.2f", $(awk '{ print $1 }' version) + .01 }')) 0" > version
> awk: BEGIN { printf "%.2f", $(awk {
> awk: ^ syntax error
> awk: cmd. line:1: BEGIN { printf "%.2f", $(awk {
> awk: cmd. line:1: ^ unexpected newline or end of string
Thanks again. Here's an updated patch. Tested like this:
$ cd ovirt-host-creator && cat version
0.90 1
$ make -s bumprelease; cat version
0.90 2
$ make -s bumprelease; cat version
0.90 3
$ make -s bumprelease; cat version
0.90 4
$ make -s bumpversion; cat version
0.91 0
$ make -s bumpversion; cat version
0.92 0
$ make -s bumpgit; cat version
0.92 0.1.200806161654gitda34c8f
$ make -s bumpgit; cat version
0.92 0.2.200806161654gitda34c8f
>From 9a65cdb5ef68ef4e8f1947771e4784670418c5c2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 15 Jun 2008 13:01:12 +0200
Subject: [PATCH] Makefile clean-up
* ovirt-host-creator/Makefile:
Remove "-" (ignore command failure) prefixes.
Rather than GNU make-specific $(shell command...) syntax,
use more concise Bourne shell syntax, $$(command...).
(X): Simplify definition by using r[2] unconditionally.
(git_head): Define.
(GITRELEASE): Use it (no need to determine branch name).
(RPM_FLAGS): Start body on a separate line, unindented,
to avoid wrapped lines.
* wui/Makefile: Likewise.
Signed-off-by: Jim Meyering <meyering at redhat.com>
---
ovirt-host-creator/Makefile | 56 +++++++++++++++++++++-------------------
wui/Makefile | 59 ++++++++++++++++++++++---------------------
2 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/ovirt-host-creator/Makefile b/ovirt-host-creator/Makefile
index b7d98ec..322d95e 100644
--- a/ovirt-host-creator/Makefile
+++ b/ovirt-host-creator/Makefile
@@ -1,50 +1,53 @@
-VERSION = $(shell echo `awk '{ print $$1 }' version`)
-NEWVERSION = $(shell printf "%.2f" `dc -e "$(VERSION) .01 + p"`)
-RELEASE = $(shell echo `awk '{ print $$2 }' version`)
-NEWRELEASE = $(shell echo $$(($(RELEASE) + 1)))
-X = $(shell echo `awk '{ if (split($$2,r,".") >= 2) { if (r[1]=="0") {print r[2]+1} else print 1 } else print 1 }' version`)
-GITRELEASE = $(shell echo 0.$(X).`date --utc +%Y%m%d%H%M`git`git show-ref --heads --hash=7 $$(git branch|awk '$$1="*" {print $$2}')`)
-DIST = $(shell rpm --eval '%{dist}')
-ARCH = $(shell uname -i)
-
-SPEC_FILE = ovirt-host-image.spec
+VERSION := $(shell awk '{ print $$1 }' version)
+RELEASE := $(shell awk '{ print $$2 }' 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)
+git_head = $$(git show-ref --hash=7 HEAD)
+GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head)
+DIST = $$(rpm --eval '%{dist}')
+ARCH = $$(uname -i)
+
NAME = ovirt-host-image
+SPEC_FILE = $(NAME).spec
NV = $(NAME)-$(VERSION)
-RPM_FLAGS = --define "_topdir %(pwd)/rpm-build" \
- --define "_builddir %{_topdir}" \
- --define "_rpmdir %{_topdir}" \
- --define "_srcrpmdir %{_topdir}" \
- --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
- --define "_specdir %{_topdir}" \
- --define "_sourcedir %{_topdir}"
+RPM_FLAGS = \
+ --define "_topdir %(pwd)/rpm-build" \
+ --define "_builddir %{_topdir}" \
+ --define "_rpmdir %{_topdir}" \
+ --define "_srcrpmdir %{_topdir}" \
+ --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
+ --define "_specdir %{_topdir}" \
+ --define "_sourcedir %{_topdir}"
all: rpms
bumpgit:
- -echo "$(VERSION) $(GITRELEASE)" > version
+ echo "$(VERSION) $(GITRELEASE)" > version
bumprelease:
- -echo "$(VERSION) $(NEWRELEASE)" > version
-
-setversion:
- -echo "$(VERSION) $(RELEASE)" > version
+ echo "$(VERSION) $(NEWRELEASE)" > version
bumpversion:
- -echo "$(NEWVERSION) 0" > version
+ echo "$(NEWVERSION) 0" > version
+
+setversion:
+ echo "$(VERSION) $(RELEASE)" > version
clean:
- -rm -rf ovirt-host-image-* ovirt-pxe.log
+ rm -rf ovirt-host-image-* ovirt-pxe.log
repos.ks: repos.ks.in
cp repos.ks.in repos.ks
build: ovirt-$(ARCH).ks common-install.ks common-pkgs.ks common-post.ks repos.ks
- -rm -rf tftpboot/
+ rm -rf tftpboot/
./ovirt-pxe.sh > ovirt-pxe.log 2>&1
tar: clean build
- mv $(shell cat iso-file) ovirt.iso
+ mv $$(cat iso-file) ovirt.iso
mkdir -p $(NV)
cp -a ovirt-host-image.spec ovirt.iso tftpboot/* $(NV)
mkdir -p rpm-build
@@ -56,4 +59,3 @@ new-rpms: bumprelease rpms
rpms: tar
rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
-
diff --git a/wui/Makefile b/wui/Makefile
index eede4d6..71239ab 100644
--- a/wui/Makefile
+++ b/wui/Makefile
@@ -1,43 +1,44 @@
-VERSION = $(shell echo `awk '{ print $$1 }' version`)
-NEWVERSION = $(shell printf "%.2f" `dc -e "$(VERSION) .01 + p"`)
-RELEASE = $(shell echo `awk '{ print $$2 }' version`)
-NEWRELEASE = $(shell echo $$(($(RELEASE) + 1)))
-X = $(shell echo `awk '{ if (split($$2,r,".") >= 2) { if (r[1]=="0") {print r[2]+1} else print 1 } else print 1 }' version`)
-GITRELEASE = $(shell echo 0.$(X).`date --utc +%Y%m%d%H%M`git`git show-ref --heads --hash=7 $$(git branch|awk '$$1="*" {print $$2}')`)
-DIST = $(shell rpm --eval '%{dist}')
-ARCH = $(shell uname -i)
-
-SPEC_FILE = ovirt-wui.spec
+VERSION := $(shell awk '{ print $$1 }' version)
+RELEASE := $(shell awk '{ print $$2 }' 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)
+git_head = $$(git show-ref --hash=7 HEAD)
+GITRELEASE = $(X).$$(date --utc +%Y%m%d%H%M)git$(git_head)
+DIST = $$(rpm --eval '%{dist}')
+ARCH = $$(uname -i)
+
NAME = ovirt-wui
+SPEC_FILE = $(NAME).spec
NV = $(NAME)-$(VERSION)
-RPM_FLAGS = --define "_topdir %(pwd)/rpm-build" \
- --define "_builddir %{_topdir}" \
- --define "_rpmdir %{_topdir}" \
- --define "_srcrpmdir %{_topdir}" \
- --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
- --define "_specdir %{_topdir}" \
- --define "_sourcedir %{_topdir}"
-
-DATADIR = $(shell rpm --eval "%{_datadir}")
+RPM_FLAGS = \
+ --define "_topdir %(pwd)/rpm-build" \
+ --define "_builddir %{_topdir}" \
+ --define "_rpmdir %{_topdir}" \
+ --define "_srcrpmdir %{_topdir}" \
+ --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
+ --define "_specdir %{_topdir}" \
+ --define "_sourcedir %{_topdir}"
all: rpms
bumpgit:
- -echo "$(VERSION) $(GITRELEASE)" > version
+ echo "$(VERSION) $(GITRELEASE)" > version
-bumprelease:
- -echo "$(VERSION) $(NEWRELEASE)" > version
-
-setversion:
- -echo "$(VERSION) $(RELEASE)" > version
+bumprelease:
+ echo "$(VERSION) $(NEWRELEASE)" > version
bumpversion:
- -echo "$(NEWVERSION) 0" > version
+ echo "$(NEWVERSION) 0" > version
+
+setversion:
+ echo "$(VERSION) $(RELEASE)" > version
clean:
- -rm -f ovirt*.gz ovirt*.rpm
- -rm -rf ovirt-wui-* dist build
+ rm -f ovirt*.gz ovirt*.rpm
+ rm -rf ovirt-wui-* dist build
genlangs:
cd src; rake updatepo; rake makemo
@@ -54,7 +55,7 @@ tar: clean
new-rpms: bumprelease rpms
-rpms: tar
+rpms: tar
rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
# convience method to simulate make install, not for production use
--
1.5.6.rc3.9.gac038
More information about the ovirt-devel
mailing list