maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ? (https://talk.maemo.org/showthread.php?t=96717)

Schturman 2016-05-06 09:38

[How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Hi.
Can someone explain/teach me how to correctly create .rpm file from the source (tar.gz) directly on the Jolla tablet/phone, if it possible at all ? I don't have/use SDK...

For example, I want to create purple-facebook package for tablet, on the tablet itself.
Here is the source https://github.com/dequis/purple-fac...g/3d30d24fdbef that @nodevel used to create package for the phone.
Usualy I use a simple tamplate for creating packages on the phone and tablet without using a source, I just create a full path with files like:
Code:

/root/rpmbuild/BUILD/homerefresh-0.1-4.i386
And inside it /usr/share etc...

Here I wrote a guide how to do this: http://talk.maemo.org/showthread.php?t=92963 by using a simple .spec file inside /root/rpmbuild/SPECS, for example:
Code:

Name:          myfirstpackage
Version:      0.1
Release:      1
Summary:      My First package
Group:        System/Tools
Vendor:        Schturman
Distribution:  SailfisfOS
Packager: Schturman <your@mail.com>
URL:          www.yoursite.com
License:      GPL
 
%description
This is my first package of custom Ambience...
 
%files
/usr/share/ambience/*
 
%post
systemctl-user restart ambienced.service
 
%postun
if [ $1 = 0 ]; then
    // Do stuff specific to uninstalls
    rm -rf /usr/share/ambience/myfirstpackage
    systemctl-user restart ambienced.service
  else
    if [ $1 = 1 ]; then
    // Do stuff specific to upgrades
    echo "It's just upgrade"
    fi
fi
 
%changelog
* Sun Mar 16 2014 Builder <builder@...> 0.1
- First build.

As far as I understand for creating from source file it will not work in this way. I need put tar.gz file to /root/rpmbuild/SOURCES and create correct .spec file for this.

Can someone create a template for this ? Full step by step guide ?
Thanks

nieldk 2016-05-06 12:54

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Basicalky what you are missing, in the spec file:

if the tar.gz file in SOURCES is myfile.tar.gz

Source: myfile.tar.gz

Schturman 2016-05-06 20:09

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Quote:

Originally Posted by nieldk (Post 1505116)
Basicalky what you are missing, in the spec file:

if the tar.gz file in SOURCES is myfile.tar.gz

Source: myfile.tar.gz

It's not only Source: myfile.tar.gz... From what I have read, for example here: http://www.rpm.org/max-rpm/s1-rpm-bu...spec-file.html Almost all sections under %description is completely different from my .spec file... This is a reason that I asked for a template that should work at least in most cases... And if possible with description like:
Code:

%prep
#This section will remove previous version of your package and will unpack a new version from your myfile.tar.gz
rm -rf $RPM_BUILD_DIR/cdplayer-1.0
zcat $RPM_SOURCE_DIR/cdplayer-1.0.tgz | tar -xvf -

or it should be:
Code:

%prep
%setup

?

And so on...
Code:

%build
make

%install
make install

And what I need to write under %files section ?:
Code:

%files
?

And what with Install/Uninstall Scripts ? where I need put them ? under which section ? If need it at all ? How to know if need to be here ?
Code:

%pre

%post

%preun

%postun

The %clean Section.. Need or not ? How I know what to write here ?

%changelog, under or before %clean Section ?

After this a creating rpm ?
Code:

rpm -ba cdplayer-1.0.spec

nieldk 2016-05-06 20:56

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Well everything is explained quite nice in your link.
You dont build with rpm, you use rpmbuild ;)
I also suggest looking in build.merproject.org to get ideas on how to use the spec file.

Schturman 2016-05-07 11:18

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Thanks @Nieldk, but it explained quite nice for people who understand this stuff and not really for noobies like me ;)
Before I posted here my question for template/explanation, I have read this site and few other...
Thanks anyway.

nieldk 2016-05-07 15:23

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Quote:

Originally Posted by Schturman (Post 1505155)
Thanks @Nieldk, but it explained quite nice for people who understand this stuff and not really for noobies like me ;)
Before I posted here my question for template/explanation, I have read this site and few other...
Thanks anyway.

OK. Later this weekend, I can make some template. No worries, but, expect any template to not work.
You will quickly learn about dependencies and other things that needs to be addressed in the spec file.

Schturman 2016-05-07 15:36

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Thank you! Waiting to try it :)

Schturman 2016-05-30 14:10

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Nieldk, Hi. Any news ?

nieldk 2016-05-31 08:05

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Quote:

Originally Posted by Schturman (Post 1506554)
Nieldk, Hi. Any news ?

Ups, went to the universe.
Here is a 'sample' spec file.
You will probably learn fast that changes are needed ;)

Code:

Name: sample
Version: 1.0
Release: 1%{?dist}
Summary: A sample application
License: GPL
URL: http://www.sample.org
Source0: http://www.sample.org/samle/%{name}-%{version}.tar.gz

BuildRequires: somelibrariesthat are needed
Requires: somerequireddependenciesforapplication

%description
This is my sample application that does nothing.

%prep
%setup -q -n

%build
%configure
make %{?_smp_mflags}

%check
make check

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%files
%doc README
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/man1/*

%changelog
* Mon Mar 31 2016 John Doe <jdoe@example.com> 1.0
- Initial release


Schturman 2016-06-03 16:21

Re: [How to] Creating rpm file from the source (tar.gz) file directly on the Jolla tablet/phone ?
 
Thanks Nieldk! I will try it.
But I have a few questions:
1. Release: 1%{?dist}
What this 1%{?dist} ? It mean the spec file will read this number from source package ? Or I can just write the release number that I want ?

2. Source0: http://www.sample.org/samle/%{name}-%{version}.tar.gz
If I already have tar.gz file, can I just put it to /root/rpmbuild/SOURCES folder and write it as is, for example:
Code:

Source0: /root/rpmbuild/SOURCES/purple-facebook-3d30d24fdbef.tar.gz
3. BuildRequires: somelibrariesthat are needed
How I check what libraries my package need ?

4. Requires: somerequireddependenciesforapplication
How I check what requires my package need ?

5. make %{?_smp_mflags}
What it mean ? I need leave it as you wrote ? or I need change it {?_smp_mflags} to something ?

Thanks


All times are GMT. The time now is 21:56.

vBulletin® Version 3.8.8