Bug 1570551

Summary: Review Request: pgcli - Postgres CLI with autocompletion and syntax highlighting
Product: [Fedora] Fedora Reporter: Dick Marinus <dick>
Component: Package ReviewAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: itamar, package-review, per, zbyszek, zebob.m
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-11 17:08:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1570555, 1833783    
Bug Blocks: 177841    

Description Dick Marinus 2018-04-23 08:20:19 UTC
Spec URL: https://github.com/dbcli/copr-pgcli/blob/master/pgcli.spec
SRPM URL: https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-27-x86_64/00743702-pgcli/pgcli-1.9.1-1.fc27.src.rpm
Description: This is a postgres client that does auto-completion and syntax highlighting.
Fedora Account System Username: meeuw

Comment 1 Per Bothner 2018-05-19 00:17:19 UTC
The SRPM URL is dead.  Instead I tried:
https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-27-x86_64/00738202-pgcli/pgcli-1.9.1-1.fc27.src.rpm
I got a confusing result from fedora-review:

INFO: Processing local files: /home/bothner/Downloads/pgcli-1.9.1-1.fc27.src.rpm
INFO: Getting .spec and .srpm Urls from : Local files in /home/bothner/tmp
INFO:   --> SRPM url: file:///home/bothner/Downloads/pgcli-1.9.1-1.fc27.src.rpm
INFO: Using review directory: /home/bothner/tmp/pgcli
INFO: Downloading (Source0): https://files.pythonhosted.org/packages/source/p/pgcli/pgcli-1.9.1.tar.gz
INFO: Running checks and generating report
ERROR: Exception(/home/bothner/Downloads/pgcli-1.9.1-1.fc27.src.rpm) Config(fedora-27-x86_64) 0 minutes 4 seconds
INFO: Results and/or logs in: /home/bothner/tmp/pgcli/results
ERROR: Command failed: 
INFO: WARNING: Probably non-rawhide buildroot used. Rawhide should be used for most package reviews
ERROR: 'mock build failed, see /home/bothner/tmp/pgcli/results/build.log'
[tmp]1059$ less /home/bothner/tmp/pgcli/results/build.log
[tmp]1060$ uname -a
Linux localhost.localdomain 4.16.8-300.fc28.x86_64 #1 SMP Wed May 9 20:23:40 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

No useful error messages in /home/bothner/tmp/pgcli/results/build.log.

I'm running Fedora 28.  If you still want this reviewed, I suggest creating a new src.rpm for Fedora 28, and fixing the URLs.

Comment 2 Dick Marinus 2018-05-19 10:58:23 UTC
Thanks for checking! I've enable and built the RPMS for 28 and rawhide:

The source RPMs can be found in:

https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-rawhide-x86_64/
https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-28-x86_64/

Then check the directories which start which start with the highest number.

Comment 3 Zbigniew Jędrzejewski-Szmek 2018-05-19 16:07:19 UTC
@Per: if you run mock by hand, it shows the following error:
No matching package to install: 'python3-pgspecial >= 1.10.0'

The issue is that OP has two packages under review, and this one depends on the other one. I added the "Depends On" so that the bugs are linked.

So you need to build and install python-pgspecial first, and then build this package. For example like this:
$ mock python-pgspecial-1.10.0-1.fc29.src.rpm --postinstall
$ mock -n pgcli-1.9.1-1.fc29.src.rpm --postinstall

To run fedora-review with an existing mock buildroot:
$ wget https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-rawhide-x86_64/00756263-pgcli/pgcli-1.9.1-1.fc29.src.rpm https://copr-be.cloud.fedoraproject.org/results/meeuw/pgcli/fedora-rawhide-x86_64/00756263-pgcli/pgcli.spec
$ fedora-review -o ' -n' -n pgcli

