On Mon, Apr 1, 2019 at 8:10 AM Robert-André Mauchin <zebob.m(a)gmail.com> wrote:
On Monday, 1 April 2019 09:40:09 CEST Jakub Cajka wrote:
> ----- Original Message -----
>
> > From: "Robert-André Mauchin" <zebob.m(a)gmail.com>
> > To: golang(a)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(a)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?
--
真実はいつも一つ!/ Always, there's only one truth!