Hi,

I created a patch for linuxboot/Makefile that affects how make download works.  
I added a "download cache" 
where the downloaded source files can be kept.  If the files are already there, 
then those copies are used
rather than downloading the file again.  This helps me in doing a clean rebuild 
on a slower link without 
having to download all of the files again.  If you just use the defaults, it 
should work as it did before.

Allan.

Index: Makefile
===================================================================
RCS file: /cvsroot/unattended/unattended/linuxboot/Makefile,v
retrieving revision 1.196
diff -u -8 -p -r1.196 Makefile
--- Makefile	24 Jan 2009 18:51:16 -0000	1.196
+++ Makefile	31 Jan 2009 17:33:34 -0000
@@ -843,37 +843,41 @@ $(call link_file,iso/isolinux/isolinux.c
 
 tftpboot: tftpboot/bzImage tftpboot/initrd tftpboot/pxelinux.cfg/default tftpboot/pxelinux.0
 
 ## Maintainer targets
 
 # Macro to generate download-foo rule to download and unpack a package
 # FIXME - This is horrid
 dest=.
+downloadcache=/var/tmp
 download_rule=								\
 download-$(strip $(1)) :  ;						\
 	@what=$(strip $(1)) && suffix=$(strip $(2))			\
 	&& url=$(strip $(3)) && sub=$(strip $(4))			\
+	&& target=$(downloadcache)/$$$$what.$$$$suffix			\
 	&& [ -d $$$$what ]						\
-	|| { [ -n "$$$$sub" ] || sub=.					\
-	&& temp=`mktemp /var/tmp/dl.XXXXXX`				\
+	|| { [ -f $$$$target ]						\
+	|| { temp=`mktemp /var/tmp/dl.XXXXXX`				\
 	&& wget --passive-ftp --timeout 30 -O $$$$temp 			\
 		$$$$url$$$$what.$$$$suffix    				\
+	&& mv -f $$$$temp $$$$target; }					\
 	&& case $$$$suffix in						\
 		*.gz|tgz) prog="gzip -d -c" ;;				\
 		*.bz2) prog="bzcat -c" ;;				\
 		*) prog=cat ;;						\
 	esac								\
-	&& { $$$$prog $$$$temp | tar -C $(dest)/$$$$sub -xvf - ; }	\
-	&& { [ "$$$$sub" == . ] || ln -nsf "$$$$sub" "$$$$what" ; }	\
-	&& { [ "$$$$sub" != . ] || [ "$(dest)" == . ]			\
+	&& [ "x$$$$sub" != "x" ] || sub=.				\
+	&& { $$$$prog $$$$target | tar -C $(dest)/$$$$sub -xvf - ; }	\
+	&& echo sub:$$$$sub						\
+	&& { [ "x$$$$sub" = "x." ] || ln -nsf "$$$$sub" "$$$$what" ; }	\
+	&& { [ "x$$$$sub" != "x." ] || [ "$(dest)" = . ]		\
 		|| ln -sf $(dest)/$$$$what . ; }			\
-	&& if [ "$(keep-archives)" == "1" ] ; then			\
-		mv -f $$$$temp /var/tmp/$$$$what.$$$$suffix;		\
-	else rm $$$$temp ;						\
+	&& if [ "x$(keep-archives)" != "x1" ] ; then			\
+		rm $$target ;						\
 	fi								\
 	}
 
 cvs_rule=								\
 download-$(strip $(1)) : ;						\
 	@what=$(strip $(1)) && module=$(strip $(2))			\
 	&& repo=$(strip $(3)) && date=$$$${what\#\#*-}			\
 	&& { [ -d "$$$$what" ] && exit 0 || : ; }			\
Index: README.txt
===================================================================
RCS file: /cvsroot/unattended/unattended/linuxboot/README.txt,v
retrieving revision 1.4
diff -u -8 -p -r1.4 README.txt
--- README.txt	9 Jun 2004 21:47:53 -0000	1.4
+++ README.txt	31 Jan 2009 17:33:34 -0000
@@ -36,15 +36,28 @@ The Makefile generates the Linux boot di
 all required sources from their canonical locations, do "make
 download".  This will use gobs of disk space, a fast connection, and
 lots of time.
 
 If you want to download the packages into a different directory and
 create symlinks from here to there, use "make
 dest=/path/to/scratch/directory download" instead.
 
+By default, the source packages are kept after being unpacked.  If you
+want then removed, add "keep-archives=0" to the make variables.
+
+By default, if a source package is found in the directory specified by
+downloadcache (default /var/tmp), that is used instead of downloading
+the file again.  So, if you have a fresh checkout of unattended and
+all of the required source files, nothing more should get downloaded.
+This is particularly handy when you want to do a completely clean
+rebuild.
+
+Summarizing the options for "make download":
+make dest=/scratch/dir keep-archives=1 downloadcache=/path/mycache download
+
 Do "make iso" to build linuxboot.iso.  Do "make tftpboot" to populate
 the tftpboot/ directory.  A simple "make" does both.
 
 For more details, read the Makefile and other sources.  Hey, what do
 you expect on the bleeding edge?
 
 More ramblings and commentary are in NOTES.txt.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
unattended-devel mailing list
unattended-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to