cookutils annotate doc/general-questions.md @ rev 1137

modules/pack: introduce *-lang packages: to make it just append SPLIT="..." by "$PACKAGE-lang"
The list of supported locales you can find still in the $WOK/slitaz-i18n/stuff/locale-pack.conf
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Feb 02 13:36:54 2019 +0200 (2019-02-02)
parents
children 1a7427f778ae
rev   line source
al@1137 1 # General questions
al@1137 2
al@1137 3 ## `sed` or patches?
al@1137 4
al@1137 5 Sometimes I come across cases where `sed` is used to change some values in the
al@1137 6 source code, or to add / remove / change some parts of the source code.
al@1137 7 It may look like a good idea for a one-time job, but you will encounter
al@1137 8 problems in the future when you upgrade the package.
al@1137 9
al@1137 10 `sed` works quietly, and it is impossible to understand whether it found what
al@1137 11 was needed to be found, whether he replaced what we wanted? Maybe this change
al@1137 12 is already in the new sources, and we no longer need `sed` command?
al@1137 13
al@1137 14 If we consider only the updated sources, sometimes it is impossible
al@1137 15 to understand the essence of the `sed` changes. And then you have to download
al@1137 16 and analyze the old sources.
al@1137 17
al@1137 18 Feel free to use patches. The `patch` is smart enough to find the necessary
al@1137 19 lines in the new sources, and also it will signal to you if your changes have
al@1137 20 already been made in the sources, or if the sources has changed so much that
al@1137 21 your intervention is required.
al@1137 22
al@1137 23 Go from `sed` to `patch` is easy. You must use the `-o.backup` option (value
al@1137 24 after the `-o` you can change). For example, you used this code:
al@1137 25
al@1137 26 ```bash
al@1137 27 sed -i '/debug/ s|true|false|' config
al@1137 28 ```
al@1137 29
al@1137 30 Now apply the changes saving the original file:
al@1137 31
al@1137 32 ```bash
al@1137 33 sed -i.orig '/debug/ s|true|false|' config
al@1137 34 ```
al@1137 35
al@1137 36 Create a patch using the original and modified files:
al@1137 37
al@1137 38 ```bash
al@1137 39 diff ./config.orig ./config > ../../stuff/patches/config.patch
al@1137 40 ```
al@1137 41
al@1137 42 Now you can use the created patch and remove the `sed` command.
al@1137 43