Reply
Thread Tools
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#1791
Originally Posted by Ancelad View Post
Ok, let's do it step by step...

1) Login into putty and winscp
2) Go to destination folder, for example, /usr/share/fonts
Code:
cd /usr/share/fonts
3) Decide, what file will be changed and copy it to backup, for example, file is Sans.ttf
Code:
cp Sans.ttf Sans.ttf.orig
4) Edit Sans.ttf as you want and save the file
5) Run
Code:
diff -u Sans.ttf.orig Sans.ttf > unified_diff.patch
This will create unified_diff.patch into /usr/share/fonts
6) Open unified_diff.patch and you will see something like this:
Code:
--- Sans.ttf.orig
+++ Sans.ttf
*some diff-code*
Edit it to
Code:
--- /usr/share/fonts/Sans.ttf
+++ /usr/share/fonts/Sans.ttf
*some diff-code*
And save patch...
Thank you Ancelad, much clearer, but still not helping for some reason.

You do see that I'm diffing on folders not files and the files are font files and so are not editable.
So far, I have succeeded in generating empty unified_diff.patches and others containing nothing relating to any other type of patch file I've seen so far. I don't know what I'm doing wrong.

I need to clean up my file system, there are unwanted files all over now, boy, what a mess and it only serves to confuse me more. This is harder than I thought. Files seem easier to diff compared to folders. I will keep trying, thanks for your input. It makes the most sense so far and is familiar to what little I've already learned.
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 
pichlo's Avatar
Posts: 6,453 | Thanked: 20,983 times | Joined on Sep 2012 @ UK
#1792
OK. Step one, make a copy of all the files you are going to change. Then, when dealing with whole directories, you have to get the list of altered files. Write them down in whatever form you find most comfortable: quill on papyrus if necessary. Then go down the list and for each file, compare the changed file with the backup copy, using Ancelad's instructions. Only use >> ("append to the end") instead of > ("overwrite from the beginning"), since your patch file will contain concatenated differences from multiple files.
__________________
Русский военный корабль, иди нахуй!
 

The Following User Says Thank You to pichlo For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#1793
Right, despite clear instructions from Ancelad, I'm still unable to produce a working patch.

At Pichlo's suggestion, I put together the diff output into a unified_diff.patch file, compiled the RPM and installed it on my device. It installs, it shows in patchmanager but still will not apply. I have no idea where I'm going wrong. I'd really like to achieve making this with or without help.

Here's my final diff output, bearing in mind this is 'hand-made' as it was constructed from 2 different outputs. This is my last attempt tonight, my head hurts!......,

Code:
--- /usr/share/fonts/roboto
+++ /usr/share/fonts/roboto
-        /usr/share/fonts/roboto: Roboto-Light.ttf
-        /usr/share/fonts/roboto: Roboto-Thin.ttf
+        /usr/share/fonts/roboto: Roboto-Medium.ttf
+        /usr/share/fonts/roboto: Roboto-Regular.ttf

--- /usr/share/fonts/sail-sans-pro
+++ /usr/share/fonts/fira-sans-pro
-        /usr/share/fonts/sail-sans-pro: SailSansPro-ExtraLight.ttf
-        /usr/share/fonts/sail-sans-pro: SailSansPro-Light.ttf
+        /usr/share/fonts/fira-sans-pro: FiraSans-Bold.ttf
+        /usr/share/fonts/fira-sans-pro: FiraSans-Heavy.ttf
Anyone see where I'm going wrong?
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 
pichlo's Avatar
Posts: 6,453 | Thanked: 20,983 times | Joined on Sep 2012 @ UK
#1794
Originally Posted by Markkyboy View Post
Anyone see where I'm going wrong?
Yes!

It is now crystal clear that we were talking about the goat whilst you were talking about the cart. It is also possible that you might be trying to push Patchmanager beyond its limits.

Perhaps it would help if you first tried to explain what you wanted to achieve. By the looks of it, you are trying to replace one file with another. This is not what unified_diff.patch is for: it is for replacing the files content of a text file.

For example, you have a file containing this text:

Code:
Now is the time
For all good men
To come to the aid
Of the party.
You want to change it to:

