Bug 238487 - deskutils/conkyemail: Calls /usr/bin/env python at runtime
Summary: deskutils/conkyemail: Calls /usr/bin/env python at runtime
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kai Knoblich
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2019-06-11 07:57 UTC by Katsuyuki Miyoshi
Modified: 2019-06-24 13:13 UTC (History)
3 users (show)

See Also:
kai: merge-quarterly+


Attachments
Makefile.patch (570 bytes, patch)
2019-06-11 07:57 UTC, Katsuyuki Miyoshi
no flags Details | Diff
conkyemail-2.15.patch (5.17 KB, patch)
2019-06-15 20:47 UTC, Kai Knoblich
kai: maintainer-approval? (katsubsd)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katsuyuki Miyoshi 2019-06-11 07:57:45 UTC
Created attachment 204977 [details]
Makefile.patch

I get an error when I execute conkyemail.

============================================================
% conky -D -c myconkyEmail.conf
...
  File "/usr/local/share/conkyemail/conkyEmail.py", line 167
    except Exception, e:
                    ^
SyntaxError: invalid syntax
...
============================================================

This is because conkyemail used python of python3.6.

============================================================
% grep python /usr/local/bin/conkyEmail
$PYTHONPATH /usr/bin/env python /usr/local/share/conkyemail/conkyEmail.py "$@"
% python --version
Python 3.6.8
% pkg info 'python*'
python-3.6_3,2
python2-2_3
python27-2.7.16_1
python3-3_3
python36-3.6.8_2
============================================================
(PYTHON_DEFAULT=3.6 is the current default.)

USES=python:2.7 is specified in conkyemail/Makefile, and conkyemail needs to use python2.7.

Attach a simple patch to use ${PYTHON_VERSION}.

Thanks.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 08:01:19 UTC
Thank you for the report Katsuyuki.

