Skip to contentSkip to conversation

make: Check tools/qemu-xen[-traditional] for qemu before downloading

PATCH In review George Dunlap 4 participants 14 messages Jul 2, 2014 – Jul 8, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 make: Check tools/qemu-xen[-traditional] for qemu before downloading

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

In order to make this "just work", at the moment developer doing the release manually modifies Config.mk as part of the relase process so that CONFIG_QEMU and QEMU_UPSTREAM_URL point into the tools/ directory instead.

Modify Config.mk to automatically check there before trying a remote repository.

---

Since we're essentially manually doing this for each release anyway, I propose this c/s be backported to all currently-maintained branches.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Jan Beulich <[email protected]>
---
 Config.mk |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
Config.mk +13 -5
index e7f14ef..dac9893 100644
@@ -224,6 +224,19 @@ else
 QEMU_REMOTE ?= git://xenbits.xen.org/qemu-xen-unstable.git
 endif
 
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif
+
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen))
+QEMU_UPSTREAM_URL ?= $(XEN_ROOT)/tools/qemu-xen
+endif
+
 ifeq ($(GIT_HTTP),y)
 OVMF_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/ovmf.git
 QEMU_UPSTREAM_URL ?= http://xenbits.xen.org/git-http/qemu-upstream-unstable.git
@@ -241,11 +254,6 @@ SEABIOS_UPSTREAM_TAG ?= rel-1.7.4
 
 ETHERBOOT_NICS ?= rtl8139 8086100e
 
-# Specify which qemu-dm to use. This may be `ioemu' to use the old
-# Mercurial in-tree version, or a local directory, or a git URL.
-# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
-CONFIG_QEMU ?= $(QEMU_REMOTE)
-
 QEMU_TAG ?= d0395cc49b2ec6d1723c01f1daf2394b9264ca29
 # Tue Apr 8 16:50:06 2014 +0000
 # qemu-xen-trad: free all the pirqs for msi/msix when driver unloads
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 make: Make "src-tarball" target actually make a source tarball

At the moment, making a release tarball is an annoyingly manual process that involves running "git archive" into a temporary directory.

Script this process up and make a target, so that the release manager can simply type "make src-tarball" and have everything show up nice and neat in dist/xen-$version.tar.gz.

---

I realize we don't normally backport this sort of thing, but I thought it might be worth considering an exception, just to make future releases much more consistent.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Jan Beulich <[email protected]>
---
 Makefile             |   19 ++++++++++++-------
 tools/misc/mktarball |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 7 deletions(-)
 create mode 100755 tools/misc/mktarball
Makefile +12 -7
index 41dabbf..f309034 100644
@@ -135,6 +135,15 @@ debball: dist
 rpmball: dist
 	bash ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
+# Make a source tarball
+.PHONY: src-tarball
+src-tarball: 
+	$(MAKE) -C tools qemu-xen-dir-find
+	$(MAKE) -C tools qemu-xen-dir-force-update
+	$(MAKE) -C tools qemu-xen-traditional-dir-find
+	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
+	bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
+
 .PHONY: clean
 clean::
 	$(MAKE) -C xen clean
@@ -163,13 +172,6 @@ endif
 .PHONY: mrproper
 mrproper: distclean
 
-# Prepare for source tarball
-.PHONY: src-tarball
-src-tarball: distclean
-	$(MAKE) -C xen .banner
-	rm -rf xen/tools/figlet .[a-z]*
-	$(MAKE) -C xen distclean
-
 .PHONY: help
 help:
 	@echo 'Installation targets:'
@@ -202,6 +204,9 @@ help:
 	@echo '  install-tboot    - download, build, and install the tboot module'
 	@echo '  clean-tboot      - clean the tboot module if it exists'
 	@echo
+	@echo 'Tarball targets:'
+	@echo '  src-tarball      - make a source tarball with xen and qemu suitable for a release'
+	@echo
 	@echo 'Environment:'
 	@echo '  [ this documentation is sadly not complete ]'
 
tools/misc/mktarball new file +42 -0

43 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

Quoted 1 line · George Dunlap

+tdir=$(mktemp -d $xen_root/dist/xen.XXXXXXXX) || exit 1

Doesn't set -e make all (or most) of these "|| exit 1" bits unnecessary?

tools/misc/mktarball line 30

