maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   [GUIDE for noobs] RPM packaging directly on your Jolla phone. (https://talk.maemo.org/showthread.php?t=92963)

Schturman 2014-10-29 22:36

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Ooops, sorry now looked you output again and you are right, it not created rpm file. You do something wrong.

Markkyboy 2014-10-30 00:20

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Quote:

Originally Posted by Schturman (Post 1445078)
Ooops, sorry now looked you output again and you are right, it not created rpm file. You do something wrong.

Okay, thanks.

I used your SPEC file - should I have changed/removed anything or can I use your file as it is? I have added or removed '/' from different lines, hance the different results I keep getting. I've got muddled again.

NielDK mentions about each operation in the spec file requiring a '/' before the % - in say /%files and that each line you want used, must start with '/' - but it's understanding which ones to '/' and which ones to leave as just '%'

Any information is gratefully received.

Regards

Schturman 2014-10-30 01:53

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
if you used my zip from the first post, you don't need to change nothing i the spec file.

Schturman 2014-10-30 09:27

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
I checked my example zip from the first post and found that I can't unzip directly on the phone. Unzip command converted folder inside zip archive to simple file, why I don't know... I suggest you extract it on your PC.
Here is output of creating rpm from this files and with NOT changed .spec file, just download zip -> extract on your PC -> transfer to the phone to correct location -> create rpm:
Code:

[root@Jolla ~]# /bin/cp -rf /root/rpmbuild/BUILD/myfirstpackage-0.1-1.arm /root/rpmbuild/BUILDROOT
[root@Jolla ~]# cd /root/rpmbuild
[root@Jolla rpmbuild]# rpmbuild -bb SPECS/myfirstpackage.spec
Processing files: myfirstpackage-0.1-1.armv7hl
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh
Requires(postun): /bin/sh
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/myfirstpackage-0.1-1.arm
warning: Could not canonicalize hostname: Jolla
Wrote: /root/rpmbuild/RPMS/armv7hl/myfirstpackage-0.1-1.armv7hl.rpm
Executing(%clean): /bin/sh -e /root/rpmbuild/tmp/rpm-tmp.9Tvth7
+ umask 022
+ cd /root/rpmbuild/BUILD
+ /bin/rm -rf /root/rpmbuild/BUILDROOT/myfirstpackage-0.1-1.arm
+ exit 0
[root@Jolla rpmbuild]#

and here is a file:
Code:

[root@Jolla rpmbuild]# ls /root/rpmbuild/RPMS/armv7hl | grep myfirst
myfirstpackage-0.1-1.armv7hl.rpm
[root@Jolla rpmbuild]#

PS. I REzipped files directly on the phone and reuploaded them (same link on the first post), now it can unzip correctly on the phone too by my Unzip & Unrar tool :D

Markkyboy 2014-10-30 23:02

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Thanks Schturman,
Lol, I finally spotted the SPEC file in your example package. Don't know how I missed it! So I ended up copying and pasting from the 'spec file example' you laid out in your first post (thinking it would be the same as the proper spec file you provided). Eyes open, mind closed!!, doh! (I now know you were only showing uses for strings in your example).
Brilliant!, I now have your theme on my phone and I like it, although I have a preference for my AllBlack ambience ;)
I can now go back and start creating resources for my next ambience, perhaps AllBlack2..??, ;)
A second file for my Openrepo account! :)
Thanks again Schturman!, much appreciated.

Schturman 2014-10-31 05:24

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
no problem, good luck ;)

Markkyboy 2014-10-31 13:47

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Quote:

Originally Posted by Schturman (Post 1445237)
no problem, good luck ;)

Just one more aspect I don't understand.

NielDK mentioned about needing to put a '/' in the '%files' section of SPEC file.

I am now looking at your SPEC file for 'myfirstpackage' and none of your entries contain a '/' in the '%files' section yet it does work and produces the RPM package.

I have edited your SPEC file for the purpose of creating my own ambience, I have not made any changes to the SPEC %files section, only name changes, URL, etc and yet upon going through the process, I am getting this error from rpmbuild;

Code:

root@Jolla rpmbuild]# rpmbuild -bb SPECS/allblack2.spec
Processing files: allblack2-0.1-1.armv7hl
error: File must begin with "/":


RPM build errors:
    File must begin with "/":

Now, I know what NielDK said about a leading '/' in %files but there are no '/' in your spec file - so this I really don't understand.

Here's my spec file (your original one but altered), maybe you can see where I'm going wrong.

Code:

Name:          allblack2
Version:      0.2
Release:      2
Summary:      My Second package
Group:        System/Tools
Vendor:        Markkyboy
Distribution:  SailfishOS
Packager:      Markkyboy
URL:          https://together.jolla.com/questions/
License:      GPL

%description
My second custom Ambience package

%files

%defattr(-,root,root,-)
/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"
systemctl-user restart ambienced.service
fi
fi

%changelog
* Sun Mar 16 2014 Builder <builder@...> 0.1
- First build.

Any info please, thanks :)

Regards,

Schturman 2014-10-31 14:14

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
It explained in the first post...
If you don't need special permission, you can write your files under %files
for example in my spec I added my files a special permission and put it under: %defattr(-,root,root,-)

But you can change it like this:
Code:

%files
/usr/share/ambience/*

and delete this from spec:
Code:

%defattr(-,root,root,-)
/usr/share/ambience/*

You package will be created without any problem ;)

Markkyboy 2015-01-04 12:45

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Quote:

Originally Posted by Schturman (Post 1445237)
no problem, good luck ;)

Finally!, I got it!, it's all a lot clearer than it was a few weeks ago. I have a much better understanding of the process now!, thanks to your guide! :cool:

I'm still baffled by one problem which occurs occasionally, the RPM is created, installs but does not show in Gallery/Ambience, even after reboot or restarting ambienced.service, etc, etc.
So, I cleared out all folders in /root/rpmbuild/BUILD, SPECS and so on until all were empty and started again, after that, the RPM once installed, then works!?, go figure!.
Maybe some files are getting muddled??, I don't get any errors except one that goes something like this;
"Warning: Could not canonicalise the name Jolla",.... but I researched and it appears I can ignore it, which seems right, as ALL of the RPMs I've made, have all had that warning but most install and work. Hmmmm, any ideas? :confused:

Anyway, I know more than I did a month ago, thanks Schturman, your input is invaluable

Regards

Schturman 2015-01-04 13:11

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
I don't know why it not worked for you from the first time, but it should...
I used this command in %post line for restart service in all my ambience packages and it always worked immediately without reboot etc..
Code:

systemctl-user restart ambienced.service
Example of spec file from one of my ambience packages:
Code:

Name:          ambience-green-hexagon
Version:      0.0.1
Release:      1
Summary:      Ambience Green Hexagon
Group:        System/Tools
Vendor:        Schturman
Distribution:  SailfisfOS
Packager: Schturman <schturman@hotmail.com>
URL:          www.dhrider.co.cc

License:      GPL

%description
This is a Green Hexagon ambience with sounds...

%files

%defattr(-,root,root,-)
/usr/share/ambience/*

%post
systemctl-user restart ambienced.service

%postun
if [ $1 = 0 ]; then
    #Do stuff specific to uninstalls
rm -rf /usr/share/ambience/ambience-green-hexagon
systemctl-user restart ambienced.service
else
if [ $1 = 1 ]; then
    #Do stuff specific to upgrades
echo "It's just upgrade"
systemctl-user restart ambienced.service
fi
fi

%changelog
* Sun Mar 16 2014 Builder <builder@...> 0.1
- First build.



All times are GMT. The time now is 08:10.

vBulletin® Version 3.8.8