cookutils rev 990
Update doc/receipts-v2.md with examples (still wip); lighttpd/index.cgi: fix CMake listings beginning with '--'
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Oct 29 18:08:46 2017 +0200 (2017-10-29) |
parents | 03374082dafa |
children | 9a3a955f4eb1 |
files | doc/receipts-v2.md lighttpd/index.cgi |
line diff
1.1 --- a/doc/receipts-v2.md Sat Oct 28 16:04:43 2017 +0300 1.2 +++ b/doc/receipts-v2.md Sun Oct 29 18:08:46 2017 +0200 1.3 @@ -7,7 +7,9 @@ 1.4 In order to switch to version 2, you must specify 'v2' in the first line of the 1.5 receipt: 1.6 1.7 - # SliTaz package receipt v2. 1.8 +```bash 1.9 +# SliTaz package receipt v2. 1.10 +``` 1.11 1.12 You can write the single receipt v2 to compile, for example `attr` sources and 1.13 then make two packages: `attr` and `attr-dev` using compiled files. Next we will 1.14 @@ -16,18 +18,21 @@ 1.15 You must specify all the names of *split packages* that must be created after 1.16 the compilation in the SPLIT variable. Example for our `attr` receipt: 1.17 1.18 - SPLIT="attr-dev" 1.19 +```bash 1.20 +SPLIT="attr-dev" 1.21 +``` 1.22 1.23 You must specify rules to generate each package inside the genpkg_rules(). 1.24 Example for package `attr`: 1.25 1.26 - genpkg_rules() 1.27 - { 1.28 - case $PACKAGE in 1.29 - attr) copy @std ;; 1.30 - attr-dev) copy @dev ;; 1.31 - esac 1.32 - } 1.33 +```bash 1.34 +genpkg_rules() { 1.35 + case $PACKAGE in 1.36 + attr) copy @std ;; 1.37 + attr-dev) copy @dev ;; 1.38 + esac 1.39 +} 1.40 +``` 1.41 1.42 Here, in every rule you can: 1.43 1.44 @@ -43,7 +48,7 @@ 1.45 put single space between the quotes: `DEPENDS=" "`. 1.46 * define the two-in-one CAT variable for *split packages*. Variable format: 1.47 1.48 - ``` 1.49 + ```bash 1.50 CAT="category|addition" 1.51 ``` 1.52 1.53 @@ -53,7 +58,7 @@ 1.54 definition for the "dev" packages. In this case it will be implicitly 1.55 defined as: 1.56 1.57 - ``` 1.58 + ```bash 1.59 CAT="development|development files" 1.60 ``` 1.61 * define some other variables, like COOKOPTS. 1.62 @@ -107,49 +112,109 @@ 1.63 * `file` - file name without the slash in the end. 1.64 1.65 Both patterns `@std` and `@dev` are meta-patterns making the most common actions 1.66 -extremely simple. 1.67 +extremely simple. Here all files are divided into three types: standard, 1.68 +development and all the others (documentation, translations, etc). You may put 1.69 +`@std` into "standard" package, `@dev` into "developer" package, not packaging 1.70 +any documentation, man pages, translations, BASH completion, etc... 1.71 1.72 In the `folder/` and `file` forms of the patterns you can use the asterisk (`*`) 1.73 symbol meaning any number of any characters. 1.74 1.75 Some examples (executed on the chroot with the "busybox" package installed): 1.76 1.77 + Pattern | Result 1.78 +-----------|-------------------------------------------------------------------- 1.79 +` bin/ `|`/bin`<br>`/usr/bin` 1.80 +` *bin/ `|`/bin`<br>`/sbin`<br>`/usr/bin`<br>`/usr/sbin`<br>`/var/www/cgi-bin` 1.81 +`/usr/bin/`|`/usr/bin` 1.82 +` usr/bin/`|`/usr/bin` 1.83 +` r/bin/`|` ` 1.84 +` cat `|`/bin/cat` 1.85 +` *.sh `|`/lib/libtaz.sh`<br>`/sbin/mktazdevs.sh`<br>`/usr/bin/gettext.sh`<br>`/usr/bin/httpd_helper.sh`<br>`/usr/lib/slitaz/httphelper.sh`<br>`/usr/lib/slitaz/libpkg.sh`<br>`/var/www/cgi-bin/cgi-env.sh` 1.86 +` pt* `|`/dev/pts`<br>`/usr/share/locale/pt_BR`<br>`/usr/share/locale/pt_BR/LC_MESSAGES` 1.87 +`/bin/*.sh`|`/usr/bin/gettext.sh`<br>`/usr/bin/httpd_helper.sh` 1.88 +`/lib/*.sh`|`/lib/libtaz.sh`<br>`/usr/lib/slitaz/httphelper.sh`<br>`/usr/lib/slitaz/libpkg.sh` 1.89 + 1.90 +Also, `copy()` understands the `@rm` pattern. It does not copy anything, but it 1.91 +removes already copied files that have already been packed. 1.92 + 1.93 +### Some more examples of using `copy()` 1.94 + 1.95 +If your package used only for development purposes (like automake, flex, vala 1.96 +and some other), you may use the next commant to put all the files you want 1.97 +to pack into one package: 1.98 + 1.99 +```bash 1.100 +copy @std @dev 1.101 ``` 1.102 - Pattern | Result 1.103 -===========|==================================================================== 1.104 - bin/ | /bin 1.105 - | /usr/bin 1.106 ------------|-------------------------------------------------------------------- 1.107 - *bin/ | /bin 1.108 - | /sbin 1.109 - | /usr/bin 1.110 - | /usr/sbin 1.111 - | /var/www/cgi-bin 1.112 ------------|-------------------------------------------------------------------- 1.113 - /usr/bin/ | /usr/bin 1.114 ------------|-------------------------------------------------------------------- 1.115 - usr/bin/ | /usr/bin 1.116 ------------|-------------------------------------------------------------------- 1.117 - r/bin/ | 1.118 -===========|==================================================================== 1.119 - cat | /bin/cat 1.120 ------------|-------------------------------------------------------------------- 1.121 - *.sh | /lib/libtaz.sh 1.122 - | /sbin/mktazdevs.sh 1.123 - | /usr/bin/gettext.sh 1.124 - | /usr/bin/httpd_helper.sh 1.125 - | /usr/lib/slitaz/httphelper.sh 1.126 - | /usr/lib/slitaz/libpkg.sh 1.127 - | /var/www/cgi-bin/cgi-env.sh 1.128 ------------|-------------------------------------------------------------------- 1.129 - pt* | /dev/pts 1.130 - | /usr/share/locale/pt_BR 1.131 - | /usr/share/locale/pt_BR/LC_MESSAGES 1.132 ------------|-------------------------------------------------------------------- 1.133 - /bin/*.sh | /usr/bin/gettext.sh 1.134 - | /usr/bin/httpd_helper.sh 1.135 ------------|-------------------------------------------------------------------- 1.136 - /lib/*.sh | /lib/libtaz.sh 1.137 - | /usr/lib/slitaz/httphelper.sh 1.138 - | /usr/lib/slitaz/libpkg.sh 1.139 + 1.140 +In most cases, the package breaks up into "main" and "dev" packages. In this 1.141 +case, your code might look like this: 1.142 + 1.143 +```bash 1.144 +PACKAGE="my-package" 1.145 +SPLIT="my-package-dev" 1.146 + 1.147 +genpkg_rules() { 1.148 + case $PACKAGE in 1.149 + my-package) 1.150 + copy @std 1.151 + DEPENDS="your-package" 1.152 + ;; 1.153 + *-dev) 1.154 + copy @dev 1.155 + ;; 1.156 + esac 1.157 +} 1.158 ``` 1.159 + 1.160 +In the following example, a package can contain libraries (which can be used by 1.161 +other programs) and executables that use these libraries. We need to split 1.162 +`@std` into two parts: libraries and executable files. This can be done in few 1.163 +ways. 1.164 + 1.165 +```bash 1.166 +PACKAGE="my-pkg" 1.167 +# We omit "my-pkg" in the $SPLIT, then it is implicit in the first place 1.168 +SPLIT="my-pkg-bin my-pkg-dev" 1.169 +genpkg_rules() { 1.170 + case $PACKAGE in 1.171 + my-pkg) copy *.so*;; # (1) copy all the libs 1.172 + *-bin) copy bin/;; # (2) copy all the execs from /usr/bin/ 1.173 + *-dev) copy @dev;; # (3) copy development files 1.174 + esac 1.175 +} 1.176 +``` 1.177 + 1.178 +```bash 1.179 +# If package contains some more files outside the /bin/ (for example, configs), 1.180 +# that we want to pack with the "bin" package: 1.181 +PACKAGE="my-pkg" 1.182 +SPLIT="my-pkg-bin my-pkg-dev" 1.183 +genpkg_rules() { 1.184 + case $PACKAGE in 1.185 + my-pkg) copy *.so*;; # (1) copy all the libs 1.186 + *-bin) copy @std @rm;; # (2) copy standard (binaries and configs, etc), 1.187 + # then remove already packed (libs) 1.188 + *-dev) copy @dev;; # (3) copy development files 1.189 + esac 1.190 +} 1.191 +``` 1.192 + 1.193 +```bash 1.194 +# Pack two different libraries into two packages, and the rest into third 1.195 +# package: 1.196 +PACKAGE="my-pkg" 1.197 +# We explicitly specified all the packages, therefore they will be processed 1.198 +# in the specified order 1.199 +SPLIT="my-pkg-lib1 my-pkg-lib2 my-pkg my-pkg-dev" 1.200 +genpkg_rules() { 1.201 + case $PACKAGE in 1.202 + *-lib1) copy lib-cli.so*;; # (1) copy first libraries 1.203 + *-lib2) copy lib-gui.so*;; # (2) copy second libraries 1.204 + my-pkg) copy @std @rm;; # (3) copy all the standard files, 1.205 + # then remove already packed (libs) 1.206 + *-dev) copy @dev;; # (4) copy development files 1.207 + esac 1.208 +} 1.209 +```
2.1 --- a/lighttpd/index.cgi Sat Oct 28 16:04:43 2017 +0300 2.2 +++ b/lighttpd/index.cgi Sun Oct 29 18:08:46 2017 +0200 2.3 @@ -550,7 +550,7 @@ 2.4 s|\[39m|</span>|; 2.5 s|\[1m|<strong>|g; s|\[0m|</strong>|g" \ 2.6 -e "s|^+.*|<i>\0</i>|; 2.7 - s|^-.*|<b>\0</b>|; /----/s|</*b>||" 2.8 + s|^-.*|<b>\0</b>|; /----/s|</*b>||; /^-- /s|</*b>||;" 2.9 ;; 2.10 2.11 files)