[Ovirt-devel] [PATCH 1/4] Makefile, build-all adjustments
Jim Meyering
jim at meyering.net
Thu Jun 19 21:16:29 UTC 2008
Jim Meyering <jim at meyering.net> wrote:
> Alan Pevec <apevec at redhat.com> wrote:
>
>> Jim Meyering wrote:
>>> git release, "make bumprelease" no longer works.
>>> However, a manual "make bumprelease NEWRELEASE=2" does work.
>>
>> right, need to fix bumprelease to read only till dot in release field
>>
>>> of duplication, eventually I expect to factor those parts
>>> into a common file and include that file from both places.
>>
>> yes, we need Makefile.common
>>
>>> --- a/wui/Makefile
>>> +++ b/wui/Makefile
>>> -VERSION = $(shell echo `awk '{ print $$1 }' version`)
>>> -NEWVERSION = $(shell printf "%.2f" `dc -e "$(VERSION) .01 + p"`)
>>
>>> +VERSION = $$(awk '{ print $$1 }' version)
>>> +NEWVERSION = $$(awk 'BEGIN { printf "%.2f", $(VERSION) + .01 }'))
>>
>> This fails:
>> 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
>
> Good catch.
> My bad. I neglected to retest after rebasing (and resolving conflicts)
> last night. Here's an incremental change to fix it, that I'm about to
> squash onto 1/4 (which I will repost):
I've just pushed the following to the new, "next" branch:
http://git.et.redhat.com/?p=ovirt.git;a=shortlog;h=next
>From 6c90a4ddb55223411cf44f96e703373b915ea672 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.
---
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..3094a91 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 := $(shell 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..7208988 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 := $(shell 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.23.gc3bdd
>From 7f450e6e1031cad4ddb3551040cc5ddfcb430021 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 15 Jun 2008 14:48:55 +0200
Subject: [PATCH] * build-all.sh: split some long lines
---
build-all.sh | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/build-all.sh b/build-all.sh
index fcf1563..3d7a735 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -80,7 +80,8 @@ done
test $err = 1 && { try_h; exit 1; }
test $help = 1 && { usage; exit 0; }
test $update_app = 1 -a -z "$app_type" && usage "Need to specify -d or -b"
-test $include_src = 1 -a "$update_pungi" = 0 && usage "Need to specify -p when including source"
+test $include_src = 1 -a "$update_pungi" = 0 &&
+ usage "Need to specify -p when including source"
test "$update_pungi" != 0 -a "$update_pungi" != "init" \
-a "$update_pungi" != "update" \
&& usage "-p must provide either init or update argument"
@@ -114,8 +115,10 @@ fi
# If doing either a node or app build, make sure http is running
if [ $update_app = 1 -o $update_node = 1 -o $update_pungi != 0 ]; then
lokkit --service http
- service httpd status > /dev/null 2>&1 || service httpd start > /dev/null 2>&1
- service libvirtd status > /dev/null 2>&1 || service libvirtd start > /dev/null 2>&1
+ service httpd status > /dev/null 2>&1 ||
+ service httpd start > /dev/null 2>&1
+ service libvirtd status > /dev/null 2>&1 ||
+ service libvirtd start > /dev/null 2>&1
service libvirtd reload
fi
@@ -142,10 +145,13 @@ if [ $update_pungi != 0 ]; then
pungi_flags="-GC"
fi
+ fedora_mirror=http://mirrors.fedoraproject.org/mirrorlist
# use Fedora + updates
cat > $PUNGIKS << EOF
-repo --name=f$FEDORA --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$FEDORA&arch=\$basearch
-repo --name=f$FEDORA-updates --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$FEDORA&arch=\$basearch
+repo --name=f$FEDORA \
+ --mirrorlist=$fedora_mirror?repo=fedora-$FEDORA&arch=\$basearch
+repo --name=f$FEDORA-updates \
+ --mirrorlist=$fedora_mirror?repo=updates-released-f$FEDORA&arch=\$basearch
EOF
# + ovirt.org repo for updates not yet in Fedora
# + local ovirt repo with locally rebuilt ovirt* RPMs ( options -w and -n )
@@ -158,13 +164,17 @@ repo --name=ovirt --baseurl=http://localhost/ovirt
EOF
fi
cat >> $PUNGIKS << EOF
-repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/\$basearch $excludepkgs
+repo --name=ovirt-org \
+ --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/\$basearch $excludepkgs
EOF
if [ $include_src != 0 ]; then
cat >> $PUNGIKS << EOF
-repo --name=f$FEDORA-src --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$FEDORA&arch=\$basearch
-repo --name=f$FEDORA-updates-src --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$FEDORA&arch=\$basearch
-repo --name=ovirt-org-src --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/src $excludepkgs
+repo --name=f$FEDORA-src \
+ --mirrorlist=$fedora_mirror?repo=fedora-source-$FEDORA&arch=\$basearch
+repo --name=f$FEDORA-updates-src \
+ --mirrorlist=$fedora_mirror?repo=updates-released-source-f$FEDORA&arch=\$basearch
+repo --name=ovirt-org-src \
+ --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/src $excludepkgs
EOF
else
pungi_flags+=" --nosource"
@@ -176,7 +186,8 @@ EOF
%packages
EOF
# merge package lists from all oVirt kickstarts
- # exclude ovirt-host-image* (chicken-egg: built at the next step using repo created here)
+ # exclude ovirt-host-image* (chicken-egg: built at the next step
+ # using repo created here)
egrep -hv "^-|^ovirt-host-image" \
ovirt-host-creator/common-pkgs.ks \
wui-appliance/common-pkgs.ks \
@@ -236,7 +247,9 @@ repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/x86_64 $exc
EOF
make
cp wui-rel-*.ks $OVIRT
- ./create-wui-appliance.sh -t http://$VIRBR/pungi/$FEDORA/$ARCH/os -k http://$VIRBR/ovirt/wui-rel-$ARCH.ks $app_type
+ ./create-wui-appliance.sh \
+ -t http://$VIRBR/pungi/$FEDORA/$ARCH/os \
+ -k http://$VIRBR/ovirt/wui-rel-$ARCH.ks $app_type
set +x
echo "oVirt appliance setup started, check progress with:"
@@ -248,4 +261,3 @@ EOF
fi
fi
-
--
1.5.6.rc3.23.gc3bdd
>From a872e0e8be166fc642ee5fa425fcb78ca4fb50f4 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 15 Jun 2008 14:51:44 +0200
Subject: [PATCH] change $FEDORA to shorter $F_REL
---
build-all.sh | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/build-all.sh b/build-all.sh
index 3d7a735..2ce7446 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -18,7 +18,7 @@ die() { warn "$@"; try_h; exit 1; }
cd $(dirname $0)
BASE=$(pwd)
-FEDORA=9
+F_REL=9
ARCH=$(uname -i)
HTDOCS=/var/www/html
OVIRT=$HTDOCS/ovirt
@@ -148,10 +148,10 @@ if [ $update_pungi != 0 ]; then
fedora_mirror=http://mirrors.fedoraproject.org/mirrorlist
# use Fedora + updates
cat > $PUNGIKS << EOF
-repo --name=f$FEDORA \
- --mirrorlist=$fedora_mirror?repo=fedora-$FEDORA&arch=\$basearch
-repo --name=f$FEDORA-updates \
- --mirrorlist=$fedora_mirror?repo=updates-released-f$FEDORA&arch=\$basearch
+repo --name=f$F_REL \
+ --mirrorlist=$fedora_mirror?repo=fedora-$F_REL&arch=\$basearch
+repo --name=f$F_REL-updates \
+ --mirrorlist=$fedora_mirror?repo=updates-released-f$F_REL&arch=\$basearch
EOF
# + ovirt.org repo for updates not yet in Fedora
# + local ovirt repo with locally rebuilt ovirt* RPMs ( options -w and -n )
@@ -165,16 +165,16 @@ EOF
fi
cat >> $PUNGIKS << EOF
repo --name=ovirt-org \
- --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/\$basearch $excludepkgs
+ --baseurl=http://ovirt.org/repos/ovirt/$F_REL/\$basearch $excludepkgs
EOF
if [ $include_src != 0 ]; then
cat >> $PUNGIKS << EOF
-repo --name=f$FEDORA-src \
- --mirrorlist=$fedora_mirror?repo=fedora-source-$FEDORA&arch=\$basearch
-repo --name=f$FEDORA-updates-src \
- --mirrorlist=$fedora_mirror?repo=updates-released-source-f$FEDORA&arch=\$basearch
+repo --name=f$F_REL-src \
+ --mirrorlist=$fedora_mirror?repo=fedora-source-$F_REL&arch=\$basearch
+repo --name=f$F_REL-updates-src \
+ --mirrorlist=$fedora_mirror?repo=updates-released-source-f$F_REL&arch=\$basearch
repo --name=ovirt-org-src \
- --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/src $excludepkgs
+ --baseurl=http://ovirt.org/repos/ovirt/$F_REL/src $excludepkgs
EOF
else
pungi_flags+=" --nosource"
@@ -198,9 +198,9 @@ anaconda-runtime
%end
EOF
cd $PUNGI
- pungi --ver=$FEDORA $pungi_flags -c $PUNGIKS --force
+ pungi --ver=$F_REL $pungi_flags -c $PUNGIKS --force
if [ $include_src != 0 ]; then
- pungi --ver=$FEDORA -I --sourceisos --nosplitmedia -c $PUNGIKS --force
+ pungi --ver=$F_REL -I --sourceisos --nosplitmedia -c $PUNGIKS --force
fi
restorecon -r .
fi
@@ -211,7 +211,7 @@ if [ $update_node = 1 ]; then
cd $BASE/ovirt-host-creator
rm -rf rpm-build
cat > repos.ks << EOF
-repo --name=f$FEDORA --baseurl=http://localhost/pungi/$FEDORA/$ARCH/os
+repo --name=f$F_REL --baseurl=http://localhost/pungi/$F_REL/$ARCH/os
EOF
bumpver
@@ -232,7 +232,7 @@ if [ $update_app == 1 ]; then
cd $BASE/wui-appliance
make clean
cat > repos-x86_64.ks << EOF
-url --url http://$VIRBR/pungi/$FEDORA/$ARCH/os
+url --url http://$VIRBR/pungi/$F_REL/$ARCH/os
EOF
excludepkgs=
if [[ -f $OVIRT/repodata/repomd.xml ]]; then
@@ -242,13 +242,13 @@ repo --name=ovirt --baseurl=http://$VIRBR/ovirt
EOF
fi
cat >> repos-x86_64.ks << EOF
-repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/$FEDORA/x86_64 $excludepkgs
+repo --name=ovirt-org --baseurl=http://ovirt.org/repos/ovirt/$F_REL/x86_64 $excludepkgs
EOF
make
cp wui-rel-*.ks $OVIRT
./create-wui-appliance.sh \
- -t http://$VIRBR/pungi/$FEDORA/$ARCH/os \
+ -t http://$VIRBR/pungi/$F_REL/$ARCH/os \
-k http://$VIRBR/ovirt/wui-rel-$ARCH.ks $app_type
set +x
--
1.5.6.rc3.23.gc3bdd
>From 276576902ab93ad2bd0d0291f1273aa1775eaaf1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 15 Jun 2008 14:55:43 +0200
Subject: [PATCH] build-all.sh: avoid an unnecessary grep in IP-addr-extraction code
---
build-all.sh | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/build-all.sh b/build-all.sh
index 2ce7446..8c3a7e9 100755
--- a/build-all.sh
+++ b/build-all.sh
@@ -226,7 +226,8 @@ fi
# NOTE: create-wui-appliance.sh must be run as root
if [ $update_app == 1 ]; then
# FIXME: This can go away once we have livecd tools building the appliances
- VIRBR=$(virsh net-dumpxml default | grep "<ip address=" | sed "s/.*ip address='\(.*\)' .*/\1/")
+ VIRBR=$(virsh net-dumpxml default \
+ | sed -n "s/^ *<ip address='\([^.]*\)' .*/\1/p")
test -z $VIRBR && die "Could not get ip address of default network for app"
cd $BASE/wui-appliance
--
1.5.6.rc3.23.gc3bdd
>From da8f3761b2d343489b7b359538860424ddd6c3e0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 16 Jun 2008 20:43:35 +0200
Subject: [PATCH] factor common variable definitions and rules out of Makefiles
* common/release.mk: New file, factored out of...
* ovirt-host-creator/Makefile: ...here, and...
* wui/Makefile: ...here.
Plus, add .PHONY: dependents.
And rename "NAME" to "pkg_name".
---
common/release.mk | 47 +++++++++++++++++++++++++++++++++++++++++++
ovirt-host-creator/Makefile | 42 ++-----------------------------------
wui/Makefile | 44 +++------------------------------------
3 files changed, 54 insertions(+), 79 deletions(-)
create mode 100644 common/release.mk
diff --git a/common/release.mk b/common/release.mk
new file mode 100644
index 0000000..f1fb5f7
--- /dev/null
+++ b/common/release.mk
@@ -0,0 +1,47 @@
+# Release/version-related Makefile variables and rules.
+# This Makefile snippet is included by both ../wui/Makefile and
+# ../ovirt-host-creator/Makefile. 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)
+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}')
+
+SPEC_FILE = $(pkg_name).spec
+
+NV = $(pkg_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}"
+
+bumpgit:
+ echo "$(VERSION) $(GITRELEASE)" > version
+
+bumprelease:
+ echo "$(VERSION) $(NEWRELEASE)" > version
+
+bumpversion:
+ echo "$(NEWVERSION) 0" > version
+
+setversion:
+ echo "$(VERSION) $(RELEASE)" > version
+
+new-rpms: bumprelease rpms
+
+rpms: tar
+ rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
+
+.PHONY: rpms new-rpms setversion bumprelease bumpversion bumpgit
diff --git a/ovirt-host-creator/Makefile b/ovirt-host-creator/Makefile
index 3094a91..d7806ea 100644
--- a/ovirt-host-creator/Makefile
+++ b/ovirt-host-creator/Makefile
@@ -1,40 +1,7 @@
-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 := $(shell 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}"
+pkg_name = ovirt-host-image
all: rpms
-
-bumpgit:
- echo "$(VERSION) $(GITRELEASE)" > version
-
-bumprelease:
- echo "$(VERSION) $(NEWRELEASE)" > version
-
-bumpversion:
- echo "$(NEWVERSION) 0" > version
-
-setversion:
- echo "$(VERSION) $(RELEASE)" > version
+include ../common/release.mk
clean:
rm -rf ovirt-host-image-* ovirt-pxe.log
@@ -55,7 +22,4 @@ tar: clean build
cp version rpm-build/
rm -rf $(NV)
-new-rpms: bumprelease rpms
-
-rpms: tar
- rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
+.PHONY: all clean build tar
diff --git a/wui/Makefile b/wui/Makefile
index 7208988..b726287 100644
--- a/wui/Makefile
+++ b/wui/Makefile
@@ -1,40 +1,7 @@
-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 := $(shell 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}"
+pkg_name = ovirt-wui
all: rpms
-
-bumpgit:
- echo "$(VERSION) $(GITRELEASE)" > version
-
-bumprelease:
- echo "$(VERSION) $(NEWRELEASE)" > version
-
-bumpversion:
- echo "$(NEWVERSION) 0" > version
-
-setversion:
- echo "$(VERSION) $(RELEASE)" > version
+include ../common/release.mk
clean:
rm -f ovirt*.gz ovirt*.rpm
@@ -53,11 +20,8 @@ tar: clean
cp version rpm-build/
rm -rf $(NV)
-new-rpms: bumprelease rpms
-
-rpms: tar
- rpmbuild $(RPM_FLAGS) -ba $(SPEC_FILE)
-
# convience method to simulate make install, not for production use
install: rpms
rpm -Uvh rpm-build/ovirt-wui-$(VERSION)-$(RELEASE)$(DIST).$(ARCH).rpm --force
+
+.PHONY: all clean genlangs tar install
--
1.5.6.rc3.23.gc3bdd
More information about the ovirt-devel
mailing list