gradle-ospackage-plugin icon indicating copy to clipboard operation
gradle-ospackage-plugin copied to clipboard

Exclude parent directory of base "into" statement from spec file

Open ankitkothana opened this issue 6 years ago • 8 comments

Hi,

I am creating my application rpm with this plugin version 2.2.3. Here is how I am applying this plugin:

`

version = version.substring(0, version.indexOf('-'))
preInstall = file('deploy/preInstall.sh')
postInstall = file('deploy/postInstall.sh')
preUninstall = file('deploy/preUninstall.sh')
postUninstall = file('deploy/postUninstall.sh')

requires('jdk', '1.8.0_25', GREATER | EQUAL)

into '/usr/local/share/myapp'
from(jar.outputs.files) {
    into 'lib'
}

from(configurations.runtime) {
    exclude '**/*.yml', '*.yml', '**/*.properties', '*.properties', '*.xml', '**/*.xml', 'jmxremote.*', '*.xsd', '**/*.xsd'
    into 'lib'
}

from(configurations.runtime) {
    include '**/*.yml', '*.yml', '**/*.properties', '*.properties', '*.xml', '**/*.xml', 'jmxremote.*', '*.xsd', '**/*.xsd'
    into 'conf'
}

`

When I build RPM and extract it to see the files its modifying, it also lists "/usr/local/share". How can I exclude "/usr/local/share" from list of files in spec?

ankitkothana avatar Jul 26 '18 09:07 ankitkothana

The reason I want to remove "/usr/local/share" from the list is because centos 7 is causing issues with it:

file /usr/local/share from install of myapp-0:2.3.0-20180726073010.09097b4.noarch conflicts with file from package filesystem-3.2-25.el7.x86_64

ankitkothana avatar Jul 26 '18 09:07 ankitkothana

I essentially have the same question but for /home--how do I exclude buildRpm from trying to package /home?

shivknight avatar Aug 14 '18 01:08 shivknight

I've got the same problem and it's quite a big issue for me. Is there any workaround?

awallat avatar Aug 13 '19 16:08 awallat

I found a solution! With the following options, the parent directories are not created anymore and there won't be any conflicts anymore:

addParentDirs false
createDirectoryEntry false

awallat avatar Aug 14 '19 07:08 awallat

Possibly related to #59

tbroyer avatar Nov 20 '19 10:11 tbroyer

@awallat I was unable to get this to work for us. hoping you can shed some more light on your success. what version of ospackage are you using? were you using an ospackage or buildrpm block? was the into a top level item or was it inside a from?

bmagistro avatar Jan 13 '20 21:01 bmagistro

@bmagistro I used version 7.0.3 of "nebula.rpm" plugin. For me the most important option to set was "addParentDirs". I don't know if later versions of this plugin behave differently.

The task looks something likes this:

task buildRpm(type: Rpm) {
    release '1'
    arch 'noarch'
    os LINUX
    addParentDirs false
    ...

    from('server/build') {
        createDirectoryEntry true
        into '/opt/someDirectory'
    }
    ...
}

awallat avatar Jan 15 '20 14:01 awallat

I didn't have success with this but did have some luck with https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/59#issuecomment-59349084 but also found https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/246#issuecomment-396619852 and settled on that approach.

bmagistro avatar Feb 15 '20 18:02 bmagistro