The change should probably take the form of using USES=shabangfix, rather than a REINPLACE_CMD command
Comment 2 Katsuyuki Miyoshi 2019-06-12 06:37:34 UTC
(In reply to Kubilay Kocak from comment #1)
Yes, Please implement more appropriate method.

But more specifically, conkyEmail(the original of conkyemail_2.07.tar.gz) is as follows.

========================================
% cat src/conkyEmail
#! /bin/sh
cd /usr/share/conkyemail/
$PYTHONPATH /usr/bin/python /usr/share/conkyemail/conkyEmail.py "$@"
========================================

This is not python shebang. Are there other ports that handle this case well?

(By the way, it is a known original bug that $PYTHONPATH is here.)

Thanks.
Comment 3 Kai Knoblich freebsd_committer 2019-06-13 08:24:01 UTC
(In reply to Katsuyuki Miyoshi from comment #2)

I did some improvements together with your patch because the port was in a rather bad shape.

Would you like to adopt the port? If so, I'll add your Bugzilla email address to the MAINTAINER field.
Comment 4 Katsuyuki Miyoshi 2019-06-15 09:37:08 UTC
(In reply to Kai Knoblich from comment #3)
That's fine with me.

Please use katsubsd@gmail.com for my email address in the MAINTAINER field. I will also change my Bugzilla email address to this one.
Comment 5 Katsuyuki Miyoshi 2019-06-15 12:51:23 UTC
(In reply to Katsuyuki Miyoshi from comment #4)
I have changed my Bugzilla email address to katsubsd@gmail.com.
Comment 6 Kai Knoblich freebsd_committer 2019-06-15 20:47:04 UTC
Created attachment 205084 [details]
conkyemail-2.15.patch

(In reply to Katsuyuki Miyoshi from comment #5)

Hi Katsuyuki,

thank you for taking maintainership! Meanwhile I did some research and discovered that the latest release of desktutils/conkyemail is 2.15.

I attached a new patch for 2.15 with all the required fixes/dependencies to make it work but I haven't tested it fully regarding the runtime.

Can you please test the patch on occasion if everything works for you? As soon as I receive a short feedback from you I'll commit it then.
Comment 7 Katsuyuki Miyoshi 2019-06-17 10:39:30 UTC
(In reply to Kai Knoblich from comment #6)
Great! It works well with conkyemail-2.15.patch.

If I have to say something,

1) conkyemail will not need the conky command for RUN_DEPEND.

  Conkyemail actually works independently of conky.

2) If we use conkyemail_2.15, we would like to use conkykeyring.

  The keyring function used in conkyemail_2.15 will be expected to use conkykeyring (https://launchpad.net/~conky-companions/+archive/ubuntu/ppa/+sourcefiles/conkykeyring/1.01/conkykeyring_1.01.tar.gz).
  However, conkykeyring does not exist in FreeBSD ports collection.

Thanks.
Comment 8 Kai Knoblich freebsd_committer 2019-06-17 11:31:40 UTC
(In reply to Katsuyuki Miyoshi from comment #7)

Thank you for testing the update and your suggestions. Point 1) can be easily fixed and I'll do that when committing the patch.

Point 2) should be also no problem. Question here is: Would you like to give it a try to port conkykeyring by yourself? If so, please open a new PR with the attached patch / shar file.

If not, it's also fine. Then I'll add that port during this week to the ports tree.

Don't hesitate to ask if there are any questions.
Comment 9 Katsuyuki Miyoshi 2019-06-18 08:32:31 UTC
(In reply to Kai Knoblich from comment #8)
Thank you for your response.

> Would you like to give it a try to port conkykeyring by yourself?

I'm afraid it is a little difficult for me. I would be grateful if you would port conkykeyring.
Comment 10 commit-hook freebsd_committer 2019-06-23 22:32:53 UTC
A commit references this bug:

Author: kai
Date: Sun Jun 23 22:32:34 UTC 2019
New revision: 504995
URL: https://svnweb.freebsd.org/changeset/ports/504995

Log:
  deskutils/conkyemail: Fix invocation of Python script at runtime

  Since the default version of Python has been switched to 3.6 in r498529 the
  script "conkyEmail.py" that is invoked by the shell script "conkyEmail"
  fails at runtime due incompatible code.

  This occurs only if the Python meta port is also installed otherwise it
  won't start at all due a hardcoded reference (= /usr/bin/env python) in the
  shell script, thus:

  * Update and simplify the patch for "conkyEmail" by using placeholders for
    the Python interpreter and ${DATADIR} that will be replaced by the
    post-patch target. [1]

  Also while I'm here:
  * Silence all commands of the post-patch target to reduce cluttering of
    logfiles
  * Add license information
  * Pet portlint

  PR:		238487
  Submitted by:	Katsuyuki Miyoshi <katsubsd@gmail.com> (initial patch)
  MFH:		2019Q2 (blanket, runtime fix and framework compliance)

Changes:
  head/deskutils/conkyemail/Makefile
  head/deskutils/conkyemail/files/patch-conkyEmail
Comment 11 commit-hook freebsd_committer 2019-06-23 22:39:00 UTC
A commit references this bug:

Author: kai
Date: Sun Jun 23 22:38:06 UTC 2019
New revision: 504996
URL: https://svnweb.freebsd.org/changeset/ports/504996

Log:
  MFH: r504995

  deskutils/conkyemail: Fix invocation of Python script at runtime

  Since the default version of Python has been switched to 3.6 in r498529 the
  script "conkyEmail.py" that is invoked by the shell script "conkyEmail"
  fails at runtime due incompatible code.

  This occurs only if the Python meta port is also installed otherwise it
  won't start at all due a hardcoded reference (= /usr/bin/env python) in the
  shell script, thus:

  * Update and simplify the patch for "conkyEmail" by using placeholders for
    the Python interpreter and ${DATADIR} that will be replaced by the
    post-patch target. [1]

  Also while I'm here:
  * Silence all commands of the post-patch target to reduce cluttering of
    logfiles
  * Add license information
  * Pet portlint

  PR:		238487
  Submitted by:	Katsuyuki Miyoshi <katsubsd@gmail.com> (initial patch)
  Approved by:	ports-secteam (blanket: runtime fix, framework compliance)

Changes:
_U  branches/2019Q2/
  branches/2019Q2/deskutils/conkyemail/Makefile
  branches/2019Q2/deskutils/conkyemail/files/patch-conkyEmail
Comment 12 Kai Knoblich freebsd_committer 2019-06-23 22:43:48 UTC
(In reply to Katsuyuki Miyoshi from comment #9)

The fix for the runtime has been applied to /head and the 2019Q2 branch. deskutils/conkyemail should be usable again in its current version.

The next steps are now:

- I'll soon add the "conkykeyring" port to the Ports tree.
- Once that port has landed I'll update deskutils/conkyemail to the latest version and add you as maintainer for it.
Comment 13 Katsuyuki Miyoshi 2019-06-24 13:13:45 UTC
(In reply to Kai Knoblich from comment #12)
It's working!
Thanks.