Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directories are being created, even if addParentDirs=false #124

Closed
novasbc opened this issue Aug 28, 2015 · 6 comments
Closed

Directories are being created, even if addParentDirs=false #124

novasbc opened this issue Aug 28, 2015 · 6 comments
Labels
Milestone

Comments

@novasbc
Copy link

novasbc commented Aug 28, 2015

I have been trying to debug some issues with our build that seem to be a combination of things. The error doesn't happen for all of our packages, but some number of our packages fail with:

file /var/lib/tomcat conflicts between attempted installs of my-package-0:1.0.0-1.x86_64 and tomcat-0:7.0.42-8.el7_0.noarch"
file /var/lib/tomcat/webapps conflicts between attempted installs of my-package-0:1.0.0-1.x86_64 and tomcat-0:7.0.42-8.el7_0.noarch"

I simplified the package for testing purposes, and it seems that despite my using addParentDirs=false, it still creates folders beyond /var/lib (I.E. it is attempting to create tomcat and webapps). When I look at the RPM with 7zip, I can see that tomcat and webapps carry a mode, and a modification date:
image
image
You can see below, that no such attributes show up for the /usr/share folder:
image

When I run rpm -qpl on the RPM file, it shows:

/usr/share/tomcat
/usr/share/tomcat/webapps
/usr/share/tomcat/webapps/mywarfile-3.0.2-SNAPSHOT.war

I haven't worked with many RPM files in the past, but I believe the first two lines shouldn't be listed.

If instead of going into /var/lib/tomcat/webapps, I use /usr/share/tomcat/webapps/foo/bar/1/2/3, here is the output:

/usr/share/tomcat
/usr/share/tomcat/webapps
/usr/share/tomcat/webapps/foo
/usr/share/tomcat/webapps/foo/bar
/usr/share/tomcat/webapps/foo/bar/1
/usr/share/tomcat/webapps/foo/bar/1/2
/usr/share/tomcat/webapps/foo/bar/1/2/3
/usr/share/tomcat/webapps/foo/bar/1/2/3/mywarfile-3.0.2-SNAPSHOT.war

It appears to create folders from tomcat all the way down the line.

Here is my simplified ospackage statement:

ospackage {
    packageName = 'my-package'
    summary = 'Test WAR RPM'
description = 'Just a test'
    vendor = 'Me'
    license = 'Proprietary'
arch = 'x86_64'
os = 'LINUX'
    url = 'http://support.mycompany.com'
    release = 1
    version = rpmVersion
    addParentDirs = false

    into ('/usr/share/tomcat/webapps/foo/bar/1/2/3') {
//      into ('/var/lib/tomcat/webapps') {
        addParentDirs = false
    from (war.outputs.files) {
            addParentDirs = false
        }
    }
}

As a last test, I attempted to put things into a completely random path, wondering if there was something magical about /var/lib or /usr/share, and perhaps the redline package was seeing this path, overriding it, and not letting you put it out there. The result from the RPM output:

/my
/my/path
/my/path/tomcat
<snip>
/my/path/tomcat/webapps/foo/bar/1/2/3
/my/path/tomcat/webapps/foo/bar/1/2/3/mywarfile-3.0.2-SNAPSHOT.war

So, it went ahead and created all paths, despite me putting addParentDirs=false all over the place.

Here is how I am referencing the plugin:

buildscript {
  dependencies {
    classpath "com.netflix.nebula:gradle-ospackage-plugin:2.2.6"
  }
}
apply plugin: 'os-package'

Either I am doing something wrong, and misunderstand addParentDirs, or there is a bug here somewhere. I don't think I have it wrong, however, as even the documentation for this ospackage plugin shows this exact scenario at https://github.com/nebula-plugins/gradle-ospackage-plugin/blob/gradle-2.2/Plugin-Rpm.md.

Mark

@novasbc
Copy link
Author

novasbc commented Aug 28, 2015

I have figured out that this is related to my using ospackage for the file elements. If I use buildRpm directly, addParentDirs appears to work.

@abedwardsw
Copy link

Same here. If I either:
a) add the addParentsDirs to buildRpm config it works
buildRpm {
addParentDirs = false
}

b) define the task myself and add addParentDirs in the file lists there, then it works

Since the documentation shows that adding addParentDirs into the ospackage "should" work, I think we should either update the samples to one of the configs above, or fix the bug.

@DanielThomas DanielThomas added this to the 3.3 milestone Dec 3, 2015
@Jolter
Copy link

Jolter commented Apr 5, 2016

I am also experiencing this when migrating from 2.0.3 to 3.4.0. I guess this was not delivered to the 3.3 milestone. I will try to work around it by the method described above.

@zunkree
Copy link

zunkree commented May 10, 2016

I made pull request #182 which fix this issue.

@nicknezis
Copy link
Contributor

I found this behavior in 4.1.0 to change based on if I'm using addParentDirs false and addParentDirs = false. The first doesn't work, but the later does.

nicknezis added a commit to nicknezis/gradle-ospackage-plugin that referenced this issue Dec 14, 2016
…t being handled properly.

Also added test to catch future regression. Fixes issues nebula-plugins#124 and nebula-plugins#212
@sghill
Copy link
Contributor

sghill commented Dec 15, 2016

Fixed with the release of v4.3.0 today

@sghill sghill closed this as completed Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants