You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/packaging/package.yml.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,7 @@ Not all fields in `package.yml` are mandatory, but a small selection are. Below
98
98
| **rundeps** | `dict(s)` | Specify further runtime dependencies for the packages. You can learn more [here](/docs/packaging/packaging-practices#runtime-dependencies). |
99
99
| **checkdeps** | `dict(s)` | Specify build dependencies for the package which will _not_ be considered when determining build order for automatic builds. These dependencies should only be used during the `check` build phase. You can learn more [here](/docs/packaging/packaging-practices#check-dependencies) |
100
100
| **replaces** | `dict(s)` | Replace one package with another, used when renaming or deprecating packages for clean upgrade paths. |
101
-
| **patterns** | `dict(s)` | Allows fine grained control over file placement within the package or sub-packages. Useful for packages that are development only (i.e. `/usr/bin` files). |
101
+
| **patterns** | `dict(s)` | Allows fine grained control over file placement within the package or sub-packages. Useful for packages that are development only (i.e. `/usr/bin` files). You can learn more [here](/docs/packaging/packaging-practices#patterns). |
102
102
| **environment** | `unicode` | Specify code that will be exported to all packaging steps of the build (i.e. exporting variables for the entire build). |
103
103
| **networking** | `bool` | Set to `yes` to enable networking within solbuild. |
In most instances, `ypkg` will assign the correct location for files, whether it be in the main `name` package, or a subpackage. However there may be instances where the default does not match the intended behaviour.
299
+
In most instances, `ypkg` will assign the correct location for files, whether it be in the main `name` package, or a subpackage. However, there may be instances where the default does not match the intended behaviour.
300
300
301
-
In these instances it is possible to override the default assignment by way of patterns. These are simply a list of paths or globs to ensure a particular file, or set of files, end up in the desired location.
301
+
In these instances, it is possible to override the default assignment by way of patterns. These are simply a list of paths or globs to ensure a particular file, or set of files, end up in the desired package.
302
302
303
303
The `patterns` key expects a `dict(s)` argument. The default key for each pattern is assumed to be the `name` of the package, so omitting the name would place files into the main package. The value should be a path or pattern you wish to match, ensuring files go to a specific location.
304
304
305
-
In this example from `libjpeg-turbo`, we move all documentation into the `docs` subpackage:
305
+
### Naming
306
+
307
+
There are two ways to name a pattern. Say you have a package named `foo`, and you want to create a subpackage `foo-bar`. You can do this by creating a pattern with the key `bar`. The name of the key will be appended to the name of the package.
306
308
309
+
```yaml
310
+
name : foo
311
+
patterns :
312
+
- bar :
313
+
- [ ... ]
307
314
```
308
-
patterns:
309
-
- docs: [/usr/share/man]
315
+
316
+
If you don't want the name of the subpackage to start with the name of the main package, you can do that, too. Keys starting with a `^` character will not prepend the base package name to the name of the subpackage. If you want to create a package named `bar` from the `foo` package, it would look like this:
317
+
318
+
```yaml
319
+
name : foo
320
+
patterns :
321
+
- ^bar :
322
+
- [ ... ]
310
323
```
311
324
312
-
This example, taken from the `wayland` package, ensures the binaries from `/usr/bin` and the directory `/usr/share/wayland` are located in the `devel` subpackage:
325
+
### Customizing subpackages
326
+
327
+
Often with subpackages, you will want a different component, summary, description, license, or runtime dependencies than the base package. This can be accomplished by turning the keys keys you want to change into lists of `dict(s)`. The key for each entry follows the same rules as the `patterns` key outlined above.
313
328
329
+
If you have package `foo` and subpackage `foo-bar`, changing the properties would look like this:
330
+
331
+
```yaml
332
+
name : foo
333
+
license :
334
+
- bar : MIT
335
+
- Apache-2.0
336
+
component :
337
+
- bar : desktop
338
+
- desktop.library
339
+
summary :
340
+
- bar : This summary applies to the bar subpackage
341
+
- This summary applies to the foo package
342
+
rundeps :
343
+
- bar :
344
+
- foo
345
+
patterns :
346
+
- bar :
347
+
- [ ... ]
314
348
```
315
-
patterns:
316
-
- devel:
349
+
350
+
:::note
351
+
352
+
Usually, packages will automatically depend on created subpackages by default. Consider making the subpackages depend on the base package instead by adding it as a runtime dependency.
353
+
354
+
:::
355
+
356
+
### Examples
357
+
358
+
In this example from `libjpeg-turbo`, we move all documentation into the `docs` subpackage:
359
+
360
+
```yaml
361
+
patterns :
362
+
- docs : [/usr/share/man]
363
+
```
364
+
365
+
This example, taken from the `wayland` package, ensures the binaries from `/usr/bin` and the directory `/usr/share/wayland` are located in the `devel` subpackage:
366
+
367
+
```yaml
368
+
patterns :
369
+
- devel :
317
370
- /usr/bin
318
371
- /usr/share/wayland
319
372
```
320
373
374
+
To create a header-only package, like `spirv-headers`, create a pattern that matches all files. This can also be used in cases where you don't want any automatically-generated subpackages.
375
+
376
+
```yaml
377
+
patterns :
378
+
- /*
379
+
```
380
+
321
381
## Replace / rename
322
382
323
383
In some situations, it may be required to replace one package with another, or to rename an existing package. In these instances you should coordinate with a repository maintainer to ensure the replaced package is marked **Obsolete** within the index. This will ensure correct upgrade paths for users.
0 commit comments