Quoted 9 lines
tools/misc/mktarball new file +9 -0
+
+mkdir $tdir/xen-$desc || exit 1
+
+git archive --format=tar HEAD |tar Cxf $tdir/xen-$desc - || exit 1
+
+mkdir $tdir/xen-$desc/tools/qemu-xen || exit 1
+mkdir $tdir/xen-$desc/tools/qemu-xen-traditional || exit 1
+
+pushd $xen_root/tools/qemu-xen-traditional-dir-remote || exit 1

FWIW I think you could avoid much of this pushd/popd stuff with tar -C and git --git-dir= (perhaps --work-dir, not sure for git archive).

Ian.

#3 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

Quoted 3 lines · Ian Campbell
Quoted 1 line · George Dunlap

+tdir=$(mktemp -d $xen_root/dist/xen.XXXXXXXX) || exit 1

Doesn't set -e make all (or most) of these "|| exit 1" bits unnecessary?

Er, yes. Sorry.

Quoted 12 lines

tools/misc/mktarball line 30

Quoted 10 lines
tools/misc/mktarball new file +9 -0
+
+mkdir $tdir/xen-$desc || exit 1
+
+git archive --format=tar HEAD |tar Cxf $tdir/xen-$desc - || exit 1
+
+mkdir $tdir/xen-$desc/tools/qemu-xen || exit 1
+mkdir $tdir/xen-$desc/tools/qemu-xen-traditional || exit 1
+
+pushd $xen_root/tools/qemu-xen-traditional-dir-remote || exit 1

FWIW I think you could avoid much of this pushd/popd stuff with tar -C and git --git-dir= (perhaps --work-dir, not sure for git archive).

The --git-dir think seemed to work differently enough to hg's "-C"
option that I didn't really trust it. If you think it's better I can try to work it out.

-George

#4 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

Quoted 20 lines · George Dunlap
Quoted 3 lines · Ian Campbell
Quoted 1 line · George Dunlap

+tdir=$(mktemp -d $xen_root/dist/xen.XXXXXXXX) || exit 1

Doesn't set -e make all (or most) of these "|| exit 1" bits unnecessary?

Er, yes. Sorry.

Quoted 12 lines

tools/misc/mktarball line 30

Quoted 10 lines
tools/misc/mktarball new file +9 -0
+
+mkdir $tdir/xen-$desc || exit 1
+
+git archive --format=tar HEAD |tar Cxf $tdir/xen-$desc - || exit 1
+
+mkdir $tdir/xen-$desc/tools/qemu-xen || exit 1
+mkdir $tdir/xen-$desc/tools/qemu-xen-traditional || exit 1
+
+pushd $xen_root/tools/qemu-xen-traditional-dir-remote || exit 1

FWIW I think you could avoid much of this pushd/popd stuff with tar -C and git --git-dir= (perhaps --work-dir, not sure for git archive).

Quoted 3 lines

The --git-dir think seemed to work differently enough to hg's "-C"
option that I didn't really trust it. If you think it's better I can try to work it out.

You might need work-dir too?

Ian.

#5 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

In reply to George Dunlap

George Dunlap writes ("Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball"):

Quoted 7 lines · Ian Campbell
Quoted 2 lines

FWIW I think you could avoid much of this pushd/popd stuff with tar -C and git --git-dir= (perhaps --work-dir, not sure for git archive).

The --git-dir think seemed to work differently enough to hg's "-C"
option that I didn't really trust it. If you think it's better I can try to work it out.

Firstly, thanks for cleaning up this area, which sorely needs it.

Please don't. I wouldn't really trust it either :-).

Instead of pushd/popd, you might consider ( ).

Ian.

#6 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

Quoted 9 lines · Ian Jackson

George Dunlap writes ("Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball"):

Quoted 7 lines · Ian Campbell
Quoted 2 lines

FWIW I think you could avoid much of this pushd/popd stuff with tar -C and git --git-dir= (perhaps --work-dir, not sure for git archive).

The --git-dir think seemed to work differently enough to hg's "-C"
option that I didn't really trust it. If you think it's better I can try to work it out.

Quoted 5 lines

Firstly, thanks for cleaning up this area, which sorely needs it.

Please don't. I wouldn't really trust it either :-).

Instead of pushd/popd, you might consider ( ).

Well I've rewritten it with --git-dir already, and it looks a lot cleaner. I'll send that version and you can see what you think.

(May be a few days.)

-George

#7 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

In reply to George Dunlap
Quoted 2 lines · George Dunlap

At the moment, making a release tarball is an annoyingly manual process that involves running "git archive" into a temporary directory.

Does the source tarball would need to includes tarball of ipxe and the different stuff to build a stubdom ?

Quoted 82 lines