Comment 4 Per Bothner 2018-05-22 16:10:03 UTC
After changing /etc/mock/default.cfg to fedora-rawhide-x86_64.cfg and then:
$  mock /home/bothner/Downloads/python-pgspecial-1.11.0-4.fc29.src.rpm  --postinstall
$ mock -n /home/bothner/Downloads/pgcli-1.9.1-3.fc29.src.rpm --postinstall

the latter failed:

Start: build setup for pgcli-1.9.1-3.fc29.src.rpm
Building target platforms: x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/pgcli-1.9.1-3.fc29.src.rpm
Last metadata expiration check: 0:00:00 ago on Tue 22 May 2018 09:05:34 AM PDT.
No matching package to install: 'python3-pgspecial >= 1.10.0'
Not all dependencies satisfied
Error: Some packages could not be found.
ERROR: Exception(/home/bothner/Downloads/pgcli-1.9.1-3.fc29.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 2 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-rawhide-x86_64/result
ERROR: Command failed: 
 # /usr/bin/dnf builddep --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 29 /var/lib/mock/fedora-rawhide-x86_64/root//builddir/build/SRPMS/pgcli-1.9.1-3.fc29.src.rpm
Last metadata expiration check: 0:00:00 ago on Tue 22 May 2018 09:05:34 AM PDT.
No matching package to install: 'python3-pgspecial >= 1.10.0'
Not all dependencies satisfied
Error: Some packages could not be found.

Could this be a python/python2/python3 issue?

FWIW I also tried:
$ mock --resultdir pg /home/bothner/Downloads/python-pgspecial-1.11.0-4.fc29.src.rpm /home/bothner/Downloads/pgcli-1.9.1-3.fc29.src.rpm --postinstall
with similar result.

Comment 5 Dick Marinus 2018-05-22 17:37:56 UTC
python3-pgspecial is a new dependency (which isn't in Fedora yet).

you can download python3-pgspecial from copr:
copr enable meeuw/pgcli
dnf download python3-pgspecial

Then you can run fedora-review -n pgcli -L /path/to/pgspecial to get a fedora-review.

Comment 6 Per Bothner 2018-05-24 12:03:13 UTC
That did not work:

$ sudo copr enable meeuw/pgcli
usage: copr [-h] [--debug] [--config CONFIG] [--version]
            {whoami,list,mock-config,create,modify,delete,fork,build,buildpypi,buildgem,buildcustom,buildfedpkg,buildtito,buildmock,buildscm,status,download-build,cancel,watch-build,delete-build,edit-chroot,get-chroot,add-package-tito,edit-package-tito,add-package-pypi,edit-package-pypi,add-package-mockscm,edit-package-mockscm,add-package-scm,edit-package-scm,add-package-rubygems,edit-package-rubygems,add-package-custom,edit-package-custom,list-packages,list-package-names,get-package,delete-package,reset-package,build-package,build-module}

I think for me to try to figure this all out is counter-productive and is wasting everybody's time. pgcli is too complex a package (in terms of dependencies and python issues) for me to usefully review.  I'm not even a python programmer - tough I do have quite an interest in repls and clis.  I'm requiring too much hand-holding and teaching of new commands that I will immediately forget.

(I'd say my areas of Fedora-relevant expertise are C, autotools, Java, XML, JavaScript (weak on npm and related tools - but I need to solidify that), and the Scheme/Lisp languages.)

Comment 7 Dick Marinus 2018-05-24 18:05:21 UTC
oh my bad, it is: dnf copr enable meeuw/pgcli ... sorry

Comment 8 Per Bothner 2018-05-25 20:26:34 UTC
A problem not with pgcli but with fedora-review/mock is a terrible error message.
I've tried running fedora-review in various ways, and I typically get:

INFO: Running checks and generating report
ERROR: Exception(/home/bothner/tmp/pgcli-1.9.1-3.fc28.src.rpm) Config(fedora-rawhide-x86_64) 12 minutes 42 seconds
INFO: Results and/or logs in: /home/bothner/tmp/review-pgcli/results
ERROR: Command failed: 
ERROR: 'mock build failed, see /home/bothner/tmp/review-pgcli/results/build.log'
[tmp]1013$ less /home/bothner/tmp/review-pgcli/results/build.log

Then I look at /home/bothner/tmp/review-pgcli/results/build.log and *there is no error message there*.  I see:

Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '9ef15e6bf216491ba8829a9ce86f2af0', '-D', '/var/lib/mock/fedora-rawhide-x86_64/root', '-a', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=en_US.UTF-8', '-u', 'mockbuild', 'bash', '--login', '-c', '/usr/bin/rpmbuild -bs --target x86_64 --nodeps /builddir/build/SPECS/pgcli.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'en_US.UTF-8'} and shell False
Building target platforms: x86_64
Building for target x86_64
Wrote: /builddir/build/SRPMS/pgcli-1.9.1-3.fc29.src.rpm
Child return code was: 0
Mock Version: 1.4.10

(The "and shell False" is a bit weird but I have no idea if it is legitimate.)

This is a serious usability bug in mock and/or fedora-review: To write an error message 'mock build failed, see FILENAME' and then have FILENAME not contain any error message is pretty bad.  (Not the fault of pgcli, of course.)

Comment 9 Robert-André Mauchin 🐧 2018-05-25 21:22:54 UTC
(In reply to Per Bothner from comment #8)
> A problem not with pgcli but with fedora-review/mock is a terrible error
> message.
> I've tried running fedora-review in various ways, and I typically get:
> 
Look at root.log and search for "Error:"

Comment 10 Per Bothner 2018-05-25 23:15:26 UTC
Getting a bit firther, with
   $ fedora-review -n pgcli -L `pwd`
INFO: Processing local files: pgcli
INFO: Getting .spec and .srpm Urls from : Local files in /home/bothner/tmp
INFO:   --> SRPM url: file:///home/bothner/tmp/pgcli-1.9.1-3.fc28.src.rpm
INFO:   --> Spec url: file:///home/bothner/tmp/pgcli.spec
INFO: Using review directory: /home/bothner/tmp/review-pgcli
INFO: Downloading (Source0): https://files.pythonhosted.org/packages/source/p/pgcli/pgcli-1.9.1.tar.gz
INFO: Running checks and generating report
INFO: Install command returned error code 30
ERROR: 'While building: INFO: mock.py version 1.4.10 starting (python version = 3.6.5)...\nStart: init plugins\nINFO: selinux disabled\nFinish: init plugins\nStart: run\nStart: chroot init\nINFO: calling preinit hooks\nINFO: enabled root cache\nINFO: enabled dnf cache\nStart: cleaning dnf metadata\nFinish: cleaning dnf metadata\nINFO: enabled HW Info plugin\nMock Version: 1.4.10\nINFO: Mock Version: 1.4.10\nFinish: chroot init\nINFO: installing package(s): /home/bothner/tmp/pgcli-1.9.1-3.fc28.src.rpm /home/bothner/tmp/python3-pgspecial-1.11.0-4.fc28.noarch.rpm\nERROR: Command failed: \n # /usr/bin/dnf --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 29 --disableplugin=local --setopt=deltarpm=False install /home/bothner/tmp/pgcli-1.9.1-3.fc28.src.rpm /home/bothner/tmp/python3-pgspecial-1.11.0-4.fc28.noarch.rpm\n\n' (logs in /home/bothner/.cache/fedora-review.log)

Or more readably, it looks like this command failed with return code 30:

# /usr/bin/dnf --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 29 --disableplugin=local --setopt=deltarpm=False install /home/bothner/tmp/pgcli-1.9.1-3.fc28.src.rpm /home/bothner/tmp/python3-pgspecial-1.11.0-4.fc28.noarch.rpm

Comment 11 Robert-André Mauchin 🐧 2018-10-04 16:16:34 UTC
Run the command separatly, it will tell you why it's failing. Probably a missing dep.

Comment 12 Itamar Reis Peixoto 2020-05-11 17:08:59 UTC

*** This bug has been marked as a duplicate of bug 1833785 ***