Skip to content

Commit

Permalink
Add package for wireguard-tools (#743)
Browse files Browse the repository at this point in the history
* Add package for wireguard-tools

* Pull in provides from #600

* Add provides to wireguard packages

* add conflicts

---------

Co-authored-by: Nathaniel van Diepen <Eeems@users.noreply.github.com>
  • Loading branch information
Etn40ff and Eeems committed Dec 10, 2023
1 parent 37e693f commit 9a5fba4
Show file tree
Hide file tree
Showing 4 changed files with 51 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 @@ -405,6 +405,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
32 changes: 32 additions & 0 deletions package/wireguard-tools/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Copyright (c) 2031 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(wireguard-tools)
pkgdesc="Fast, modern, secure VPN tunnel"
url=https://www.wireguard.com
pkgver=1.0.20210914-1
timestamp=2021-02-23T00:00Z
section=kernel
maintainer="Salvatore Stella <etn45p4m@gmail.com>"
license=GPL-2.0-only
image=base:v3.1
provides=(wireguard-tools)
conflicts=(wireguard)
source=("https://git.zx2c4.com/wireguard-tools/snapshot/wireguard-tools-${pkgver%-*}.tar.xz")

sha256sums=(97ff31489217bb265b7ae850d3d0f335ab07d2652ba1feec88b734bc96bd05ac)

prepare() {
# The symlink at src/wg-quick/wg needs something to point to
touch "$srcdir/src/wg"
}

build() {
make -C "$srcdir/src" PLATFORM=linux "CC=${CROSS_COMPILE}cc"
}

package() {
install -D -t "$pkgdir/opt/bin" "$srcdir/src/wg"
install -D "$srcdir/src/wg-quick/linux.bash" "$pkgdir/opt/bin/wg-quick"
}
1 change: 1 addition & 0 deletions package/wireguard/package
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ maintainer="Jonah Weissman <jonahrweissman+toltec@gmail.com>"
license=GPL-2.0-only
makedepends=(build:bc build:lzop build:git)
flags=(nostrip)
provides=(wireguard-tools)

_kernelrepo=https://github.com/remarkable/linux
_kernelrevs=(
Expand Down
4 changes: 3 additions & 1 deletion scripts/toltec/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,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 @@ -391,7 +392,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 @@ -483,6 +484,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 9a5fba4

Please sign in to comment.