Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class DebCopyAction extends AbstractPackagingCopyAction<Deb> {
def inputFile = extractFile(fileDetails)

Directive fileType = lookup(specToLookAt, 'fileType')
if (fileType == 'CONFIG') {
if (fileType != null && (fileType.flag() & Directive.RPMFILE_CONFIG) != 0) {
logger.debug "mark {} as configuration file", fileDetails.relativePath.pathString
task.configurationFile(fileDetails.relativePath.pathString)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,20 @@

package com.netflix.gradle.plugins.packaging

import groovy.transform.CompileDynamic
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.BasePlugin
import org.redline_rpm.payload.Directive

@CompileDynamic
class CommonPackagingPlugin implements Plugin<Project> {
void apply(Project project) {
project.plugins.apply(BasePlugin.class)

Directive.metaClass.or = { Directive other ->
new Directive(delegate.flag | other.flag)
}
// Used to be used to add metaClass properties to CopySpec, but now it's done with CopySpecEnhancement
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class RpmPlugin implements Plugin<Project> {
format.getLead().getName() + "-src.rpm"
}

Directive.metaClass.or = { Directive other ->
new Directive(delegate.flag | other.flag)
}

// Some defaults, if not set by the user
project.tasks.withType(Rpm).configureEach(new Action<Rpm>() {
@Override
Expand All @@ -61,4 +57,4 @@ class RpmPlugin implements Plugin<Project> {
AliasHelper.aliasStaticInstances(Directive.class, dynamicObjectAware)
AliasHelper.aliasStaticInstances(Flags.class, int.class, dynamicObjectAware)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package com.netflix.gradle.plugins.deb
import nebula.test.ProjectSpec
import nebula.test.dependencies.DependencyGraph
import nebula.test.dependencies.GradleDependencyGenerator
import org.vafer.jdeb.shaded.commons.io.FileUtils
import org.redline_rpm.header.Flags
import org.vafer.jdeb.shaded.commons.io.FileUtils
import spock.lang.Issue
import spock.lang.Unroll

Expand Down Expand Up @@ -152,12 +152,12 @@ class DebPluginTest extends ProjectSpec {

from(srcDir.toString() + '/main/groovy') {
createDirectoryEntry true
fileType = CONFIG
}

from(noParentsDir) {
addParentDirs = false
into '/a/path/not/to/create'
fileType CONFIG | NOREPLACE
}

link('/opt/bleah/banana', '/opt/bleah/apple')
Expand All @@ -176,10 +176,8 @@ class DebPluginTest extends ProjectSpec {
'amd64' == scan.getHeaderEntry('Architecture')
'optional' == scan.getHeaderEntry('Priority')

scan.controlContents['./conffiles'].eachLine {
'/etc/init.d/served' == it || '/opt/bleah/main/groovy' == it
}

scan.controlContents['./conffiles'].readLines() == ['/etc/init.d/served', 'a/path/not/to/create/alone']

def file = scan.getEntry('./a/path/not/to/create/alone')
file.isFile()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package com.netflix.gradle.plugins.rpm
import com.netflix.gradle.plugins.packaging.ProjectPackagingExtension
import com.netflix.gradle.plugins.utils.JavaNIOUtils
import nebula.test.ProjectSpec
import org.redline_rpm.payload.Directive
import org.vafer.jdeb.shaded.commons.io.FileUtils
import org.apache.commons.lang3.JavaVersion
import org.apache.commons.lang3.SystemUtils
Expand Down Expand Up @@ -80,12 +81,12 @@ class RpmPluginTest extends ProjectSpec {

from(srcDir.toString() + '/main/groovy') {
createDirectoryEntry true
fileType CONFIG | NOREPLACE
}

from(noParentsDir) {
addParentDirs false
into '/a/path/not/to/create'
fileType CONFIG | NOREPLACE
}

link('/opt/bleah/banana', '/opt/bleah/apple')
Expand All @@ -102,6 +103,13 @@ class RpmPluginTest extends ProjectSpec {
0 == Scanner.getHeaderEntry(scan, EPOCH).values[0]
'i386' == Scanner.getHeaderEntryString(scan, ARCH)
'linux' == Scanner.getHeaderEntryString(scan, OS)

def confFileIndex = scan.files.findIndexOf {
it.name == './a/path/not/to/create/alone'
}
def configNoReplaceFlag = Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE
configNoReplaceFlag == Scanner.getHeaderEntry(scan, FILEFLAGS).values[confFileIndex]

['SuperSystem'] == Scanner.getHeaderEntry(scan, DISTRIBUTION).values
scan.files*.name.every { fileName ->
['./a/path/not/to/create/alone', './opt/bleah',
Expand Down