OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Martin Iturbide on September 27, 2020, 04:53:57 am

Title: Creating a RPM package for PMDLL
Post by: Martin Iturbide on September 27, 2020, 04:53:57 am
Hi

I'm trying to create a RPM package for PMDLL.

1) I'm experiencing a WPS freeze with the installer created the PMDLL icon.  (maybe because of ASSOCTYPE= and ASSOCFILTER=). Do you experience the same issue? Suggestions? (Please go with caution.. I'm not sure if this is breaking some rpm stuff)

2) The PMDLL package has PMDLL.SYM and PMDLL.XQS. I didn't find on the documentation what to do with those files, what are those for?

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: Dave Yeo on September 27, 2020, 05:25:04 am
The XQS is for exceptq to output approximate location of crash, what was on stack etc. The sym file is used in debugging and to build the XQS file. Probably should have the XQS file installed unless you have a debug package planned.
Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on September 27, 2020, 03:31:00 pm
Thanks Dave.

I really don't know much about exceptq, I did some readme reading yesterday. I didn't get exactly what to do with the files. My question remains: I'm putting PMDLL.EXE on /usr/bin where should I put the XQS and SYM for it to work with the PMDLL.EXE ?

- Should I put the XQS and SYM on /usr/bin
or
- Should I create a /usr/share/PMDLL/, put XQS and SYM  and set PMDLL icon working path to /usr/share/PMDLL/ ? Should it work that way?
or
- The XQS and SYM  file should be on /usr/lib ?

I still do not know how to test if the XQS and SYM files are working to get errors/exceptions with exceptq on PMDLL use. Maybe it is basic knowledge, but I don't know about it.

I'm open to suggestions

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on September 27, 2020, 05:37:50 pm
These files always go into the very same directory as the Executable.
Title: Re: Creating a RPM package for PMDLL
Post by: Dave Yeo on September 27, 2020, 06:57:15 pm
Try opening a cmd window, do SET EXCEPTQ=Z or set EXCEPTQ=ZZ and start and exit pmdll. It should generate a trp file on closing.
And as Lars says, in the same directory as the executable or in the case of a DLL's xqs file, in the DLL directory.
Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on September 28, 2020, 05:29:30 pm
Thanks for the tips. I will try it out.

How do you fix this error?
Code: [Select]
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.yum-complete-transaction does not seems a valid command on OS/2. Is there any other way to call it or fix this error message?

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: Doug Bissett on September 28, 2020, 06:53:40 pm
Quote
yum-complete-transaction does not seems a valid command on OS/2. Is there any other way to call it or fix this error message?

It is a Python script. Run it with the menu option in ANPM.
Manage-> YUM Tools-> Maintenance-> Complete transaction
(you may not have all of those, depending on which version of ANPM you have).
Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on September 28, 2020, 07:22:49 pm
Hi

This is my second take on the RPM package, putting the .SYM and .XQS file on the usr/bin.

I still get some strange freeze on the WPS and on TOP I can see WPS-OBJECT.EXE that does not finish,when I'm installing this package.

Do you think is something wrong on how I'm doing the WPS object creation?

Code: [Select]
%post
if [ "$1" -ge 1 ]; then # (upon update)
    %wps_object_delete_all
fi
%wps_object_create_begin
PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library,,;ASSOCFILTER=*.EXE,*.DLL,,;
%wps_object_create_end

%postun
if [ "$1" -eq 0 ]; then # (upon removal)
    %wps_object_delete_all
fi
Title: Re: Creating a RPM package for PMDLL
Post by: Andreas Schnellbacher on September 28, 2020, 08:26:35 pm
Does rpmlint exist for OS/2?
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on September 29, 2020, 09:02:06 am
Just a wild guess (I have no experience writing RPM spec files):
use %% instead of % for refering to _bindir.

