Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1691998 - Review Request: golang-github-redis-v2 - Redis client for Go
Summary: Review Request: golang-github-redis-v2 - Redis client for Go
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Mark Goodwin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1670656
TreeView+ depends on / blocked
 
Reported: 2019-03-23 04:50 UTC by Nathan Scott
Modified: 2019-05-03 03:41 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-03-26 20:49:49 UTC
Type: ---
Embargoed:
mgoodwin: fedora-review+


Attachments (Terms of Use)

Description Nathan Scott 2019-03-23 04:50:00 UTC
Spec URL: https://nathans.fedorapeople.org/redis-v2/golang-github-redis-v2.spec
SRPM URL: https://nathans.fedorapeople.org/redis-v2/golang-github-redis-v2-2.3.2-1.fc29.src.rpm

Description: Redis client for Go
Fedora Account System Username: nathans

Comment 1 Nathan Scott 2019-03-23 04:57:47 UTC
Koji build: https://koji.fedoraproject.org/koji/taskinfo?taskID=33704240

Note: this package contains a patch to allow the tests to run without assuming local redis-server's are available and running, and to function on current versions of both Redis and Go.  This patch is not sent upstream as -v2 is an old stable API, and so the patch has no chance of being merged (or even useful to others).  In order for the tests to function, the spec BuildDepends on the redis package (there is no runtime dependency needed) and the %check section starts a redis-server on a non-default high port for single server testing.

Comment 2 Robert-André Mauchin 🐧 2019-03-23 17:16:50 UTC
 - Main import path is gopkg.in/redis.v2: this should be the primary import path from which goname and spec name is derived.

   All other secondary import path must be included in compat packages.

# Old naming of the same project
%global oldgoipath xxxx
%global oldgoname  %gorpmname %{oldgoipath}

[…]

# If you’ve defined an alternative go name
%package -n compat-%{oldgoname}-devel
Summary:   %{summary}
Obsoletes: %{oldgoname}-devel < %{version}-%{release}

%description -n compat-%{oldgoname}-devel
%{common_description}

This package provides symbolic links that alias the following Go import paths
to %{goipath}:
 – %{oldgoipath}

[…]
%goinstall
# Old name aliasing
install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{oldgoipath})
ln -s %{gopath}/src/%{goipath} %{buildroot}%{gopath}/src/%{oldgoipath}

[…]


%files -n compat-%{oldgoname}-devel
# You need as many of those as necessary to own the levels of directories
# between %{gopath}/src and %{gopath}/src/%{oldgoipath}, that are not already
# owned by the %{goname}-devel subpackage
%dir %{gopath}/src/%(dirname %(dirname %{oldgoipath}))
%dir %{gopath}/src/%(dirname %{oldgoipath})
%{gopath}/src/%{oldgoipath}

Comment 3 Nathan Scott 2019-03-26 00:03:57 UTC
| - Main import path is gopkg.in/redis.v2: this should be the primary import path from which goname and spec name is derived.

This doesn't work.  Some macros, like %gosource at least, are unable to expand correctly from a %goipath like "gopkg.in/redis.v2".

Attempting to do so results in this early build failure -

$ rpmbuild -ba golang-gopkg-redis.v2.spec
error: Bad source: [...]/SOURCES/%{archivename}.tar.gz: No such file or directory

i.e. the archivename macro was not successfully expanded - and I've tried all sorts of gopkg.in naming to workaround this, with no joy.

I'll try to take onboard the other "compat"-naming related comments as best I can, but I suspect the original spec was much closer to what we'll have to end up going with with here, and it was much cleaner too.

cheers.

Comment 4 Robert-André Mauchin 🐧 2019-03-26 00:31:36 UTC
%global goipath gopkg.in/redis.v2
%global forgeurl  github.com/go-redis/redis

should work.

Check this example https://eclipseo.fedorapeople.org/guidelines/packaging-guidelines/Golang_templates/#_manual_package_deprecated

