Hello,
I have written go2rpm, based off rust2rpm, to convert Go packages to RPM. It is available here: https://pagure.io/GoSIG/go2rpm
It needs code review and extensive testing, as I am a Python noob.
Please send merge requests.
Best regards,
Robert-André
----- Original Message -----
From: "Robert-André Mauchin" zebob.m@gmail.com To: golang@lists.fedoraproject.org Sent: Sunday, March 31, 2019 6:29:30 PM Subject: go2rpm
Hello,
I have written go2rpm, based off rust2rpm, to convert Go packages to RPM. It is available here: https://pagure.io/GoSIG/go2rpm
How does it compare to the gofed?
JC
It needs code review and extensive testing, as I am a Python noob.
Please send merge requests.
Best regards,
Robert-André
golang mailing list -- golang@lists.fedoraproject.org To unsubscribe send an email to golang-leave@lists.fedoraproject.org Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/golang@lists.fedoraproject.org
On Monday, 1 April 2019 09:40:09 CEST Jakub Cajka wrote:
----- Original Message -----
From: "Robert-André Mauchin" zebob.m@gmail.com To: golang@lists.fedoraproject.org Sent: Sunday, March 31, 2019 6:29:30 PM Subject: go2rpm
Hello,
I have written go2rpm, based off rust2rpm, to convert Go packages to RPM. It is available here: https://pagure.io/GoSIG/go2rpm
How does it compare to the gofed?
JC
Gofed is much more than a SPEC producer:
Synopsis: gofed COMMAND [OPTIONS]
Automation of packaging of golang projects and analysis of Go ecosystem
help Prints this help apidiff Compare API of two commits of the same golang project approx-deps Approximate project dependencies bbo Buildroot override builds for all branches bitbucket2spec Generate spec file from bitbucket build Build all Fedora branches bump Bump spec file check-deps Check packages for commit clean-resources Dispose all resources retrieved by gofed create-tracker Create tracker for a golang package or find one if already created fetch Fetch resource for target, e.g. download tarball for spec file gcpmaster Git cherry pick master branch ggi Get golang imports github2spec Generate spec file from github googlecode2spec Generate spec file from googlecode inspect Inspect golang tarball lint Lint for golang spec files pull Pull from branches push Push to branches repo2spec Generate spec file from repository import path review-request Create review for Bugzilla scan-deps Scan all golang packages for dependencies (e.g. cyclic) scan-distro Scan distribution scan-packages Scan packages scratch-build Scratch build all Fedora branches tools Tools for packaging unit-test Run Go project unit tests update Update all Fedora branches version Print gofed version wizard Run phases of bulding, updating, ... at once
go2rpm only handle the "repo2spec" part of gofed.
Gofed is Python 2 only and as such won't be included in Fedora 30.
go2rpm is more automated, you just give it the import path and it will detect the latest version automatically, detect the licenses, qet the license files and readme files, detect the description, fill the %changelog entry. It also detects if there are commands to put in a binary package.
go2rpm --help usage: go2rpm [-h] [--show-license-map] [--no-auto-changelog-entry] [-] [-f [FORGE]] [-a ALTIPATHS [ALTIPATHS ...]] [-v [VERSION]] [-t [TAG]] [-c [COMMIT]] [goipath]
positional arguments: goipath Import path
optional arguments: -h, --help show this help message and exit --show-license-map Print license mappings and exit --no-auto-changelog-entry Do not generate a changelog entry -, --stdout Print spec into stdout -f [FORGE], --forge [FORGE] Forge URL -a ALTIPATHS [ALTIPATHS ...], --altipaths ALTIPATHS [ALTIPATHS ...] List of alternate import paths -v [VERSION], --version [VERSION] Package version -t [TAG], --tag [TAG] Package tag -c [COMMIT], --commit [COMMIT] Package commit
Example output:
go2rpm --stdout gopkg.in/square/go-jose.v2 -f https://github.com/square/go-jose Upstream license tag Apache-2.0 translated to ASL 2.0 Upstream license tag BSD-3-Clause translated to BSD # golang-gopkg-square-jose-2.spec # Generated by go2rpm %bcond_without check
# https://github.com/square/go-jose %global goipath gopkg.in/square/go-jose.v2 %global forgeurl https://github.com/square/go-jose Version: 2.3.0
%gometa
%global common_description %{expand: An implementation of jose standards (jwe, jws, jwt) in go.}
%global golicenses LICENSE json/LICENSE %global godocs BUG-BOUNTY.md CONTRIBUTING.md README.md jose-util/README.md json/README.md jwk-keygen/README.md
Name: golang-gopkg-square-jose-2 Release: 1%{?dist} Summary: An implementation of jose standards (jwe, jws, jwt) in go
# Upstream license specification: Apache-2.0 and BSD-3-Clause License: ASL 2.0 and BSD URL: %{gourl} Source: %{gosource}
BuildRequires: golang(golang.org/x/crypto/ed25519) BuildRequires: golang(golang.org/x/crypto/pbkdf2) BuildRequires: golang(gopkg.in/alecthomas/kingpin.v2)
%if %{with check} # Tests BuildRequires: golang(github.com/stretchr/testify/assert) BuildRequires: golang(github.com/stretchr/testify/require) %endif
%description %{common_description}
%gopkg
%prep %goprep %gogenbr -r
%build for cmd in jose-util jwk-keygen; do %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done
%install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
%if %{with check} %check %gocheck %endif
%files %license %{golicenses} %doc %{godocs} %{_bindir}/*
%gopkgfiles
%changelog * Mon Apr 01 14:38:24 CEST 2019 Robert-André Mauchin zebob.m@gmail.com - 2.3.0-1 - Initial package
go2rpm is written to use the future Go macros, Gofed uses the current ones.
go2rpm depends on Golist to gather BR, hopefully Golist will handle modules in the future.
It also depends on askalono, a Rust tool by Amazon to detect licenses: https://bugzilla.redhat.com/show_bug.cgi?id=rust-askalono-cli https://copr.fedorainfracloud.org/coprs/eclipseo/askalono
I find it more robust than licensecheck and it allows me to use the SPDX to Fedora license converter written for rust2rpm.
On Mon, Apr 1, 2019 at 8:10 AM Robert-André Mauchin zebob.m@gmail.com wrote:
On Monday, 1 April 2019 09:40:09 CEST Jakub Cajka wrote:
----- Original Message -----
From: "Robert-André Mauchin" zebob.m@gmail.com To: golang@lists.fedoraproject.org Sent: Sunday, March 31, 2019 6:29:30 PM Subject: go2rpm
Hello,
I have written go2rpm, based off rust2rpm, to convert Go packages to RPM. It is available here: https://pagure.io/GoSIG/go2rpm
How does it compare to the gofed?
JC
Gofed is much more than a SPEC producer:
Synopsis: gofed COMMAND [OPTIONS]
Automation of packaging of golang projects and analysis of Go ecosystem
help Prints this help apidiff Compare API of two commits of the same golang project approx-deps Approximate project dependencies bbo Buildroot override builds for all branches bitbucket2spec Generate spec file from bitbucket build Build all Fedora branches bump Bump spec file check-deps Check packages for commit clean-resources Dispose all resources retrieved by gofed create-tracker Create tracker for a golang package or find one if already created fetch Fetch resource for target, e.g. download tarball for spec file gcpmaster Git cherry pick master branch ggi Get golang imports github2spec Generate spec file from github googlecode2spec Generate spec file from googlecode inspect Inspect golang tarball lint Lint for golang spec files pull Pull from branches push Push to branches repo2spec Generate spec file from repository import path review-request Create review for Bugzilla scan-deps Scan all golang packages for dependencies (e.g. cyclic) scan-distro Scan distribution scan-packages Scan packages scratch-build Scratch build all Fedora branches tools Tools for packaging unit-test Run Go project unit tests update Update all Fedora branches version Print gofed version wizard Run phases of bulding, updating, ... at oncego2rpm only handle the "repo2spec" part of gofed.
Gofed is Python 2 only and as such won't be included in Fedora 30.
go2rpm is more automated, you just give it the import path and it will detect the latest version automatically, detect the licenses, qet the license files and readme files, detect the description, fill the %changelog entry. It also detects if there are commands to put in a binary package.
go2rpm --help usage: go2rpm [-h] [--show-license-map] [--no-auto-changelog-entry] [-] [-f [FORGE]] [-a ALTIPATHS [ALTIPATHS ...]] [-v [VERSION]] [-t [TAG]] [-c [COMMIT]] [goipath]
positional arguments: goipath Import path
optional arguments: -h, --help show this help message and exit --show-license-map Print license mappings and exit --no-auto-changelog-entry Do not generate a changelog entry -, --stdout Print spec into stdout -f [FORGE], --forge [FORGE] Forge URL -a ALTIPATHS [ALTIPATHS ...], --altipaths ALTIPATHS [ALTIPATHS ...] List of alternate import paths -v [VERSION], --version [VERSION] Package version -t [TAG], --tag [TAG] Package tag -c [COMMIT], --commit [COMMIT] Package commit
Example output:
go2rpm --stdout gopkg.in/square/go-jose.v2 -f https://github.com/square/go-jose Upstream license tag Apache-2.0 translated to ASL 2.0 Upstream license tag BSD-3-Clause translated to BSD # golang-gopkg-square-jose-2.spec # Generated by go2rpm %bcond_without check
# https://github.com/square/go-jose %global goipath gopkg.in/square/go-jose.v2 %global forgeurl https://github.com/square/go-jose Version: 2.3.0
%gometa
%global common_description %{expand: An implementation of jose standards (jwe, jws, jwt) in go.}
%global golicenses LICENSE json/LICENSE %global godocs BUG-BOUNTY.md CONTRIBUTING.md README.md jose-util/README.md json/README.md jwk-keygen/README.md
Name: golang-gopkg-square-jose-2 Release: 1%{?dist} Summary: An implementation of jose standards (jwe, jws, jwt) in go
# Upstream license specification: Apache-2.0 and BSD-3-Clause License: ASL 2.0 and BSD URL: %{gourl} Source: %{gosource}
BuildRequires: golang(golang.org/x/crypto/ed25519) BuildRequires: golang(golang.org/x/crypto/pbkdf2) BuildRequires: golang(gopkg.in/alecthomas/kingpin.v2)
%if %{with check} # Tests BuildRequires: golang(github.com/stretchr/testify/assert) BuildRequires: golang(github.com/stretchr/testify/require) %endif
%description %{common_description}
%gopkg
%prep %goprep %gogenbr -r
%build for cmd in jose-util jwk-keygen; do %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd done
%install %gopkginstall install -m 0755 -vd %{buildroot}%{_bindir} install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
%if %{with check} %check %gocheck %endif
%files %license %{golicenses} %doc %{godocs} %{_bindir}/*
%gopkgfiles
%changelog
- Mon Apr 01 14:38:24 CEST 2019 Robert-André Mauchin zebob.m@gmail.com - 2.3.0-1
- Initial package
go2rpm is written to use the future Go macros, Gofed uses the current ones.
go2rpm depends on Golist to gather BR, hopefully Golist will handle modules in the future.
It also depends on askalono, a Rust tool by Amazon to detect licenses: https://bugzilla.redhat.com/show_bug.cgi?id=rust-askalono-cli https://copr.fedorainfracloud.org/coprs/eclipseo/askalono
I find it more robust than licensecheck and it allows me to use the SPDX to Fedora license converter written for rust2rpm.
Would you consider making a pull request to make it so we can use askalono in fedora-review as an alternative to licensecheck, when available?
On Monday, 1 April 2019 18:03:22 CEST Neal Gompa wrote:
Would you consider making a pull request to make it so we can use askalono in fedora-review as an alternative to licensecheck, when available?
Not sure it is a good idea: current licensecheck scans all files notably headers in all the source tree. askalono by default restrict itself to common license files as described in rust-ignore [1]. There might be improvement regarding this in the yet-to-be released code but I haven't tested it. Granted it might also be an improvement over how licensecheck fails on minified javascript and other niceties, but I haven't tested that part yet.
[1]: https://github.com/BurntSushi/ripgrep/blob/master/ignore/src/ types.rs#L171
golang@lists.fedoraproject.org