Subject: pgadmin4 RPM broken?

From: John Harvey <[email-masked]>
Date: Mon, 24 Apr 2017 09:37:08 -0400

Hello Devrim,

I know that pgadmin4 is being overhauled, but it looks like the current yum
installation is broken.

I just tried the following procedure:

   1. Create a Centos7 VM
   2. sudo yum -y install
   https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm
   3. sudo yum install pgadmin4-v1-web

When I do this, I get a lot of errors about missing python-* packages.  I
know that rencently, the python-* dependencies were changed to a prefix of
pgadmin4-python.  This all worked fine until the python-* packages were
removed from the yum repository.  When that happened, the currently-posted
pgadmin4 is based on a specfile that still has Requires lines referencing
the old dependency package structure, that are now missing.

As a quick example, take a look at:
pgrpms/rpm/redhat/9.5/pgadmin4-v1/EL-7/ pgadmin4-v1.spec

This specfile still has a bunch of Requires lines for
Requires:       python3-babel >= 1.3
Requires:       python3-flask >= 0.11.1
etc.

I know there's a FIXME written to do the work, but if that is going to take
some time to do, I might request that the python-* packages be restored
temporarily so that the current version of pgadmin4 on the yum repository
will be able to install properly.

Regards,
  -John Harvey

---

From: Devrim Gündüz <[email-masked]>
Date: Thu, 27 Apr 2017 13:35:13 +0300

Hi John,

Wow, I was sure that I tested this, but apparently I did not. I see your point.
Actually the recent spec file in the repo should be good (as a part of some new
repo announcement), so I need to rebuild pgadmin4 RPM using that spec file.

Will do.

Regards, Devrim

-- 
Devrim Gündüz
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: John Harvey <[email-masked]>
Date: Thu, 27 Apr 2017 17:38:24 -0400

Hi Devrim,

Wow, I was sure that I tested this, but apparently I did not. I see your
> point.

No worries.  I know that things have been busy.

BTW, I did some test building with the latest spec on RHEL7, since you
mentioned you're thinking of a rebuild/re-release.
I had a few findings that may be of use, if you are still finalizing the
spec-file.
Some of these are small and have to do with a few of the new
pgadmin4-python packages.

1) I noticed that there is no pgadmin4-babel directory in the 9.5 folder,
but it exists in 9.6.  Does it make sense to copy that over to 9.5 (and
pg10) as well?  It is a necessary build dependency
for pgadmin4-python-flask-babel.

2) Do you think it makes sense to change the name of the pgadmin4-babel
specfile (babel.spec) to pgadmin4-babel.spec to match the other pgadmin4
specfile naming conventions?

3) In the yum repository, one of the pgadmin4-python RPM's has some strange
capitalization in the RPM name:
pgadmin4-python-Flask-Mail-0.9.1-3.rhel6.noarch.rpm.
Should this all be lowercase?

4) When I try building with the current pgadmin4 specfile on RHEL7, I get
an error at patch-time:

+ cd pgadmin4-1.3
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ echo 'Patch #0 (pgadmin4-sphinx-theme.patch):'
Patch #0 (pgadmin4-sphinx-theme.patch):
+ /usr/bin/cat pgadmin4/SOURCES/pgadmin4-sphinx-theme.patch
+ /usr/bin/patch -p0 --fuzz=0
patching file docs/en_US/conf.py
+ echo 'Patch #4 (pgadmin4-rhel7-sphinx.patch):'
Patch #4 (pgadmin4-rhel7-sphinx.patch):
+ /usr/bin/cat pgadmin4/SOURCES/pgadmin4-rhel7-sphinx.patch
+ /usr/bin/patch -p0 --fuzz=0
patching file docs/en_US/Makefile.sphinx
Reversed (or previously applied) patch detected!  Assume -R? [n]

I'm not sure why this occurs.  I'll keep investigating.

5) I suggest that the pgadmin4 specfile should add the following line:
BuildRequires: pgadmin4-python-flask-mail
Without it (assuming I remove the patch line from my issue 4 above), I see
this when I compile pgadmin4:

Running Sphinx v1.1.3

Exception occurred:
  File "/usr/lib/python2.7/site-packages/pgadmin4-web/flask_security/utils.py",
line 27, in <module>
    from flask_mail import Message
ImportError: No module named flask_mail

After that, the build fails.
Note that this is solved when I install the pgadmin4-python-flask-mail RPM
directly.

6) I suggest that the pgadmin4 specfile should add the following line:
BuildRequires: pgadmin4-python-dateutil
Without it (assuming I remove the patch line from my issue 4 above), I see
this when I compile pgadmin4:

Making output directory...
Running Sphinx v1.1.3

Exception occurred:
  File "pgadmin4/BUILD/pgadmin4-1.3/web/pgadmin/utils/preferences.py", line
17, in <module>
    import dateutil.parser as dateutil_parser
ImportError: No module named dateutil.parser

After that, the build fails.
Note that this is solved when I install the pgadmin4-python-dateutil RPM.

7) I think the pgadmin4 specfile may need the following line:
BuildRequires: pgadmin4-python-flask-gravatar
Without it (assuming I remove the patch line from my issue 4 above), I see
this when I compile pgadmin4:

