From b78f71f14ab88fdabcc217b5d4627861d5b2b7d0 Mon Sep 17 00:00:00 2001 From: Pradeep Bansal Date: Mon, 29 Apr 2019 11:58:02 -0700 Subject: [PATCH] Added property osname to support AIX rpm. This is simply the porting of change which Brian Cox did on v3.2.1 version ( https://github.com/nebula-plugins/gradle-ospackage-plugin/compare/master...brc0x1:feature/osname?expand=1) --- .../plugins/packaging/SystemPackagingExtension.groovy | 3 +++ .../gradle/plugins/packaging/SystemPackagingTask.groovy | 4 ++++ src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy | 1 + .../com/netflix/gradle/plugins/rpm/RpmCopyAction.groovy | 7 ++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingExtension.groovy b/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingExtension.groovy index 79eb8883..77431c27 100755 --- a/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingExtension.groovy +++ b/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingExtension.groovy @@ -114,6 +114,9 @@ class SystemPackagingExtension { @Input @Optional Os os + + @Input @Optional + String osName @Input @Optional RpmType type diff --git a/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingTask.groovy b/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingTask.groovy index df4f4191..b9d57cf1 100755 --- a/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingTask.groovy +++ b/src/main/groovy/com/netflix/gradle/plugins/packaging/SystemPackagingTask.groovy @@ -257,6 +257,10 @@ abstract class SystemPackagingTask extends AbstractArchiveTask { } return this } + + public String getOsString() { + return osName ? osName.toLowerCase() : (os?.toString()?.toLowerCase() ?: ''); + } @Override public AbstractCopyTask from(Object sourcePath, Closure c) { diff --git a/src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy b/src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy index 99f08dd8..5f564a61 100755 --- a/src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy +++ b/src/main/groovy/com/netflix/gradle/plugins/rpm/Rpm.groovy @@ -66,6 +66,7 @@ class Rpm extends SystemPackagingTask { parentExten?.getArchStr()?:Architecture.NOARCH.name() }) mapping.map('os', { parentExten?.getOs()?:Os.UNKNOWN}) + mapping.map('osName', { parentExten?.getOsName()?: ''}) mapping.map('type', { parentExten?.getType()?:RpmType.BINARY }) // NOTE: Believe parentExten is always null diff --git a/src/main/groovy/com/netflix/gradle/plugins/rpm/RpmCopyAction.groovy b/src/main/groovy/com/netflix/gradle/plugins/rpm/RpmCopyAction.groovy index f4a99228..99f0d77c 100755 --- a/src/main/groovy/com/netflix/gradle/plugins/rpm/RpmCopyAction.groovy +++ b/src/main/groovy/com/netflix/gradle/plugins/rpm/RpmCopyAction.groovy @@ -61,7 +61,12 @@ class RpmCopyAction extends AbstractPackagingCopyAction { builder = createBuilder() builder.setPackage task.packageName, task.version, task.release, task.epoch builder.setType task.type - builder.setPlatform Architecture.valueOf(task.archStr.toUpperCase()), task.os + if (task.osName) { + builder.setPlatform Architecture.valueOf(task.archStr.toUpperCase()), task.osName + } else { + builder.setPlatform Architecture.valueOf(task.archStr.toUpperCase()), task.os + } + builder.setGroup task.packageGroup builder.setBuildHost task.buildHost builder.setSummary task.summary