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 2025-04-09 21:50:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-go_modules (Old)
 and      /work/SRC/openSUSE:Factory/.obs-service-go_modules.new.1907 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "obs-service-go_modules"

Wed Apr  9 21:50:24 2025 rev:13 rq:1268025 version:0.6.5

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/obs-service-go_modules/obs-service-go_modules.changes
    2025-03-27 22:32:14.680465568 +0100
+++ 
/work/SRC/openSUSE:Factory/.obs-service-go_modules.new.1907/obs-service-go_modules.changes
  2025-04-09 21:50:55.799784924 +0200
@@ -1,0 +2,15 @@
+Wed Apr 09 05:16:36 UTC 2025 - Jeff Kowalczyk <[email protected]>
+
+- Update to version 0.6.5:
+  * feat: allow `archive` be name of the subdirectory
+  * ignore directories containing '.git' when searching for the basename (#51)
+  * doc(README): osc service disabled has been disabled
+  * Make output archives more reproducible
+
+-------------------------------------------------------------------
+Tue Apr  8 02:08:37 UTC 2025 - Jeff Kowalczyk <[email protected]>
+
+- Packaging improvements:
+  * _service tar_scm url use .git extension by convention
+
+-------------------------------------------------------------------

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

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

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

Other differences:
------------------
++++++ obs-service-go_modules.spec ++++++
--- /var/tmp/diff_new_pack.Z5UNKJ/_old  2025-04-09 21:50:56.267804640 +0200
+++ /var/tmp/diff_new_pack.Z5UNKJ/_new  2025-04-09 21:50:56.267804640 +0200
@@ -37,7 +37,7 @@
 %define use_test   test
 %endif
 Name:           obs-service-%{service}
-Version:        0.6.4
+Version:        0.6.5
 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.Z5UNKJ/_old  2025-04-09 21:50:56.295805820 +0200
+++ /var/tmp/diff_new_pack.Z5UNKJ/_new  2025-04-09 21:50:56.299805988 +0200
@@ -1,9 +1,9 @@
 <services>
   <service name="tar_scm" mode="manual">
-    <param 
name="url">https://github.com/openSUSE/obs-service-go_modules</param>
+    <param 
name="url">https://github.com/openSUSE/obs-service-go_modules.git</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
-    <param name="revision">v0.6.4</param>
+    <param name="revision">v0.6.5</param>
     <param name="versionformat">@PARENT_TAG@</param>
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.Z5UNKJ/_old  2025-04-09 21:50:56.315806662 +0200
+++ /var/tmp/diff_new_pack.Z5UNKJ/_new  2025-04-09 21:50:56.331807336 +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">54cd3833dfd6475a4c643730e7a1ad84c6f678ba</param></service></servicedata>
+                <param 
name="url">https://github.com/openSUSE/obs-service-go_modules.git</param>
+              <param 
name="changesrevision">c88e8592e3c20539d797381bc0248be3f1000f45</param></service></servicedata>
 (No newline at EOF)
 

++++++ obs-service-go_modules-0.6.4.tar.gz -> 
obs-service-go_modules-0.6.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/obs-service-go_modules-0.6.4/.github/workflows/black.yml 
new/obs-service-go_modules-0.6.5/.github/workflows/black.yml
--- old/obs-service-go_modules-0.6.4/.github/workflows/black.yml        
2023-06-28 23:17:22.000000000 +0200
+++ new/obs-service-go_modules-0.6.5/.github/workflows/black.yml        
1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-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.4/.github/workflows/flake8.yml 
new/obs-service-go_modules-0.6.5/.github/workflows/flake8.yml
--- old/obs-service-go_modules-0.6.4/.github/workflows/flake8.yml       
2023-06-28 23:17:22.000000000 +0200
+++ new/obs-service-go_modules-0.6.5/.github/workflows/flake8.yml       
1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
-name: flake8 Lint
-
-on: [push, pull_request]
-
-jobs:
-  flake8-lint:
-    runs-on: ubuntu-latest
-    name: Lint
-    steps:
-      - name: Check out source repository
-        uses: actions/checkout@v3
-      - name: Set up Python environment
-        uses: actions/setup-python@v4
-        with:
-          python-version: "3.11"
-      - name: flake8 Lint
-        uses: py-actions/flake8@v2
-        with:
-          path: "go_modules"
-          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.4/README.md 
new/obs-service-go_modules-0.6.5/README.md
--- old/obs-service-go_modules-0.6.4/README.md  2023-06-28 23:17:22.000000000 
+0200
+++ new/obs-service-go_modules-0.6.5/README.md  2025-04-09 06:52:15.000000000 
+0200
@@ -57,7 +57,7 @@
 
 ```
 <services>
-  <service name="go_modules" mode="disabled">
+  <service name="go_modules" mode="manual">
   </service>
 </services>
 ```
@@ -66,7 +66,7 @@
 
 ```
 <services>
-  <service name="go_modules" mode="disabled">
+  <service name="go_modules" mode="manual">
   <param name="archive">app-0.1.0.tar.xz</param>
   </service>
 </services>
@@ -75,13 +75,13 @@
 Run `osc` command locally:
 
 ```
-osc service disabledrun
+osc service manualrun
 ```
 
-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:
+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 manualrun` command:
 
 ```
-rm -rf app; osc service disabledrun
+rm -rf app; osc service manualrun
 ```
 
 See [Example](#example) below for typical output with a complete `_service` 
file.
@@ -121,9 +121,9 @@
 OBS Source Services can run in one of several modes as shown in
 [OBS Documentation: Using Source Services: Modes of 
Services](https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.source_service.html#sec.obs.sserv.mode).
 
-Currently the recommended mode is `disabled` (aliased as `manual`) which 
implies:
+Currently the recommended mode is `manual` which implies:
 
-- The service is run locally via explicit CLI call `osc service disabledrun`
+- The service is run locally via explicit CLI call `osc service manualrun`
 
 - `obs-service-go_modules` and its dependencies
   `python3`, `libarchive` and `python3-libarchive-c`
@@ -175,7 +175,7 @@
 _service
 _servicedata
 
-$ osc service disabledrun
+$ osc service manualrun
 INFO:obs-service-go_modules:Autodetecting archive since no archive param 
provided in _service
 INFO:obs-service-go_modules:Archive autodetected at 
/path/to/prj/pkg/hugo-0.57.2.tar.gz
 INFO:obs-service-go_modules:Using archive hugo-0.57.2.tar.gz
@@ -222,7 +222,7 @@
 
 ```
 <services>
-  <service name="tar_scm" mode="disabled">
+  <service name="tar_scm" mode="manual">
     <param name="url">git://github.com/gohugoio/hugo.git</param>
     <param name="scm">git</param>
     <param name="exclude">.git</param>
@@ -231,14 +231,14 @@
     <param name="changesgenerate">enable</param>
     <param name="versionrewrite-pattern">v(.*)</param>
   </service>
-  <service name="set_version" mode="disabled">
+  <service name="set_version" mode="manual">
     <param name="basename">hugo</param>
   </service>
-  <service name="recompress" mode="disabled">
+  <service name="recompress" mode="manual">
     <param name="file">*.tar</param>
     <param name="compression">gz</param>
   </service>
-  <service name="go_modules" mode="disabled">
+  <service name="go_modules" mode="manual">
   </service>
 </services>
 ```
@@ -278,7 +278,7 @@
 ### Q: Does `vendor.tar.gz` need to be committed to OBS package?
 
 A: Currently yes.
-As long as  `obs-service-go_modules` is run locally via `osc service 
disabledrun`,
+As long as  `obs-service-go_modules` is run locally via `osc service 
manualrun`,
 then `vendor.tar.gz` should be committed and referenced as an additional 
`Source:`.
 If and when `obs-service-go_modules` is available on
 [OBS](https://build.opensuse.org),
@@ -301,7 +301,7 @@
 
 ### Q: Does `obs-service-go_modules` cache Go module downloads to save time 
and bandwidth?
 
-A: Yes. For local use with `osc service disabledrun`,
+A: Yes. For local use with `osc service manualrun`,
 `obs-service-go_modules` uses the standard module cache `~/go/pkg/mod`.
 Subsequent runs of `obs-service-go_modules` with a populated cache will finish 
in less time.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/obs-service-go_modules-0.6.4/go_modules 
new/obs-service-go_modules-0.6.5/go_modules
--- old/obs-service-go_modules-0.6.4/go_modules 2023-06-28 23:17:22.000000000 
+0200
+++ new/obs-service-go_modules-0.6.5/go_modules 2025-04-09 06:52:15.000000000 
+0200
@@ -32,6 +32,7 @@
 import re
 import libarchive
 import os
+import shutil
 import sys
 import tempfile
 
@@ -81,26 +82,32 @@
 
 
 def basename_from_archive_name(archive_name):
-    basename = re.sub(
-        
r"^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",
-        r"\g<basename>",
-        archive_name,
-    )
+    if os.path.isdir(archive_name):
+        basename = archive_name
+    else:
+        basename = re.sub(
+            
r"^(?P<service_prefix>_service:[^:]+:)?(?P<basename>.*)\.(?P<extension>obscpio|tar\.[^\.]+)$",
+            r"\g<basename>",
+            archive_name,
+        )
     if basename:
-        log.info(f"Detected basename {basename} form archive name")
+        log.info(f"Detected basename {basename} from archive name")
     return basename
 
 
 def basename_from_archive(archive_name):
     paths = []
-    with libarchive.file_reader(archive_name) as archive:
-        for entry in archive:
-            if entry.isdir:
-                paths.append(entry.name)
-        try:
-            basename = os.path.commonpath(paths)
-        except ValueError:
-            return
+    try:
+        with libarchive.file_reader(archive_name) as archive:
+            for entry in archive:
+                if entry.isdir and ".git" not in entry.pathname:
+                    paths.append(entry.name)
+            try:
+                basename = os.path.commonpath(paths)
+            except ValueError:
+                return
+    except libarchive.exception.ArchiveError:
+        return
     log.info(f"Detected basename {basename} from archive")
     return basename
 
@@ -115,6 +122,7 @@
     - .tar.lz
     - .tar.xz
     - .tar.zst
+    Returns str with filename of the archive or subdirectory
     """
     log.info("Autodetecting archive since no archive param provided in 
_service")
     specs = sorted(Path.cwd().glob("*.spec"), reverse=True)
@@ -126,7 +134,8 @@
     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]
+        [spec.stem]
+        + [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"]
@@ -142,23 +151,25 @@
         log.error("Archive autodetection found no matching archive")
         exit(1)
 
-    log.info(f"Archive autodetected at {archive}")
-    # Check that app.spec Version: directive value
-    # is a substring of detected archive filename
-    # Warn if there is disagreement between the versions.
-    pattern = re.compile(r"^Version:\s+([\S]+)$", re.IGNORECASE)
-    with spec.open(encoding="utf-8") as f:
-        for line in f:
-            versionmatch = pattern.match(line)
-            if versionmatch:
-                version = versionmatch.groups(0)[0]
-        if not version:
-            log.warning(f"Version not found in {spec.name}")
-        else:
-            if not (version in archive.name):
-                log.warning(
-                    f"Version {version} in {spec.name} does not match 
{archive.name}"
-                )
+    log.info(f"Archive autodetected at {archive} ({type(archive)})")
+
+    if archive.name != spec.stem:
+        # Check that app.spec Version: directive value
+        # is a substring of detected archive filename
+        # Warn if there is disagreement between the versions.
+        pattern = re.compile(r"^Version:\s+([\S]+)$", re.IGNORECASE)
+        with spec.open(encoding="utf-8") as f:
+            for line in f:
+                versionmatch = pattern.match(line)
+                if versionmatch:
+                    version = versionmatch.groups(0)[0]
+            if not version:
+                log.warning(f"Version not found in {spec.name}")
+            else:
+                if not (version in archive.name):
+                    log.warning(
+                        f"Version {version} in {spec.name} does not match 
{archive.name}"
+                    )
     return str(archive.name)  # return string not PosixPath
 
 
@@ -174,7 +185,7 @@
     os.chdir(outdir)
 
     try:
-        libarchive.extract_file(filename)
+        libarchive.extract_file(filename, libarchive.extract.EXTRACT_TIME)
     except libarchive.exception.ArchiveError as archive_error:
         log.error(archive_error)
         exit(1)
@@ -238,7 +249,10 @@
     log.info(f"Using archive {archive}")
 
     with tempfile.TemporaryDirectory() as tempdir:
-        extract(archive, tempdir)
+        if os.path.isdir(archive):
+            shutil.copytree(archive, os.path.join(tempdir, archive))
+        else:
+            extract(archive, tempdir)
 
         basename = (
             args.basename
@@ -299,16 +313,21 @@
             os.chdir(go_mod_dir)
             vendor_dir = "vendor"
 
-            kwargs = {}
+            mtime = os.path.getmtime(go_mod_path)
+            log.debug(f"Set archive files times to {mtime}")
+
+            options = []
+            if archive_args["compression"] == "gzip":
+                options.append("!timestamp")
             if archive_args["level"]:
-                kwargs["options"] = 
f"compression-level={archive_args['level']}"
+                options.append(f"compression-level={archive_args['level']}")
             with libarchive.file_writer(
                 vendor_tarfile,
                 archive_args["format"],
                 archive_args["compression"],
-                **kwargs,
+                options=",".join(options),
             ) as new_archive:
-                new_archive.add_files(vendor_dir)
+                new_archive.add_files(vendor_dir, mtime=mtime, ctime=mtime, 
atime=mtime)
             os.chdir(cwd)
 
 

Reply via email to