Add missing files for RHEL builds

Source and Patch listings should not be conditionalized, as that causes
SRPM contents to be inconsistent.

https://src.fedoraproject.org/rpms/toolbox/pull-request/14
This commit is contained in:
Yaakov Selkowitz 2023-06-22 16:54:55 -04:00 committed by Debarshi Ray
parent 037ea0e724
commit 006d4f5d81
3 changed files with 122 additions and 6 deletions

View File

@ -0,0 +1,101 @@
From d461caa5b1a278124d039df93140d2d5bf4eabe7 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <rishi@fedoraproject.org>
Date: Wed, 18 Aug 2021 17:55:21 +0200
Subject: [PATCH 1/2] cmd/run: Make sosreport work by setting the HOST
environment variable
https://bugzilla.redhat.com/show_bug.cgi?id=1940037
---
src/cmd/run.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cmd/run.go b/src/cmd/run.go
index 7657ffa50821..23d422623b14 100644
--- a/src/cmd/run.go
+++ b/src/cmd/run.go
@@ -501,6 +501,7 @@ func constructExecArgs(container, preserveFDs string,
execArgs = append(execArgs, envOptions...)
execArgs = append(execArgs, []string{
+ "--env", "HOST=/run/host",
"--interactive",
"--preserve-fds", preserveFDs,
}...)
--
2.39.2
From 3c2c67752e8f88f72058799cbce3612fc937b230 Mon Sep 17 00:00:00 2001
From: Debarshi Ray <rishi@fedoraproject.org>
Date: Fri, 10 Dec 2021 13:42:15 +0100
Subject: [PATCH 2/2] test/system: Update to test the migration path for
coreos/toolbox users
This reverts the changes to the tests made in commit
411147988b730dabf8b9e761a5426e12d648f008 by restoring commit
ca899c8a561f357ae32c6ba6813520fd8b682abb and the parts of commit
3aeb7cf288319e35eb9c5e26ea18d97452462c1e that were removed.
---
test/system/002-help.bats | 11 -----------
test/system/100-root.bats | 27 +++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 11 deletions(-)
create mode 100644 test/system/100-root.bats
diff --git a/test/system/002-help.bats b/test/system/002-help.bats
index 7e4565e9d23d..58a4c2c87ece 100644
--- a/test/system/002-help.bats
+++ b/test/system/002-help.bats
@@ -23,17 +23,6 @@ setup() {
_setup_environment
}
-@test "help: Try to run toolbox with no command" {
- run $TOOLBOX
-
- assert_failure
- assert_line --index 0 "Error: missing command"
- assert_line --index 1 "create Create a new toolbox container"
- assert_line --index 2 "enter Enter an existing toolbox container"
- assert_line --index 3 "list List all existing toolbox containers and images"
- assert_line --index 4 "Run 'toolbox --help' for usage."
-}
-
@test "help: Run command 'help'" {
if ! command -v man 2>/dev/null; then
skip "Test works only if man is in PATH"
diff --git a/test/system/100-root.bats b/test/system/100-root.bats
new file mode 100644
index 000000000000..32d87904213e
--- /dev/null
+++ b/test/system/100-root.bats
@@ -0,0 +1,27 @@
+#!/usr/bin/env bats
+
+load 'libs/bats-support/load'
+load 'libs/bats-assert/load'
+load 'libs/helpers'
+
+setup() {
+ _setup_environment
+ cleanup_containers
+}
+
+teardown() {
+ cleanup_containers
+}
+
+@test "root: Try to enter the default container with no containers created" {
+ run $TOOLBOX <<< "n"
+
+ assert_success
+ assert_line --index 0 "No toolbox containers found. Create now? [y/N] A container can be created later with the 'create' command."
+ assert_line --index 1 "Run 'toolbox --help' for usage."
+}
+
+# TODO: Write the test
+@test "root: Enter the default container when 1 non-default container is present" {
+ skip "Testing of entering toolboxes is not implemented"
+}
--
2.39.2

17
toolbox.conf Normal file
View File

@ -0,0 +1,17 @@
[general]
# Create a toolbox container for a different operating system distro than the
# host. Cannot be used with 'image'.
## distro = "fedora"
# Create a toolbox container for a different operating system release than the
# host. Cannot be used with 'image'.
## release = "33"
# Change the name of the image used to create the toolbox container. This is
# useful for creating containers from custom-built images. Cannot be used with
# 'distro' or 'release'.
#
# If the name does not contain a registry, the local image storage will be
# consulted, and if it's not present there then it will be pulled from a
# suitable remote registry.
image = "registry.access.redhat.com/ubi9/toolbox:latest"

View File

@ -17,9 +17,7 @@ Summary: Tool for containerized command line environments on Linux
License: ASL 2.0 License: ASL 2.0
URL: https://containertoolbx.org/ URL: https://containertoolbx.org/
Source0: https://github.com/containers/%{name}/releases/download/%{version}/%{name}-%{version}-vendored.tar.xz Source0: https://github.com/containers/%{name}/releases/download/%{version}/%{name}-%{version}-vendored.tar.xz
%if 0%{?rhel}
Source1: %{name}.conf Source1: %{name}.conf
%endif
# Upstream # Upstream
Patch0: toolbox-Don-t-use-podman-1-when-generating-the-comp.patch Patch0: toolbox-Don-t-use-podman-1-when-generating-the-comp.patch
@ -28,9 +26,9 @@ Patch1: toolbox-Sprinkle-a-debug-log.patch
# Fedora specific # Fedora specific
Patch100: toolbox-Make-the-build-flags-match-Fedora-s-gobuild.patch Patch100: toolbox-Make-the-build-flags-match-Fedora-s-gobuild.patch
Patch101: toolbox-Make-the-build-flags-match-Fedora-s-gobuild-for-PPC64.patch Patch101: toolbox-Make-the-build-flags-match-Fedora-s-gobuild-for-PPC64.patch
%if 0%{?rhel}
Patch102: toolbox-Add-migration-paths-for-coreos-toolbox-users.patch # RHEL specific
%endif Patch200: toolbox-Add-migration-paths-for-coreos-toolbox-users.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: go-md2man BuildRequires: go-md2man
@ -176,7 +174,7 @@ The %{name}-tests package contains system tests for %{name}.
%endif %endif
%if 0%{?rhel} %if 0%{?rhel}
%patch102 -p1 %patch200 -p1
%endif %endif
%gomkdir -s %{_builddir}/%{extractdir}/src %{?rhel:-k} %gomkdir -s %{_builddir}/%{extractdir}/src %{?rhel:-k}