An OS/2 commandline requires escaping the % character by specifying two % characters.
As a test you can run:
rpm --eval %%_bindir
try instead:
rpm --eval %_bindir
and you will realize that the former works while the latter does not.

However I don't know if installing an RPM will lead to invocation of an OS/2 commandline with the arguments passed in as written in the RPM spec file.


Something else I don't understand (but maybe it is intended) is that if you run:
rpm --eval %%_bindir (or rpm --eval %%{_bindir})
is that this is returned:
/@unixroot/usr/bin

I hope that /@unixroot is silently resolved by using the UNIXROOT environment variable (which needs to be set on your system).

Title: Re: Creating a RPM package for PMDLL
Post by: ivan on September 29, 2020, 02:28:32 pm
I would ask why go to all the trouble when a simple zip file will do the job?  To me it looks like a lot of effort for no real gain.
Title: Re: Creating a RPM package for PMDLL
Post by: Dave Yeo on September 29, 2020, 05:15:54 pm
Just a wild guess (I have no experience writing RPM spec files):
use %% instead of % for refering to _bindir.

An OS/2 commandline requires escaping the % character by specifying two % characters.
As a test you can run:
rpm --eval %%_bindir
try instead:
rpm --eval %_bindir
and you will realize that the former works while the latter does not.

However I don't know if installing an RPM will lead to invocation of an OS/2 commandline with the arguments passed in as written in the RPM spec file.


Something else I don't understand (but maybe it is intended) is that if you run:
rpm --eval %%_bindir (or rpm --eval %%{_bindir})
is that this is returned:
/@unixroot/usr/bin

I hope that /@unixroot is silently resolved by using the UNIXROOT environment variable (which needs to be set on your system).

Hi Lars, from a cmd prompt,
Code: [Select]
[H:\tmp]rpm --eval %%_bindir
%_bindir

[H:\tmp]rpm --eval %_bindir
/@unixroot/usr/bin

Note that even the second one isn't correct as /@unixroot will resolve here as /w:/usr/bin.
And yes, %UNIXROOT% needs to be set to a drive letter plus colon, though on a single root system such as everything on C:, /usr/bin will work for most programs with exceptions for DOSISH programs that consider / to be the start of a parameter and use a drive letter to tell it's a PATH. Wlink is an example that needs a drive letter when using / as a dir separator.
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on September 29, 2020, 06:36:30 pm
Try:

Code: [Select]
%wps_object_create_begin
PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL|R
%wps_object_create_end

Title: Re: Creating a RPM package for PMDLL
Post by: Lars on September 30, 2020, 09:31:30 am
Try:

Code: [Select]
%wps_object_create_begin
PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL|R
%wps_object_create_end

By the way: you can only set the ASSOCTYPE's that actually exists. On my system, "Executable" exists but not "Dynamic Link Library". Check your XWorkplace Workplace Shell Object.
In the end, the "lengthy" string that you specify as the 4.parameter (where parameters are separated by |) follows the setup strings as described in the "Workplace Shell Programming Reference"
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on September 30, 2020, 07:49:44 pm
Hi Lars, from a cmd prompt,
Code: [Select]
[H:\tmp]rpm --eval %%_bindir
%_bindir

[H:\tmp]rpm --eval %_bindir
/@unixroot/usr/bin

Note that even the second one isn't correct as /@unixroot will resolve here as /w:/usr/bin.
And yes, %UNIXROOT% needs to be set to a drive letter plus colon, though on a single root system such as everything on C:, /usr/bin will work for most programs with exceptions for DOSISH programs that consider / to be the start of a parameter and use a drive letter to tell it's a PATH. Wlink is an example that needs a drive letter when using / as a dir separator.

... and now we are in deep shit trouble because the 4OS2 command line behaves as I have stated but the OS/2 command line behaves as you have stated.
Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on October 07, 2020, 03:21:58 am
Thanks for the suggestion.

Try:

Code: [Select]
%wps_object_create_begin
PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL|R
%wps_object_create_end

