cookutils 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 4f2ea8b43594
children 1a7427f778ae
files doc/general-questions.md modules/pack
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/doc/general-questions.md	Sat Feb 02 13:36:54 2019 +0200
     1.3 @@ -0,0 +1,43 @@
     1.4 +# General questions
     1.5 +
     1.6 +## `sed` or patches?
     1.7 +
     1.8 +Sometimes I come across cases where `sed` is used to change some values in the
     1.9 +source code, or to add / remove / change some parts of the source code.
    1.10 +It may look like a good idea for a one-time job, but you will encounter
    1.11 +problems in the future when you upgrade the package.
    1.12 +
    1.13 +`sed` works quietly, and it is impossible to understand whether it found what
    1.14 +was needed to be found, whether he replaced what we wanted? Maybe this change
    1.15 +is already in the new sources, and we no longer need `sed` command?
    1.16 +
    1.17 +If we consider only the updated sources, sometimes it is impossible
    1.18 +to understand the essence of the `sed` changes. And then you have to download
    1.19 +and analyze the old sources.
    1.20 +
    1.21 +Feel free to use patches. The `patch` is smart enough to find the necessary
    1.22 +lines in the new sources, and also it will signal to you if your changes have
    1.23 +already been made in the sources, or if the sources has changed so much that
    1.24 +your intervention is required.
    1.25 +
    1.26 +Go from `sed` to `patch` is easy. You must use the `-o.backup` option (value
    1.27 +after the `-o` you can change). For example, you used this code:
    1.28 +
    1.29 +```bash
    1.30 +sed -i '/debug/ s|true|false|' config
    1.31 +```
    1.32 +
    1.33 +Now apply the changes saving the original file:
    1.34 +
    1.35 +```bash
    1.36 +sed -i.orig '/debug/ s|true|false|' config
    1.37 +```
    1.38 +
    1.39 +Create a patch using the original and modified files:
    1.40 +
    1.41 +```bash
    1.42 +diff ./config.orig ./config > ../../stuff/patches/config.patch
    1.43 +```
    1.44 +
    1.45 +Now you can use the created patch and remove the `sed` command.
    1.46 +
     2.1 --- a/modules/pack	Wed Jan 30 23:26:44 2019 +0200
     2.2 +++ b/modules/pack	Sat Feb 02 13:36:54 2019 +0200
     2.3 @@ -576,6 +576,7 @@
     2.4  				$basepkg)    COPY='@std @rm';;
     2.5  				*-dev)       COPY='@dev @rm';;
     2.6  				lib$basepkg) COPY='*.so.*'; [ -n "$CAT" ] || CAT="libs|shared library";;
     2.7 +				*-lang)      COPY='*.mo';   [ -n "$CAT" ] || CAT="localization|translations";;
     2.8  			esac
     2.9  		fi
    2.10