Mailing List Archive

[xen-unstable] Updates for XEN_LINUX_SOURCE=hg-clone.
# HG changeset patch
# User Ian Campbell <ian.campbell@xensource.com>
# Date 1180619469 -3600
# Node ID f6ff5d42164fb0b2257da5accd1352891629a96c
# Parent e2ba95ed2b091333984e1cc7283255323db9058f
Updates for XEN_LINUX_SOURCE=hg-clone.

By default search for mercurial repositories in $(LINUX_SRC_PATH)
followed by a location derived from the current Xen repository's
default parent. e.g. A clone of
http://xenbits.xensource.com/xen-unstable.hg will derive
http://xenbits.xensource.com/linux-2.6.18-xen.hg. A specific
repository can be specified by giving XEN_LINUX_HGREPO=<URL or path>
on the make command line.

Add capability to put XEN_LINUX_UPDATE=y on the make command line to
update the Linux repository. Disabled by default since we don't want
to touch a developers repository without permission.

Dropped XEN_LINUX_HGUPDATES since it was unecessary and confusing.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
---
buildconfigs/mk.linux-2.6-xen | 4 +++
buildconfigs/select-repository | 49 +++++++++++++++++++++++++++++++++++++++++
buildconfigs/src.hg-clone | 49 +++++++++++++++++++++++++----------------
buildconfigs/src.sparse | 2 -
buildconfigs/src.tarball | 2 -
5 files changed, 84 insertions(+), 22 deletions(-)

diff -r e2ba95ed2b09 -r f6ff5d42164f buildconfigs/mk.linux-2.6-xen
--- a/buildconfigs/mk.linux-2.6-xen Thu May 31 10:58:22 2007 +0100
+++ b/buildconfigs/mk.linux-2.6-xen Thu May 31 14:51:09 2007 +0100
@@ -2,6 +2,10 @@ LINUX_VER ?= 2.6.18
LINUX_VER ?= 2.6.18

EXTRAVERSION ?= -xen
+
+# Linux search path, will be searched for tarballs and mercurial
+# repositories.
+LINUX_SRC_PATH ?= .:..

XEN_LINUX_SOURCE ?= sparse