By the way: you can only set the ASSOCTYPE's that actually exists. On my system, "Executable" exists but not "Dynamic Link Library". Check your XWorkplace Workplace Shell Object.
In the end, the "lengthy" string that you specify as the 4.parameter (where parameters are separated by |) follows the setup strings as described in the "Workplace Shell Programming Reference"

What is the "|R" at the end?

By the way, on ArcaOS I have a "Dynamic Link Library" on WPS and it even seems to assign ok the Association.  (Check attached picture)

I changed the "%wps_object_create_begin", but I still get a freeze on the WPS-OBJECT.EXE file and the desktop gets locked when I install the rpm package.

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on October 07, 2020, 09:13:36 am
1) go to directory \var\cache\rpm\wps\packages and check if you find a file for your package (PMDLL). Have a look at the contained file and check if the string resolves to what you expect it to be
2) try to do a "dry" run of wps-object.exe:
   a) change to directory \usr\lib\rpm\pc
   b) invoke: wps-object.exe /create pmdll "PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL;|R"

That should create the desktop icon. Of couse, since the path does not properly resolve, it will not work. But that will let you check if wps-object.exe runs unobstructed. If the latter fails then you know you have a problem with your WPS. If it succeeds, it means you have a problem somewhere else in your spec file or a broken RPM installation that possibly fails in resolving the %{_bindir} variable.

The "R" stands for "replace" in contrast to "U" which stands for "update". Since "update" is the default, you do not need to specify it.

All of this is explained here:http://trac.netlabs.org/rpm/changeset/91

That will also show you that wps-object.exe really is just a simple REXX script that has been compiled into an executable (via the REXX2EXE tool from Veit Kannegieser).

Lars


Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on October 10, 2020, 03:22:31 am
Hi
1) go to directory \var\cache\rpm\wps\packages and check if you find a file for your package (PMDLL). Have a look at the contained file and check if the string resolves to what you expect it to be
I didn't find any folder related to PMDLL.


2) try to do a "dry" run of wps-object.exe:
   a) change to directory \usr\lib\rpm\pc
   b) invoke: wps-object.exe /create pmdll "PMDLL_EXE:WPProgram|PMDLL|<WP_DESKTOP>|EXENAME=((%{_bindir}/PMDLL.EXE));ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL;|R"
It worked very fast to create a WPS Object on the desktop and it didn't hang.

But now I have a problem with YUM and RPM. Now everytime I try to run YUM I get a error that says it is locked. (Check Screenshot)

Any it to unlock YUM is welcome.

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: ivan on October 10, 2020, 05:07:55 am
Have you used something like Task Buster to check what is attached to the PID displayed?  It might give you some idea of what is going on as well as allowing the possibility of killing it.,

EDIT to attach Task Buster in zip format.
Title: Re: Creating a RPM package for PMDLL
Post by: Dave Yeo on October 10, 2020, 09:07:52 am
Yum probably crashed and left its PID file behind and now that it sees it, thinks it is already running. Try deleting the PID file.
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on October 10, 2020, 12:40:06 pm
One Thing is clear by now: you have a screwed installation of yum/rpm.
I suggest you redo the install of yum/rpm via ANPM, if possible. Possibly also python.
Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on October 11, 2020, 04:30:28 am
Hi

I reset the VM to a previous snapshot where RPM/YUM worked fine.
I created PMDLL rpm and install it again, but it keeps stalling at the wps-object.exe process and slowing down the PM desktop. (CPU does not spike). If I stop the installation procedure, the desktop remains unreliable (a reboot was required). I'm attaching the specs file.

If I remove the ";ASSOCTYPE=Executable,Dynamic Link Library;ASSOCFILTER=*.EXE,*.DLL;", the rpm package works perfectly, but does not associate the type and filters of course.

Any other experience trying ASSOCTYPE= and ASSOCFILTER= with RPM?

