tcurdt / jdeb

This library provides an Ant task and a Maven plugin to create Debian packages from Java builds in a truly cross platform manner.
https://github.com/tcurdt/jdeb
Apache License 2.0
533 stars 324 forks source link

The deb task doesn't preserve the filesystem permissions #55

Open i30817 opened 12 years ago

i30817 commented 12 years ago

I whenever i tried to build, even with this: http://pastebin.com/raw.php?i=FmMaXiux

When i used lintian

BUILD SUCCESSFUL Total time: 27 seconds E: bookjar: control-file-has-bad-permissions conffiles 0755 != 0644 W: bookjar: extended-description-line-too-long E: bookjar: non-standard-file-permissions-for-etc-init.d-script etc/init.d/bookjar 0644 != 0755 W: bookjar: script-not-executable etc/init.d/bookjar

(notice it reports etc/init.d/bookjar is not executable even though i was set explicitly before the deb task) Whatever i do, whatever the permissions before the files go into the deb task it doesn't seem to change this, so i can only guess the task is modifying the files but not setting a appropriate permission back again.

ebourg commented 12 years ago

Could you try again by replacing the data element with a fileset? It should preserve the permissions.

    <deb destfile="${name}.deb" compression="gzip"  control="debian/pkg/DEBIAN">
        <fileset dir="debian/pkg/data" />
    </deb>
ebourg commented 12 years ago

Actually the right solution is to use a tarfileset. Until jdeb uses the Java 7 nio2 API it's not possible to preserve the permissions from the filesystem.

i30817 commented 12 years ago

Even a tar fileset won't work, because different things on the data dir (or indeed the control dir, where i didn't see the option to use a tar) need different permissions and tarfileset sets them to all the files.

If i gave a (exec-ed) tar file would it work? BTW, i don't mind using java 7. In fact, the best option might be a fork. Where in the code do you copy files?

i30817 commented 12 years ago

It looks pretty gnarly. You only use inputstreams. I wonder if there is a wrapper output stream that saves file permissions and reapplies them on the end

ebourg commented 12 years ago

You can use several tarfilesets, one per type of permission, or you can use a permission mapper. There are some examples in the documentation : https://github.com/tcurdt/jdeb/blob/master/docs/ant.md

i30817 commented 12 years ago

What about the control directory?

i30817 commented 12 years ago

Now i'm confused too: http://developer.ubuntu.com/packaging/html/debian-dir-overview.html

there are a number of files in that article (changelog, .desktop) that i was putting in their final directories in the data instead of the control directory. Will jdeb do the right thing on this or is it too distribution specific?

ebourg commented 12 years ago

The .desktop file has to be put in the right directory (typically into /usr/share/applications), jdeb will not move it automatically.

i30817 commented 12 years ago

Bummer i was hoping that the distro installer did (and that jdeb exposed the mapping variable mechanism so i could use the [[]] syntax in all control/\ files)

prapicault commented 10 years ago

What is the best way to address the permission issue in a Maven build?

tcurdt commented 10 years ago

https://github.com/tcurdt/jdeb/blob/master/docs/maven.md

prapicault commented 9 years ago

I'm interested in providing a fix for this issue. Would you be interested by such a contribution?

tcurdt commented 9 years ago

@prapicault what kind of fix do you have in mind?

prapicault commented 9 years ago

I wanted to create a new mapper that would obtain the permission from the file system using java 7 API (https://docs.oracle.com/javase/7/docs/api/java/nio/file/attribute/package-summary.html). Of course this would only work on linux or macs, but for people who already have the application to be packged ready with all the proper permissions, it would avoid the duplication of information. For example, in my case, I'm trying to automate the creation of debian packages for eclipse archives. In this case the archive already has all the right permissions and having to duplicate this in the deb plugin is annoying.

tcurdt commented 9 years ago

@prapicault we already had such a contribution. maybe check the old issues. The main problem is that 1.x should stay on java6.

For 2.x I am more than open for such functionality! I just haven't gotten around to layout the new 2.x API design yet.

The current config file discussion happens here.

https://gist.github.com/tcurdt/9275523