SPECS: Add go-github-vishvananda-netns

Signed-off-by: Jvle <keke.oerv@isrc.iscas.ac.cn>
This commit is contained in:
Jvle
2026-08-19 15:25:47 +08:00
committed by Kiryuu Sakuya
parent 7eec560212
commit c16adfa8b5
2 changed files with 79 additions and 0 deletions
@@ -0,0 +1,38 @@
From 470a48568f6793d5e2e60262eb9d518bba8effe6 Mon Sep 17 00:00:00 2001
From: Jvle <keke.oerv@isrc.iscas.ac.cn>
Date: Thu, 20 Aug 2026 16:38:57 +0800
Subject: [PATCH] tests: skip netns creation without privileges
Signed-off-by: Jvle <keke.oerv@isrc.iscas.ac.cn>
---
netns_linux_test.go | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/netns_linux_test.go b/netns_linux_test.go
index b8d9bd9..a34365a 100644
--- a/netns_linux_test.go
+++ b/netns_linux_test.go
@@ -1,7 +1,10 @@
package netns
import (
+ "errors"
"runtime"
+
+ "golang.org/x/sys/unix"
"sync"
"testing"
)
@@ -16,6 +19,9 @@ func TestGetNewSetDelete(t *testing.T) {
}
newns, err := New()
if err != nil {
+ if errors.Is(err, unix.EPERM) {
+ t.Skip("network namespace creation requires privileges unavailable in OBS")
+ }
t.Fatal(err)
}
if origns.Equal(newns) {
--
2.43.0
@@ -0,0 +1,41 @@
# SPDX-FileCopyrightText: (C) 2026 Institute of Software, Chinese Academy of Sciences (ISCAS)
# SPDX-FileCopyrightText: (C) 2026 openRuyi Project Contributors
#
# SPDX-License-Identifier: MulanPSL-2.0
%define _name netns
%define go_import_path github.com/vishvananda/netns
Name: go-github-vishvananda-netns
Version: 0.0.5
Release: %autorelease
Summary: Allows ultra-simple network namespace handling
License: Apache-2.0
URL: https://github.com/vishvananda/netns
#!RemoteAsset: sha256:745c35e848d0decde763848ceb0347290ad48287e9640d021628f32e888dd93e
Source0: https://github.com/vishvananda/netns/archive/v%{version}.tar.gz#/%{_name}-%{version}.tar.gz
BuildArch: noarch
BuildSystem: golangmodules
# Skip only the network namespace creation test when OBS lacks the required privilege.
# - Jvle
Patch2000: 2000-skip-netns-test-without-privileges.patch
BuildRequires: go
BuildRequires: go-rpm-macros
BuildRequires: go(golang.org/x/sys)
Provides: go(github.com/vishvananda/netns) = %{version}
Requires: go(golang.org/x/sys)
%description
This package provides Go bindings for Linux network namespace and netlink APIs.
%files
%doc README.md
%license LICENSE
%{go_sys_gopath}/%{go_import_path}
%changelog
%autochangelog