Regards

Title: Re: Creating a RPM package for PMDLL
Post by: Martin Iturbide on October 11, 2020, 05:26:35 am
Hi

I also tried a different sample, since Ivan posted the Task Buster binaries. So I tried to create a rpm package for it.

But I may be missing something on the .spec, since the installer tells me it required BUSTER.DLL and I had included it on the package.

This is the error I get:

Code: [Select]
[C:\HOME\RPMBUILD\RPMS\I686]yum install TaskBuster-2.00-1.oc00.i686.rpm
Setting up Install Process
Examining TaskBuster-2.00-1.oc00.i686.rpm: TaskBuster-2.00-1.oc00.i686
Marking TaskBuster-2.00-1.oc00.i686.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package TaskBuster.i686 0:2.00-1.oc00 will be installed
--> Processing Dependency: buster.dll for package: TaskBuster-2.00-1.oc00.i686
--> Finished Dependency Resolution
Error: Package: TaskBuster-2.00-1.oc00.i686 (/TaskBuster-2.00-1.oc00.i686)
           Requires: buster.dll
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Any tips on how I tell the rpm installer that BUSTER.DLL is already included there?

Regards
Title: Re: Creating a RPM package for PMDLL
Post by: ivan on October 11, 2020, 07:07:46 pm
Hi Martin,

One thing I found with the Task Buster program is that both the exe and dll need to be in the same directory.  I don't know if that will help, I'm a hardware engineer that employed others to do the software.
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on October 11, 2020, 10:44:04 pm
Martin's problem is not a runtime problem but an installation problem.
Nonetheless, if what you say is true, that also means that Martin will have to change the spec file accordingly.
Title: Re: Creating a RPM package for PMDLL
Post by: Lars on October 12, 2020, 03:30:18 pm
Hi

I also tried a different sample, since Ivan posted the Task Buster binaries. So I tried to create a rpm package for it.

But I may be missing something on the .spec, since the installer tells me it required BUSTER.DLL and I had included it on the package.

This is the error I get:

Code: [Select]
[C:\HOME\RPMBUILD\RPMS\I686]yum install TaskBuster-2.00-1.oc00.i686.rpm
Setting up Install Process
Examining TaskBuster-2.00-1.oc00.i686.rpm: TaskBuster-2.00-1.oc00.i686
Marking TaskBuster-2.00-1.oc00.i686.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package TaskBuster.i686 0:2.00-1.oc00 will be installed
--> Processing Dependency: buster.dll for package: TaskBuster-2.00-1.oc00.i686
--> Finished Dependency Resolution
Error: Package: TaskBuster-2.00-1.oc00.i686 (/TaskBuster-2.00-1.oc00.i686)
           Requires: buster.dll
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Any tips on how I tell the rpm installer that BUSTER.DLL is already included there?

Regards

Hi Martin,
have you looked at https://www.golinuxcloud.com/how-to-create-rpm-package-in-linux/ or similar pages ?

What you need to do is set up a directory structure in some temporary dir to DIRECTLY reflect the directory structure that you specify in %files in the spec file which is also the directory structure that you want to exist or be created on the installation target (for example, an "bin" dir for executables and a "lib" dir for DLLs). You then create a tar file from the files to install that preserves that directory structure.
Once this is done, you need to place that tar file into the subdirectory that "rpmbuild" will look for (installation) sources.
Maybe you should look at the tar file you produced (did you ?) to see what directory structure you have created.
Title: Re: Creating a RPM package for PMDLL
Post by: Andreas Schnellbacher on October 12, 2020, 10:08:46 pm
All of this is explained here:http://trac.netlabs.org/rpm/changeset/91
BTW: The file was moved. The current revision is here (http://svn.netlabs.org/repos/rpm/spec/trunk/SPECS/os2-rpm/wps-object.cmd). (The Trac browser doesn't show .cmd files.)