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 2022-04-28 23:07:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-go_modules (Old)
and /work/SRC/openSUSE:Factory/.obs-service-go_modules.new.1538 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-go_modules"
Thu Apr 28 23:07:55 2022 rev:2 rq:973508 version:0.4.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/obs-service-go_modules/obs-service-go_modules.changes
2019-10-16 09:13:11.179792147 +0200
+++
/work/SRC/openSUSE:Factory/.obs-service-go_modules.new.1538/obs-service-go_modules.changes
2022-04-28 23:07:59.680689240 +0200
@@ -1,0 +2,7 @@
+Tue Apr 26 08:53:25 UTC 2022 - [email protected]
+
+- Update to version 0.4.0:
+ * don't ignore go mod command errors
+ * allow specifying source / vendor archive compression mode
+
+-------------------------------------------------------------------
Old:
----
obs-service-go_modules-0.3.0.tar.gz
New:
----
obs-service-go_modules-0.4.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ obs-service-go_modules.spec ++++++
--- /var/tmp/diff_new_pack.vh7sP1/_old 2022-04-28 23:08:00.176689780 +0200
+++ /var/tmp/diff_new_pack.vh7sP1/_new 2022-04-28 23:08:00.184689789 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package obs-service-go_modules
+# spec file
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# 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
@@ -15,13 +15,13 @@
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
-# Macros from obs-service_tar_scm
+
+%define service go_modules
%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29
%bcond_without python3
%else
%bcond_with python3
%endif
-
# This list probably needs to be extended
# logic seems to be if python < 2.7 ; then needs_external_argparse ; fi
%if (0%{?centos_version} == 6) || (0%{?suse_version} && 0%{?suse_version} <
1315) || (0%{?fedora_version} && 0%{?fedora_version} < 26)
@@ -29,7 +29,6 @@
%else
%bcond_with needs_external_argparse
%endif
-
%if %{with python3}
%define use_python python3
%define use_test test3
@@ -37,17 +36,19 @@
%define use_python python
%define use_test test
%endif
-
-%define service go_modules
-
Name: obs-service-%{service}
+Version: 0.4.0
+Release: 0
Summary: An OBS source service: Download, verify and vendor Go module
dependencies
License: GPL-2.0-or-later
Group: Development/Tools/Building
-Url: https://github.com/openSUSE/obs-service-%{service}
-Version: 0.3.0
-Release: 0
+URL: https://github.com/openSUSE/obs-service-%{service}
Source: %{name}-%{version}.tar.gz
+BuildRequires: go-md2man
+Requires: go >= 1.11
+Requires: gzip
+Requires: tar
+BuildArch: noarch
%if %{with needs_external_argparse}
BuildRequires: %{use_python}-argparse
%endif
@@ -56,12 +57,6 @@
# Fix missing Requires in python3-pbr in Leap42.3
BuildRequires: %{use_python}-setuptools
%endif
-BuildRequires: go-md2man
-Requires: go >= 1.11
-Requires: gzip
-Requires: tar
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildArch: noarch
%description
An OBS Source Service that will download,
@@ -96,7 +91,6 @@
rm %{name}.1
%files
-%defattr(-,root,root)
%doc README.md
%license LICENSE
%dir %{_prefix}/lib/obs
++++++ _service ++++++
--- /var/tmp/diff_new_pack.vh7sP1/_old 2022-04-28 23:08:00.220689828 +0200
+++ /var/tmp/diff_new_pack.vh7sP1/_new 2022-04-28 23:08:00.224689832 +0200
@@ -1,9 +1,9 @@
<services>
<service name="tar_scm" mode="disabled">
- <param
name="url">git://github.com/openSUSE/obs-service-go_modules.git</param>
+ <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.3.0</param>
+ <param name="revision">v0.4.0</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="changesgenerate">enable</param>
<param name="versionrewrite-pattern">v(.*)</param>
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.vh7sP1/_old 2022-04-28 23:08:00.244689854 +0200
+++ /var/tmp/diff_new_pack.vh7sP1/_new 2022-04-28 23:08:00.244689854 +0200
@@ -1,8 +1,5 @@
<servicedata>
<service name="tar_scm">
- <param
name="url">git://github.com/openSUSEjfkw/obs-service-go_modules.git</param>
- <param
name="changesrevision">861db1a1f880e835fd688477acf0def5930947b1</param></service><service
name="tar_scm">
- <param
name="url">git://github.com/openSUSE/obs-service-go_modules.git</param>
- <param
name="changesrevision">01876e4604a337048df00a3617ed1332d6fd7769</param></service></servicedata>
-(No newline at EOF)
+ <param
name="url">https://github.com/openSUSE/obs-service-go_modules</param>
+ <param
name="changesrevision">3bb1a375ee40d2c4a074c3c715cf06fdbb195b4b</param></service></servicedata>
++++++ obs-service-go_modules-0.3.0.tar.gz ->
obs-service-go_modules-0.4.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-go_modules-0.3.0/.gitmessage
new/obs-service-go_modules-0.4.0/.gitmessage
--- old/obs-service-go_modules-0.3.0/.gitmessage 2019-08-30
05:31:18.000000000 +0200
+++ new/obs-service-go_modules-0.4.0/.gitmessage 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-Initial import
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-go_modules-0.3.0/README.md
new/obs-service-go_modules-0.4.0/README.md
--- old/obs-service-go_modules-0.3.0/README.md 2019-08-30 05:31:18.000000000
+0200
+++ new/obs-service-go_modules-0.4.0/README.md 2020-08-20 23:58:12.000000000
+0200
@@ -18,19 +18,20 @@
go mod vendor
```
-`obs-service-go_modules` will create `vendor.tar.gz` containing the
-`vendor/` directory populated by `go mod vendor`. `vendor.tar.gz`
-is generated in the rpm package directory. `vendor.tar.gz` can be
-committed to [OBS](https://build.opensuse.org) to facilitate
-offline Go application package builds for
-[openSUSE](https://www.opensuse.org),
+`obs-service-go_modules` will create a `vendor.tar[.<tar compression>]` archive
+containing the `vendor/` directory populated by `go mod vendor`. The archive
+is generated in the rpm package directory, and can be committed to
+[OBS](https://build.opensuse.org) to facilitate offline Go application package
builds
+for [openSUSE](https://www.opensuse.org),
[SUSE](https://www.suse.com), and numerous other distributions.
## Usage for packagers
-Presently it is assumed the Go application is distributed as
-a tarball `app-0.1.0.tar.gz` unpacking to `app-0.1.0/`.
-`obs-service-go_modules` will autodetect tarball archives of the form
`app-0.1.0.tar.gz`,
+Presently it is assumed the Go application is distributed as a tarball named
+`app-0.1.0.tar[.<tar compression>]`, unpacking to `app-0.1.0/`.
+The `<tar compression>` extension can be specified using the `compression`
parameter,
+and defaults to `gz`.
+`obs-service-go_modules` will autodetect tarball archives of the form
`app-0.1.0.tar[.<tar compression>]`,
where the RPM packaging uses spec file `app.spec`.
Create a `_service` file containing:
@@ -155,7 +156,7 @@
## Transition note
Until such time as `obs-service-go_modules` is available on
-[OBS](https://build.opensuse.org), `vendor.tar.gz` should
+[OBS](https://build.opensuse.org), `vendor.tar[.<tar compression>]` should
be committed along with the Go application release tarball.
## openSUSE RPM packages built using `obs-service-go_modules`
@@ -168,11 +169,11 @@
## FAQ
-### Q: Does `vendor.tar.gz` need to be committed to OBS package?
+### Q: Does `vendor.tar[.<tar compression>]` need to be committed to OBS
package?
A: Currently yes.
As long as `obs-service-go_modules` is run locally via `osc service
disabledrun`,
-then `vendor.tar.gz` should be committed and referenced as an additional
`Source:`.
+then `vendor.tar[.<tar compression>]` should be committed and referenced as an
additional `Source:`.
If and when `obs-service-go_modules` is available on
[OBS](https://build.opensuse.org),
additional strategies should be possible such as a `vendor.cpio`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-go_modules-0.3.0/go_modules
new/obs-service-go_modules-0.4.0/go_modules
--- old/obs-service-go_modules-0.3.0/go_modules 2019-08-30 05:31:18.000000000
+0200
+++ new/obs-service-go_modules-0.4.0/go_modules 2020-08-20 23:58:12.000000000
+0200
@@ -20,7 +20,8 @@
go mod verify
go mod vendor
-obs-service-go_modules will create vendor.tar.gz containing the
+obs-service-go_modules will create a vendor tarball, compressed with
+the specified method (default to "gz"), containing the
vendor/ directory populated by go mod vendor.
See README.md for additional documentation.
@@ -38,27 +39,44 @@
from subprocess import CalledProcessError
app_name = "obs-service-go_modules"
-vendor_tarname = "vendor.tar.gz"
description = __doc__
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(app_name)
+DEFAULT_COMPRESSION = "gz"
+
parser = argparse.ArgumentParser(
description=description,
formatter_class=argparse.RawDescriptionHelpFormatter
)
parser.add_argument("--strategy", default="vendor")
parser.add_argument("--archive")
parser.add_argument("--outdir")
+parser.add_argument("--compression")
args = parser.parse_args()
outdir = args.outdir
+def get_archive_extension():
+ if args.compression not in tarfile.TarFile.OPEN_METH:
+ log.error(f"The specified compression mode is not supported:
\"{args.compression}\"")
+ exit(1)
+
+ if args.compression == "tar":
+ return "tar"
+
+ return "tar." + (args.compression or DEFAULT_COMPRESSION)
+
+
+archive_ext = get_archive_extension()
+vendor_tarname = f"vendor.{archive_ext}"
+
+
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.
+ For most Go applications this will be app-x.y.z.tar[.<tar
compression>].
Use the name of the .spec file as the stem for the archive to detect.
Archive formats supported:
- .tar.gz
@@ -74,7 +92,7 @@
spec_dir = spec.parent # typically the same as cwd
spec_stem = spec.stem # stem is app in app.spec
# highest sorted archive under spec_dir
- pattern = f"{spec.stem}*.tar.gz"
+ pattern = f"{spec.stem}*.{archive_ext}"
archive = next(reversed(sorted(Path(spec_dir).glob(pattern))), None)
if not archive:
log.error(f"Archive autodetection found no matching archive under
{cwd}")
@@ -103,11 +121,11 @@
archive = args.archive or archive_autodetect()
log.info(f"Using archive {archive}")
-basename = archive.replace(".tar.gz", "") # currently only .tar.gz supported
+basename = archive.replace(f".{archive_ext}", "")
def extract(filename, dir):
- if filename.endswith(".tar.gz"):
+ if filename.endswith(f".{archive_ext}"):
tar = tarfile.open(filename)
tar.extractall(path=dir)
tar.close()
@@ -128,12 +146,11 @@
output = check_output(["go", "mod", cmd],
cwd=dir).decode("utf-8").strip()
if output:
log.info(output)
- return True
except CalledProcessError as e:
error = e.output.decode("utf-8").strip()
if error:
log.info(error)
- return False
+ raise
def main():
@@ -159,7 +176,7 @@
log.info(f"Vendor go.mod dependencies to {vendor_tarname}")
vendor_tarfile = os.path.join(outdir, vendor_tarname)
vendor_dir = os.path.join(go_mod_dir, "vendor")
- with tarfile.open(vendor_tarfile, "w:gz") as tar:
+ with tarfile.open(vendor_tarfile, "w:" + args.compression) as tar:
tar.add(vendor_dir, arcname=("vendor"))
# remove extracted Go application source
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-go_modules-0.3.0/go_modules.service
new/obs-service-go_modules-0.4.0/go_modules.service
--- old/obs-service-go_modules-0.3.0/go_modules.service 2019-08-30
05:31:18.000000000 +0200
+++ new/obs-service-go_modules-0.4.0/go_modules.service 2020-08-20
23:58:12.000000000 +0200
@@ -3,7 +3,7 @@
<description>This service extracts a Go application source,
reads the files go.mod and go.sum,
downloads and verifies Go module dependencies,
- and creates a vendor.tar.gz to be committed allowing fully offline
+ and creates a vendor.tar[.<tar compression>] to be committed allowing fully
offline
builds of Go applications.</description>
<parameter name="strategy">
<description>Choose the strategy this service runs in. Values: vendor.
Default: vendor</description>
@@ -11,4 +11,7 @@
<parameter name="archive">
<description>Specify the Go application source archive that contains
go.mod and go.sum. Values: app-x.y.z.tar.gz. Default: None, will use
autodetection</description>
</parameter>
+ <parameter name="compression">
+ <description>Specify the source / vendor tarballs compression method. When
using "tar" no compression is applied. Default: "gz".</description>
+ </parameter>
</service>