10
0

Accepting request 1037273 from Kernel:tools

Pure Lua library for program interaction.

OBS-URL: https://build.opensuse.org/request/show/1037273
OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua-shell-games?expand=0&rev=1
This commit is contained in:
2022-11-22 21:13:42 +00:00
committed by Git OBS Bridge
commit 76cfa40f7c
9 changed files with 174 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,40 @@
From 8bbb1fb233b4ff9075078a626ec8541223c9edf0 Mon Sep 17 00:00:00 2001
From: Michal Suchanek <msuchanek@suse.de>
Date: Tue, 22 Nov 2022 11:30:00 +0100
Subject: [PATCH] Fix capture_combined_spec with new shell
/bin/sh --version
GNU bash, version 5.2.2(1)-release (x86_64-suse-linux)
---
spec/capture_combined_spec.lua | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/spec/capture_combined_spec.lua b/spec/capture_combined_spec.lua
index 9ba4f34..20bb6be 100644
--- a/spec/capture_combined_spec.lua
+++ b/spec/capture_combined_spec.lua
@@ -74,13 +74,20 @@ describe("capture_combined", function()
assert.are.equal(nil, err)
result, err = shell.capture_combined({ "ls", "-1", "chdir.txt" }, { chdir = "spec/tmp/not existent with spaces" })
- if string.match(result["output"], "line 1") then
+ if string.match(result["output"], "cd: line 1") then
assert.are.same({
command = [[sh -c 'cd '"'"'spec/tmp/not existent with spaces'"'"' && ls -1 chdir.txt' 2>&1]],
status = 2,
output = "sh: cd: line 1: can't cd to spec/tmp/not existent with spaces: No such file or directory\n",
}, result)
assert.are.equal("Executing command failed (exit code 2): sh -c 'cd '\"'\"'spec/tmp/not existent with spaces'\"'\"' && ls -1 chdir.txt' 2>&1\nOutput: sh: cd: line 1: can't cd to spec/tmp/not existent with spaces: No such file or directory\n", err)
+ elseif string.match(result["output"], "sh: line 1") then
+ assert.are.same({
+ command = [[sh -c 'cd '"'"'spec/tmp/not existent with spaces'"'"' && ls -1 chdir.txt' 2>&1]],
+ status = 1,
+ output = "sh: line 1: cd: spec/tmp/not existent with spaces: No such file or directory\n",
+ }, result)
+ assert.are.equal("Executing command failed (exit code 1): sh -c 'cd '\"'\"'spec/tmp/not existent with spaces'\"'\"' && ls -1 chdir.txt' 2>&1\nOutput: sh: line 1: cd: spec/tmp/not existent with spaces: No such file or directory\n", err)
else
assert.are.same({
command = [[sh -c 'cd '"'"'spec/tmp/not existent with spaces'"'"' && ls -1 chdir.txt' 2>&1]],
--
2.38.0

5
_multibuild Normal file
View File

@@ -0,0 +1,5 @@
<multibuild>
<package>lua51</package>
<package>lua53</package>
<package>lua54</package>
</multibuild>

15
_service Normal file
View File

@@ -0,0 +1,15 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://github.com/GUI/lua-shell-games</param>
<param name="revision">master</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="versionformat">@PARENT_TAG@+git@TAG_OFFSET@.%h</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="disabled" />
</services>

4
_servicedata Normal file
View File

@@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/GUI/lua-shell-games</param>
<param name="changesrevision">acf2ba88b27dcf18cf08a38311282d6e8647798b</param></service></servicedata>

BIN
lua-shell-games-1.1.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

6
lua-shell-games.changes Normal file
View File

@@ -0,0 +1,6 @@
-------------------------------------------------------------------
Mon Nov 21 20:31:30 UTC 2022 - Michal Suchanek <msuchanek@suse.com>
- Lua shell-games 1.1.0 package
- Fix overly specific test with bash 5
+ Fix-capture_combined_spec-with-new-shell.patch

77
lua-shell-games.spec Normal file
View File

@@ -0,0 +1,77 @@
#
# spec file for package lua-shell-games
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define flavor @BUILD_FLAVOR@
%define mod_name shell-games
Version: 1.1.0
Release: 0
Summary: Lua library to help execute shell commands
License: MIT
Group: Development/Libraries/Other
URL: https://github.com/GUI/lua-shell-games
Source: https://github.com/GUI/lua-shell-games/archive/v%{version}.tar.gz#/lua-%{mod_name}-%{version}.tar.gz
Patch1: Fix-capture_combined_spec-with-new-shell.patch
BuildRequires: %{flavor}-busted
BuildRequires: %{flavor}-devel
BuildRequires: %{flavor}-luacheck
BuildRequires: %{flavor}-luarocks
BuildRequires: lua-macros
Requires: %{flavor}
BuildArch: noarch
%lua_provides
%if "%{flavor}" == ""
Name: name-%{mod_name}
ExclusiveArch: do_not_build
%else
Name: %{flavor}-%{mod_name}
%endif
%description
A Lua library to help execute shell commands more easily and safely.
* Easily execute shell commands, while capturing the command's output and exit
code. Includes compatibility across versions of Lua, LuaJIT, and OpenResty
where io.popen may not return exit codes (pre Lua 5.2 behavior).
* Utilities to quote and escape shell arguments for safer, less error-prone
execution.
When executing shell commands, shell-games wraps either os.execute or io.popen
(depending on whether the output is being captured).
%prep
%autosetup -p1 -n lua-%{mod_name}-%{version}
%build
%install
install -m 0755 -p -d %{buildroot}%{lua_noarchdir}
install -v -D -m 0644 -p -t %{buildroot}%{lua_noarchdir} lib/%{mod_name}.lua
%check
ln -sfv lib/%{mod_name}.lua .
%if "%{flavor}" == "lua51"
REFUTE_LUA52_BEHAVIOR=true \
%endif
EXPECTED_LUA_VERSION="Lua %{lua_version}" %make_build test
%files
%license LICENSE.txt
%doc README.md CHANGELOG.md
%{lua_noarchdir}/%{mod_name}*
%changelog