Script this process up and make a target, so that the release manager can simply type "make src-tarball" and have everything show up nice and neat in dist/xen-$version.tar.gz.

---

I realize we don't normally backport this sort of thing, but I thought it might be worth considering an exception, just to make future releases much more consistent.

CC Ian Campbell <[email protected]>
CC Ian Jackson <[email protected]>
CC Jan Beulich <[email protected]>
---
 Makefile             |   19 ++++++++++++-------
 tools/misc/mktarball |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 7 deletions(-)
 create mode 100755 tools/misc/mktarball
Makefile +12 -7
index 41dabbf..f309034 100644
@@ -135,6 +135,15 @@ debball: dist
 rpmball: dist
 	bash ./tools/misc/mkrpm $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
 
+# Make a source tarball
+.PHONY: src-tarball
+src-tarball: 
+	$(MAKE) -C tools qemu-xen-dir-find
+	$(MAKE) -C tools qemu-xen-dir-force-update
+	$(MAKE) -C tools qemu-xen-traditional-dir-find
+	$(MAKE) -C tools qemu-xen-traditional-dir-force-update
+	bash ./tools/misc/mktarball $(XEN_ROOT) $$($(MAKE) -C xen xenversion --no-print-directory)
+
 .PHONY: clean
 clean::
 	$(MAKE) -C xen clean
@@ -163,13 +172,6 @@ endif
 .PHONY: mrproper
 mrproper: distclean
 
-# Prepare for source tarball
-.PHONY: src-tarball
-src-tarball: distclean
-	$(MAKE) -C xen .banner
-	rm -rf xen/tools/figlet .[a-z]*
-	$(MAKE) -C xen distclean
-
 .PHONY: help
 help:
 	@echo 'Installation targets:'
@@ -202,6 +204,9 @@ help:
 	@echo '  install-tboot    - download, build, and install the tboot module'
 	@echo '  clean-tboot      - clean the tboot module if it exists'
 	@echo
+	@echo 'Tarball targets:'
+	@echo '  src-tarball      - make a source tarball with xen and qemu suitable for a release'
+	@echo
 	@echo 'Environment:'
 	@echo '  [ this documentation is sadly not complete ]'
 
tools/misc/mktarball new file +11 -0
new file mode 100755
index 0000000..95ef480
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# mktarball: Make a release tarball (including xen, qemu, and qemu-traditional)
+#
+# Takes 2 arguments, the path to the dist directory and the version
+function finish {
+    [[ -n "$tdir" ]] && rm -rf $tdir
+}
+trap finish EXIT
+
+set -e

tools/misc/mktarball line 21

Quoted 10 lines
tools/misc/mktarball new file +10 -0
+
+if [[ -z "$1" || -z "$2" ]] ; then
+  echo "usage: $0 path-to-XEN_ROOT xen-version"
+  exit 1
+fi
+
+xen_root=$1
+desc=$2
+
+tdir=$(mktemp -d $xen_root/dist/xen.XXXXXXXX) || exit 1

Many missing " around variables, better safe than sorry :).

Signature · 1 line
Anthony PERARD
#8 lore raw

Re: [PATCH 2/2] make: Make "src-tarball" target actually make a source tarball

Quoted 5 lines · Anthony PERARD
Quoted 2 lines · George Dunlap

At the moment, making a release tarball is an annoyingly manual process that involves running "git archive" into a temporary directory.

Does the source tarball would need to includes tarball of ipxe and the different stuff to build a stubdom ?

At the moment, AFAIK, the normal xen release tarballs do not.

We could call this target "release-tarball" instead.

Quoted 6 lines

tools/misc/mktarball line 21

Quoted 5 lines
tools/misc/mktarball new file +4 -0
+xen_root=$1
+desc=$2
+
+tdir=$(mktemp -d $xen_root/dist/xen.XXXXXXXX) || exit 1

Many missing " around variables, better safe than sorry :).

Ack.

-George

#9 lore raw
In reply to George Dunlap
Quoted 8 lines · George Dunlap

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

In order to make this "just work", at the moment developer doing the release manually modifies Config.mk as part of the relase process so that CONFIG_QEMU and QEMU_UPSTREAM_URL point into the tools/ directory instead.

Since this mainly means Ian I'll mostly leave both of these patches to him.

Config.mk else · line 234

Quoted 8 lines
Config.mk +8 -0
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif

Does this DTRT on subsequent runs after the automatic git clone has happened on the first run? I suspect so, but I'm not 100% sure. f.e. does "make tools/qemu-xen-traditional-dir-force-update" still work?

Ian.

