openSUSE / obs-service-tar_scm

An OBS source service: fetches code from any SCM and archives it
GNU General Public License v2.0
31 stars 105 forks source link

Allow to use "tar" service also standalone. #483

Closed adrianschroeter closed 7 months ago

adrianschroeter commented 7 months ago

One use case is to maintain a package in git repo and just create tar balls at buildtime.

Example (in this case with submodule) can be found here

https://github.com/adrianschroeter/git-example-4

M0ses commented 7 months ago

Try this patch to get the behavior like before and fix the test suite

diff --git a/TarSCM/scm/tar.py b/TarSCM/scm/tar.py
index a38f74d..868f766 100644
--- a/TarSCM/scm/tar.py
+++ b/TarSCM/scm/tar.py
@@ -26,7 +26,7 @@ class Tar(Scm):
         if self.args.filename:
             self.basename = self.clone_dir = self.args.filename

-        if self.args.version:
+        if self.args.version and self.args.version != '_auto_':
             version = self.args.version

         if not self.basename or not self.clone_dir:
@@ -37,7 +37,7 @@ class Tar(Scm):
             sys.exit("name in obsinfo contains '/'.")

         if "/" in version or '..' in version:
-            sys.exit("version in obsinfo contains '/' or '..'.")
+            raise SystemExit("version in obsinfo contains '/' or '..'.")

         if version != '' and version != '_none_':
             self.clone_dir += "-" + version
diff --git a/tests/unittestcases.py b/tests/unittestcases.py
index 26866c2..917afdf 100644
--- a/tests/unittestcases.py
+++ b/tests/unittestcases.py
@@ -316,7 +316,7 @@ class UnitTestCases(unittest.TestCase):
         six.assertRaisesRegex(
             self,
             SystemExit,
-            re.compile("verion in obsinfo contains '/' or '..'."),
+            re.compile("version in obsinfo contains '/' or '..'."),
             scm_object.fetch_upstream
         )

@@ -330,7 +330,7 @@ class UnitTestCases(unittest.TestCase):
         six.assertRaisesRegex(
             self,
             SystemExit,
-            re.compile("verion in obsinfo contains '/' or '..'."),
+            re.compile("version in obsinfo contains '/' or '..'."),
             scm_object.fetch_upstream
         )