TrigonicSolutions / gradle-rpm-plugin

Gradle plugin for constructing RPM packages.
Apache License 2.0
38 stars 19 forks source link

Optional parents info #29

Closed merscwog closed 11 years ago

merscwog commented 11 years ago

Forgot to add the README.md and History.md changes to my original commit.

soid commented 11 years ago

Sorry if it's not related, but issues are not available for this project. I'm trying to use addParentDirs as explained in this pull request to avoid changing ownership for parent directories as explained here: https://code.google.com/p/redline-rpm/issues/detail?id=16&can=1 but it's not working. Below is my sample minimal project.

build.gradle

apply plugin: 'rpm'

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.trigonic:gradle-rpm-plugin:1.3'
    }
}

task fooRpm(type: Rpm) {
    packageName = 'foo'
    version = '1.2.3'
    release = 1
    arch = I386
    os = LINUX

    into '/opt/myapps/foo'

    from('myfile') {
        addParentDirs = false
        user = "games"
        into 'lib'
    }
}

Here is my session of installing the result rpm:

$ ls -lh /opt/
total 40K
drwxr-xr-x 2 root   root   4.0K Jul  8  2011 bin
drwxr-xr-x 3 root   root   4.0K Jul  8  2011 include
drwxr-xr-x 4 root   root   4.0K Jul  8  2011 lib
drwxr-xr-x 2 tomcat tomcat 4.0K Mar 26 15:05 myapps
drwxr-xr-x 3 root   root   4.0K Jul  8  2011 share

$ sudo rpm -Uvh build/distributions/foo-1.2.3-1.i386.rpm
Preparing...                ########################################### [100%]
   1:foo                    ########################################### [100%]

$ ls -lh /opt/
total 40K
drwxr-xr-x 2 root  root 4.0K Jul  8  2011 bin
drwxr-xr-x 3 root  root 4.0K Jul  8  2011 include
drwxr-xr-x 4 root  root 4.0K Jul  8  2011 lib
drwxr-xr-x 3 games root 4.0K Mar 26 15:15 myapps
drwxr-xr-x 3 root  root 4.0K Jul  8  2011 share

As you can see even if myapps/ folder already existed and had 'tomcat' ownership, it has changed to 'games' after installing rpm even when I specified addParentDirs=false

merscwog commented 11 years ago

I've just gotten a chance to look at this, and what is posted up on Maven Central for the compiled software seems a bit odd. If you are using a newer gradle, are you getting a warning complaining about:Deprecated dynamic property: "addParentDirs" on "task ':fooRpm'", value: "false". I'm the person who actually submitted the patch for this support, but it seems somehow that even though it shows up in the source at the github repository, versions 1.2 and 1.3 of the gradle-rpm-plugin do not seem to have the code to support addParentDirs compiled in somehow. Attached is a version I just built from the raw github sources, and it excludes the directory creation as expected. Not sure if attachments will actually work to a response like this. -Spencer


From: Greg Temchenko notifications@github.com To: TrigonicSolutions/gradle-rpm-plugin gradle-rpm-plugin@noreply.github.com Cc: Spencer Allain spencer_allain@yahoo.com Sent: Tuesday, March 26, 2013 6:24 PM Subject: Re: [gradle-rpm-plugin] Optional parents info (#29)

Sorry if it's not related, but issues are not available for this project. I'm trying to use addParentDirs as explained in this pull request to avoid changing ownership for parent directories as explained here: https://code.google.com/p/redline-rpm/issues/detail?id=16&can=1 but it's not working. Below is my sample minimal project. build.gradle apply plugin: 'rpm' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.trigonic:gradle-rpm-plugin:1.3' } } task fooRpm(type: Rpm) { packageName = 'foo' version = '1.2.3' release = 1 arch = I386 os = LINUX into '/opt/myapps/foo' from('myfile') { addParentDirs = false user = "games" into 'lib' } } Here is my session of installing the result rpm: $ ls -lh /opt/ total 40K drwxr-xr-x 2 root root 4.0K Jul 8 2011 bin drwxr-xr-x 3 root root 4.0K Jul 8 2011 include drwxr-xr-x 4 root root 4.0K Jul 8 2011 lib drwxr-xr-x 2 tomcat tomcat 4.0K Mar 26 15:05 myapps drwxr-xr-x 3 root root 4.0K Jul 8 2011 share $ sudo rpm -Uvh build/distributions/foo-1.2.3-1.i386.rpm Preparing... ########################################### [100%] 1:foo ########################################### [100%] $ ls -lh /opt/ total 40K drwxr-xr-x 2 root root 4.0K Jul 8 2011 bin drwxr-xr-x 3 root root 4.0K Jul 8 2011 include drwxr-xr-x 4 root root 4.0K Jul 8 2011 lib drwxr-xr-x 3 games root 4.0K Mar 26 15:15 myapps drwxr-xr-x 3 root root 4.0K Jul 8 2011 share As you can see even if myapps/ folder already existed and had 'tomcat' ownership, it has changed to 'games' after installing rpm even when I specified addParentDirs=false — Reply to this email directly or view it on GitHub.

AlanKrueger commented 11 years ago

I'm able to replicate this on my system. It's a bit late to track down tonight, but I'll see what I can do tomorrow.