OS/2, eCS & ArcaOS - Technical > Applications

Creating some apps RPM packages

<< < (6/10) > >>

Ben Rietbroek:
rpm --eval '%os2_expand_dos_vars %PROGRAMS%'

Martin Iturbide:
Hi

Here it is my sample to understand better my issue. Right now it is working with the "PROGRAMS" hardcoded.  My goal is to install gotcha on C:\PROGRAMS\GOTCHA\  , just all files there.

 %os2_expand_dos_vars %PROGRAMS% or "$PROGRAMS" works fine for the WPS icon creation since I need the full path.

Under %install. For the mk and cp commands I have the PROGRAMS directory hardcoded instead of bringing it  from the environment variable.

Also on the %files, I have "PROGRAMS" hardcoded.

I think I need a way to bring the %PROGRAMS% without the drive letter, but other ideas and points of view are welcome.
BTW: I know it may not be usual to someone to change the "SET PROGRAMS=" to other directory, but I think it may be better to call the environment variable instead of hardcoding it. (if possible)

Regards

Ben Rietbroek:
Hi Martin,


--- Quote ---I want to find a way to install things on the \Programs\ path without hard coding it.

--- End quote ---

The thing of course is that the drive-letter for %UNIXROOT% is not necessarily
the same as the drive-letter for %PROGRAMS%.

Since RPM comes from the *NIX world, which has a single-root concept for the
file-system, stored (file) paths in a '.rpm' package _must_ start with a '/',
a requirement that propagates to the %files section of a specfile.

This is why '/@unixroot' exists at the scripting level, where it basically
functions as a placeholder for %UNIXROOT%, which is evaluated at install-time
on the target-system.

If the %PROGRAMS% location at the target-system is on a different drive than
the %UNIXROOT% location, its _true_ location cannot be used as a target for the
package files. One could strip the drive-letter and ':' from %PROGRAMS% and
use that as a destination, which would result in that path being created under
the %UNIXROOT% location.

This is why I mentioned packaging _legacy_ applications earlier.

I think we need to discuss how we would solve this.
Solutions can range from '@unixrooting' such legacy applications,
to using ZIP-files in the '.rpm' and extract that with -d,
to installing to /@unixroot/var/tmp and then moving to %PROGRAMS%,
to rpm-relocating at install-time,
to ...

I have also contemplated introducing additional placeholders, like @programs
or even a more generalized form where '/@?/' could be a placeholder for a drive
so that '/@C/AUTOEXEC.BAT' would be possible.
Any four-char string in the form of '/@?/' would mark such a placeholder where
? is in [C-Z] or [c-z].

Of course the real RPM gurus are at BWW, and I think that once we have a more
clear picture on this, their input and advise is very important.

Ben Rietbroek:
So far I found 2 ways to escape %UNIXROOT% for package installations.

[using %pre and symlinks -- dirty hack]
Because %sections become shell-scripts, symlinks work.
So in %pre, which is executed at the target system _before_ files are installed,
a symlink in for instance ${UNIXROOT}/var/programs to ${PROGRAMS} could be made.
In %files then
/@unixroot/var/programs/MyLegacyApplication
would be the entry put in the .rpm and the same path can be used in ${BUILDROOT}.
The fact that var/programs on the build-system is not a symlink while on the target
system it is does not seem to pose a problem.
This method is of course a dirty hack and probably not the way to go.

[using %pre and kLIBC Path Remapper -- not fully tested yet]
This method is conceptually the same, but instead of fiddling with symlinks we
adjust the mapping in the INI-file of the remapper. A small difference is that
the remapper maps /some/unix/path to ?:\some\os2\path so /@unixroot is not
used in the %files section:
/var/programs/MyLegacyApplication
(/var/programs is mapped to %PROGRAMS%)
I have not tested this method completely yet, but it is most certainly better than
the symlink method because it can provide a proper central mapping registry for legacy apps.

I'll be doing some more testing on this stuff and merge that into the spectest example
which I will post here when it has some more flesh on it.

Martin Iturbide:

--- Quote from: Ben Rietbroek on February 23, 2021, 06:20:57 am ---/@unixroot/var/programs/MyLegacyApplication

--- End quote ---

Those are "path choices" I was talking about on the first post   :D

Is really "/@unixroot/var/programs/MyLegacyApplication" a good place for this "legacy OS/2 application" ?
According to wikipedia FHS, /var is "Variable files: files whose content is expected to continually change during normal operation of the system, such as logs, spool files, and temporary e-mail files. "

Regards

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version