OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Dave Yeo on April 19, 2023, 03:36:52 am

Title: Building a Dooble RPM
Post by: Dave Yeo on April 19, 2023, 03:36:52 am
Hi, so I've revisited building an RPM, which I haven't had luck with, this time with Dooble.
Downloaded the latest Dooble source RPM, dooble-2022.10.15-1.oc00.src.rpm and used unrpm to expand it. Followed the directions at http://trac.netlabs.org/rpm/wiki/RpmHowToPackagers (http://trac.netlabs.org/rpm/wiki/RpmHowToPackagers) to set up my environment, basically downloaded required packages and created %HOME%\.rpmmacros containing "%_topdir h:/rpmbuild" without the quotes. H: is my ramdisk. Ran rpmbuild as the page recommends, results
Code: [Select]
H:\rpmbuild>rpmbuild -ba dooble.spec
error: line 13: Unknown tag: %scm_source github https://github.com/bitwiseworks/
dooble-os2 2022.10.15-os2
or
Code: [Select]
H:\dooble_rpm>rpmbuild -ba dooble.spec
error: line 13: Unknown tag: %scm_source github https://github.com/bitwiseworks/
dooble-os2 2022.10.15-os2

The RPM page clearly says that %scm_source is a valid tag,
Quote
%scm_source

This macro is intended as a replacement for the standard Source: tag. The format is as follows:

%scm_source SCM URL REV

where SCM is the type of the source code management system (currently supported ones are svn, git and github), URL is the full URL of the source code repository for the given program and REV is the revision to use.

Any ideas where I have gone wrong? I expected a dooble rpm pretty much identical to the Bitwise release, then I could adjust it as needed. I've run into the same issue with trying to build other packages hosted on Github.
Title: Re: Building a Dooble RPM
Post by: Tom on April 19, 2023, 02:54:14 pm
The %scm_source macro seems to expect three parameters, but in your examples I see only two (the SCM and URL parameters, but no REV parameter).
That is the only obvious thing that I see (I have no experience with building RPMs).
Title: Re: Building a Dooble RPM
Post by: ivan on April 19, 2023, 03:29:22 pm
Hi Dave,

Why not just build a WPI, which is much more useful?

I have RPM on my computer because it came with the install but have never used it.
Title: Re: Building a Dooble RPM
Post by: Andi B. on April 19, 2023, 04:05:17 pm
Hi Dave,

Why not just build a WPI, which is much more useful?

I have RPM on my computer because it came with the install but have never used it.
Please don't go offtopic. If you've a question unrelated to the topic, open a new thread. Thanks. Btw. your question is answered more then once.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 19, 2023, 04:26:18 pm
The %scm_source macro seems to expect three parameters, but in your examples I see only two (the SCM and URL parameters, but no REV parameter).
That is the only obvious thing that I see (I have no experience with building RPMs).

Hi Tom, the revision is 2022.10.15-os2, which exists.
Code: [Select]
K:\work\dooble-os2>git tag
2022.04.04
2022.04.04-os2
2022.10.15
2022.10.15-os2

URL is correct as well.
Title: Re: Building a Dooble RPM
Post by: TeLLie on April 19, 2023, 07:06:08 pm
Hi Dave

I use for building RPM the BWW rpmbuild-bot
https://github.com/bitwiseworks/rpmbuild-bot
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 20, 2023, 12:21:00 am
Hi Dave

I use for building RPM the BWW rpmbuild-bot
https://github.com/bitwiseworks/rpmbuild-bot

Interesting, how do you use it? Directory setup etc?
Thanks
Title: Re: Building a Dooble RPM
Post by: Jochen Schäfer on April 20, 2023, 09:23:29 am
The .ini file has some explanations.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 20, 2023, 04:02:27 pm
Yes, I found the directions in the ini card after posting.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 21, 2023, 03:22:59 am
Well, I think I have it setup, using Dmiks setup for now.
Dies with,
Code: [Select]
error: line 13: Unknown tag: %scm_source github https://github.com/bitwiseworks/dooble-os2 2022.10.15-os2

