[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] build: clean up kclean and distclean for kernel



* Don't delete non-existent %.tar.bz2 in buildconfigs/Rules.mk's %-mrproper
* Add a mrpropper target to buildconfigs/mk.linux-2.6-xen, and
  have this delete the local tarball
  - This should also delete the local patch, if there is one, but I am not
    sure how to do this with the current incarntation of the code, and I
    will post a subsequent patch which makes this easier and effects this
    chang. As there currently is no local patch this is not a big deal at
    this moment. (Horms)
* Make distclean depend on kdekete, rather than calling delete target by
  hand
* Stop kclean from erroring out if the kernel directory doesn't exist
* Remove patches/*/.makedep in top level Makefile rather than in
  buildconfigs/Rules.mk, as calling rules in the latter causes
  patches/*/.make to be created (Magnus)

Signed-Off-By: Magnus Damm <magnus@xxxxxxxxxxxxx>
Signed-Off-By: Horms <horms@xxxxxxxxxxxx>

--- from-0001/Config.mk
+++ to-work/Config.mk   2006-06-29 10:11:45.000000000 +0900
@@ -57,7 +57,17 @@ LDFLAGS += $(foreach i, $(EXTRA_LIB), -L
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
 
 # Choose the best mirror to download linux kernel
-KERNEL_REPO = http://www.kernel.org
+DOWNLOAD_PATH_DEFAULT := .:..
+LINUX_REPO_DEFAULT    := http://www.kernel.org/pub/linux/kernel/
+ifdef LINUX_SRC_PATH
+DOWNLOAD_PATH  ?= $(LINUX_SRC_PATH) # Compatibility
+else
+DOWNLOAD_PATH  ?= $(DOWNLOAD_PATH_DEFAULT)
+endif
+DOWNLOAD_DIR   := $(firstword $(subst :, ,$(DOWNLOAD_PATH)))
+LINUX_REPO     ?= $(LINUX_REPO_DEFAULT)
+# LINUX_REPO_KERNEL_PATH Set in buildconfigs/Rules.mk, if not in environment
+# LINUX_REPO_PATCH_PATH  Set in buildconfigs/Rules.mk, if not in environment
 
 # If ACM_SECURITY = y, then the access control module is compiled
 # into Xen and the policy type can be set by the boot policy file
--- from-0002/Makefile
+++ to-work/Makefile    2006-06-29 10:11:45.000000000 +0900
@@ -175,6 +175,20 @@ help:
        @echo '                     install into prefix/lib/python<VERSION>'
        @echo '                     instead of <PREFIX>/lib/python'
        @echo '                     true if set to non-empty value, false 
otherwise'
+       @echo '  LINUX_REPO=URL   - Base URL to download linux kernel from'
+       @echo '                     Default: "$(LINUX_REPO_DEFAULT)"'
+       @echo '  LINUX_REPO_KERNEL_PATH=DIRECTORY'
+       @echo '                   - LINUX_REPO assumes that the URL has the 
same directory'
+       @echo '                     structure as $(LINUX_REPO_DEFAULT)'
+       @echo '                     and the rest of the path to the tarball is 
derived.'
+       @echo '                     If set, override the derivation.'
+       @echo '                     Default: ""'
+       @echo '  LINUX_REPO_PATCHL_PATH=DIRECTORY'
+       @echo '                   - LINUX_REPO assumes that the URL has the 
same directory'
+       @echo '                     structure as $(LINUX_REPO_DEFAULT)'
+       @echo '                     and the rest of the path to the patches is 
derived.'
+       @echo '                     If set, override the derivation.'
+       @echo '                     Default: ""'
 
 # Use this target with extreme care!
 .PHONY: uninstall
--- from-0002/buildconfigs/Rules.mk
+++ to-work/buildconfigs/Rules.mk       2006-06-29 10:11:45.000000000 +0900
@@ -22,32 +22,58 @@ LINUX_SERIES        ?= 2.6
 LINUX_VER      ?= $(shell grep "^LINUX_VER" buildconfigs/mk.linux-2.6-xen | 
sed -e 's/.*=[ ]*//')
 
 # Setup Linux search path
-LINUX_SRC_PATH ?= .:..
-vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
-vpath patch-%.bz2 $(LINUX_SRC_PATH)
+vpath linux-%.tar.bz2 $(DOWNLOAD_PATH)
+vpath patch-%.bz2 $(DOWNLOAD_PATH)
 
 # download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH
+ifndef LINUX_REPO_KERNEL_PATH
 linux-%.tar.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$*)).$(word 
2,$(subst ., ,$*))
+linux-%.tar.bz2: LINUX_REPO_KERNEL_PATH = v$(_LINUX_VDIR)
+endif
 linux-%.tar.bz2:
        @echo "Cannot find $@ in path $(LINUX_SRC_PATH)"