#10 lore raw
Quoted 12 lines · Ian Campbell
Quoted 8 lines · George Dunlap

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

In order to make this "just work", at the moment developer doing the release manually modifies Config.mk as part of the relase process so that CONFIG_QEMU and QEMU_UPSTREAM_URL point into the tools/ directory instead.

Since this mainly means Ian I'll mostly leave both of these patches to him.

Quoted 11 lines

Config.mk else · line 234

Quoted 8 lines
Config.mk +8 -0
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif

Does this DTRT on subsequent runs after the automatic git clone has happened on the first run? I suspect so, but I'm not 100% sure. f.e. does "make tools/qemu-xen-traditional-dir-force-update" still work?

Yes, all that still works, because the directories it creates when automatically cloning the qemu repos are named differently (qemu-xen[-traditional]-dir[-remote]).

-George

#11 lore raw
Quoted 25 lines · George Dunlap
Quoted 12 lines · Ian Campbell
Quoted 8 lines · George Dunlap

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

In order to make this "just work", at the moment developer doing the release manually modifies Config.mk as part of the relase process so that CONFIG_QEMU and QEMU_UPSTREAM_URL point into the tools/ directory instead.

Since this mainly means Ian I'll mostly leave both of these patches to him.

Quoted 11 lines

Config.mk else · line 234

Quoted 8 lines
Config.mk +8 -0
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif

Does this DTRT on subsequent runs after the automatic git clone has happened on the first run? I suspect so, but I'm not 100% sure. f.e. does "make tools/qemu-xen-traditional-dir-force-update" still work?

Quoted 3 lines

Yes, all that still works, because the directories it creates when automatically cloning the qemu repos are named differently (qemu-xen[-traditional]-dir[-remote]).

Ah, I thought tools/qemu-xen-traditional ended up being a symlink to that, but you are right it has a -dir suffix.

Ian.

#12 lore raw
In reply to George Dunlap

George Dunlap writes ("[PATCH 1/2] make: Check tools/qemu-xen[-traditional] for qemu before downloading"):

Quoted 3 lines

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

...

Config.mk else · line 234

Quoted 8 lines
Config.mk +8 -0
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif

Perhaps this could be better written as

  CONFIG_QEMU ?= $(or $(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional),\
                      $(QEMU_REMOTE))

?

Config.mk else · line 238

Quoted 3 lines
Config.mk +3 -0
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen))
+QEMU_UPSTREAM_URL ?= $(XEN_ROOT)/tools/qemu-xen
+endif

I'm tempted to complain about the repetition here. Perhaps
QEMU_UPSTREAM_INTREE ?= $(XEN_ROOT)/tools/qemu-xen
and use it twice ?

Ian.

#13 lore raw
Quoted 15 lines · Ian Jackson

George Dunlap writes ("[PATCH 1/2] make: Check tools/qemu-xen[-traditional] for qemu before downloading"):

Quoted 3 lines

Currently xen, qemu-xen, and qemu-xen-traditional are kept in separate repositories, but when we release them as a tarball, qemu-xen and qemu-xen-traditional are in-lined into the tools/ directory.

...

Config.mk else · line 234

Quoted 8 lines
Config.mk +8 -0
+# Specify which qemu-dm to use. This may be `ioemu' to use the old
+# Mercurial in-tree version, or a local directory, or a git URL.
+# CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional))
+CONFIG_QEMU ?= $(XEN_ROOT)/tools/qemu-xen-traditional
+else
+CONFIG_QEMU ?= $(QEMU_REMOTE)
+endif

Perhaps this could be better written as

Quoted 2 lines
   CONFIG_QEMU ?= $(or $(wildcard $(XEN_ROOT)/tools/qemu-xen-traditional),\
                       $(QEMU_REMOTE))

I'll give that a try.

Quoted 9 lines

?

Config.mk else · line 238

Quoted 3 lines
Config.mk +3 -0
+ifneq (,$(wildcard $(XEN_ROOT)/tools/qemu-xen))
+QEMU_UPSTREAM_URL ?= $(XEN_ROOT)/tools/qemu-xen
+endif

I'm tempted to complain about the repetition here. Perhaps
QEMU_UPSTREAM_INTREE ?= $(XEN_ROOT)/tools/qemu-xen
and use it twice ?

Oh, you mean duplicating the path for the inlined repo. Yeah, I could do something like that.

I was thinking about adding a CONFIG_QEMU_UPSTREAM option, so that _URL could actually mean URL, rather than sometimes meaning URL and sometimes meaning PATH. But I thought that might be too much change to backport.

-George