Code:
Now is the time
For all good men
To come to the aid
Of their country.
The patch file would look something like this (made up by hand, I did not bother creating and diffing the files):

Code:
--- /original/file/name
+++ /patched/file/name
@@ -4,1 +4,1 @@
- Of the party.
+ Of their country.
Meaning, "remove one line from line:4, add one line from line 4", with providing the contents of those removed and added lines.

A unified diff can contain lists of differences for multiple files, all following a similar format. Have you done some background reading and/or checked any existing patches as I suggested?

In your case, /usr/share/fonts/roboto is a directory, not a file. A unified diff cannot work. Perhaps you meant something like:

Code:
--- /usr/share/fonts/roboto/Roboto-Light.ttf
+++ /usr/share/fonts/roboto/Roboto-Light.ttf
(list of differences in /usr/share/fonts/roboto/Roboto-Light.ttf)

--- /usr/share/fonts/roboto/Roboto-Medium.ttf
+++ /usr/share/fonts/roboto/Roboto-Medium.ttf
(list of differences in /usr/share/fonts/roboto/Roboto-Medium.ttf)

...etc
Or perhaps you meant something completely different. An explanation of what you are trying to achieve would be welcome.
__________________
Русский военный корабль, иди нахуй!
 

The Following 3 Users Say Thank You to pichlo For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#1795
Thanks for your detailed reply, much of which I'm now beginning to grasp, which should put me in good stead for making other patches. I found many examples like yours, along the way.

My 'idea'; bigger systems fonts throughout the UI (already installed files manually on my device, looks pretty good to me).

I'm trying to create an RPM so I can install different font files (into /usr/share/fonts) for better readability in the general UI

I want to remove the 'sail-sans-pro' folder and its 2 font files (a+b) and replace with a 'fira-sans-pro' folder and its new font files (a+b).

Then, I would like to change the 2 font files (a+b) existing in the 'roboto' font folder for new font files (a+b). That's it.

Obviously it needs to uninstall cleanly and leave or restore the original font files.

I also do understand now that, diff tool is for files as you say, not folders, this is quite apparent through my hundreds of attempts at getting the right output from 'diffing' folders. (barking and tree, springs to mind)

Hope that's clear enough. Also, here's what I had made so far (RPM) and relevant files, except working unified_diff.patch (which may now be irrelevant); https://www.dropbox.com/s/teyb67xhvq...fonts.rar?dl=0

