Bug 1178754

Summary: [abrt] python-gertty: script.py:46:__init__:CommandError: Path doesn't exist: '/usr/lib/python2.7/site-packages/gertty/alembic'. Please use the 'init' command to create a new scripts folder.
Product: [Fedora] Fedora Reporter: Ihar Hrachyshka <ihrachys>
Component: python-gerttyAssignee: Kashyap Chamarthy <kchamart>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: corvus, kchamart, pblaho, pingou
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/bcfbc84ea33f795c312a965f9caed19bfeb66bf1
Whiteboard: abrt_hash:96dd76f17fe27b015a3ca4d3a02d9ac175b21e44
Fixed In Version: python-gertty-1.0.3-4.fc21 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-15 03:29:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: environ none

Description Ihar Hrachyshka 2015-01-05 13:01:30 UTC
Description of problem:
Just install python-gertty and run it. It will fail due to missing alembic directory and alembic.ini file in the package. They are missing because we drop egg file during build, and setup.cfg does not mention those files, so they are ignored.

Version-Release number of selected component:
python-gertty-1.0.3-3.fc21

Additional info:
reporter:       libreport-2.3.0
cmdline:        /usr/bin/python2 /usr/bin/gertty
dso_list:       python-alembic-0.6.6-1.fc21.noarch
executable:     /usr/bin/gertty
kernel:         3.17.7-300.fc21.x86_64
runlevel:       N 5
type:           Python
uid:            1000

Truncated backtrace:
script.py:46:__init__:CommandError: Path doesn't exist: '/usr/lib/python2.7/site-packages/gertty/alembic'.  Please use the 'init' command to create a new scripts folder.

Traceback (most recent call last):
  File "/usr/bin/gertty", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/gertty/app.py", line 434, in main
    args.fetch_missing_refs, args.path)
  File "/usr/lib/python2.7/site-packages/gertty/app.py", line 149, in __init__
    self.db = db.Database(self)
  File "/usr/lib/python2.7/site-packages/gertty/db.py", line 469, in __init__
    self.migrate()
  File "/usr/lib/python2.7/site-packages/gertty/db.py", line 492, in migrate
    alembic.command.upgrade(config, 'head')
  File "/usr/lib/python2.7/site-packages/alembic/command.py", line 105, in upgrade
    script = ScriptDirectory.from_config(config)
  File "/usr/lib/python2.7/site-packages/alembic/script.py", line 70, in from_config
    sourceless=config.get_main_option("sourceless") == "true"
  File "/usr/lib/python2.7/site-packages/alembic/script.py", line 46, in __init__
    "scripts folder." % dir)
CommandError: Path doesn't exist: '/usr/lib/python2.7/site-packages/gertty/alembic'.  Please use the 'init' command to create a new scripts folder.

Local variables in innermost frame:
sourceless: False
truncate_slug_length: None
dir: '/usr/lib/python2.7/site-packages/gertty/alembic'
file_template: '%(rev)s_%(slug)s'
self: <alembic.script.ScriptDirectory object at 0x7f1ce729b6d0>

Comment 1 Ihar Hrachyshka 2015-01-05 13:01:33 UTC
Created attachment 976416 [details]
File: backtrace

Comment 2 Ihar Hrachyshka 2015-01-05 13:01:34 UTC
Created attachment 976417 [details]
File: environ

Comment 3 Kashyap Chamarthy 2015-01-05 14:01:26 UTC
Seems like this is also reported upstream

  https://storyboard.openstack.org/#!/story/139 -- 
  Gertty requires manual alembic init command 

but is not yet fixed. I posted a comment there with a pointer to this bug

Comment 5 Fedora Update System 2015-01-05 18:53:30 UTC
python-gertty-1.0.3-4.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/python-gertty-1.0.3-4.fc21

Comment 6 James E. Blair 2015-01-05 23:36:52 UTC
After discussions in IRC, I believe the best solution is the following:

* Keep the gertty.egg-info directory from the upstream tarball (that is, remove the "rm -rf gertty.egg-info" line from the spec: http://pkgs.fedoraproject.org/cgit/python-gertty.git/tree/python-gertty.spec?id=c54748477f16c183134ab5e9b2b7c7a5fb189d22#n60 )

* And remove the patch to setup.cfg ( http://pkgs.fedoraproject.org/cgit/python-gertty.git/tree/fix_setup.cfg.patch?id=c54748477f16c183134ab5e9b2b7c7a5fb189d22 )

The egg-info directory in the upstream tarball contains the correct information in order for the alembic files to be installed, and a closer reading of the packaging policy indicates that it is okay to keep it.

I have tested this on an f21 system and confirmed the resulting RPM has the necessariy alembic files and works.

Thanks for packaging Gertty!  :)

Comment 7 Ihar Hrachyshka 2015-01-06 13:01:59 UTC
@James, tarball eggs should be dropped as per Fedora packaging policy: http://fedoraproject.org/wiki/Packaging:Python_Eggs#Upstream_Eggs

Comment 8 Pierre-YvesChibon 2015-01-06 17:22:57 UTC
@Ihar in this case the eggs contains metadata information which are required.
So while I agree for eggs packages, in the present case the guidelines does not apply (that page actually needs to be taught the difference between eggs package and eggs metadata).

Comment 9 Kashyap Chamarthy 2015-01-06 21:00:37 UTC
(In reply to Pierre-YvesChibon from comment #8)
> @Ihar in this case the eggs contains metadata information which are required.
> So while I agree for eggs packages, in the present case the guidelines does
> not apply (that page actually needs to be taught the difference between eggs
> package and eggs metadata).

Pierre, I'm submitting the clarification changes to the Fedora Packaging Comittee. Toshio Kuratomi kindly reviewed the below on IRC.

Modified:https://fedoraproject.org/wiki/User:Kashyapc/Python_Eggs
-------------------------------------------------------------------------
1. Replaced the term 'eggs' with 'egg metadata' in the whole wiki, while 
   not messing up the URLs to this[1] on both occurances.

2. In section '1.1 Why egg metadata', changed the phrase "Allowing end
   users to install eggs not made from rpms or install eggs into their 
   home directories." to "Allowing end users to install egg packages not
   made from rpms or install egg packages into their home directories."

3. In section '1.2 When to Provide egg metadata' changed the phrase "we
   need to be sure to include the egg files" to "we need to be sure to
   include the egg metadata"

4. Changed the section 1.3 tittle from  "Upstream egg metadata" to
   "Upstream egg package"

5. In section 1.3, change the phrase: "Do not distribute egg metadata
   from upstream" to "Do not distribute egg packages from upstream."
-------------------------------------------------------------------------

Comment 10 Fedora Update System 2015-01-07 01:25:23 UTC
Package python-gertty-1.0.3-4.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-gertty-1.0.3-4.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0265/python-gertty-1.0.3-4.fc21
then log in and leave karma (feedback).

Comment 11 Pierre-YvesChibon 2015-01-07 06:29:57 UTC
@Kashyap,

Looks good to me as well, thanks!

Comment 12 Fedora Update System 2015-02-15 03:29:56 UTC
python-gertty-1.0.3-4.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.