Fridrich Strba 2024-09-29 09:51:49 +00:00 committed by Git OBS Bridge
parent 796ff38fb0
commit 6f399efdea
4 changed files with 24 additions and 79 deletions

View File

@ -1,4 +1,4 @@
From 52e8ed94d648ec8e3aae2534d34c84e5f65357ed Mon Sep 17 00:00:00 2001
From ee0c9644f137d697fc598a3f7bb974787e820731 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Sun, 29 Sep 2024 10:59:57 +0200
Subject: [PATCH 1/2] Fix tests with python 3.4

View File

@ -0,0 +1,22 @@
From 5f5164c230f7a0bea9d727fd45dccb787b3ef653 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Sun, 29 Sep 2024 11:48:03 +0200
Subject: [PATCH 2/2] Allow missing components with abs2rel
---
bin/abs2rel | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/abs2rel b/bin/abs2rel
index b0b85048..a06bab76 100755
--- a/bin/abs2rel
+++ b/bin/abs2rel
@@ -36,4 +36,4 @@ if [ $# -ne 2 ]; then
exit 1
fi
-exec realpath -s --relative-to="$2" "$1"
+exec realpath -m -s --relative-to="$2" "$1"
--
2.46.1

View File

@ -1,77 +0,0 @@
From 2eef7f3c0f46f28697fbafa71ce6f83d6e4af971 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Sun, 29 Sep 2024 11:14:25 +0200
Subject: [PATCH 2/2] Partially revert the rewrite of abs2rel in shell
---
bin/abs2rel | 24 +++++++++++++++++-------
test/abs2rel_test.py | 6 +++---
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/bin/abs2rel b/bin/abs2rel
index b0b85048..1fdacb69 100755
--- a/bin/abs2rel
+++ b/bin/abs2rel
@@ -1,5 +1,5 @@
-#!/bin/sh
-# Copyright (c) 2024, Red Hat, Inc.
+#!@{pyinterpreter}
+# Copyright (c) 2017, Red Hat, Inc.
#
# All rights reserved.
#
@@ -31,9 +31,19 @@
#
# Authors: Mikolaj Izdebski <mizdebsk@redhat.com>
-if [ $# -ne 2 ]; then
- echo "Usage: $(basename $0) <PATH> <BASE>" >&2
- exit 1
-fi
+import os
+import sys
-exec realpath -s --relative-to="$2" "$1"
+if len(sys.argv) != 3:
+ print("Usage: {0} <PATH> <BASE>"
+ .format(os.path.basename(sys.argv[0])),
+ file=sys.stderr)
+ sys.exit(1)
+
+print(os.path.relpath(*sys.argv[1:]))
+
+
+# Local Variables:
+# mode: Python
+# End:
+# vi: ft=python
diff --git a/test/abs2rel_test.py b/test/abs2rel_test.py
index a55e97ea..73b0bb01 100644
--- a/test/abs2rel_test.py
+++ b/test/abs2rel_test.py
@@ -4,19 +4,19 @@ from test_common import bindir_script
class TestAbs2Rel(unittest.TestCase):
- @bindir_script('abs2rel', ['dummy'], shell=True)
+ @bindir_script('abs2rel', ['dummy'])
def test_usage(self, stdout, stderr, return_value):
self.assertEqual(return_value, 1)
self.assertEqual('', stdout)
self.assertEqual('Usage: abs2rel <PATH> <BASE>\n', stderr)
- @bindir_script('abs2rel', ['/1/2/3/a/b/c', '/1/2/3'], shell=True)
+ @bindir_script('abs2rel', ['/1/2/3/a/b/c', '/1/2/3'])
def test_abs_abs(self, stdout, stderr, return_value):
self.assertEqual(return_value, 0)
self.assertEqual('a/b/c\n', stdout)
self.assertEqual('', stderr)
- @bindir_script('abs2rel', ['foo/bar', 'foo/baz'], shell=True)
+ @bindir_script('abs2rel', ['foo/bar', 'foo/baz'])
def test_rel_rel(self, stdout, stderr, return_value):
self.assertEqual(return_value, 0)
self.assertEqual('../bar\n', stdout)
--
2.46.1

View File

@ -46,7 +46,7 @@ Patch1: python-optional.patch
# Avoid generating unresolvable requires
Patch2: suse-no-epoch.patch
Patch3: 0001-Fix-tests-with-python-3.4.patch
Patch4: 0002-Partially-revert-the-rewrite-of-abs2rel-in-shell.patch
Patch4: 0002-Allow-missing-components-with-abs2rel.patch
BuildRequires: fdupes
BuildRequires: perl