Comment 5 Nathan Scott 2019-03-26 00:51:33 UTC
Thanks Robert-André, thats helped (with https:// prefix on forgeurl).  There's still alot of wierdness with this compat package and its symlinks though - since this is a new package, I'm wondering if we even need to go the Obsoletes: and compat path - can we just provide only the gopkg.in/redis.v2 path (golang-gopkg-redis.v2) perhaps.

Will keep hacking at it, and update shortly.

Comment 6 Robert-André Mauchin 🐧 2019-03-26 01:05:10 UTC
The Obsoletes: aren't needed.

It seems I made  a mistake. The main import path on the documentation is: github.com/go-redis/redis

The gopkg.in/redis.v2 should be provided as a compat package.

So you get:

%global goipath github.com/go-redis/redis
Version:        2.3.2

%gometa

%global v2_goipath     gopkg.in/v2/redis
%global v2_goipath     gopkg.in/redis.v2

%global v2_goipath_name %gorpmname %{v2_goipath}


Not sure gopkg.in/v2/redis is used at all.

Comment 7 Nathan Scott 2019-03-26 01:16:28 UTC
ACK to all of #c6, and...

| Not sure gopkg.in/v2/redis is used at all.

Yep, I don't believe it is used.


So taking all that on board we now have minimal, nice-and-neat:

Spec URL: https://nathans.fedorapeople.org/redis-v2/golang-github-redis-v2.spec
SRPM URL: https://nathans.fedorapeople.org/redis-v2/golang-github-redis-v2-2.3.2-1.fc29.src.rpm

Comment 8 Robert-André Mauchin 🐧 2019-03-26 01:36:44 UTC
%goinstall -i %{v2_goipath} -o v2-devel.file-list

 No use a symbolic link as shown before.

install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{v2_goipath_name})
ln -s %{gopath}/src/%{goipath} %{buildroot}%{gopath}/src/%{v2_goipath_name}

[…]

%files -n %{v2_goipath_name}-devel
%dir %{gopath}/src/%(dirname %(dirname %{v2_goipath_name}))
%dir %{gopath}/src/%(dirname %{v2_goipath_name})
%{gopath}/src/%{v2_goipath_name}

Comment 9 Nathan Scott 2019-03-26 01:56:36 UTC
(In reply to Robert-André Mauchin from comment #8)
> %goinstall -i %{v2_goipath} -o v2-devel.file-list
> 
>  No use a symbolic link as shown before.

Done - updated spec and SRPM in same place as #c7.

Comment 10 Robert-André Mauchin 🐧 2019-03-26 02:50:59 UTC
Shouldn't -devel Requires: redis ?

 - Seems they do not respect their own import path:

FAIL	github.com/go-redis/redis [setup failed]
BUILDSTDERR: # github.com/go-redis/redis
BUILDSTDERR: example_test.go:7:2: cannot find package "gopkg.in/redis.v2" in any of:
BUILDSTDERR: 	/usr/lib/golang/src/gopkg.in/redis.v2 (from $GOROOT)
BUILDSTDERR: 	/builddir/build/BUILD/redis-2.3.2/_build/src/gopkg.in/redis.v2 (from $GOPATH)
BUILDSTDERR: 	/usr/share/gocode/src/gopkg.in/redis.v2

I've investigated further, it seems they change from gopkg.in/redis.vX to github.com/go-redis/redis in version 5.
So I revert back my original idea, make gopkg.in/redis.v2 the main import path.

Comment 11 Robert-André Mauchin 🐧 2019-03-26 02:58:23 UTC
golang-gopkg-redis-2.spec

%global goipath gopkg.in/redis.v2
%global forgeurl https://github.com/go-redis/redis
Version:        2.3.2

%gometa

%global v2_goipath      github.com/go-redis/redis
%global v2_goipath_name %gorpmname %{v2_goipath}

Name:           %{goname}
Release:        1%{?dist}
Summary:        Redis client for Go
License:        BSD
URL:            %{gourl}
Source0:        %{gosource}
Patch0:         redis-testing-fixes.patch

BuildRequires:  redis
BuildRequires:  golang(gopkg.in/bufio.v1)
BuildRequires:  golang(gopkg.in/check.v1)

%description
%{summary}.


%package devel
Summary:       %{summary}
BuildArch:     noarch

%description devel
%{summary}.

This package contains library source intended for building other packages which
use import path with %{goipath} prefix.

%package -n %{v2_goipath_name}-devel
Summary:       %{summary}
BuildArch:     noarch

%description -n %{v2_goipath_name}-devel
%{summary}.

This package contains library source intended for
building other packages which use import path with
%{v2_goipath} prefix.


%prep
%forgeautosetup -p1


%install
%goinstall
install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{v2_goipath_name})
ln -s %{gopath}/src/%{goipath} %{buildroot}%{gopath}/src/%{v2_goipath_name}


%check
# Run a test Redis server rather than assuming the system
# is running one already (see patch0) - non-default port.
redis-server --port 8126 &
sleep 0.2   # time to startup
redis-cli -p 8126 PING || exit 1
%gochecks
redis-cli -p 8126 SHUTDOWN || exit 1


