-
Notifications
You must be signed in to change notification settings - Fork 324
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
binary control files #220
base: master
Are you sure you want to change the base?
binary control files #220
Conversation
@@ -187,7 +187,7 @@ | |||
<configuration> | |||
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> | |||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> | |||
<settingsFile>src/it/settings.xml</settingsFile> | |||
<!-- settingsFile>src/it/settings.xml</settingsFile --> | |||
<goals> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make the tests work in my environment. Quick hack for me, Do not merge this, sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But probably hard to implement. I think you detect variables withing string - and have to encode them for saving the resulting file.
Another approach would be a configurable method you call before closing the tar file. I'd add my binary file in this method. And make my method availabe to your Code by adding a dependency to the Plugin config in my pom.
Hey Michael, |
Yes, it want to ship a jar file that I can access from my maintainer script. The only way (I found ...) to do this is to append the jar file to the postrm script. You can see this in action here: https://github.com/mlhartme/stool/blob/master/setup/pom.xml |
if (CONFIGURATION_FILENAMES.contains(file.getName()) || MAINTAINER_SCRIPTS.contains(file.getName())) { | ||
FilteredFile configurationFile = new FilteredFile(new FileInputStream(file), resolver); | ||
configurationFile.setOpenToken(openReplaceToken); | ||
configurationFile.setCloseToken(closeReplaceToken); | ||
addControlEntry(file.getName(), configurationFile.toString(), outputStream); | ||
|
||
} else if (file.getName().endsWith(".bin")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly speaking I am not such a fan of adding some new rule about the file name. Maybe we should just make this work with https://github.com/mlhartme/jdeb/blob/binanry_control/src/main/java/org/vafer/jdeb/ControlBuilder.java#L120 instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. I though about that too, but i didn't see a reliable way to detect binary files. In my case, the file is a shell script with a jar file appended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the proper way to fix this is expanding https://github.com/tcurdt/jdeb/blob/master/src/main/java/org/vafer/jdeb/utils/InformationInputStream.java
Right now we are only checking for the BOM and the shebang. We could also also try to detect a binary there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can you properly check for a binary there? Character codes >= 128?
And by the way: what about shell scripts with "here documents" http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_04. Maybe they have a similar problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't use BOM and Shebang but plain heuristics we indeed run into those problems with "here documents", too.
I am wondering if we should take a step back here. Right now we have 2 types
- shell - where we apply variable expansion
- other - which we just copy without applying variable expansion
Introducing a 3rd type is a bit sneaky as we would want to have variable expansion on only the shell part of the combined file.
So question is whether there is another way to ship the jar but appending it to the shell script or having some kind of convention/marker that tells jdeb where to apply the variable expansion and what to copy as binary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of an alternative place for the jar: is has to be present when postrm is executed. And at this point dpkg has removed all other files of the package. Even e.g. prerm.
Is there a way to define a variables with my binary content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not binary variables yet - but that's actually a very (!) interesting line of thinking to solve this.
I need to add binary control files to a package (actually a jar file, that I use in my maintainer scripts).
Can you please consider to merge something like this?
Best regards
Michael