use opkg/host for package installation - speeds up rebuild operations - aligns generated package list format with the one created by opkg on the target - fixes broken dependency handling in imagebuilder

SVN-Revision: 22949
This commit is contained in:
Jo-Philipp Wich 2010-09-06 02:15:46 +00:00
parent 5949f33b06
commit 9d74fc3eb3
2 changed files with 33 additions and 13 deletions

View file

@ -6,12 +6,15 @@
# #
# where to build (and put) .ipk packages # where to build (and put) .ipk packages
IPKG:= \ OPKG:= \
IPKG_TMP=$(TMP_DIR)/ipkg \ IPKG_TMP=$(TMP_DIR)/ipkg \
IPKG_INSTROOT=$(TARGET_DIR) \ IPKG_INSTROOT=$(TARGET_DIR) \
IPKG_CONF_DIR=$(STAGING_DIR)/etc \ IPKG_CONF_DIR=$(STAGING_DIR)/etc \
IPKG_OFFLINE_ROOT=$(TARGET_DIR) \ IPKG_OFFLINE_ROOT=$(TARGET_DIR) \
$(SCRIPT_DIR)/ipkg -force-defaults -force-depends $(STAGING_DIR_HOST)/bin/opkg \
-f $(STAGING_DIR)/etc/opkg.conf \
--force-depends \
--force-overwrite
# invoke ipkg-build with some default options # invoke ipkg-build with some default options
IPKG_BUILD:= \ IPKG_BUILD:= \
@ -76,7 +79,7 @@ ifeq ($(DUMP),)
rm -rf $(STAGING_DIR_ROOT)/tmp-$(1) rm -rf $(STAGING_DIR_ROOT)/tmp-$(1)
touch $$@ touch $$@
$$(IPKG_$(1)): $(STAGING_DIR)/etc/ipkg.conf $(STAMP_BUILT) $$(IPKG_$(1)): $(STAGING_DIR)/etc/opkg.conf $(STAMP_BUILT)
@rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1)) @rm -rf $(PACKAGE_DIR)/$(1)_* $$(IDIR_$(1))
mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL mkdir -p $(PACKAGE_DIR) $$(IDIR_$(1))/CONTROL
$(call Package/$(1)/install,$$(IDIR_$(1))) $(call Package/$(1)/install,$$(IDIR_$(1)))
@ -108,7 +111,8 @@ ifeq ($(DUMP),)
@[ -f $$(IPKG_$(1)) ] @[ -f $$(IPKG_$(1)) ]
$$(INFO_$(1)): $$(IPKG_$(1)) $$(INFO_$(1)): $$(IPKG_$(1))
$(IPKG) install $$(IPKG_$(1)) @[ -d $(TARGET_DIR)/tmp ] || mkdir -p $(TARGET_DIR)/tmp
$(OPKG) install $$(IPKG_$(1))
$(1)-clean: $(1)-clean:
rm -f $(PACKAGE_DIR)/$(1)_* rm -f $(PACKAGE_DIR)/$(1)_*
@ -117,9 +121,11 @@ ifeq ($(DUMP),)
endef endef
$(STAGING_DIR)/etc/ipkg.conf: $(STAGING_DIR)/etc/opkg.conf:
mkdir -p $(STAGING_DIR)/etc mkdir -p $(STAGING_DIR)/etc
echo "dest root /" > $(STAGING_DIR)/etc/ipkg.conf ( echo "dest root /" > $@; \
echo "option offline_root $(TARGET_DIR)" >> $(STAGING_DIR)/etc/ipkg.conf echo "arch all 100" >> $@; \
echo "arch $(PKGARCH) 200" >> $@; \
echo "option offline_root $(TARGET_DIR)" >> $@ )
endif endif

View file

@ -52,12 +52,15 @@ help: FORCE
# override variables from rules.mk # override variables from rules.mk
PACKAGE_DIR:=$(TOPDIR)/packages PACKAGE_DIR:=$(TOPDIR)/packages
IPKG:= \ OPKG:= \
IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \ IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \
IPKG_INSTROOT="$(TARGET_DIR)" \ IPKG_INSTROOT="$(TARGET_DIR)" \
IPKG_CONF_DIR="$(TOPDIR)/tmp" \ IPKG_CONF_DIR="$(TOPDIR)/tmp" \
IPKG_OFFLINE_ROOT="$(TARGET_DIR)" \ IPKG_OFFLINE_ROOT="$(TARGET_DIR)" \
$(SCRIPT_DIR)/ipkg -force-defaults $(STAGING_DIR_HOST)/bin/opkg \
-f $(TOPDIR)/tmp/opkg.conf \
--force-depends \
--force-overwrite
define Profile define Profile
$(eval $(call Profile/Default)) $(eval $(call Profile/Default))
@ -79,10 +82,18 @@ _call_info: FORCE
echo 'Available Profiles:' echo 'Available Profiles:'
echo; $(PROFILE_LIST) echo; $(PROFILE_LIST)
$(TOPDIR)/tmp/ipkg.conf: FORCE $(TOPDIR)/tmp/opkg.conf: FORCE
@mkdir -p $(TOPDIR)/tmp @mkdir -p $(TOPDIR)/tmp
@mkdir -p $(TARGET_DIR)/tmp
@echo 'dest root /' > $@ @echo 'dest root /' > $@
@echo 'src packages file:$(PACKAGE_DIR)' >> $@ @echo 'src packages file:$(PACKAGE_DIR)' >> $@
@echo 'arch all 100' >> $@
ifneq ($(CONFIG_TARGET_adm5120),y)
@echo 'arch $(BOARD) 200' >> $@
else
@echo 'arch $(BOARD)_$(ARCH) 200' >> $@
endif
@echo 'option offline_root $(TARGET_DIR)' >> $@
BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel) BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(USER_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
# "-pkgname" in the package list means remove "pkgname" from the package list # "-pkgname" in the package list means remove "pkgname" from the package list
@ -102,18 +113,18 @@ endif
$(MAKE) package_postinst $(MAKE) package_postinst
$(MAKE) build_image $(MAKE) build_image
package_index: $(TOPDIR)/tmp/ipkg.conf FORCE package_index: $(TOPDIR)/tmp/opkg.conf FORCE
@echo @echo
@echo Building package index... @echo Building package index...
(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \ (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
gzip -9c Packages > Packages.gz \ gzip -9c Packages > Packages.gz \
) >/dev/null 2>/dev/null ) >/dev/null 2>/dev/null
$(IPKG) update $(OPKG) update
package_install: FORCE package_install: FORCE
@echo @echo
@echo Installing packages... @echo Installing packages...
$(IPKG) install $(BUILD_PACKAGES) $(OPKG) install $(BUILD_PACKAGES)
copy_files: FORCE copy_files: FORCE
@echo @echo
@ -121,6 +132,9 @@ copy_files: FORCE
$(CP) $(USER_FILES)/* $(TARGET_DIR)/ $(CP) $(USER_FILES)/* $(TARGET_DIR)/
package_postinst: FORCE package_postinst: FORCE
@echo
@echo Cleaning up
@rm -f $(TARGET_DIR)/tmp/opkg.lock
@echo @echo
@echo Activating init scripts @echo Activating init scripts
@( \ @( \