Author Topic: Help on RPM installer  (Read 662 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Help on RPM installer
« 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
« Last Edit: March 16, 2018, 11:00:02 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 98
  • Posts: 1362
    • View Profile
Re: Help on RPM installer
« Reply #1 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.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #2 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
« Last Edit: March 17, 2018, 02:56:17 am by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 98
  • Posts: 1362
    • View Profile
Re: Help on RPM installer
« Reply #3 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? Might be better to start with as it seems RPM is really geared towards having the source.

Pete

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 28
  • Posts: 622
    • View Profile
Re: Help on RPM installer
« Reply #4 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

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 98
  • Posts: 1362
    • View Profile
Re: Help on RPM installer
« Reply #5 on: March 18, 2018, 12:09:15 am »
Probably @UNIXROOT\usr\lib\game or possibly @UNIXROOT\usr\share\game.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #6 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

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
« Last Edit: March 20, 2018, 05:52:28 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Thank You
  • -Given: 8
  • -Receive: 98
  • Posts: 1362
    • View Profile
Re: Help on RPM installer
« Reply #7 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.

Silvan Scherrer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 8
  • Posts: 141
    • View Profile
Re: Help on RPM installer
« Reply #8 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
kind regards
Silvan
CTO bww bitwise works GmbH

Please help us with donations, so we can further work on OS/2 based projects. Our Shop is at https://www.bitwiseworks.com/shop/index.php

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #9 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
« Last Edit: March 20, 2018, 04:54:01 pm by Martin Iturbide »
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #10 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.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #11 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Silvan Scherrer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 8
  • Posts: 141
    • View Profile
Re: Help on RPM installer
« Reply #12 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.
kind regards
Silvan
CTO bww bitwise works GmbH

Please help us with donations, so we can further work on OS/2 based projects. Our Shop is at https://www.bitwiseworks.com/shop/index.php

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #13 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 285
  • -Receive: 56
  • Posts: 1869
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Help on RPM installer
« Reply #14 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.