diff -r e2ba95ed2b09 -r f6ff5d42164f buildconfigs/select-repository
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/buildconfigs/select-repository Thu May 31 14:51:09 2007 +0100
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+ME=$(basename $0)
+
+if [ $# -lt 1 ] || [ $# -gt 2 ] ; then
+ echo "usage: $ME <repository-name> [search-path]" 1>&2
+ exit 1;
+fi
+
+REPO=$1
+LINUX_SRC_PATH=$2
+
+if [ X"${LINUX_SRC_PATH}" != X ] ; then
+ echo "$ME: Searching \`${LINUX_SRC_PATH}' for $REPO" 1>&2
+ IFS_saved="$IFS"
+ IFS=:
+ for i in $LINUX_SRC_PATH ; do
+ # Ignore current directory since we will almost certainly find
+ # the target directory there which breaks updating (there's no
+ # point updating from yourself!).
+ if [ X"." = X"${i}" ] ; then
+ echo "$ME: Ignoring \`.'" 1>&2
+ continue
+ fi
+
+ if [ -d "$i/$REPO/.hg" ] ; then
+ echo "$ME: Found $i/$REPO" 1>&2
+ echo "$i/$REPO"
+ exit 0
+ fi
+ done
+ IFS="$IFS_saved"
+fi
+
+XEN=$(hg -R ${XEN_ROOT} path default)
+if [ $? -ne 0 ] || [ X"$XEN" = "X" ] ; then
+ echo "$ME: Unable to determine Xen repository parent." 1>&2
+ exit 1;
+fi
+
+BASE=$(dirname ${XEN})
+if [ $? -ne 0 ] || [ X"$XEN" = "X" ] ; then
+ echo "$ME: Unable to determine Xen repository parent." 1>&2
+ exit 1;
+fi
+
+echo "$ME: Found ${BASE}/${REPO}" 1>&2
+echo ${BASE}/${REPO}
+exit 0
diff -r e2ba95ed2b09 -r f6ff5d42164f buildconfigs/src.hg-clone
--- a/buildconfigs/src.hg-clone Thu May 31 10:58:22 2007 +0100
+++ b/buildconfigs/src.hg-clone Thu May 31 14:51:09 2007 +0100
@@ -1,26 +1,39 @@
-# Main repository to clone.
-XEN_LINUX_HGREPO ?= http://xenbits.xensource.com/linux-$(LINUX_VER)-xen.hg
-
-# Set this to pull additional changesets from a second source.
-
-# This can be useful if you use a local mirror for XEN_LINUX_HGREPO
-# (to reduce time spent cloning) but still want to pull the very
-# latest changesets from xenbits.
-XEN_LINUX_HGUPDATES ?=
-
-# Set this to update to a particlar revision.
-XEN_LINUX_HGREV ?=
+# Mercurial
+HG ?= hg

LINUX_SRCDIR ?= linux-$(LINUX_VER)-xen.hg

-$(LINUX_SRCDIR)/.valid-src:
+# Repository to clone.
+XEN_LINUX_HGREPO ?= $$(sh buildconfigs/select-repository $(LINUX_SRCDIR) $(LINUX_SRC_PATH))
+
+# The source directory is not automatically updated to avoid blowing
+# away developer's changes. If you want to automatically pull a new
+# version of the Linux tree then add `XEN_LINUX_UPDATE=y' to your make
+# command line.
+ifeq ($(XEN_LINUX_UPDATE),y)
+__XEN_LINUX_UPDATE = $(LINUX_SRCDIR)/.force-update
+else
+__XEN_LINUX_UPDATE =
+endif
+
+# Set XEN_LINUX_HGREV to update to a particlar revision.
+XEN_LINUX_HGREV ?= tip
+
+$(LINUX_SRCDIR)/.valid-src: $(__XEN_LINUX_UPDATE)
+ set -e ; __repo=$(XEN_LINUX_HGREPO) ; \
if [ ! -d $(LINUX_SRCDIR) ] ; then \
- hg clone $(XEN_LINUX_HGREPO) $(LINUX_SRCDIR) ; \
- fi
- if [ -n "$(XEN_LINUX_HGUPDATES)" ] ; then \
- hg pull -R $(LINUX_SRCDIR) $(XEN_LINUX_HGUPDATES) ; \
+ echo "Cloning $${__repo} to $(LINUX_SRCDIR)." ; \
+ $(HG) clone $${__repo} $(LINUX_SRCDIR) ; \
+ else \
+ echo "Pulling changes from $${__repo} into $(LINUX_SRCDIR)." ; \
+ $(HG) -R $(LINUX_SRCDIR) pull $${__repo} ; \
fi
if [ -n "$(XEN_LINUX_HGREV)" ] ; then \
- hg update -R $(LINUX_SRCDIR) $(XEN_LINUX_HGREV) ; \
+ echo "Updating $(LINUX_SRCDIR) to revision $(XEN_LINUX_HGREV)." ; \
+ $(HG) update -R $(LINUX_SRCDIR) $(XEN_LINUX_HGREV) ; \
fi
touch $@
+
+.PHONY: $(LINUX_SRCDIR)/.force-update
+$(LINUX_SRCDIR)/.force-update:
+ @ :
diff -r e2ba95ed2b09 -r f6ff5d42164f buildconfigs/src.sparse
--- a/buildconfigs/src.sparse Thu May 31 10:58:22 2007 +0100
+++ b/buildconfigs/src.sparse Thu May 31 14:51:09 2007 +0100
@@ -7,8 +7,6 @@ PRISTINE_SRC_PATH ?= .:..
PRISTINE_SRC_PATH ?= .:..
vpath pristine-% $(PRISTINE_SRC_PATH)

-# Setup Linux search path
-LINUX_SRC_PATH ?= .:..
vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
vpath patch-%.bz2 $(LINUX_SRC_PATH)

diff -r e2ba95ed2b09 -r f6ff5d42164f buildconfigs/src.tarball
--- a/buildconfigs/src.tarball Thu May 31 10:58:22 2007 +0100
+++ b/buildconfigs/src.tarball Thu May 31 14:51:09 2007 +0100
@@ -3,8 +3,6 @@ XEN_LINUX_TARBALL ?= linux-$(LINUX_VER)-

LINUX_SRCDIR ?= linux-$(LINUX_VER)

-# Setup Linux search path
-LINUX_SRC_PATH ?= .:..
vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)

# download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog