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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #15 on: February 16, 2021, 05:14:51 am »
Hi

%{PROGRAMS} didn't work to create the RPM packaged.  :(

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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #16 on: February 16, 2021, 02:04:26 pm »
Hi

I'm trying  "%{getenv:PROGRAMS}"  but it gets me "C:PROGRAMS" without the backslash.

- %{getenv:PROGRAMS} = C:PROGRAMS
-  %{getenv:HOME}   =  C:HOME

This is an issue for me, since I need to take out the "C:" for the cp command to work.  If I can only know how to trim the first to characters, it will be fine for me.

Regards
« Last Edit: February 16, 2021, 03:53:12 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Creating some apps RPM packages
« Reply #17 on: February 16, 2021, 04:33:12 pm »
The backslash is an escape character on *nix and needs escaping. Try "SET PROGRAMS=c:\\programs"

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4786
  • Karma: +99/-1
    • View Profile
Re: Creating some apps RPM packages
« Reply #18 on: February 16, 2021, 04:55:10 pm »
This is an issue for me, since I need to take out the "C:" for the cp command to work.  If I can only know how to trim the first to characters, it will be fine for me.

Code: [Select]
echo %PROGRAMS% | cut -c 3-




Andreas Schnellbacher

  • Hero Member
  • *****
  • Posts: 827
  • Karma: +14/-0
    • View Profile
Re: Creating some apps RPM packages
« Reply #19 on: February 16, 2021, 06:51:32 pm »
I've tried and read a bit, but haven't tried to build an .rpm. I'm still not sure if rpm uses the sh or the cmd syntax. Here's what I got:
Code: [Select]
[C:\]echo %PROGRAMS%
F:\Apps

[C:\]sh
#

# rpm --eval %{echo:$PROGRAMS\\myapp}
F:\Apps\myapp

# exit

[C:\]rpm --eval %{echo:$PROGRAMS\\myapp}
$PROGRAMS\\myapp

I've found that expressions beginning with "${_" are macros. According to this, defining the macro in the header and using it below might work:
Code: [Select]
%_programs %{echo:PROGRAMS}
...
%{_programs}/...
or
%{_programs}\\...

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #20 on: February 17, 2021, 04:06:32 pm »
Hi,

My name is Ben Rietbroek and I am working on RPM for V.O.I.C.E
(VOICE Software Provisioning)

The use of RPM packages for OS/2 will increase in the future, so it might be
a good idea to think about conventions all RPM providers should adhere to.

These are the conventions I settled on for VOICE:
- package names are lowercase
- the dash (-) is used to separate name components
- no underscores (_)
- always use the '.oc00' distribution identifier

I am developing automated RPM stuff so consistent naming is important for
proper processing.

Additionally one can distinguish between packaging legacy software and
*NIX ported software. This has to do with the locations where the files are
installed and their structure.

And there are more things which would need some cooperation among
package providers so we do not make a mess of our upcoming repositories.

I am open for discussion on these subjects, either at this forum or via:
ben-at-rpm.os2voice.org

Best regards,
Ben Rietbroek.
(aka rousseau)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #21 on: February 18, 2021, 02:00:33 am »
Hi Ben

I would love the see the specs samples that you have produced for the OS2VOICE RPM.
I would also like to check your suggested specs for "legacy software".

Are you writing the os2voice rpm rules somewhere? I will like to collaborate creating more packages.

- always use the '.oc00' distribution identifier
I have no idea what is this '.oc00'. I don't know where it came from, on the specs it came from "{?dist}"

Regards
« Last Edit: February 18, 2021, 02:43:46 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #22 on: February 19, 2021, 06:34:22 pm »
Hi Martin,

Quote
I would love the see the specs samples that you have produced for the OS2VOICE RPM.
I would also like to check your suggested specs for "legacy software".

I will address the above with a broader document in a Request-For-Comments (RFC)
fashion. I am working on that.

Quote
Are you writing the os2voice rpm rules somewhere?

I am writing almost everything down, from issues with tools to useful conventions to
ideas that popup in my head. They all have a tag and there is a background task active
clustering relevant stuff to produce a coherent document.

Quote
I will like to collaborate creating more packages.

That is very cool.
I tool the liberty to send you an invitation to become a "bollplanker", which kinda means this
https://en.wiktionary.org/wiki/bollplank
and where the focus is on _your_ perspective of things.

Quote
I have no idea what is this '.oc00'.
I don't know where it came from, on the specs it came from "{?dist}"

It is defined in: '@unixroot/etc/macros.dist'.
It is mainly used in the *NIX world to identify target platform.
Dunno who defined the '.oc00' name or what it stands for (yet).

[spectest]
I have a self-contained Makefile that does some 'rpmbuild' inspection.
It comes from the MDE4OS2 engine, so I have to manually adjust it a bit.
When ready I will post a dl-link here for anyone interested in inspecting
how 'rpmbuild' sees your environment behind the scenes.

Looking forward to working with you at the RPM front.

Greetz,
  Ben.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #23 on: February 20, 2021, 09:48:29 pm »
Hi
I got this suggestion to try out:

Quote
# System-wide path for OS/2 language files accessed via DPATH env. variable.
%os2_langdir %{_datadir}/os2/lang

# System-wide path for OS/2 INF files accessible via BOOKSHELF env. variable.
%os2_bookdir %{_datadir}/os2/book

# System-wide path for OS/2 HLP files accessible via HELP env. variable.
%os2_helpdir %{_datadir}/os2/help

those values are defined in rpm anyway. So don't add new stuff to dpath, help env and so forth
every installation has those values defined.

...but this knowledge came with a demotivational complain that I removed. ;D

But it is not what I'm looking for:
Quote
# rpm --eval %{_programs}
%{_programs}
# rpm --eval %os2_langdir
/@unixroot/usr/share/os2/lang
# rpm --eval %os2_bookdir
/@unixroot/usr/share/os2/book
# rpm --eval %os2_helpdir
/@unixroot/usr/share/os2/help
#

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

Regards
« Last Edit: February 20, 2021, 10:30:22 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #24 on: February 21, 2021, 05:22:02 pm »
Does
rpm --eval %{os2_boot_drive}/Programs
help you?

I also checked a fresh install and %PROGRAMS% is set in CONFIG.SYS,
so it should be in the ENVIRONMENT. So depending on which %section
you are in ${PROGRAMS} might evaluate properly.
« Last Edit: February 21, 2021, 05:36:45 pm by Ben Rietbroek »

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #25 on: February 21, 2021, 08:26:43 pm »
rpm --eval '%os2_expand_dos_vars %PROGRAMS%'

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #26 on: February 22, 2021, 02:09:09 am »
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
« Last Edit: February 22, 2021, 02:22:47 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #27 on: February 22, 2021, 05:36:53 pm »
Hi Martin,

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

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.

rousseau

  • Guest
Re: Creating some apps RPM packages
« Reply #28 on: February 23, 2021, 06:20:57 am »
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

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Creating some apps RPM packages
« Reply #29 on: February 24, 2021, 12:26:00 am »
/@unixroot/var/programs/MyLegacyApplication

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
Martin Iturbide
OS2World NewsMaster
... just share the dream.