-       wget $(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$@ -O./$@
+       wget $(LINUX_REPO)/$(LINUX_REPO_KERNEL_PATH)/$@ -O$(DOWNLOAD_DIR)/$@ \
+               || { rm -f $(DOWNLOAD_DIR)/$@; false; }
 
+ifndef LINUX_REPO_PATCH_PATH
 patch-%.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$(*F))).$(word 
2,$(subst ., ,$(*F)))
 patch-%.bz2: override _LINUX_XDIR = $(if $(word 3,$(subst -, 
,$(*F))),snapshots,testing)
+patch-%.bz2: LINUX_REPO_PATCH_PATH = v$(_LINUX_VDIR)/$(_LINUX_XDIR)
+endif
 patch-%.bz2:
        @echo "Cannot find $(@F) in path $(LINUX_SRC_PATH)"
-       wget 
$(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$(_LINUX_XDIR)/$(@F) -O./$@
+       wget $(LINUX_REPO)/$(LINUX_REPO_PATCH_PATH)/$(@F) \
+               -O$(DOWNLOAD_DIR)/$@ || { rm -f $(DOWNLOAD_DIR)/$@; false; }
 
 pristine-%: pristine-%/.valid-pristine
        @true
+  
+# unpack-pristine and patch-pristine targets are run in a submake
+# so that vpath is re-evaluated. This is important for the case
+# where the files are dowloaded this time around, and they are downloaded
+# into an alternate directory, as specified by DOWNLOAD_PATH
+
+unpack-pristine-%-X: %
+       tar -C $(UNPACK_DIR) -jxf $<
+
+patch-pristine-%-X: %
+       echo $<
+       bzcat $< | patch -d $(UNPACK_DIR) -p1
+
+.PHONY: patch-pristine-dummy
+patch-pristine-dummy-X:
 
-pristine-%/.valid-pristine: %.tar.bz2
+pristine-%/.valid-pristine: $(LINUX_TARBALL) $(LINUX_PATCHES)
        rm -rf tmp-pristine-$* $(@D)
        mkdir -p tmp-pristine-$*
-       tar -C tmp-pristine-$* -jxf $<
-       -@rm -f tmp-pristine-$*/pax_global_header
+       @# firstword is used to get rid of any whitespace
+       $(MAKE) UNPACK_DIR=tmp-pristine-$* \
+               unpack-pristine-$(firstword $(LINUX_TARBALL))-X
+       -rm -f tmp-pristine-$*/pax_global_header
        mv tmp-pristine-$*/* $(@D)
-       @rm -rf tmp-pristine-$*
+       rm -rf tmp-pristine-$*
+       $(MAKE) KERNELS=linux-2.6-xen UNPACK_DIR=pristine-$* \
+               $(patsubst %, patch-pristine-%-X, dummy $(LINUX_PATCHES))
        touch $(@D)/.hgskip
        touch $@ # update timestamp to avoid rebuild
 
--- from-0003/buildconfigs/mk.linux-2.6-xen
+++ to-work/buildconfigs/mk.linux-2.6-xen       2006-06-29 10:14:41.000000000 
+0900
@@ -1,5 +1,7 @@
 LINUX_SERIES = 2.6
 LINUX_VER    = 2.6.16.13
+LINUX_TARBALL = linux-2.6.16.13.tar.bz2 # Only one makes sense
+#LINUX_PATCHES = patch-2.6.17-rcN.bz2 # Usually zero or one patch
 
 EXTRAVERSION ?= xen
 
@@ -57,4 +59,4 @@ delete: 
 
 .PHONY: mrpropper
 mrpropper:
-       rm -f linux-$(LINUX_VER).tar.bz2
+       rm -f $(LINUX_TARBALL) $(LINUX_PATCHES)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.