Reply
Thread Tools
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#1
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
 

The Following 4 Users Say Thank You to Schturman For This Useful Post:
Posts: 1,289 | Thanked: 4,318 times | Joined on Oct 2014
#2
Basicalky what you are missing, in the spec file:

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

Source: myfile.tar.gz
 

The Following 2 Users Say Thank You to nieldk For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#3
Originally Posted by nieldk View Post
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
 

The Following User Says Thank You to Schturman For This Useful Post:
Posts: 1,289 | Thanked: 4,318 times | Joined on Oct 2014
#4
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's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#5
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.
 
Posts: 1,289 | Thanked: 4,318 times | Joined on Oct 2014
#6
Originally Posted by Schturman View Post
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.
 

The Following 2 Users Say Thank You to nieldk For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#7
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#8
 
Posts: 1,289 | Thanked: 4,318 times | Joined on Oct 2014
#9
Originally Posted by Schturman View Post
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
 

The Following 3 Users Say Thank You to nieldk For This Useful Post:
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#10
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
 
Reply


 
Forum Jump


All times are GMT. The time now is 20:24.