So right back to where I was at the beginning except now it tries to build an i686 version first. One problem is that the goal of RPM is to produce billable consultant hours rather then ease of use.
Title: Re: Building a Dooble RPM
Post by: Rich Walsh on April 21, 2023, 10:00:46 am
One problem is that the goal of RPM is to produce billable consultant hours rather then ease of use.

Not necessarily, at least in this case. A Google search shows that this is a non-standard, home-brew macro that dmik created.

AFAICT, the problem you're having is that your 'x:\usr\lib\rpm\macros' file should include this macro but doesn't (mine doesn't). Look at the diff attached to http://trac.netlabs.org/rpm/ticket/232 and copy its contents into your copy of 'macros'.
Title: Re: Building a Dooble RPM
Post by: Jochen Schäfer on April 21, 2023, 10:35:16 am
Well, I think I have it setup, using Dmiks setup for now.
Dies with,
Code: [Select]
error: line 13: Unknown tag: %scm_source github https://github.com/bitwiseworks/dooble-os2 2022.10.15-os2

So right back to where I was at the beginning except now it tries to build an i686 version first. One problem is that the goal of RPM is to produce billable consultant hours rather then ease of use.
I think, you have to install the BWW rpm tools.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 21, 2023, 05:54:52 pm
One problem is that the goal of RPM is to produce billable consultant hours rather then ease of use.

Not necessarily, at least in this case. A Google search shows that this is a non-standard, home-brew macro that dmik created.

AFAICT, the problem you're having is that your 'x:\usr\lib\rpm\macros' file should include this macro but doesn't (mine doesn't). Look at the diff attached to http://trac.netlabs.org/rpm/ticket/232 and copy its contents into your copy of 'macros'.

Should have used Google instead of DDG :) Yes, it looks like one of the times they imported from vender these macros got lost in the merge, which doen't explain why Jochen and Tellie seems to have them.
I'll test this evening with those patches and will have to file an issue with Bitwise.
Thanks for finding the patch.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 22, 2023, 03:17:43 am
OK, looking further, http://trac.netlabs.org/rpm/ticket/245 (http://trac.netlabs.org/rpm/ticket/245) split the OS/2 macros into their own file, so I was missing "yum install os2-rpm-build" to finish my install. Now the Github macros etc are in @unixroot/usr/lib/rpm/macros.d/macros.scm. There's also @unixroot/etc/rpm/macros.scm_pwd to keep your Github credentials in plain text.
Back to trying to build an dooble RPM and then think about a ticket for a documentation update.
Edit: well rpmbuild -ba dooble.spec built an i386 rpm, actually the debug and source rpm's as well. So next question is how to target P4?
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 22, 2023, 05:15:36 am
OK, using rpmbuild-bot, I have i686 and pentium4 packages, both binary and dbg rpms, as well as the source rpm and the zip file built. Worked fine though I need to tune the directories to my liking and it would be nice to use more jobs when building, perhaps make -j3.
Now to adapt the spec file.
Is anyone interested in the rpm's? Not sure yet how they would co-exist with any future Bitwise releases, perhaps just releasing the zip would be fine.
Title: Re: Building a Dooble RPM
Post by: Mike Kölling on April 22, 2023, 10:08:04 am
Is anyone interested in the rpm's? Not sure yet how they would co-exist with any future Bitwise releases, perhaps just releasing the zip would be fine.

At the moment the zip files are fine for me. However I would like to give the RPMs a try (out of curiosity).
By the way, your latest dooble build (QT5 version) is starting fast and the start page (in my case DuckDuckGo) is loading without problems.

Greetings,
Mike
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 23, 2023, 05:43:17 am
Here's my try at an rpm (actually includes the dbg one too). https://c.gmx.com/@744346040190108571/Uatmhxp_S_-YR9AMwll-nQ (https://c.gmx.com/@744346040190108571/Uatmhxp_S_-YR9AMwll-nQ)
Title: Re: Building a Dooble RPM
Post by: Mike Kölling on April 23, 2023, 04:52:34 pm
Here's my try at an rpm (actually includes the dbg one too). https://c.gmx.com/@744346040190108571/Uatmhxp_S_-YR9AMwll-nQ (https://c.gmx.com/@744346040190108571/Uatmhxp_S_-YR9AMwll-nQ)

Installation went well from command line "yum install dooble-2023.04.20-1.oc00.pentium4.rpm".
Using the ANPM installation from file failed with no indication what was wrong.
I'm typing now from the new rpm installation.

Greetings from Potsdam / Germany
Mike
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 23, 2023, 06:21:54 pm
Interesting, it installed fine here using ANPM.
Title: Re: Building a Dooble RPM
Post by: Mike Kölling on April 24, 2023, 09:38:43 am
Interesting, it installed fine here using ANPM.

I tried an install on my second machine using ANPM today. This time it runs almost fine. It installed the executable, it created the folder with the objects.
However it stated also the following error message at the end:

ERROR: wps-object: Could not create an object with ID <BWW_dooble_README_OS2> and specification "WPShadow|README_OS2|<BWW_dooble_FOLDER>|SHADOWID=D:\usr\share\doc\dooble-2023.04.20\README-os2.txt".

ERROR: wps-object: Could not create an object with ID <BWW_dooble_CHANGES_OS2> and specification "WPShadow|CHANGES_OS2|<BWW_dooble_FOLDER>|SHADOWID=D:\usr\share\doc\dooble-2023.04.20\CHANGES-os2.txt".

Rpmdb checksum is invalid: dCDPT(pkg checksums): dooble.pentium4 0:2023.04.20-1.oc00 - u

Greetings,
Mike
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 25, 2023, 05:24:43 am
Yes, I can duplicate this. Not sure of the best solution. Remove the old objects and create new after testing for their existence? Just don't create them seems simplest.
Title: Re: Building a Dooble RPM
Post by: Lars on April 26, 2023, 12:26:03 pm
Interesting, it installed fine here using ANPM.

I tried an install on my second machine using ANPM today. This time it runs almost fine. It installed the executable, it created the folder with the objects.
However it stated also the following error message at the end:

ERROR: wps-object: Could not create an object with ID <BWW_dooble_README_OS2> and specification "WPShadow|README_OS2|<BWW_dooble_FOLDER>|SHADOWID=D:\usr\share\doc\dooble-2023.04.20\README-os2.txt".

ERROR: wps-object: Could not create an object with ID <BWW_dooble_CHANGES_OS2> and specification "WPShadow|CHANGES_OS2|<BWW_dooble_FOLDER>|SHADOWID=D:\usr\share\doc\dooble-2023.04.20\CHANGES-os2.txt".

Rpmdb checksum is invalid: dCDPT(pkg checksums): dooble.pentium4 0:2023.04.20-1.oc00 - u

Greetings,
Mike

The error message likely wants to say that no folder with object id = <BWW_dooble_FOLDER> exists at the point in time where the shadow objects are to be created (in that folder).

Did/Does there exist a folder with object id = <BWW_dooble_FOLDER> when the Dooble RPM is installed ? If that folder is created by the Dooble RPM, is that folder created BEFORE these shadow objects are created ?

My personal experience is that it is a better choice to always newly create an object (even if it already exists) instead of updating it.
Title: Re: Building a Dooble RPM
Post by: Dave Yeo on April 26, 2023, 05:26:18 pm
It does look like it deletes it first, if working correctly. In my case I had a shadow of the program object in the xcentre which may have interfered, have to experiment on a different install.
The code, which I never touched
Code: [Select]
%if 0%{?os2_version}
%global wps_folder_title Dooble

%post -e
if [ "$1" -ge 1 ]; then # (upon update)
    %wps_object_delete_all
fi
%global wps_app_title Dooble
%bww_folder -t %{wps_folder_title}
%bww_app -f %{_bindir}/%{name}.exe -t %{wps_app_title} -i ${name}.ico
%bww_app_shadow
%bww_readme -f %_defaultdocdir/%{name}-%{version}/README
%bww_license -f %_defaultlicensedir/%{name}-%{version}/LICENSE
%bww_file TODO -f %_defaultdocdir/%{name}-%{version}/TO-DO
#%bww_file README_OS2 -f %_defaultdocdir/%{name}-%{version}/README-os2.txt
#%bww_file CHANGES_OS2 -f %_defaultdocdir/%{name}-%{version}/CHANGES-os2.txt

%postun
if [ "$1" -eq 0 ]; then # (upon removal)
    %wps_object_delete_all
fi
%endif