Skip to content

Commit

Permalink
Add provides/conflicts for perf packages
Browse files Browse the repository at this point in the history
  • Loading branch information
matteodelabre committed Nov 28, 2022
1 parent c1d12e7 commit 4f85b60
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
15 changes: 15 additions & 0 deletions docs/package.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,21 @@ A list of packages that the current package replaces.
Setting this field allows the current package to overwrite and take ownership of files from other packages.
Note that the replaced packages will not be automatically uninstalled unless you also declare a conflict with them using the [`conflicts` field](#conflicts-field).

#### `provides` field

<table>
<tr>
<th>Required?</th>
<td>No, defaults to <code>()</code></th>
</tr>
<tr>
<th>Type</th>
<td>Array of strings</td>
</tr>
</table>

A list of virtual packages that the current package provides.

#### `package()` function

The `package()` function populates the `$pkgdir` directory with the files and directories that need to be installed using artifacts from the `$srcdir` directory.
Expand Down
2 changes: 2 additions & 0 deletions package/linux-mainline/package
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ linux-mainline-perf() {
pkgdesc="Linux profiling with performance counters"
url=https://perf.wiki.kernel.org
section=devel
provides=(perf)
conflicts=(perf)

package() {
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/tools/perf/perf
Expand Down
2 changes: 2 additions & 0 deletions package/linux-stracciatella/package
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ linux-stracciatella-perf() {
pkgdesc="Linux profiling with performance counters"
url=https://perf.wiki.kernel.org
section=devel
provides=(perf)
conflicts=(perf)

package() {
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/tools/perf/perf
Expand Down
4 changes: 3 additions & 1 deletion scripts/toltec/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class Package: # pylint:disable=too-many-instance-attributes
installdepends: Set[Dependency]
conflicts: Set[Dependency]
replaces: Set[Dependency]
provides: Set[Dependency]

functions: bash.Functions
custom_functions: bash.Functions
Expand Down Expand Up @@ -390,7 +391,7 @@ def _load_fields(self, variables: bash.Variables) -> None:
self.license = _pop_field_string(variables, "license")
self.variables["license"] = self.license

for field in ("installdepends", "conflicts", "replaces"):
for field in ("installdepends", "conflicts", "replaces", "provides"):
field_raw = _pop_field_indexed(variables, field, [])
self.variables[field] = field_raw
setattr(self, field, set())
Expand Down Expand Up @@ -482,6 +483,7 @@ def control_fields(self) -> str:
("Depends", self.installdepends),
("Conflicts", self.conflicts),
("Replaces", self.replaces),
("Provides", self.provides),
):
if field:
control += (
Expand Down

0 comments on commit 4f85b60

Please sign in to comment.