%files devel -f devel.file-list
%doc README.md
%license LICENSE

%files -n %{v2_goipath_name}-devel
%dir %{gopath}/src/%(dirname %(dirname %{v2_goipath_name}))
%dir %{gopath}/src/%(dirname %{v2_goipath_name})
%{gopath}/src/%{v2_goipath_name}


%changelog
* Fri Mar 22 2019 Nathan Scott <nathans> - 2.3.2-1
- First package for Fedora

Comment 12 Robert-André Mauchin 🐧 2019-03-26 03:03:07 UTC
Made a mistake

golang-gopkg-redis-2.spec

%global goipath gopkg.in/redis.v2
%global forgeurl https://github.com/go-redis/redis
Version:        2.3.2

%gometa

%global v2_goipath      github.com/go-redis/redis
%global v2_goipath_name %gorpmname %{v2_goipath}

Name:           %{goname}
Release:        1%{?dist}
Summary:        Redis client for Go
License:        BSD
URL:            %{gourl}
Source0:        %{gosource}
Patch0:         redis-testing-fixes.patch

BuildRequires:  redis
BuildRequires:  golang(gopkg.in/bufio.v1)
BuildRequires:  golang(gopkg.in/check.v1)

%description
%{summary}.


%package devel
Summary:       %{summary}
BuildArch:     noarch

%description devel
%{summary}.

This package contains library source intended for building other packages which
use import path with %{goipath} prefix.

%package -n %{v2_goipath_name}-devel
Summary:       %{summary}
BuildArch:     noarch

%description -n %{v2_goipath_name}-devel
%{summary}.

This package contains library source intended for
building other packages which use import path with
%{v2_goipath} prefix.


%prep
%forgeautosetup -p1


%install
%goinstall
install -m 0755 -vd %{buildroot}%{gopath}/src/%(dirname %{v2_goipath})
ln -s %{gopath}/src/%{goipath} %{buildroot}%{gopath}/src/%{v2_goipath}


%check
# Run a test Redis server rather than assuming the system
# is running one already (see patch0) - non-default port.
redis-server --port 8126 &
sleep 0.2   # time to startup
redis-cli -p 8126 PING || exit 1
%gochecks
redis-cli -p 8126 SHUTDOWN || exit 1


%files devel -f devel.file-list
%doc README.md
%license LICENSE

%files -n %{v2_goipath_name}-devel
%dir %{gopath}/src/%(dirname %(dirname %{v2_goipath}))
%dir %{gopath}/src/%(dirname %{v2_goipath})
%{gopath}/src/%{v2_goipath}


%changelog
* Fri Mar 22 2019 Nathan Scott <nathans> - 2.3.2-1
- First package for Fedora

Repost Spec/SRPM if ok.

