Author Topic: Creating some apps RPM packages  (Read 3048 times)

Ben Rietbroek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #30 on: February 24, 2021, 09:02:10 am »
Quote
Those are "path choices" I was talking about on the first post   :D
Indeed.

Quote
Is really "/@unixroot/var/programs/MyLegacyApplication" a good place for this "legacy OS/2 application" ?
No it is not.

I do experimental stuff using /var and it kinda came with the copy-paste.
Cool to throw the FHS in the argument  ;D

But I have been doing more testing with the Path Remapper and I think it is the solution
to this legacy-apps issue and generic outside %UNIXROOT% dir and file addressing.

I must admit I have always taken that clever piece of software for granted :-[

Using the remapper makes it possible to package legacy applications using their native
directory structure and install them in %PROGRAMS%, even if the
drive-letter for %PROGRAMS% differs from the %UNIXROOT% drive-letter.

My next post will explain using the Path Remapper in more detail...

Ben Rietbroek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #31 on: February 24, 2021, 11:08:19 am »

== Using the Path Remapper to install Legacy Applications ==

What is it and what does it do ?
The Path Remapper maps /unix/style/paths to ?:\os2\style\paths.
It operates at the kLIBC level so its functionality is available for every
application compiled with GCC-OS2. That includes sh.exe, rpm.exe, rpmbuild.exe
and more generally the whole *NIX framework and friends as provided by Bitwiseworks.

Where is it ?
It is in Computer -> System Setup -> kLIBC Path Remapper.
Click on it and it will show you what remappings are active on your system.

Remapping for legacy applications
Now add the following entry:
From: /remapped/programs
To: %PROGRAMS%

Testing with sh or bash
Open a command-prompt.
Enter sh or bash
(bash is more handy as command retrieval works)
Now do: ls /remapped/programs
You will see the content of your %PROGRAMS% directory.

Remappings are virtual *NIX paths
The interesting stuff is that the From paths are virtual, so they do not exist
on the file-system. And they are only visible to kLIBC applications, which is
why a dir ?:\remapped\programs under CMD does not find it on any drive.
The path is not physically present.

Using the Path Remapper in a specfile
Given that the above mentioned /remapped/programs -> %PROGRAMS% mapping now
exists on your build-box, the /remapped/programs can now be used in %pre and %files
and other %sections as part of the location where files will be installed.
The resulting package.rpm file will show entries starting with /remapped/programs.
And of course it is possible to create %{variables} like:
%define remapped_programs_key   /remapped/programs
%define remapped_programs_value %PROGRAMS%

Installing such a path-remapped package on the user system
Of course the user does not have the required /remapped/programs -> %PROGRAMS%
mappings yet, but those are easy to do in the %pre section. Even better, have
a tiny dependency package do it, so registering the mapping is centralized.

Mapping Persistence
While the mapping is not required for the remapped (legacy) programs to
operate, since they are not aware of any kLIBC magic, the mappings are needed
for the RPM tools to do proper querying, since the location is also entered
into all relevant package databases, including those of YUM when that is used.

Determining a proper mapping name
In my example I used /remapped/programs as the from-path to emphasize the
package uses the remapper. We would need to come up with a name agreed upon
by all parties to have a standard.

One could envision mapping other locations like /remapped/osdir -> %OSDIR% and
/remapped/os2root -> %OSDIR\.. and others. The convention I used here is a
remapped prefix followed by a lowercase name of the %VARIABLE% it maps on.

A spectest example
I am working on a spectest example that creates a few example packages using
the remapper solution. I will cram it all in a GNU Makefile with a
File Commander/2 user-menu front-end for the interface.

Hold on...

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #32 on: February 27, 2021, 09:55:48 pm »
Hi

I'm also trying to create a File Commnader/2 RPM installer, but I'm still fighting to create the WPS object for the readme located on %doc.

This is not working, it puts me the %doc on the path as text:
Quote
FC2_README:WPProgram|File Commander/2 Read Me|<FC2_FOLDER>|EXENAME=e.exe;\PROGTYPE=PROG_PM;PARAMETERS=((%doc/fc.txt));OPEN=RUNNING

Ideas are welcome.

Regards
« Last Edit: February 27, 2021, 09:58:03 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #33 on: February 27, 2021, 09:58:40 pm »
Hi

FYI: These are the rpm OS/2 macros:
http://svn.netlabs.org/repos/rpm/spec/trunk/SPECS/os2-rpm/macros.os2

Interesting:

Quote
# Converts back slashes to forward slashes.
%os2_fwdslashes()

# Converts forward lashes to back slashes.
%os2_backslashes()
« Last Edit: February 28, 2021, 11:00:36 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Ben Rietbroek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #34 on: February 28, 2021, 05:21:03 pm »
Quote
FC2_README:WPProgram|File Commander/2 Read Me|<FC2_FOLDER>|EXENAME=e.exe;\PROGTYPE=PROG_PM;PARAMETERS=((%doc/fc.txt));OPEN=RUNNING

Wat is that backslash before PROGTYPE doing there ?
It is also in your 'Larsen_Commander.spec' file from your posted examples.

Ben Rietbroek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #35 on: February 28, 2021, 05:34:04 pm »

Please note that File Commander is not freeware.

It is worth its purchase fee back and forth and sideways,
so I would encourage anyone to obtain a proper registration for the OS/2 version,
which is still being developed.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #36 on: February 28, 2021, 10:25:42 pm »

Please note that File Commander is not freeware.


Yes, that is the shareware version. It has no registration information at all on the RPM.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #37 on: February 28, 2021, 10:50:41 pm »
Quote
FC2_README:WPProgram|File Commander/2 Read Me|<FC2_FOLDER>|EXENAME=e.exe;\PROGTYPE=PROG_PM;PARAMETERS=((%doc/fc.txt));OPEN=RUNNING

Wat is that backslash before PROGTYPE doing there ?
It is also in your 'Larsen_Commander.spec' file from your posted examples.


It seems it was a mistake, but it didn't produce any issue, neither help with my problem. I still do not know how to get the %doc to set the path for the WPS readme shortcut. Maybe there should be some other alternative instead of %doc to put file on usr/share/doc/-name-version/

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #38 on: February 28, 2021, 11:41:17 pm »
Hi

I found it. odin.spec was a good sample that helped me.

The trick was "%{_docdir}. Now the readme is correctly pointed on the WPS object.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #39 on: March 01, 2021, 12:01:26 am »
Hi

Just a little tweaking to include the icon on the exe.
I think I'm done with File Commander, it was a nice learning. Until Ben let me know the specifics of what should I do to include it on the RPM server once we elaborate more the idea.

Regard
Martin Iturbide
OS2World NewsMaster
... just share the dream.

ivan

  • Hero Member
  • *****
  • Thank You
  • -Given: 2
  • -Receive: 51
  • Posts: 1309
  • Karma: +12/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #40 on: March 01, 2021, 01:31:13 am »
Hi Martin,

Thank you for a nice chuckle, I say that because the thought just crossed my mind 'you put them together and I take them apart to use'.  No offence meant but I just don't like the stupidity of the RPM system and will get away from it as much as possible, I have even gone as far as denuding the @unixroot directory of as much junk as possible.

Ben Rietbroek

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #41 on: March 01, 2021, 04:39:41 pm »

FWIW:
%doc is used to mark files as documentation.
It has to do with RPM querying -- querying a list of documentation files.
The files themselves still must be part of the %files section.
See: File-related Directives

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #42 on: March 01, 2021, 10:15:39 pm »

FWIW:
%doc is used to mark files as documentation.
It has to do with RPM querying -- querying a list of documentation files.
The files themselves still must be part of the %files section.
See: File-related Directives

uhm... I'm still do not know if I'm using the %doc correctly. I'm putting almost all readme.txt files, like history.txt, whatsnew.txt, and all alike inside that directoy that at the end is "usr/share/doc/-name of the app-version/"
But if it is a .txt used by the application, like "high score" for a game or anything like that I'm putting it on "usr/share/-name of the app/".

Yes, FHS is a mess, not even the linux guys like it, but it is how it work  :-\

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 581
  • -Receive: 121
  • Posts: 3222
  • Karma: +25/-0
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #43 on: March 01, 2021, 10:21:24 pm »
Hi

By the way I made some little updates to some packages, trying to standardize how I use the .specs a little bit better, and trying to use lowercase on the package names.

https://archive.org/download/rpm-warp-samples

I still have some road ahead to learn to register a WPS class with this and create a install for "Black Hole" as example.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 13
  • -Receive: 219
  • Posts: 3066
  • Karma: +50/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #44 on: March 01, 2021, 10:45:50 pm »
But if it is a .txt used by the application, like "high score" for a game or anything like that I'm putting it on "usr/share/-name of the app/".

Shouldn't system wide high scores go somewhere under @unixroot\var with individual ones under %HOME%