[OpenWrt-Devel] [PATCH 08/14] targets images: Add a version 'flavour'
openwrt at daniel.thecshore.com
openwrt at daniel.thecshore.com
Sun Jan 3 01:02:56 EST 2016
From: Daniel Dickinson <openwrt at daniel.thecshore.com>
The version flavour is string that goes into output filenames
and the openwrt_release file, and is available for opkg repositories.
It is intended to make it easy to manage parallel streams of SDK etc that
are built with different options depending on the intended type of target
use.
Signed-off-by: Daniel Dickinson <openwrt at daniel.thecshore.com>
---
include/image.mk | 3 ++-
include/version.mk | 6 ++++++
package/base-files/files/etc/openwrt_release | 1 +
package/base-files/image-config.in | 13 +++++++++++++
target/imagebuilder/Makefile | 2 +-
target/sdk/Makefile | 2 +-
target/toolchain/Makefile | 2 +-
7 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/include/image.mk b/include/image.mk
index cebe42e..8b8e867 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -32,8 +32,9 @@ endef
DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
EXTRA_NAME_SANITIZED=$(call sanitize,$(EXTRA_IMAGE_NAME))
+FLAVOUR_SANITIZED=$(call sanitize,$(VERSION_FLAVOUR))
-IMG_PREFIX:=$(DIST_SANITIZED)-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
+IMG_PREFIX:=$(DIST_SANITIZED)-$(if $(FLAVOUR_SANITIZED),$(FLAVOUR_SANITIZED)-)$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(if $(EXTRA_NAME_SANITIZED),$(EXTRA_NAME_SANITIZED)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
diff --git a/include/version.mk b/include/version.mk
index 4bce096..3817780 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -11,6 +11,7 @@
PKG_CONFIG_DEPENDS += \
CONFIG_VERSION_NUMBER \
CONFIG_VERSION_NICK \
+ CONFIG_VERSION_FLAVOUR \
CONFIG_VERSION_REPO \
CONFIG_VERSION_DIST \
CONFIG_VERSION_MANUFACTURER \
@@ -30,6 +31,9 @@ VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),Bleeding Edge)
VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
+VERSION_FLAVOUR:=$(call qstrip_escape,$(CONFIG_VERSION_FLAVOUR))
+VERSION_FLAVOUR:=$(if $(VERSION_FLAVOUR),$(VERSION_FLAVOUR))
+
VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots/trunk/%S/packages)
@@ -79,6 +83,8 @@ VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
-e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
-e 's,%N,$(VERSION_NICK),g' \
-e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
+ -e 's,%F,$(VERSION_FLAVOUR),g' \
+ -e 's,%f,\L$(subst $(space),_,$(VERSION_FLAVOUR)),g' \
-e 's,%D,$(VERSION_DIST),g' \
-e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
-e 's,%R,$(REVISION),g' \
diff --git a/package/base-files/files/etc/openwrt_release b/package/base-files/files/etc/openwrt_release
index 9b2a40c..df91f72 100644
--- a/package/base-files/files/etc/openwrt_release
+++ b/package/base-files/files/etc/openwrt_release
@@ -1,5 +1,6 @@
DISTRIB_ID='%D'
DISTRIB_RELEASE='%C'
+DISTRIB_FLAVOUR='%F'
DISTRIB_REVISION='%R'
DISTRIB_CODENAME='%n'
DISTRIB_TARGET='%S'
diff --git a/package/base-files/image-config.in b/package/base-files/image-config.in
index 3dfbedc..bc865e3 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -152,6 +152,17 @@ if VERSIONOPT
This is the name of the release distribution.
If unspecified, it defaults to OpenWrt.
+ config VERSION_FLAVOUR
+ string
+ prompt "Release flavour"
+ default ""
+ help
+ This is an optional string that gets added to
+ output filenames and is part of the version id,
+ which identifies a 'flavour' of build (for example
+ for differentiating between SDK's/images build with
+ NAS vs router appropriate settings).
+
config VERSION_NICK
string
prompt "Release version nickname"
@@ -183,6 +194,8 @@ if VERSIONOPT
%n .. Release name, lowercase
%D .. Distribution name or "OpenWrt", uppercase
%d .. Distribution name or "openwrt", lowercase
+ %F .. Flavour, uppercase
+ %f .. flavour, lowercase
%T .. Target name
%S .. Target/Subtarget name
%t .. Build taint flags, e.g. "no-all busybox"
diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
index 106ca3d..0f3fc2e 100644
--- a/target/imagebuilder/Makefile
+++ b/target/imagebuilder/Makefile
@@ -13,7 +13,7 @@ include $(INCLUDE_DIR)/feeds.mk
override MAKEFLAGS=
-IB_NAME:=$(VERSION_DIST)-ImageBuilder-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)).$(HOST_OS)-$(HOST_ARCH)
+IB_NAME:=$(VERSION_DIST)-ImageBuilder-$(if $(VERSION_FLAVOUR),$(VERSION_FLAVOUR)-)$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)).$(HOST_OS)-$(HOST_ARCH)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
IB_KDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(KERNEL_BUILD_DIR))
IB_LDIR:=$(patsubst $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(LINUX_DIR))
diff --git a/target/sdk/Makefile b/target/sdk/Makefile
index 012b597..441ffeb 100644
--- a/target/sdk/Makefile
+++ b/target/sdk/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
override MAKEFLAGS=
-SDK_NAME:=$(VERSION_DIST)-SDK-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))$(if $(GCCV),_gcc-$(GCCV))$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
+SDK_NAME:=$(VERSION_DIST)-SDK-$(if $(VERSION_FLAVOUR),$(VERSION_FLAVOUR)-)$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))$(if $(GCCV),_gcc-$(GCCV))$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
SDK_BUILD_DIR:=$(BUILD_DIR)/$(SDK_NAME)
STAGING_SUBDIR_HOST := staging_dir/host
diff --git a/target/toolchain/Makefile b/target/toolchain/Makefile
index 08e7166..64fbbff 100644
--- a/target/toolchain/Makefile
+++ b/target/toolchain/Makefile
@@ -14,7 +14,7 @@ include $(INCLUDE_DIR)/version.mk
override MAKEFLAGS=
-TOOLCHAIN_NAME:=$(VERSION_DIST)-Toolchain-$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
+TOOLCHAIN_NAME:=$(VERSION_DIST)-Toolchain-$(if $(VERSION_FLAVOUR),$(VERSION_FLAVOUR)-)$(if $(CONFIG_VERSION_FILENAMES),$(VERSION_NUMBER)-)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))_gcc-$(GCCV)$(DIR_SUFFIX).$(HOST_OS)-$(HOST_ARCH)
TOOLCHAIN_BUILD_DIR:=$(BUILD_DIR)/$(TOOLCHAIN_NAME)
EXCLUDE_DIRS:=*/ccache \
*/initial \
--
2.4.3
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list