| Status: | 5 - New |
| Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
| Scope: | 3 - Applies to all machines and operating systems |
| Subsystem: | Unassigned |
| Summary: | patch to allow variable expansion in files (for EPM-4.1) |
| Version: | -feature |
| Created By: | bomm |
| Assigned To: | Unassigned |
| Fix Version: | Unassigned |
| Update Notification: | |
Trouble Report Files:
Post File
Trouble Report Dialog:
Post Text
bomm 06:44 Nov 06, 2007 | In my init script I need references to directories where some of the files will be installed. The directories are specified in the list files by variables and I dont want ot add a separate preprocessing step for the init script.
That's why I created the attached patch.
I added the "expand" option to every place where a file specified by a file line in the list file will be copied with copy_file().
With the new option "expand()", a file will be copied line by line with variable expansion similar to the processing of %postinstall <file etc.
example: i 0555 $MyFileUser $MyFileGroup my-service my-service "expand()"
(In one of my patches patch does not correctly apply to the normal sources, it may be necessary to apply them in this order: epm-iscriptdir.patch, epm-expand.patch, epm-varcheck.patch)
Bodo |
bomm 00:48 Nov 21, 2007 | The patch I provided here is incomplete. The created native packages for some platforms (e.g. AIX) are unusable, because the size of the modified file does not match the size of the original file stored in a table inside the package. I will make some additional changes to compute the size of the modified file instead of using stat() on the original file. |
bomm 04:16 Dec 12, 2007 | My new version is based on the SVN trunk downloaded yesterday. (4.2?) It was too difficult for me to separate the variable check. That's why it contains both the code to expand variables in files marked with option "expand()" and some code to abort with an error message if a variable is not defined. If something goes wrong, it's IMHO important to not only print a message but also to exit with a non-zero return code.
Compared to my first try, this version of my patch can expand variables in files with tar_file() and copies expanded files to a temporary directory when creating pkg format.
To handle size changes that occur as a result of variable expansion, I added a size field to the file structure that will be filled when using copy_file. Additionally copy_file() can be used to compute the size of the expanded file without writing an output file. Instead of using the result of stat(), I use the size field of the file structure when the size is written to a TAR header or some control file of the software package.
Known bug: For pkg format all files to be expanded must have unique source file names because the expanded version will be written to single temporary directory using the original name.
I'm only testing EPM with deb, lsb, pkg and aix format because I don't have access to other platforms.
Bodo |
|