Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package obs-service-go_modules for 
openSUSE:Factory checked in at 2023-04-03 17:47:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-go_modules (Old)
 and      /work/SRC/openSUSE:Factory/.obs-service-go_modules.new.9019 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-go_modules"

Mon Apr  3 17:47:18 2023 rev:8 rq:1077010 version:0.6.3

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-go_modules/obs-service-go_modules.changes
    2023-03-27 18:17:27.807481213 +0200
+++ 
/work/SRC/openSUSE:Factory/.obs-service-go_modules.new.9019/obs-service-go_modules.changes
  2023-04-03 17:47:32.978872261 +0200
@@ -1,0 +2,20 @@
+Mon Apr 03 13:55:49 UTC 2023 - [email protected]
+
+- Update to version 0.6.3:
+  * Rename new argument vendorfilename to vendorname
+  * Fix default vendorfilename
+  * make vendor tarball name configurable (#27)
+  * Fix autodetection for zst/zstd confusion
+  * README.md: hint on avoiding errors if local git clone already exists
+  * README.md: add example for use of archive parameter
+  * Format source with python black refs #29
+  * Revert wrap of long lines flake8 recommends but black accepts refs #29
+  * flake8 config black compat extend-ignore E501 line too long refs #29
+  * Add GitHub CI action to run Black formatter on file go_modules
+  * Flake8 A002 argument "dir" is shadowing a python builtin
+  * Flake8 C413 Unnecessary reversed(sorted()) use sorted(reverse=True)
+  * Flake8 C413 fix extraneous closing perentheses in sorted()
+  * Flake8 C413 Unnecessary reversed(sorted()) use sorted(reverse=True)
+  * Fix flake8 CI action YAML indent plugins: under with: key
+
+-------------------------------------------------------------------

Old:
----
  obs-service-go_modules-0.6.2.tar.gz

New:
----
  obs-service-go_modules-0.6.3.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ obs-service-go_modules.spec ++++++
--- /var/tmp/diff_new_pack.8goow2/_old  2023-04-03 17:47:33.502876122 +0200
+++ /var/tmp/diff_new_pack.8goow2/_new  2023-04-03 17:47:33.510876181 +0200
@@ -37,7 +37,7 @@
 %define use_test   test
 %endif
 Name:           obs-service-%{service}
-Version:        0.6.2
+Version:        0.6.3
 Release:        0
 Summary:        An OBS source service: Download, verify and vendor Go module 
dependencies
 License:        GPL-2.0-or-later

++++++ _service ++++++
--- /var/tmp/diff_new_pack.8goow2/_old  2023-04-03 17:47:33.554876505 +0200
+++ /var/tmp/diff_new_pack.8goow2/_new  2023-04-03 17:47:33.558876534 +0200
@@ -3,7 +3,7 @@
     <param 
name="url">https://github.com/openSUSE/obs-service-go_modules</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
-    <param name="revision">v0.6.2</param>
+    <param name="revision">v0.6.3</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.8goow2/_old  2023-04-03 17:47:33.586876741 +0200
+++ /var/tmp/diff_new_pack.8goow2/_new  2023-04-03 17:47:33.590876770 +0200
@@ -1,6 +1,6 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/openSUSE/obs-service-go_modules</param>
-              <param 
name="changesrevision">e8e245c20b318ee4f950a65db4bbf3be7f64c3d0</param></service></servicedata>
+              <param 
name="changesrevision">8c0242c448a49e98a1ca7beb790f5f4b969bb9db</param></service></servicedata>
 (No newline at EOF)
 

++++++ obs-service-go_modules-0.6.2.tar.gz -> 
obs-service-go_modules-0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-service-go_modules-0.6.2/.flake8 
new/obs-service-go_modules-0.6.3/.flake8
--- old/obs-service-go_modules-0.6.2/.flake8    2023-03-27 11:36:21.000000000 
+0200
+++ new/obs-service-go_modules-0.6.3/.flake8    2023-04-03 15:09:06.000000000 
+0200
@@ -1,3 +1,3 @@
 [flake8]
 max-line-length = 88
-extend-ignore = E203
+extend-ignore = E203,E501
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/obs-service-go_modules-0.6.2/.github/workflows/black.yml 
new/obs-service-go_modules-0.6.3/.github/workflows/black.yml
--- old/obs-service-go_modules-0.6.2/.github/workflows/black.yml        
1970-01-01 01:00:00.000000000 +0100
+++ new/obs-service-go_modules-0.6.3/.github/workflows/black.yml        
2023-04-03 15:09:06.000000000 +0200
@@ -0,0 +1,13 @@
+name: black
+
+on: [push, pull_request]
+
+jobs:
+  black:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: psf/black@stable
+        with:
+          options: "--check --verbose"
+          src: "go_modules"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/obs-service-go_modules-0.6.2/.github/workflows/flake8.yml 
new/obs-service-go_modules-0.6.3/.github/workflows/flake8.yml
--- old/obs-service-go_modules-0.6.2/.github/workflows/flake8.yml       
2023-03-27 11:36:21.000000000 +0200
+++ new/obs-service-go_modules-0.6.3/.github/workflows/flake8.yml       
2023-04-03 15:09:06.000000000 +0200
@@ -17,4 +17,4 @@
         uses: py-actions/flake8@v2
         with:
           path: "go_modules"
-        plugins: "flake8-bugbear flake8-blind-except flake8-builtins 
flake8-comprehensions"
+          plugins: "flake8-bugbear flake8-blind-except flake8-builtins 
flake8-comprehensions"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-service-go_modules-0.6.2/README.md 
new/obs-service-go_modules-0.6.3/README.md
--- old/obs-service-go_modules-0.6.2/README.md  2023-03-27 11:36:21.000000000 
+0200
+++ new/obs-service-go_modules-0.6.3/README.md  2023-04-03 15:09:06.000000000 
+0200
@@ -64,12 +64,26 @@
 
 The archive name can alternatively be specified using service parameter 
`archive`.
 
+```
+<services>
+  <service name="go_modules" mode="disabled">
+  <param name="archive">app-0.1.0.tar.xz</param>
+  </service>
+</services>
+
+```
 Run `osc` command locally:
 
 ```
 osc service disabledrun
 ```
 
+In case you previously ran the command, there might be a git clone of the app 
repository. To avoid errors, remove this directory before calling the `osc 
service disabledrun` command:
+
+```
+rm -rf app; osc service disabledrun
+```
+
 See [Example](#example) below for typical output with a complete `_service` 
file.
 
 ## Compression format support
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-service-go_modules-0.6.2/go_modules 
new/obs-service-go_modules-0.6.3/go_modules
--- old/obs-service-go_modules-0.6.2/go_modules 2023-03-27 11:36:21.000000000 
+0200
+++ new/obs-service-go_modules-0.6.3/go_modules 2023-04-03 15:09:06.000000000 
+0200
@@ -43,49 +43,47 @@
 description = __doc__
 
 DEFAULT_COMPRESSION = "gz"
+DEFAULT_VENDOR_STEM = "vendor"
 
 
 def get_archive_parameters(args):
-    archive_format = None
-    archive_compression = None
-    archive_extension = None
 
+    archive = {}
+    archive["vendorname"] = args.vendorname
+    archive["compression"] = None
+    archive["level"] = None
     if args.compression == "obscpio" and "cpio" in libarchive.ffi.READ_FORMATS:
-        archive_format = "cpio_newc"
-        archive_compression = None
-        archive_extension = args.compression
-
-    elif args.compression == "tar" and "tar" in libarchive.ffi.READ_FORMATS:
-        archive_format = "gnutar"
-        archive_compression = None
-        archive_extension = args.compression
-
+        archive["format"] = "cpio_newc"
+        archive["ext"] = "obscpio"
+        return archive
+
+    archive["format"] = "gnutar"
+    if args.compression == "tar" and "tar" in libarchive.ffi.READ_FORMATS:
+        archive["ext"] = "tar"
+        return archive
+
+    archive["level"] = 9
+    if args.compression == "gz":
+        archive["compression"] = "gzip"
+    elif args.compression == "zst":
+        archive["compression"] = "zstd"
+        archive["level"] = 19
     else:
-        compression_format = args.compression
-
-        if args.compression == "gz":
-            compression_format = "gzip"
-
-        elif args.compression == "zst":
-            compression_format = "zstd"
-
-        if compression_format not in libarchive.ffi.READ_FILTERS:
-            log.error(
-                "The specified compression mode is not supported:"
-                + f'"{args.compression}"'
-            )
-            exit(1)
+        archive["compression"] = args.compression
 
-        archive_format = "gnutar"
-        archive_compression = compression_format
-        archive_extension = "tar." + (args.compression)
+    if archive["compression"] not in libarchive.ffi.READ_FILTERS:
+        log.error(
+            f"The specified compression mode is not supported: 
{args.compression}"
+        )
+        exit(1)
 
-    return archive_format, archive_compression, archive_extension
+    archive["ext"] = "tar." + (args.compression)
+    return archive
 
 
 def basename_from_archive_name(archive_name):
     basename = re.sub(
-        
r"^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",
  # noqa: E501
+        
r"^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",
         r"\g<basename>",
         archive_name,
     )
@@ -110,40 +108,36 @@
 
 def archive_autodetect():
     """Find the most likely candidate file that contains go.mod and go.sum.
-    For most Go applications this will be app-x.y.z.tar.gz or other supported
-    compression.
+    For most Go applications this will be app-x.y.z.tar.gz or other supported 
compression.
     Use the name of the .spec file as the stem for the archive to detect.
     Archive formats supported:
     - .tar.bz2
     - .tar.gz
     - .tar.lz
     - .tar.xz
-    - .tar.zstd
+    - .tar.zst
     """
     log.info("Autodetecting archive since no archive param provided in 
_service")
-    cwd = Path.cwd()
-    # first .spec under cwd or None
-    spec = next(reversed(sorted(Path(cwd).glob("*.spec"))), None)
-    if not spec:
-        log.error(f"Archive autodetection found no spec file under {cwd}")
+    specs = sorted(Path.cwd().glob("*.spec"), reverse=True)
+    if not specs:
+        log.error(f"No spec file found in {Path.cwd()}")
         exit(1)
-    else:
-        archive = None
-        spec_dir = spec.parent  # typically the same as cwd
-        # highest sorted archive under spec_dir
-        c_exts = ("gz", "xz", "zstd", "lz", "bz2")
-        patterns = (
-            [f"{spec.stem}*.tar.{c_ext}" for c_ext in c_exts]
-            + [f"{spec.stem}*.obscpio"]
-            + [f"_service:*:{spec.stem}*tar.{c_ext}" for c_ext in c_exts]
-            + [f"_service:*:{spec.stem}*obscpio"]
-        )
-        for pattern in patterns:
-            log.debug(f"Trying to find archive name with pattern {pattern}")
-            archive = next(reversed(sorted(Path(spec_dir).glob(pattern))), 
None)
 
-            if archive:
-                break
+    archive = None
+    spec = specs[0]
+    c_exts = ("gz", "xz", "zst", "lz", "bz2")
+    for pattern in (
+        [f"{spec.stem}*.tar.{c_ext}" for c_ext in c_exts]
+        + [f"{spec.stem}*.obscpio"]
+        + [f"_service:*:{spec.stem}*tar.{c_ext}" for c_ext in c_exts]
+        + [f"_service:*:{spec.stem}*obscpio"]
+    ):
+        log.debug(f"Trying to find archive name with pattern {pattern}")
+        matches = sorted(spec.parent.glob(pattern), reverse=True)
+
+        if matches:
+            archive = matches[0]
+            break
 
     if not archive:
         log.error("Archive autodetection found no matching archive")
@@ -164,8 +158,7 @@
         else:
             if not (version in archive.name):
                 log.warning(
-                    f"Version {version} in {spec.name} "
-                    + f"does not match {archive.name}"
+                    f"Version {version} in {spec.name} does not match 
{archive.name}"
                 )
     return str(archive.name)  # return string not PosixPath
 
@@ -175,8 +168,7 @@
 
     cwd = os.getcwd()
 
-    # make path absolute so we can switch away from the
-    # current working directory
+    # make path absolute so we can switch away from the current working 
directory
     filename = os.path.join(cwd, filename)
 
     log.info(f"Switching to {outdir}")
@@ -191,7 +183,7 @@
     os.chdir(cwd)
 
 
-def cmd_go_mod(cmd, dir):
+def cmd_go_mod(cmd, moddir):
     """Execute go mod subcommand using subprocess.run().
     Capture both stderr and stdout as text.
     Log as info or error in this function body.
@@ -200,19 +192,19 @@
     log.info(f"go mod {cmd}")
     # subprocess.run() returns CompletedProcess cp
     if sys.version_info >= (3, 7):
-        cp = run(["go", "mod", cmd], cwd=dir, capture_output=True, text=True)
+        cp = run(["go", "mod", cmd], cwd=moddir, capture_output=True, 
text=True)
     else:
-        cp = run(["go", "mod", cmd], cwd=dir)
+        cp = run(["go", "mod", cmd], cwd=moddir)
     if cp.returncode:
         log.error(cp.stderr.strip())
     return cp
 
 
-def sanitize_subdir(dir, subdir):
+def sanitize_subdir(basedir, subdir):
     ret = os.path.normpath(subdir)
-    if dir == os.path.commonpath([dir, ret]):
+    if basedir == os.path.commonpath([basedir, ret]):
         return ret
-    log.error("Invalid path: {ret} not subdir of {dir}")
+    log.error("Invalid path: {ret} not subdir of {basedir}")
     exit(1)
 
 
@@ -227,14 +219,15 @@
     parser.add_argument("--outdir")
     parser.add_argument("--compression", default=DEFAULT_COMPRESSION)
     parser.add_argument("--basename")
+    parser.add_argument("--vendorname", default=DEFAULT_VENDOR_STEM)
     parser.add_argument("--subdir")
     args = parser.parse_args()
 
     outdir = args.outdir
     subdir = args.subdir
 
-    archive_format, archive_compression, archive_ext = 
get_archive_parameters(args)
-    vendor_tarname = f"vendor.{archive_ext}"
+    archive_args = get_archive_parameters(args)
+    vendor_tarname = f"{archive_args['vendorname']}.{archive_args['ext']}"
     archive = args.archive or archive_autodetect()
     log.info(f"Using archive {archive}")
 
@@ -258,19 +251,15 @@
             go_mod_dir = os.path.dirname(go_mod_path)
             log.info(f"Using go.mod found at {go_mod_path}")
         else:
-            log.error(
-                "File go.mod not found under " + f"{os.path.join(tempdir, 
basename)}"
-            )
+            log.error(f"File go.mod not found under {os.path.join(tempdir, 
basename)}")
             exit(1)
 
         if args.strategy == "vendor":
             # go subcommand sequence:
             # - go mod download
-            #   (is sensitive to invalid module versions,
-            #   try and log warn if fails)
+            #   (is sensitive to invalid module versions, try and log warn if 
fails)
             # - go mod vendor
-            #   (also downloads but use separate steps for visibility in
-            #   OBS environment)
+            #   (also downloads but use separate steps for visibility in OBS 
environment)
             # - go mod verify
             #   (validates checksums)
 
@@ -279,12 +268,10 @@
             if cp.returncode:
                 if "invalid version" in cp.stderr:
                     log.warning(
-                        "go mod download is more sensitive to invalid "
-                        + "module versions than go mod vendor"
+                        "go mod download is more sensitive to invalid module 
versions than go mod vendor"
                     )
                     log.warning(
-                        "if go mod vendor and go mod verify complete, "
-                        + "vendoring is successful"
+                        "if go mod vendor and go mod verify complete, 
vendoring is successful"
                     )
                 else:
                     log.error("go mod download failed")
@@ -306,8 +293,14 @@
             os.chdir(go_mod_dir)
             vendor_dir = "vendor"
 
+            kwargs = {}
+            if archive_args["level"]:
+                kwargs["options"] = 
f"compression-level={archive_args['level']}"
             with libarchive.file_writer(
-                vendor_tarfile, archive_format, archive_compression
+                vendor_tarfile,
+                archive_args["format"],
+                archive_args["compression"],
+                **kwargs,
             ) as new_archive:
                 new_archive.add_files(vendor_dir)
             os.chdir(cwd)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-service-go_modules-0.6.2/go_modules.service 
new/obs-service-go_modules-0.6.3/go_modules.service
--- old/obs-service-go_modules-0.6.2/go_modules.service 2023-03-27 
11:36:21.000000000 +0200
+++ new/obs-service-go_modules-0.6.3/go_modules.service 2023-04-03 
15:09:06.000000000 +0200
@@ -16,4 +16,7 @@
   <parameter name="subdir">
     <description>If go.mod is not available in the top directory of the 
archive, specify its path (relative to the top directory). Default: 
None.</description>
   </parameter>
+  <parameter name="vendorname">
+    <description>Specify the name for the generated vendor tarball. Default: 
vendor</description>
+  </parameter>
 </service>

Reply via email to