From 8115ee4d6466bc4d3a37c7209dde56bd7ec70cee Mon Sep 17 00:00:00 2001 From: Salvatore Stella Date: Mon, 27 Nov 2023 01:19:35 +0100 Subject: [PATCH] Add package for wireguard-tools (#743) * Add package for wireguard-tools * Pull in provides from #600 * Add provides to wireguard packages * add conflicts --------- Co-authored-by: Nathaniel van Diepen --- docs/package.md | 15 +++++++++++++++ package/wireguard-tools/package | 32 ++++++++++++++++++++++++++++++++ package/wireguard/package | 1 + scripts/toltec/recipe.py | 4 +++- 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 package/wireguard-tools/package diff --git a/docs/package.md b/docs/package.md index 1342df0ac..72a9bdca8 100644 --- a/docs/package.md +++ b/docs/package.md @@ -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 + + + + + + + + + +
Required?No, defaults to () +
TypeArray of strings
+ +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. diff --git a/package/wireguard-tools/package b/package/wireguard-tools/package new file mode 100755 index 000000000..87bbb3971 --- /dev/null +++ b/package/wireguard-tools/package @@ -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 " +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" +} diff --git a/package/wireguard/package b/package/wireguard/package index d01ce5f3a..67b900c9d 100755 --- a/package/wireguard/package +++ b/package/wireguard/package @@ -13,6 +13,7 @@ maintainer="Jonah Weissman " license=GPL-2.0-only makedepends=(build:bc build:lzop build:git) flags=(nostrip) +provides=(wireguard-tools) _kernelrepo=https://github.com/remarkable/linux _kernelrevs=( diff --git a/scripts/toltec/recipe.py b/scripts/toltec/recipe.py index fc1cf9ae0..de3844490 100644 --- a/scripts/toltec/recipe.py +++ b/scripts/toltec/recipe.py @@ -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 @@ -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()) @@ -483,6 +484,7 @@ def control_fields(self) -> str: ("Depends", self.installdepends), ("Conflicts", self.conflicts), ("Replaces", self.replaces), + ("Provides", self.provides), ): if field: control += (