This is an automated email from the ASF dual-hosted git repository.
iwasakims pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git
The following commit(s) were added to refs/heads/master by this push:
new f6074b410 BIGTOP-4088: Refactor PKG_NAME_SUFFIX and PARENT_DIR (#1254)
f6074b410 is described below
commit f6074b410f7d776736427e61a03b4d62ebc372bf
Author: jialiang <[email protected]>
AuthorDate: Thu Apr 11 21:40:14 2024 +0800
BIGTOP-4088: Refactor PKG_NAME_SUFFIX and PARENT_DIR (#1254)
---
packages.gradle | 49 ++++++++++++++++++++++++++++++-------------------
1 file changed, 30 insertions(+), 19 deletions(-)
diff --git a/packages.gradle b/packages.gradle
index b95f42d4c..6c13a6834 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -101,6 +101,25 @@ def isValidMavenBuildThreads(threads) {
return threads.matches("\\d+C") || threads.matches("\\d+")
}
+def getPkgNameSuffix(component, type) {
+ def originalSuffix = type.equalsIgnoreCase("deb") ?
component.deb_pkg_suffix : component.rpm_pkg_suffix
+ def defaultSuffix = type.equalsIgnoreCase("deb") ? "" : "%{nil}"
+ def pkgNameSuffix = project.hasProperty("pkgSuffix")? originalSuffix :
defaultSuffix
+ def gradlePkgNameSuffix = pkgNameSuffix == defaultSuffix ? "" :
pkgNameSuffix
+
+ return [pkgNameSuffix: pkgNameSuffix, gradlePkgNameSuffix:
gradlePkgNameSuffix]
+}
+
+def getParentDir(bigtopBaseVersion, type) {
+ def defaultParentDirValue = type.equalsIgnoreCase("deb") ? "" : "%{nil}"
+ def parentDir = project.hasProperty("parentDir") ?
project.property('parentDir') : defaultParentDirValue
+ if (parentDir && parentDir != "%{nil}") {
+ parentDir = "${parentDir}/${bigtopBaseVersion}"
+ }
+ return parentDir
+}
+
+
/**
* To avoid breaking the compat with existing packages let's use the old style
names
*/
@@ -422,6 +441,7 @@ def genTasks = { target ->
def final DEB_PKG_DIR =
"$PKG_BUILD_DIR/deb/$PKG_NAME-${PKG_VERSION}-${BIGTOP_BUILD_STAMP}"
def final ENABLE_MAVEN_PARALLEL_BUILD =
config.bigtop.components[target].maven_parallel_build
def final MAVEN_BUILD_THREADS = project.hasProperty('buildThreads') ?
project.property('buildThreads') : null
+
mkdir (DEB_BLD_DIR)
copy {
from SEED_TAR
@@ -510,13 +530,11 @@ def genTasks = { target ->
}
def final BIGTOP_BASE_VERSION = "${config.bigtop.base_version}"
- def final PKG_NAME_SUFFIX = config.bigtop.components[target].rpm_pkg_suffix
- def RPM_PKG_NAME_SUFFIX = PKG_NAME_SUFFIX
- def GRADLE_PKG_NAME_SUFFIX = PKG_NAME_SUFFIX
- if (!project.hasProperty("pkgSuffix") || !PKG_NAME_SUFFIX) {
- RPM_PKG_NAME_SUFFIX = "%{nil}"
- GRADLE_PKG_NAME_SUFFIX = ""
- }
+
+ def suffixes = getPkgNameSuffix(config.bigtop.components[target], "rpm")
+ def RPM_PKG_NAME_SUFFIX = suffixes.pkgNameSuffix
+ def GRADLE_PKG_NAME_SUFFIX = suffixes.gradlePkgNameSuffix
+ def final FULL_PARENT_DIR = getParentDir(BIGTOP_BASE_VERSION, "rpm")
def final BIGTOP_BUILD_STAMP = System.getenv('BIGTOP_BUILD_STAMP') ?:
config.bigtop.components[target].version.release
@@ -535,11 +553,6 @@ def genTasks = { target ->
def final MAVEN_REPO_ID = project.hasProperty('mavenRepoId') ?
project.property('mavenRepoId') : 'default'
def final MAVEN_REPO_URI = project.hasProperty('mavenRepoUri') ?
project.property('mavenRepoUri') : null
- def final PARENT_DIR = project.hasProperty("parentDir") ?
project.property('parentDir') : "%{nil}"
- def FULL_PARENT_DIR = "${PARENT_DIR}"
- if (PARENT_DIR != "%{nil}") {
- FULL_PARENT_DIR = "${PARENT_DIR}/${BIGTOP_BASE_VERSION}"
- }
def command = [
'--define', "_topdir $PKG_BUILD_DIR/rpm/",
@@ -592,13 +605,11 @@ def genTasks = { target ->
}
def final BIGTOP_BASE_VERSION = "${config.bigtop.base_version}"
- def final PKG_NAME_SUFFIX = config.bigtop.components[target].rpm_pkg_suffix
- def RPM_PKG_NAME_SUFFIX = PKG_NAME_SUFFIX
- def GRADLE_PKG_NAME_SUFFIX = PKG_NAME_SUFFIX
- if (!project.hasProperty("pkgSuffix") || !PKG_NAME_SUFFIX) {
- RPM_PKG_NAME_SUFFIX = "%{nil}"
- GRADLE_PKG_NAME_SUFFIX = ""
- }
+
+ def suffixes = getPkgNameSuffix(config.bigtop.components[target], "rpm")
+ def RPM_PKG_NAME_SUFFIX = suffixes.pkgNameSuffix
+ def GRADLE_PKG_NAME_SUFFIX = suffixes.gradlePkgNameSuffix
+
def final BIGTOP_BUILD_STAMP = System.getenv('BIGTOP_BUILD_STAMP') ?:
config.bigtop.components[target].version.release
def final NAME = config.bigtop.components[target].name