build: add noarch support noarch
authorPaul Spooren <mail@aparcar.org>
Tue, 9 Mar 2021 22:46:40 +0000 (12:46 -1000)
committerPaul Spooren <mail@aparcar.org>
Wed, 10 Mar 2021 09:27:55 +0000 (23:27 -1000)
This allows to store all architecture independent packages in a single
folder instead of storing duplicates in each architecture folder.

As a result nearly 3000 less packages are build per architecture and
instead a single *noarch* job creates packages usable by all
architectures.

Built images will have an extended `distfeeds.conf` containing the feeds
separated in arch specific and *noarch*. As this will increase the time
needed for an `opkg update`, future commits could disable the option
`PER_FEED_REPO` as all default feeds are OpenWrt maintained and
build at the same time anyway.

A new *No-Arch* field in the package metadata allows the tools
`./scripts/feeds` to sort on arch dependent and independent packages via
later commits.

Signed-off-by: Paul Spooren <mail@aparcar.org>
include/feeds.mk
include/package-dumpinfo.mk
include/package-ipkg.mk
scripts/metadata.pm

index 98e315bceb5eab214638acdfeca3a309c0a295bb..27c3b8bf4c403975a55d49aa00a9ea68d02292c6 100644 (file)
@@ -11,7 +11,9 @@ FEEDS_AVAILABLE:=$(sort $(FEEDS_INSTALLED) $(shell $(SCRIPT_DIR)/feeds list -n 2
 PACKAGE_SUBDIRS=$(PACKAGE_DIR)
 ifneq ($(CONFIG_PER_FEED_REPO),)
   PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/base
+  PACKAGE_SUBDIRS += $(OUTPUT_DIR)/packages/noarch/base
   PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(FEED))
+  PACKAGE_SUBDIRS += $(foreach FEED,$(FEEDS_AVAILABLE),$(OUTPUT_DIR)/packages/noarch/$(FEED))
 endif
 
 opkg_package_files = $(wildcard \
@@ -19,10 +21,13 @@ opkg_package_files = $(wildcard \
          $(foreach pkg,$(1), $(dir)/$(pkg)_*.ipk)))
 
 # 1: package name
+# 2: package arch
 define FeedPackageDir
 $(strip $(if $(CONFIG_PER_FEED_REPO), \
   $(if $(Package/$(1)/subdir), \
-    $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir)), \
+    $(if $(filter all,$(2)), \
+      $(abspath $(OUTPUT_DIR)/packages/noarch/$(Package/$(1)/subdir)), \
+      $(abspath $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES)/$(Package/$(1)/subdir))), \
     $(PACKAGE_DIR)), \
   $(PACKAGE_DIR)))
 endef
@@ -37,6 +42,7 @@ define FeedSourcesAppend
                echo 'src/gz %d_kmods %U/targets/%S/kmods/$(LINUX_VERSION)-$(LINUX_RELEASE)-$(LINUX_VERMAGIC)';) \
        $(foreach feed,$(FEEDS_AVAILABLE), \
                $(if $(CONFIG_FEED_$(feed)), \
+                       echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed)_noarch %U/packages/noarch/$(feed)'; \
                        echo '$(if $(filter m,$(CONFIG_FEED_$(feed))),# )src/gz %d_$(feed) %U/packages/%A/$(feed)';)))) \
 ) >> $(1)
 endef
index 597452e4b930745f81636c50663e4bfde9687f18..3545ba249fdb2f321cd1b26807f9cd38243d0599 100644 (file)
@@ -25,7 +25,8 @@ Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
 Conflicts: $(CONFLICTS)
 Menu-Depends: $(MDEPENDS)
 Provides: $(PROVIDES)
-$(if $(VARIANT),Build-Variant: $(VARIANT)
+$(if $(filter $(PKGARCH),all),No-Arch: 1
+)$(if $(VARIANT),Build-Variant: $(VARIANT)
 $(if $(DEFAULT_VARIANT),Default-Variant: $(VARIANT)
 ))Section: $(SECTION)
 Category: $(CATEGORY)
index c2017cd220622f88aa437b73f48b5d3ffc1535d6..cc17d9b87d467dd338c90fe36c307d4b57c337b1 100644 (file)
@@ -100,7 +100,7 @@ _endef=endef
 ifeq ($(DUMP),)
   define BuildTarget/ipkg
     ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION))
-    PDIR_$(1):=$(call FeedPackageDir,$(1))
+    PDIR_$(1):=$(call FeedPackageDir,$(1),$(PKGARCH))
     IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
     IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
     KEEP_$(1):=$(strip $(call Package/$(1)/conffiles))
index 5fbb77a36c4cb22059cee802fbf9eee4648de7e1..cdc69aeed3105427ed17c3c907d01bd8c86d419f 100644 (file)
@@ -237,6 +237,7 @@ sub parse_package_metadata($) {
                        $pkg->{mdepends} = [];
                        $pkg->{provides} = [$1];
                        $pkg->{tristate} = 1;
+                       $pkg->{noarch} = 0;
                        $pkg->{override} = $override;
                        $package{$1} = $pkg;
                        push @{$src->{packages}}, $pkg;
@@ -251,6 +252,7 @@ sub parse_package_metadata($) {
                /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
                /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
                /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
+               /^No-Arch: \s*(.+)\s*$/ and $pkg->{noarch} = 1;
                /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1;
                /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1;
                /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;