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-03-31 17:11

[GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
As far as you know I'm not programmer and don't know use SDK and all programmer stuff etc... By googling I found this way very useful and easy for myself for creating RPM packages directly on my Jolla phone.

Suggestions for improvement are welcome!

The PDF instruction you can download here.

Create RPM package directly on your Jolla phone.

For easy access to your phone, use WinSCP and PuTTy. Instruction you can find here or download this PDF file.
1. Connect to your phone via WinSCP, open PuTTy as ROOT.

2. Write this command:
Code:

mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS/armv7hl,SPECS}

3.
If rpm-build package not installed, run this command as ROOT:
Code:

pkcon install -y rpm-build

4.
Download this example package of custom ambience to your PC. Extract folder myfirstpackage-0.1-1.arm and transfer to your phone:
Code:

/root/rpmbuild/BUILD
Extract myfirstpackage.spec and transfer to your phone:
Code:

/root/rpmbuild/SPECS

5. Look in to structure of files and folders to understand how to create your own packages.
https://www.dropbox.com/s/bpd4dqu9uixgjag/winscp.pnghttps://dl.dropboxusercontent.com/s/...jag/winscp.png

6.
Some explanation about SPEC file. When you use this method of creating RPM files it have a little problem when you go to uninstall your package. It will delete all your files like it should be, but it will leave your folders. Why, I don’t know… This is a reason that I suggest you to always use the postuninstall script in spec file to remove your folder (see example in my spec).

Also remember that SPEC file run your commands as ROOT, if you should run your commands as USER from SPEC file, use this template:
Code:

su -l nemo -c "command"
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

%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.

7. Some parameters that you can use too (add them under line URL:):
· Obsoletes: - if you want to uninstall other versions
· Conflicts: - if you want to keep 1st installed rpm package and stop 2 other packages from installing
· Requires: - add name of dependency packages

8. Other parameters
· %files - under this put the path to your files that NOT need special permissions. For example:
Code:

