OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Martin Iturbide on March 16, 2018, 08:28:41 pm

Title: Help on RPM installer
Post by: Martin Iturbide on March 16, 2018, 08:28:41 pm
Hi

I'm going forward making some more RPM installers. I'm doing one for Digger Reloaded.

Everything was going fine until I need to put a file (digger.sco - the score files) on the /home/ directory.

Quote
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/bin
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/share/licenses/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/@unixroot/home/.config/%{name}
cp -p *.exe $RPM_BUILD_ROOT/@unixroot/usr/bin
cp -p digger.txt $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
cp -p readme.txt $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
cp -p copyright.txt $RPM_BUILD_ROOT/@unixroot/usr/share/licenses/%{name}-%{version}
cp -p digger.sco $RPM_BUILD_ROOT/@unixroot/home/.config/%{name}

%files
%{_bindir}/*.exe
%doc digger.txt readme.txt
%license copyright.txt
???????????/*.sco


I have no idea what to put on %files so the RPM can grab digger.sco inside the RPM package.  (That is where I have the ???????)

Help is welcome.

Regards
Title: Re: Help on RPM installer
Post by: Dave Yeo on March 16, 2018, 11:49:48 pm
I notice this line,
Quote
cp -p digger.sco $RPM_BUILD_ROOT/@unixroot/home/.config/%{name}
is that right? Seems it should be
Code: [Select]
cp -p digger.sco $RPM_BUILD_ROOT/@home/.config/%{name} at a guess.
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 17, 2018, 02:39:53 am
Hi Dave

What about the stuff at "%files" ?? Any idea how do I reference the digger.sco file? I have no idea what to put there.

Regards
Title: Re: Help on RPM installer
Post by: Dave Yeo on March 17, 2018, 06:59:56 pm
Shouldn't the ico be in the same directory with the exe so that any program object would use it?

The sco file is the high scores file. Should not be put in %HOME%/config, perhaps %HOME% or @unixroot/var/games.
Seems digger is not the best program to be adapted to RPM as it expects a DOS environment but since Martin is just playing around, it doesn't matter if it actually runs.

Martin, have you looked at https://fedoraproject.org/wiki/How_to_create_a_GNU_Hello_RPM_package (https://fedoraproject.org/wiki/How_to_create_a_GNU_Hello_RPM_package)? Might be better to start with as it seems RPM is really geared towards having the source.
Title: Re: Help on RPM installer
Post by: Pete on March 17, 2018, 08:56:19 pm
Hi All

Where would an rpm package put any extra game files eg *.DLF, *.DRF?


Regards

Pete
Title: Re: Help on RPM installer
Post by: Dave Yeo on March 18, 2018, 12:09:15 am
Probably @UNIXROOT\usr\lib\game or possibly @UNIXROOT\usr\share\game.
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 18, 2018, 06:37:05 pm
Hi.

I need some reference of the syntax that the specs uses to name some of the FHS directories.
I found some here, but no Home references:https://www.gnu.org/prep/standards/html_node/Directory-Variables.html (https://www.gnu.org/prep/standards/html_node/Directory-Variables.html)

But I still haven't found what to put on "%files" for the .sco file to be included in the package. Even if home it is not the right place to locate that file, I still do not know how to include it on the package. What should I use like "%{_bindir}/*.exe" to include the sco file ?

Regards
Title: Re: Help on RPM installer
Post by: Dave Yeo on March 18, 2018, 07:29:34 pm
Looks like something along the lines of
Code: [Select]
%files
%{_bindir}/*.exe
%doc digger.txt readme.txt
%license copyright.txt
%{_localstatedir}/name
%{_localstatedir}/*.sco
untested here as I'm not setup to build packages and perhaps it should just be
Code: [Select]
%localstatedir
I should add that under *nix, these types of programs seem to create score files and configuration files that belong in %HOME% upon first run rather then installing them.
Title: Re: Help on RPM installer
Post by: Silvan Scherrer on March 19, 2018, 09:15:27 am
Hi

I'm going forward making some more RPM installers. I'm doing one for Digger Reloaded.

Everything was going fine until I need to put a file (digger.sco - the score files) on the /home/ directory.

Quote
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/bin
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/@unixroot/usr/share/licenses/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/@unixroot/home/.config/%{name}
cp -p *.exe $RPM_BUILD_ROOT/@unixroot/usr/bin
cp -p digger.txt $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
cp -p readme.txt $RPM_BUILD_ROOT/@unixroot/usr/share/doc/%{name}-%{version}
cp -p copyright.txt $RPM_BUILD_ROOT/@unixroot/usr/share/licenses/%{name}-%{version}
cp -p digger.sco $RPM_BUILD_ROOT/@unixroot/home/.config/%{name}

%files
%{_bindir}/*.exe
%doc digger.txt readme.txt
%license copyright.txt
???????????/*.sco


I have no idea what to put on %files so the RPM can grab digger.sco inside the RPM package.  (That is where I have the ???????)

Help is welcome.

Regards

this spec has some not very clean statements
like you never use rm -rf $RPM_BUILD_ROOT in the install section
%clean does that for you anyway
then you don't have to copy files which you reference later on with %doc or %license, as those %doc or %license copy them to the right location anyway.
look at the macros and then you see what they do.

regards
Silvan
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 20, 2018, 04:48:55 pm
Hi

Thanks, I made it work with the %{_localstatedir}.
Maybe, doing it by the book" the score files should be at "/var/games/DiggerReloaded/digger.sco". (this is how I did it on this case)

The nice things is that setting the working directory also as "/var/games/DiggerReloaded/" allows the program to create the INI file on that directory too.(while it uses the .sco file).

It seems to work this way. I still have many doubts on how to put some stuff on the /home/ directory with RPM, but maybe with more practice I will understand.

Regards
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 20, 2018, 04:57:29 pm
like you never use rm -rf $RPM_BUILD_ROOT in the install section
%clean does that for you anyway
then you don't have to copy files which you reference later on with %doc or %license, as those %doc or %license copy them to the right location anyway.
look at the macros and then you see what they do.

Hi Silvan.
Can you point me to a spec sample on how to use %clean?

Thanks.
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 20, 2018, 05:02:50 pm
Hi

I found on a webpage that they suggest:

Quote
%Clean
%if "%{noclean}" == ""
   rm -rf $RPM_BUILD_ROOT
%endif

I will check it out.

Regards
Title: Re: Help on RPM installer
Post by: Silvan Scherrer on March 21, 2018, 01:03:31 pm
Hi

I found on a webpage that they suggest:

Quote
%Clean
%if "%{noclean}" == ""
   rm -rf $RPM_BUILD_ROOT
%endif

I will check it out.

Regards
you don't even need %clean, as when it's not there, then it's done always. else I would use:
%clean
rm -f $(RPM_BUILD_ROOT

like in a lot of our spec.
Title: Re: Help on RPM installer
Post by: Martin Iturbide on March 21, 2018, 09:03:42 pm
Thanks Silvan I will be trying those on my installers.

I still have some doubts about "BuildArch: i686" which I took from the spec sample I got.
When it should be i686, i386 and/or pentium4 ? 

For what I see on the netlabs RPM the majority is i686, and where are no binaries it uses "noarch" (when there are configuration files, icon, text, etc)

In case of this old games should I only stick to "i686" or should I generate also the "petium4" packages?

Regards
Title: Re: Help on RPM installer
Post by: Martin Iturbide on April 02, 2018, 11:42:22 pm
Hi

Here are the three installers I had created. Those had been built with rpmbuild-bot this time.

Regards