...oO(Now, where's my quill sharpener gone?)Oo...
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..

Last edited by Markkyboy; 2016-01-02 at 02:03.
 
pichlo's Avatar
Posts: 6,453 | Thanked: 20,983 times | Joined on Sep 2012 @ UK
#1796
OK. Your case sounds like a job for a plain old RPM, without involving Patchmanager at all. Unless it also involves altering some QML files, but you did not mention that.

Basically, all you have to do is drop a few files in their respective locations and remove some existing files. The new files will be part of your installation package, removing existing files would go in you pre- or post-install script. No patching necessary.

To allow for a clean uninstallation, you will have to make a backup of the files you have removed. The simplest way of making a backup is to simply rename the files, preferably to something unique to avoid conflicts with other packages. The simplest way of renaming is to change the extension, e.g. ttf -> bak, but a safer way could be something like Roboto-Light.ttf -> Roboto-Light.ttf.Markkyboys-super-duper-cool-patch.backup. Your unistall script will then rename it back.

I am typing this on my Jolla in McDonalds while keeping an eye on the kids to keep them out of too much mischief so cannot devote more time to you but I will have a look at your code as soon as I can. Probably later tonight. Of course, someone can beat me to it by then
__________________
Русский военный корабль, иди нахуй!
 

The Following 3 Users Say Thank You to pichlo For This Useful Post:
Markkyboy's Avatar
Posts: 433 | Thanked: 727 times | Joined on Oct 2012 @ Costa Blanca, Espaņa
#1797
Thanks again Pichlo, especially while engaging in family time, much appreciated.

Sorry my description was a bit loose, I was hungover and shouldn't have been at the keyboard, I really tied myself in knots, but thanks to you, I now see why I wasn't succeeding where patching is concerned.

Yep, you're right and I see it now, a plain old RPM with a script for the hiding/renaming existing font files. I have yet to have a go at scripting, I'll look for some examples.

I realised around 3am this morning, that I can just install my new fonts to the existing sail-sans-pro folder and then hide/rename (as you've said) the existing .ttf files by placing a period at the beginning of the title.
Same for the files in the 'roboto' folder, add new fonts and then hide/rename the existing fonts.

Thanks again Pichlo, look forward to your response, as and when

Regards,
__________________
..oO(Don't just sit there standing around, pick up a shovel and sweep up!)Oo..
 
Posts: 211 | Thanked: 62 times | Joined on Oct 2014 @ Finland
#1798
Hello Ancelad,
I was trying to help you with tha translation and I could send one. Then I noticed, that it did not accepted. Got some rejection notification via email..

Can I help you to translate or not?

Or did I do something wrong?
 
Ancelad's Avatar
Posts: 1,552 | Thanked: 3,108 times | Joined on Jun 2012 @ Russia, 96
#1799
Originally Posted by R1v3r View Post
Hello Ancelad,
I was trying to help you with tha translation and I could send one. Then I noticed, that it did not accepted. Got some rejection notification via email..

Can I help you to translate or not?

Or did I do something wrong?
I've sent message to you at Transifex. Finnish is already there in all my patches We don't need duplicate them.
 

The Following User Says Thank You to Ancelad For This Useful Post:
pichlo's Avatar
Posts: 6,453 | Thanked: 20,983 times | Joined on Sep 2012 @ UK
#1800
Hey Markkyboy, sorry about the delay. Family life, a horrible thing (No, not really but the truth is I have never enough time for anything.)

I have checked out your code and had a few questions which I tried settling via a PM but apparently you opted out of PMs so I have to post here. Here it goes...

Am I reading it right that all you need for your patch to work is replacing some font files? Don't you need to update some manifest file or something? How will the OS know it should use your new files and not throw an error about the missing ones?

If the answer is yes, that's all you need to do, then you do not need to involve Patchmanager at all. Your .spec file will have only these sections:

%files
Pretty much as it is, only without the second line (referring patchmanager). You do not remove the files listed here in your %postun section; the uninstallation will automatically delete all files listed here.

%pre
Here you backup the existing font files. The simplest way is renaming the whole roboto and sail-sans-pro directories to something safe that you can rename back on unistallation.

%postun
This section will run after the unistallation, i.e. after all your new files and/or directories have been deleted. Now is the time to rename your backup back to their original names.

Here is something I concocted quickly without testing. It will almost certainly not work straight away and will need your tweaking, but it should at least give you the basic idea. It will also need some adopting for different code paths for fresh install and upgrade, or you may simply disallow upgrades and force an upgrade through uninstall and fresh install.

Code:
Name:          sailfishos-patch-bigger-system-fonts
Version:       0.1
Release:       1
Summary:       Increase readability of most fonts throughout UI		
Group:         Application
License:       GPL
Vendor:        Markkyboy
Distribution:  SailfishOS
Packager:      Markkyboy
URL:           https://www.facebook.com/JollaUK
Requires:      sailfish-version >= 2.0.0

%description
Bigger system fonts - Experimental

%files
/usr/share/fonts/roboto/*
/usr/share/fonts/sail-sans-pro/*

%pre
// move existing font directories out of the way by renaming them
mv /usr/share/fonts/roboto /usr/share/fonts/roboto-Markkyboy.bak
mv /usr/share/fonts/sail-sans-pro /usr/share/fonts/sail-sans-pro-Markkyboy.bak

%postun
// my new files have been removed, restore backup
mv /usr/share/fonts/roboto-Markkyboy.bak /usr/share/fonts/roboto
mv /usr/share/fonts/sail-sans-pro-Markkyboy.bak /usr/share/fonts/sail-sans-pro

%changelog
blablabla...
PS
Since Patchmanager is no longer involved, this has become off-topic in this thread. I am happy to take it offline or move it to another thread.
__________________
Русский военный корабль, иди нахуй!
 

The Following User Says Thank You to pichlo For This Useful Post:
Reply

Tags
patchmanager, sailfish os


 
Forum Jump


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