Commits

alasdairlumsden committed b4aa197 Draft

2680 Extract source archives to a subdirectory
2681 Downloading archives to a common area

Comments (0)

Files changed (3)

make-rules/prep.mk

 
 # template for download rules. add new rules with $(call download-rule, suffix)
 define download-rule
+ifdef COMPONENT_ARCHIVE$(1)
 ARCHIVES += $$(COMPONENT_ARCHIVE$(1))
 CLOBBER_PATHS += $$(COMPONENT_ARCHIVE$(1))
-$$(USERLAND_ARCHIVES)$$(COMPONENT_ARCHIVE$(1)):	Makefile
+$$(USERLAND_ARCHIVES)/$$(COMPONENT_ARCHIVE$(1)):	Makefile
+	($$(MKDIR) $$(USERLAND_ARCHIVES) && \
 	$$(FETCH) --file $$@ \
 		$$(COMPONENT_ARCHIVE_URL$(1):%=--url %) \
-		$$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %)
-	$$(TOUCH) $$@
+		$$(COMPONENT_ARCHIVE_HASH$(1):%=--hash %) && \
+	$$(TOUCH) $$@)
+endif
 endef
 
 # Generate the download rules from the above template
 
 $(SOURCE_DIR)/.unpacked:	download Makefile $(PATCHES)
 	$(RM) -r $(SOURCE_DIR)
-	$(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)$(COMPONENT_ARCHIVE)
+	($(MKDIR) $(COMPONENT_DIR)/source && \
+	cd $(COMPONENT_DIR)/source && \
+	$(UNPACK) $(UNPACK_ARGS) $(USERLAND_ARCHIVES)/$(COMPONENT_ARCHIVE))
+	$(COMPONENT_POST_UNPACK_ACTION)
 	$(TOUCH) $@
 
 $(SOURCE_DIR)/.patched:	$(SOURCE_DIR)/.unpacked $(STAMPS)
 
 prep::	$(SOURCE_DIR)/.prep
 
-download::	$(ARCHIVES:%=$(USERLAND_ARCHIVES)%)
+download::	$(ARCHIVES:%=$(USERLAND_ARCHIVES)/%)
 
 clean::
 	$(RM) -r $(CLEAN_PATHS)

make-rules/shared-macros.mk

 WS_INCORPORATIONS =	$(WS_TOP)/incorporations
 WS_LINT_CACHE =	$(WS_TOP)/$(MACH)/pkglint-cache
 
+USERLAND_ARCHIVES ?=	$(WS_TOP)/archives
+
 BASS_O_MATIC =	$(WS_TOOLS)/bass-o-matic
 
 CLONEY =	$(WS_TOOLS)/cloney
 #CANONICAL_REPO ?=		http://pkg.openindiana.org/experimental/
 
 COMPONENT_DIR =	$(shell pwd)
-SOURCE_DIR =	$(COMPONENT_DIR)/$(COMPONENT_SRC)
+SOURCE_DIR =	$(COMPONENT_DIR)/source/$(COMPONENT_SRC)
 BUILD_DIR =	$(COMPONENT_DIR)/build
 PROTO_DIR =	$(BUILD_DIR)/prototype/$(MACH)
 

tools/userland-unpack

 		else:
 			assert False, "unknown option"
 
-	filename = ((args[0] == '/') and "%s" or "../%s") % args[0]
+	filename = args[0]
 	uncompress, unpack = uncompress_unpack_commands(filename)
 	tempdir = tempfile.mkdtemp(dir='.')