craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

recursive directory adding #88

Open pausebreak opened 8 years ago

pausebreak commented 8 years ago

I'm not sure if recursively adding a directory is supported by redline.

When calling addFile() if you pass it a directory you get:

java.io.FileNotFoundException: script/rpm/layout/etc (Is a directory)
 at java.io.FileInputStream.open (FileInputStream.java:-2)
    java.io.FileInputStream.<init> (FileInputStream.java:138)
    org.redline_rpm.payload.Contents.getMD5s (Contents.java:582)
    org.redline_rpm.Builder.build (Builder.java:1142)

Putting a directory in the %files section appears to be straight forward from the .spec file standpoint. See: http://www.rpm.org/max-rpm/s1-rpm-inside-files-list.html

Is there another way redline supports that I'm not noticing or do I have to do the recursion in my code?

ioneyed commented 8 years ago

I was able to add a directory by doing a recursive function however I have found that adding a directory via the addDirectory method usually ends in a cpio error when installing the RPM. Maybe you will have better luck with addDirectory than I am.

pausebreak commented 8 years ago

I handle recursive directories by assuming the same perms/attributes all the way down.

See: :recurse https://github.com/pausebreak/lein-redline-rpm

I'm not calling addDirectory. I call addFile for each file found.