+ make PYTHON=/usr/bin/python docs
LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 make -C docs/en_US -f Makefile.sphinx
html
make[1]: Entering directory `pgadmin4/BUILD/pgadmin4-1.3/docs/en_US'
Generating code-snippet.rst for some of the important classes...
Traceback (most recent call last):
  File "build_code_snippet.py", line 61, in <module>
    from pgadmin.browser.utils import NodeView
  File "pgadmin4/BUILD/pgadmin4-1.3/web/pgadmin/browser/__init__.py", line
18, in <module>
    from flask_gravatar import Gravatar
ImportError: No module named flask_gravatar
make[1]: [code_snippet] Error 1 (ignored)

Granted, this is an error that is ignored (the build continues), but I
think people may encounter unexpected behavior without it.

I hope these are helpful.

Regards,
  -John

---

From: Devrim Gündüz <[email-masked]>
Date: Fri, 28 Apr 2017 16:35:07 +0300

Hi John,

> No worries.  I know that things have been busy.

Yeah :/

> mentioned you're thinking of a rebuild/re-release.

Thanks!

> I had a few findings that may be of use, if you are still finalizing the

Patches always welcome. I shuffled the spec file * a lot * , I'm sure I may
have missed something.

> for pgadmin4-python-flask-babel.

Right, I'll do that.

> specfile naming conventions?

Thanks, done.
> Should this all be lowercase?

I think this comes from the tarball. I'll leave it as is for now.

> I'm not sure why this occurs.  I'll keep investigating.

Can't reproduce -- can you please clean up your repo and try again?

> this when I compile pgadmin4:

<snip>

Done.

> BuildRequires: pgadmin4-python-dateutil

Done.

> BuildRequires: pgadmin4-python-flask-gravatar

Done.

> I hope these are helpful.

Thank you, they are very useful!

Regards,

---

From: John Harvey <[email-masked]>
Date: Fri, 28 Apr 2017 16:05:11 -0400

Hi Devrim,

Thanks for putting all of the changes in.  They all work great!

> Can't reproduce -- can you please clean up your repo and try again?

I keep seeing it even in a clean repo, but I'll try to dig a little deeper.
It could definitely be something in my environment.
I'll try to provide more helpful information if it is something that's a
problem.

I found two more specfile recommendations today after some more testing:

1) I would suggest adding "BuildRequires: pgadmin4-python-simplejson" to
the pgadmin4 specfile.

Without it, I see this trace in the build log:

Generating code-snippet.rst for some of the important classes...
Traceback (most recent call last):
  File "build_code_snippet.py", line 61, in <module>
    from pgadmin.browser.utils import NodeView
  File "pgadmin4/BUILD/pgadmin4-1.3/web/pgadmin/browser/__init__.py", line
19, in <module>
    from pgadmin.settings import get_setting
  File "pgadmin4/BUILD/pgadmin4-1.3/web/pgadmin/settings/__init__.py", line
19, in <module>
    from pgadmin.utils.ajax import make_json_response, bad_request
  File "pgadmin4/BUILD/pgadmin4-1.3/web/pgadmin/utils/ajax.py", line 15, in
<module>
    import simplejson as json
ImportError: No module named simplejson
make[1]: [code_snippet] Error 1 (ignored)
sphinx-build -b html -d _build/doctrees   . _build/html

The build continues even with the failure, but my guess is that it's not
ideal.

2) I think that two Requires lines may need to change, specifically around
python-itsdangerous

Requires:       python3-itsdangerous >= 0.24
Requires:       python-itsdangerous >= 0.24

On CentOS 7, python-itsdangerous-0.23-2.el7.noarch is available from the
@extras packages
On RHEL 7, python-itsdangerous-0.23-2.el7.noarch is available from the
@rhel-7-server-extras-rpms packages
Unfortunately, these are too low of a version.  I'm guessing we want to use
the PGDG-built version.

I think that these lines should actually now be moved to:
Requires:       pgadmin4-python-itsdangerous >= 0.24

Is that a correct assumption?

After making those two modifications (and ignoring the patchfile, which I'm
investigating), I am able to build and install pgadmin4 successfully with
the new specfile, which is pretty awesome.

Thanks!
  -John

---

From: Devrim Gündüz <[email-masked]>
Date: Sun, 30 Apr 2017 11:35:09 +0300

Hi John,

<snip>

Added.

> Is that a correct assumption?

I changed Python2 part only, and that was a great catch. Thanks!

The new spec file is in the repo now. Thanks for looking at this, it was great!

Regards,

---

From: John Harvey <[email-masked]>
Date: Mon, 1 May 2017 08:15:03 -0400

Hi Devrim,

> I changed Python2 part only, and that was a great catch. Thanks!

It looks pretty good so far.  I think there's one last change needed based
on your most recent commit.
The line below appears to now be broken:

BuildRequires: python-itsdangerous >= 0.24 pgadmin4-python-flask-htmlmin

I think it should be:

BuildRequires: pgadmin4-python-itsdangerous >= 0.24
pgadmin4-python-flask-htmlmin

Without this change, I am unable to build on EL-7 since the base
python-itsdangerous package only goes up to 0.23.
However, if I make the above change, I can build successfully on EL-7.

The new spec file is in the repo now. Thanks for looking at this, it was
> great!

No problem.  Glad to help! :)

Regards,
  -John

---

From: John Harvey <[email-masked]>
Date: Mon, 8 May 2017 10:44:41 -0400

Hi Devrim,

It looks like all changes are in and work just fine.
I also can't reproduce my patch-file issues anymore, so that's good too!

I had one last finding today, based on your last set of commits from the
weekend.
I see that you've changed the python-flask dependencies in the pgadmin4
spec file to be pgadmin4-python-flask.

I have no issue with that change, but for consistency, you may want to
consider the following 2 modifications:

1) pgadmin4-python-flask-principal.spec

Change:
    Requires:      python-flask
to:
    Requires:      pgadmin4-python-flask

2) pgadmin4-python-flask-sqlalchemy.spec

Change:
    BuildRequires:  python-flask
to:
    BuildRequires:  pgadmin4-python-flask

Regards,
  -John