%files
/usr/share/applications/openrepos-myfirstpackage.desktop
/usr/share/icons/hicolor/86x86/apps/openrepos-myfirstpackage-off.png
/usr/share/openrepos-myfirstpackage/*

· %defattr(-,root,root,-) - under this put the path to your files that NEED special permissions. For example:
Code:

%defattr(4755,root,root)
/usr/share/openrepos-myfirstpackage/myscript.sh
/usr/share/openrepos-myfirstpackage/myscript2.sh
/usr/share/openrepos-myfirstpackage/myscript-root

9. Preinstall, Postinstall, Preuninstall and Postuninstall scripts.
· %pre– preinstall script, example:
Code:

%pre
if [ $1 = 1 ]; then
      #Do stuff specific for first install
      echo "It's first time install"
  else
    if [ $1 = 2 ]; then
      #Do stuff specific to upgrades
      echo "It's upgrade"
    fi
fi

· %post – postinstall script, example:
Code:

%post
if [ $1 = 1 ]; then
      #Do stuff specific for first install
      echo "It's first time install"
  else
    if [ $1 = 2 ]; then
      #Do stuff specific to upgrades
      echo "It's upgrade"
    fi
fi

· %preun – preuninstall script, example:
Code:

%preun
if [ $1 = 0 ]; then
      #Do stuff specific for uninstalls
      echo "Going to uninstall"
  else
    if [ $1 = 1 ]; then
      #Do stuff specific to upgrades
      echo "It's upgrade"
    fi
fi

· %postun – postuninstall script, example:
Code:

%postun
if [ $1 = 0 ]; then
      #Do stuff specific for uninstalls
      echo "Going to uninstall"
  else
    if [ $1 = 1 ]; then
      #Do stuff specific to upgrades
      echo "It's upgrade"
    fi
fi

10. Creating RPM package, run as ROOT in PuTTy:
Code:

/bin/cp -rf /root/rpmbuild/BUILD/myfirstpackage-0.1-1.arm /root/rpmbuild/BUILDROOT
cd /root/rpmbuild
rpmbuild -bb SPECS/myfirstpackage.spec

11. Transfer your RPM package to Downloads folder for example:
Code:

/bin/cp -f /root/rpmbuild/RPMS/armv7hl/myfirstpackage-0.1-1.armv7hl.rpm /home/nemo/Downloads
12. Install your package as USER via any File browser or as ROOT from terminal:
Code:

pkcon install-local -y /home/nemo/Downloads/myfirstpackage-0.1-1.armv7hl.rpm
13. Uninstall your package from homescreen (long press -> X) or as ROOT from terminal:
Code:

pkcon remove myfirstpackage
Good luck! Use it on your own risk ! :D

Schturman
29.03.2014

Some users poins:
* From what nieldk explained (here and here) you can do all this stuff as USER,
just replace the path /root/rpmbuild/....with /home/nemo/rpmbuild/

nieldk 2014-03-31 17:48

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
good post, only one thing.
You dont need (read: should not) run as root.
There really are no necessary reason for running rpmbuild as root,
the %defatr section defines the default permissions (in your example user:root and group:root) you can, and should also set permission in the %files section as needed per folder/file, and in some cases the default %defattr root:root will result in eg configuration files not being readable by normal user (nemo)
As rpmbuild builds in ~/rpmbuild directory tree it is able to create the rpm as user nemo etc.

Schturman 2014-03-31 18:02

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

Originally Posted by nieldk (Post 1419332)
good post, only one thing.
You dont need (read: should not) run as root.
There really are no necessary reason for running rpmbuild as root,
the %defatr section defines the default permissions (in your example user:root and group:root) you can, and should also set permission in the %files section as needed per folder/file, and in some cases the default %defattr root:root will result in eg configuration files not being readable by normal user (nemo)
As rpmbuild builds in ~/rpmbuild directory tree it is able to create the rpm as user nemo etc.

Thanks
I just never tried do this as USER, I use WinSCP and Putty and it easily to do as ROOT or as USER and transfer files where you want.
If you start as USER you can't create folders from the first commands and if you already did it as ROOT you can just continue to other commands as root too :o

flotron 2014-03-31 18:02

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Thanks man. Added to my bookmarks

Schturman 2014-03-31 19:16

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
PDF instruction updated with screenshot from WinSCP and link to this thread :D

nieldk 2014-03-31 19:27

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

Originally Posted by Schturman (Post 1419334)
Thanks
I just never tried do this as USER, I use WinSCP and Putty and it easily to do as ROOT or as USER and transfer files where you want.
If you start as USER you can't create folders from the first commands and if you already did it as ROOT you can just continue to other commands as root too :o

just replace the path /root/rpmbuild/....
with
/home/nemo/rpmbuild/.... (SPECS/SOURCES/RPMS/SRPMS)

:)

Schturman 2014-03-31 19:44

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Thanks
I will add your points to the first post...

flotron 2014-03-31 20:49

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
%defattr could work also to execute a postint script as root?

like:
Quote:

%defattr
ln -s /usr/share/harbour-mytheme /usr/share/themes

flotron 2014-03-31 21:28

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

rpmbuild -bb SPECS/myfirstpackage.spec

i get: bash: rpmbuild: command not found

Schturman 2014-03-31 21:38

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

Originally Posted by flotron (Post 1419378)
after:

rpmbuild -bb SPECS/myfirstpackage.spec

i get: bash: rpmbuild: command not found

install rpmbuild:
Code:

pkcon install -y rpm-build
Add creating your symlink to the scripts (pre, post, preun or postun) where you need it...

flotron 2014-03-31 21:55

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
RPM built. Now lets brick the phone :P

flotron 2014-03-31 22:10

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

Except after apply theme and refresh it didn't apply. Maybe needs more time?

doing pkill via terminal after install worked

gconftool-2 -s --type=string /meegotouch/theme/name harbour-mytheme
pkill lipstick


What if i add a pause after pkill?

Schturman 2014-03-31 22:31

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Don't know, try it...
Maybe instead pkill try
Code:

systemctl-user restart lipstick.service
Maybe it like in N9 when you need to restart some processes, not only homescreen refresh...
Maximum add reboot ;)

flotron 2014-03-31 23:03

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
The problem is thats not apply the theme with root privileges, only with user. I probed with root and user in terminal

Do you know how to apply the theme with user privilege?

This one
"gconftool-2 -s --type=string /meegotouch/theme/name harbour-mytheme"

Schturman 2014-03-31 23:19

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

su -l nemo -c "command"
;)

flotron 2014-04-01 00:24

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

Originally Posted by Schturman (Post 1419395)
use:
Code:

su -l nemo -c "command"
;)

That worked. :)

Schturman 2014-04-01 10:47

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
First post and PDF instruction updated!
* added explanation about running command from SPEC file as USER
* added command for installation of rpm-build package.

flotron 2014-04-01 18:58

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Could it be possible notifications like n9?

dbus-send --print-reply --dest=com.meego.core.MNotificationManager /notificationmanager com.meego.core.MNotificationManager.addNotificatio n uint32:1000 uint32:0 string:'x-nokia.internet' string:'Theme' string:'Theme installed!

Schturman 2014-04-01 22:17

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
use notifer.py likr this: python /path/notifer.py. Use it also as USER from spec file.
Code:

#!/usr/bin/python
import dbus

bus = dbus.SessionBus()
object = bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications')
interface = dbus.Interface(object,'org.freedesktop.Notifications')
#print(interface.GetCapabilities())

interface.Notify("app_name",
                0,
                "icon-m-notifications",
                "Dalvik is STOPPED !",
                "Dalvik stopper",
                dbus.Array(["default", ""]),
                dbus.Dictionary({"x-nemo-preview-body": "Dalvik stopper",
                                  "x-nemo-preview-summary": "Dalvik is STOPPED !"},
                                  signature='sv'),
                0)

that mean:
Code:

su -l nemo -c "python /path/notifer.py"

Schturman 2014-04-14 22:30

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Hi to all
After last system update 1.0.5.16, I can't update my apps created with this method :( Don't know why, more detailed explanation here: http://talk.maemo.org/showthread.php?t=93023
Any help will be appreciated.
Thanks

Schturman 2014-04-17 15:11

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Method work like expected, it was my mistake in previous version of vkb :D

Schturman 2014-04-24 10:18

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
T.Mavica, here is your .spec file:
Code:

Name:          sailfishquickim
Version:      0.1
Release:      1
Summary:      Traditional Chinese input
Group:        System/Tools
Vendor:        Arthur Artoria
Distribution:  SailfisfOS
Packager: Arthur Artoria <arthurartoria@gmail.com>
URL:          www.mysite.com

License:      GPL

%description
Chinese Traditional Quick Input Method For Sailfish.

%files

%defattr(-,nemo,nemo,-)
/home/nemo/.local/share/maliit-server/QML/OfflineStorage/Databases/*

%defattr(644,root,root,-)
/usr/share/maliit/plugins/com/jolla/layouts/*

%post
if [ $1 = 1 ]; then
    #Do stuff specific for first install
echo "It's first time install"
killall maliit-server
killall jolla-messages
killall jolla-email
killall jolla-notes
killall jolla-clock
else
if [ $1 = 2 ]; then
    #Do stuff specific to upgrades
killall maliit-server
fi
fi

%postun
if [ $1 = 0 ]; then
    #Do stuff specific to uninstalls
rm -rf /usr/share/maliit/plugins/com/jolla/layouts/quickZH
killall maliit-server
else
if [ $1 = 1 ]; then
    #Do stuff specific to upgrades
echo "It's just upgrade"
fi
fi

%changelog
* Wed Jan 25 2014 Builder <builder@...> 0.1
- First build.

folder name that include your files in BUILD directory is: sailfishquickim-0.1-1.arm

P.S.
0.1-1:
0.1 = number of Version
1 = number of Release

If you change this numbers in folder name, also you need change them in the .spec file.

Good luck ;)

Schturman 2014-05-05 17:00

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
T.Mavica, detailed explanation for you ;)

1. Connect your phone to WinSCP via SSH connection and open Putty. How to here: http://talk.maemo.org/showthread.php?t=92491
2. Run this command as ROOT:
Code:

mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS/armv7hl,SPECS}
3. Download this files to your PC -> extract from ZIP and transfer folder named sailfishquickim-0.3-1.arm to /root/rpmbuild/BUILD on your phone.
3. Download this spec file to your PC -> transfer it to /root/rpmbuild/SPECS
4. Three commands for creating your package (as ROOT):
Code:

/bin/cp -rf /root/rpmbuild/BUILD/sailfishquickim-0.3-1.arm /root/rpmbuild/BUILDROOT
cd /root/rpmbuild
rpmbuild -bb SPECS/sailfishquickim.spec


5. Transfere it where you want, for example to Downloads folder:
Code:

/bin/cp -f /root/rpmbuild/RPMS/armv7hl/sailfishquickim-0.3-1.armv7hl.rpm /home/nemo/Downloads
6. Install your package from any File manger directly on the phone or as ROOT from terminal/Putty:
Code:

pkcon install-local -y /home/nemo/Downloads/sailfishquickim-0.3-1.armv7hl.rpm
7. Uninstall your package as ROOT:
Code:

pkcon remove sailfishquickim
Here is your last (new) package: https://dl.dropboxusercontent.com/u/...-1.armv7hl.rpm

So, if you want to update your package, some steps:
1. Change version number of your folder, for example from
sailfishquickim-0.3-1.arm to
sailfishquickim-0.4-1.arm or
sailfishquickim-0.3-2.arm

Where is:
0.3-1:
0.3 = number of Version
1 = number of Release

2. Change to the SAME version in the .spec file. For example:
From this:
Code:

Name:          sailfishquickim
Version:      0.3
Release:      1

to this:
Code:

Name:          sailfishquickim
Version:      0.4
Release:      1

or this:
Code:

Name:          sailfishquickim
Version:      0.3
Release:      2

3. Change your files inside sailfishquickim-0.3-1.arm folder to new files.
4. Create new RPM package

That's all :D

Markkyboy 2014-10-29 19:53

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
Hi Schturman,

wonder if you can help, after entering the line
Code:

rpmbuild -bb SPECS/myfirstpackage.spec
I get the following output;

Code:

[nemo@Jolla rpmbuild]$ rpmbuild -bb SPECS/myfirstpackage.spec
Processing files: myfirstpackage-0.1-1.armv7hl
error: File must begin with "/"

How do I proceed please?

Regards,

nieldk 2014-10-29 20:03

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

Originally Posted by Markkyboy (Post 1445034)
Hi Schturman,

wonder if you can help, after entering the line
Code:

rpmbuild -bb SPECS/myfirstpackage.spec
I get the following output;

Code:

[nemo@Jolla rpmbuild]$ rpmbuild -bb SPECS/myfirstpackage.spec
Processing files: myfirstpackage-0.1-1.armv7hl
error: File must begin with "/"

How do I proceed please?

Regards,

your %files section in spec file, all listed files must begin with /

Markkyboy 2014-10-29 20:30

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

Originally Posted by nieldk (Post 1445037)
your %files section in spec file, all listed files must begin with /

Thanks NielDK, that worked, albeit I now have a different error from RPM build;

Code:

RPM build errors:
    Installed (but unpackaged) file(s) found:
  /usr/share/ambience/myfirstpackage/images/myfirstpackage.jpg
  /usr/share/ambience/myfirstpackage/myfirstpackage.ambience
  /usr/share/ambience/myfirstpackage/sounds.index
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_Calendar.mp3
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_Clock.mp3
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_Email.mp3
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_IM.mp3
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_Ringtone.mp3
  /usr/share/ambience/myfirstpackage/sounds/myfirstpackage_SMS.mp3

I'm a total noob when it comes to this, but I do want to learn. Why is the package not being compiled and would I be right in thinking when it is compiled , I should then find the package RPMS folder?

Thanks for your help, it's much appreciated NielDK.

Regards,

Schturman 2014-10-29 21:05

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
post a full spec file and we will fix it ;)

Markkyboy 2014-10-29 21:31

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

Originally Posted by Schturman (Post 1445057)
post a full spec file and we will fix it ;)

Hi Schturman,
thanks, but for now, I'm trying to compile your file using your SPEC file, all as an experiment so I can see what is doing what before my eyes.
So, as yet, I have no SPEC file of my own, only yours.

NielDK kindly answered me and now I have got a bit further. It seems that a line or command in the SPEC file was causing the compiled RPM to get deleted - I'm in a right pickle!, but it's all good and is how I learn!

I'm starting again and hopefully this time, I will have an RPM file at the end of it! (I feel like I'm learning another language and not doing very well!)

Here is where I'm at now;
Code:

[root@Jolla rpmbuild]# rpmbuild -bb SPECS/myfirstpackage.spec                  Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/myfirstpackage-0.1-1.arm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.C5rTfh
+ umask 022
+ cd /root/rpmbuild/BUILD
+ /bin/rm -rf /root/rpmbuild/BUILDROOT/myfirstpackage-0.1-1.arm
+ exit 0
[root@Jolla rpmbuild]#

After the above, there is no RPM, only the created files. I'm a bit lost! :)

Regards,

Schturman 2014-10-29 21:42

Re: [GUIDE for noobs] RPM packaging directly on your Jolla phone.
 
It's good output! You will find created rpm file in: /root/rpmbuild/RPMS/armv7hl
just copy it to you Downloads folder...

Markkyboy 2014-10-29 22:04

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

Originally Posted by Schturman (Post 1445067)
It's good output! You will find created rpm file in: /root/rpmbuild/RPMS/armv7hl
just copy it to you Downloads folder...

Cool, it's good to know you think the output is good, however, I couldn't continue because no file existed at /root/rpmbuild/RPMS/armv7hl

I will try again, but now for some reason I am hitting permission problems with root/user - I must be doing something wrong, I'm sure I will get there, these journeys are often long for me! :D

Thanks Schturman, I'm sure I will be back with more questions!

EDIT - Twice I've tried now, the same output you say is good, but still no RPM being created/found in RPMS directory.

Regards,

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 05:14.

vBulletin® Version 3.8.8