Comment 13 Nathan Scott 2019-03-26 03:09:34 UTC
(In reply to Robert-André Mauchin from comment #10)
> Shouldn't -devel Requires: redis ?

It's a BuildRequires (for the tests) dependency only.  There's no need to have a local Redis server when using this client library (i.e. the -devel install has no runtime dependency).

>  - Seems they do not respect their own import path:

Just came across this too - it was an error in the paths from the 'ln' command from #c8 - I've fixed it now.

> So I revert back my original idea, make gopkg.in/redis.v2 the main import
> path.

The 'source code' links on every redis-vN linked from e.g. https://gopkg.in/redis.v2 point to tagged branches in the same github.com/go-redis repository - so I disagree that "gopkg.in/redis.v2" should be the main import.  IMO, the spec/srpm versions on fedorapeople now are fully functional and fine as-is, and I think we're in danger of bike-shedding a bit here.

Comment 14 Nathan Scott 2019-03-26 05:46:59 UTC
The symlink approach seems to be fundamentally broken FWIW - whichever package uses symlinks cannot be tested using %check - the tests will be run in the buildroot but the symlinks point to the (not yet) installed files.

This is probably why some other existing golang packages don't seem to do this - and use the separate-copies-of-same-files approach.  *shrug*, no big deal - they're -devel packages, not typically installed by end users.

Comment 15 Mark Goodwin 2019-03-26 06:25:29 UTC
Agree symlinks is flawed in it's current form, so reverting to separate-copies is justified, package approved.

Package Review
==============

Legend:
[x] = Pass, [!] = Fail, [-] = Not applicable, [?] = Not evaluated
[ ] = Manual review needed



===== MUST items =====

Generic:
[x]: Package is licensed with an open-source compatible license and meets
     other legal requirements as defined in the legal section of Packaging
     Guidelines.
[x]: License field in the package spec file matches the actual license.
     Note: Checking patched sources after %prep for licenses. Licenses
     found: "BSD 3-clause "New" or "Revised" License", "Unknown or
     generated". 23 files have unknown license. Detailed output of
     licensecheck in /home/mgoodwin/src/fedora/reviews/1691998-golang-
     github-redis-v2/licensecheck.txt
[-]: License file installed when any subpackage combination is installed.
[x]: Package must own all directories that it creates.
     Note: Directories without known owners: /usr/share/gocode/src,
     /usr/share/gocode
[x]: Package does not own files or directories owned by other packages.
[x]: %build honors applicable compiler flags or justifies otherwise.
[-]: Package contains no bundled libraries without FPC exception.
[x]: Changelog in prescribed format.
[x]: Sources contain only permissible code or content.
[-]: Package contains desktop file if it is a GUI application.
[x]: Development files must be in a -devel package
[x]: Package uses nothing in %doc for runtime.
[x]: Package consistently uses macros (instead of hard-coded directory
     names).
[x]: Package is named according to the Package Naming Guidelines.
[x]: Package does not generate any conflict.
[x]: Package obeys FHS, except libexecdir and /usr/target.
[-]: If the package is a rename of another package, proper Obsoletes and
     Provides are present.
[-]: Requires correct, justified where necessary.
[x]: Spec file is legible and written in American English.
[-]: Package contains systemd file(s) if in need.
[x]: Package is not known to require an ExcludeArch tag.
[-]: Large documentation must go in a -doc subpackage. Large could be size
     (~1MB) or number of files.
     Note: Documentation size is 20480 bytes in 2 files.
[x]: Package complies to the Packaging Guidelines
[x]: Package successfully compiles and builds into binary rpms on at least
     one supported primary architecture.
[x]: Package installs properly.
[x]: Rpmlint is run on all rpms the build produces.
     Note: There are rpmlint messages (see attachment).
[x]: If (and only if) the source package includes the text of the
     license(s) in its own file, then that file, containing the text of the
     license(s) for the package is included in %license.
[x]: Package requires other packages for directories it uses.
[x]: All build dependencies are listed in BuildRequires, except for any
     that are listed in the exceptions section of Packaging Guidelines.
[x]: Package uses either %{buildroot} or $RPM_BUILD_ROOT
[x]: Package does not run rm -rf %{buildroot} (or $RPM_BUILD_ROOT) at the
     beginning of %install.
[x]: Macros in Summary, %description expandable at SRPM build time.
[x]: Dist tag is present.
[x]: Package does not contain duplicates in %files.
[x]: Permissions on files are set properly.
[x]: Package use %makeinstall only when make install DESTDIR=... doesn't
     work.
[x]: Package is named using only allowed ASCII characters.
[x]: Package does not use a name that already exists.
[x]: Package is not relocatable.
[x]: Sources used to build the package match the upstream source, as
     provided in the spec URL.
[x]: Spec file name must match the spec package %{name}, in the format
     %{name}.spec.
[x]: File names are valid UTF-8.
[x]: Packages must not store files under /srv, /opt or /usr/local

===== SHOULD items =====

Generic:
[-]: If the source package does not include license text(s) as a separate
     file from upstream, the packager SHOULD query upstream to include it.
[x]: Final provides and requires are sane (see attachments).
[-]: Fully versioned dependency in subpackages if applicable.
     Note: No Requires: %{name}%{?_isa} = %{version}-%{release} in golang-
     github-redis-v2-devel , golang-gopkg-redis-2-devel
[x]: Package functions as described.
[x]: Latest version is packaged. (note v2 stable is packaged here)
[x]: Package does not include license text files separate from upstream.
[x]: Patches link to upstream bugs/comments/lists or are otherwise
     justified.
[-]: Description and summary sections in the package spec file contains
     translations for supported Non-English languages, if available.
[x]: %check is present and all tests pass.
[x]: Packages should try to preserve timestamps of original installed
     files.
[x]: Reviewer should test that the package builds in mock.
[x]: Buildroot is not present
[x]: Package has no %clean section with rm -rf %{buildroot} (or
     $RPM_BUILD_ROOT)
[x]: No file requires outside of /etc, /bin, /sbin, /usr/bin, /usr/sbin.
[x]: Packager, Vendor, PreReq, Copyright tags should not be in spec file
[x]: Sources can be downloaded from URI in Source: tag
[x]: SourceX is a working URL.
[x]: Package should compile and build into binary rpms on all supported
     architectures.
[x]: Spec use %global instead of %define unless justified.

===== EXTRA items =====

Generic:
[x]: Rpmlint is run on all installed packages.
     Note: There are rpmlint messages (see attachment).
[x]: Spec file according to URL is the same as in SRPM.


Rpmlint
-------
Checking: golang-github-redis-v2-devel-2.3.2-1.fc31.noarch.rpm
          golang-gopkg-redis-2-devel-2.3.2-1.fc31.noarch.rpm
          golang-github-redis-v2-2.3.2-1.fc31.src.rpm
golang-github-redis-v2-devel.noarch: W: hidden-file-or-dir /usr/share/gocode/src/github.com/go-redis/redis/.goipath
golang-gopkg-redis-2-devel.noarch: W: hidden-file-or-dir /usr/share/gocode/src/gopkg.in/redis.v2/.goipath
golang-github-redis-v2.src: W: no-%build-section
golang-github-redis-v2.src: W: patch-not-applied Patch0: redis-testing-fixes.patch
3 packages and 0 specfiles checked; 0 errors, 4 warnings.




Rpmlint (installed packages)
----------------------------
golang-github-redis-v2-devel.noarch: W: invalid-url URL: https://github.com/go-redis/redis <urlopen error [Errno -2] Name or service not known>
golang-github-redis-v2-devel.noarch: W: hidden-file-or-dir /usr/share/gocode/src/github.com/go-redis/redis/.goipath
golang-gopkg-redis-2-devel.noarch: W: invalid-url URL: https://github.com/go-redis/redis <urlopen error [Errno -2] Name or service not known>
golang-gopkg-redis-2-devel.noarch: W: hidden-file-or-dir /usr/share/gocode/src/gopkg.in/redis.v2/.goipath
2 packages and 0 specfiles checked; 0 errors, 4 warnings.



Requires
--------
golang-github-redis-v2-devel (rpmlib, GLIBC filtered):
    golang(gopkg.in/bufio.v1)

golang-gopkg-redis-2-devel (rpmlib, GLIBC filtered):
    golang(gopkg.in/bufio.v1)



Provides
--------
golang-github-redis-v2-devel:
    golang(github.com/go-redis/redis)
    golang-github-redis-v2-devel
    golang-ipath(github.com/go-redis/redis)

golang-gopkg-redis-2-devel:
    golang(gopkg.in/redis.v2)
    golang-gopkg-redis-2-devel
    golang-ipath(gopkg.in/redis.v2)



Source checksums
----------------
https://github.com/go-redis/redis/archive/v2.3.2.tar.gz#/redis-2.3.2.tar.gz :
  CHECKSUM(SHA256) this package     : bf1765d3f26a7623c843e58759ea06dd8d605ab23ae764203ec99cef7b09c490
  CHECKSUM(SHA256) upstream package : 0623b0643d84976c36a40b6c1923852730deaae1c58417940cfdfee9330e2612
However, diff -r shows no differences


Generated by fedora-review 0.6.1 (f03e4e7) last change: 2016-05-02
Command line :/usr/bin/fedora-review -b 1691998 -m fedora-rawhide-x86_64
Buildroot used: fedora-rawhide-x86_64
Active plugins: Generic, Shell-api
Disabled plugins: Java, C/C++, Python, fonts, SugarActivity, Ocaml, Perl, Haskell, R, PHP
Disabled flags: EXARCH, DISTTAG, EPEL5, BATCH, EPEL6

Comment 16 Gwyn Ciesla 2019-03-26 13:05:21 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/golang-github-redis-v2

Comment 17 Fedora Update System 2019-04-16 06:16:42 UTC
golang-github-redis-v2-2.3.2-1.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-9dae2d70ab

Comment 18 Fedora Update System 2019-04-17 01:02:32 UTC
golang-github-redis-v2-2.3.2-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-9dae2d70ab

Comment 19 Fedora Update System 2019-04-24 00:11:04 UTC
golang-github-redis-v2-2.3.2-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-073145c540

Comment 20 Fedora Update System 2019-04-25 02:25:46 UTC
golang-github-redis-v2-2.3.2-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-073145c540

Comment 21 Fedora Update System 2019-04-27 21:25:19 UTC
golang-github-redis-v2-2.3.2-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2019-05-03 03:41:49 UTC
golang-github-redis-v2-2.3.2-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.