From b048b08bd3f91ab27d528a6dae6c11158b1383f0 Mon Sep 17 00:00:00 2001 From: jow Date: Tue, 7 Sep 2010 21:13:58 +0000 Subject: [PATCH] [backfire] merge r22947, r22960 git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@22970 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/opkg/Makefile | 25 +++++++ .../patches/014-add-force-run-hooks.patch | 68 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 package/opkg/patches/014-add-force-run-hooks.patch diff --git a/package/opkg/Makefile b/package/opkg/Makefile index 81f7b4a4a..45f8e6073 100644 --- a/package/opkg/Makefile +++ b/package/opkg/Makefile @@ -18,7 +18,9 @@ PKG_SOURCE_SUBDIR:=opkg-$(PKG_VERSION) PKG_SOURCE_URL:=http://opkg.googlecode.com/svn/trunk/ PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz PKG_FIXUP = libtool + include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/host-build.mk define Package/opkg SECTION:=base @@ -79,4 +81,27 @@ define Build/InstallDev $(CP) $(PKG_INSTALL_DIR)/usr/include/libopkg $(1)/usr/include/ endef + +HOST_BUILD_DEPENDS:=libtool/host + +HOST_CONFIGURE_ARGS+= \ + --disable-curl \ + --disable-gpg \ + --with-opkgetcdir=/etc \ + --with-opkglockfile=/tmp/opkg.lock + +define Host/Configure + (cd $(HOST_BUILD_DIR); autoreconf -v --install || exit 1) + $(call Host/Configure/Default) +endef + +define Host/Compile + $(MAKE) -C $(HOST_BUILD_DIR) CC="$(HOSTCC)" all +endef + +define Host/Install + $(INSTALL_BIN) $(HOST_BUILD_DIR)/src/opkg-cl $(STAGING_DIR_HOST)/bin/opkg +endef + $(eval $(call BuildPackage,opkg)) +$(eval $(call HostBuild)) diff --git a/package/opkg/patches/014-add-force-run-hooks.patch b/package/opkg/patches/014-add-force-run-hooks.patch new file mode 100644 index 000000000..cbf9de33b --- /dev/null +++ b/package/opkg/patches/014-add-force-run-hooks.patch @@ -0,0 +1,68 @@ +--- a/libopkg/opkg_conf.c ++++ b/libopkg/opkg_conf.c +@@ -54,6 +54,7 @@ opkg_option_t options[] = { + { "force_reinstall", OPKG_OPT_TYPE_BOOL, &_conf.force_reinstall }, + { "force_space", OPKG_OPT_TYPE_BOOL, &_conf.force_space }, + { "check_signature", OPKG_OPT_TYPE_BOOL, &_conf.check_signature }, ++ { "force_run_hooks", OPKG_OPT_TYPE_BOOL, &_conf.force_run_hooks }, + { "ftp_proxy", OPKG_OPT_TYPE_STRING, &_conf.ftp_proxy }, + { "http_proxy", OPKG_OPT_TYPE_STRING, &_conf.http_proxy }, + { "no_proxy", OPKG_OPT_TYPE_STRING, &_conf.no_proxy }, +--- a/libopkg/opkg_conf.h ++++ b/libopkg/opkg_conf.h +@@ -73,6 +73,7 @@ struct opkg_conf + int force_space; + int force_removal_of_dependent_packages; + int force_removal_of_essential_packages; ++ int force_run_hooks; + int check_signature; + int nodeps; /* do not follow dependencies */ + char *offline_root; +--- a/libopkg/pkg.c ++++ b/libopkg/pkg.c +@@ -1249,7 +1249,7 @@ pkg_run_script(pkg_t *pkg, const char *s + + /* XXX: FEATURE: When conf->offline_root is set, we should run the + maintainer script within a chroot environment. */ +- if (conf->offline_root) { ++ if (conf->offline_root && !conf->force_run_hooks) { + opkg_msg(INFO, "Offline root mode: not running %s.%s.\n", + pkg->name, script); + return 0; +--- a/src/opkg-cl.c ++++ b/src/opkg-cl.c +@@ -39,6 +39,7 @@ enum { + ARGS_OPT_FORCE_REMOVAL_OF_DEPENDENT_PACKAGES, + ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES, + ARGS_OPT_FORCE_SPACE, ++ ARGS_OPT_FORCE_RUN_HOOKS, + ARGS_OPT_NOACTION, + ARGS_OPT_DOWNLOAD_ONLY, + ARGS_OPT_NODEPS, +@@ -74,6 +75,8 @@ static struct option long_options[] = { + ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES}, + {"force_removal_of_essential_packages", 0, 0, + ARGS_OPT_FORCE_REMOVAL_OF_ESSENTIAL_PACKAGES}, ++ {"force-run-hooks", 0, 0, ARGS_OPT_FORCE_RUN_HOOKS}, ++ {"force_run_hooks", 0, 0, ARGS_OPT_FORCE_RUN_HOOKS}, + {"noaction", 0, 0, ARGS_OPT_NOACTION}, + {"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY}, + {"nodeps", 0, 0, ARGS_OPT_NODEPS}, +@@ -153,6 +156,9 @@ args_parse(int argc, char *argv[]) + case ARGS_OPT_FORCE_SPACE: + conf->force_space = 1; + break; ++ case ARGS_OPT_FORCE_RUN_HOOKS: ++ conf->force_run_hooks = 1; ++ break; + case ARGS_OPT_NODEPS: + conf->nodeps = 1; + break; +@@ -242,6 +248,7 @@ usage() + printf("\t--force-overwrite Overwrite files from other package(s)\n"); + printf("\t--force-downgrade Allow opkg to downgrade packages\n"); + printf("\t--force-space Disable free space checks\n"); ++ printf("\t--force-run-hooks Run postinstall scripts even in offline mode\n"); + printf("\t--noaction No action -- test only\n"); + printf("\t--download-only No action -- download only\n"); + printf("\t--nodeps Do not follow dependencies\n");