Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 570798 - emirrordist fails on dev-lang/python[-berkdb], needs to try bsddb3
Summary: emirrordist fails on dev-lang/python[-berkdb], needs to try bsddb3
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - External Interaction (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 549914
  Show dependency tree
 
Reported: 2016-01-03 23:22 UTC by Robin Johnson
Modified: 2020-05-08 19:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
support bsddb3 (untested) (0001-emirrordist-support-bsddb3-module-bug-570798.patch,1.10 KB, patch)
2016-01-04 03:10 UTC, Zac Medico
Details | Diff
support bsddb3 (0001-emirrordist-support-bsddb3-module-bug-570798.patch,1.25 KB, patch)
2016-01-04 21:20 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-01-03 23:22:28 UTC
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emirrordist", line 13, in <module>
    sys.exit(emirrordist_main(sys.argv[1:]))
  File "/usr/lib64/python2.7/site-packages/portage/_emirrordist/main.py", line 451, in emirrordist_main
    SchedulerInterface(global_event_loop())) as config:
  File "/usr/lib64/python2.7/site-packages/portage/_emirrordist/Config.py", line 68, in __init__
    options.distfiles_db, 'distfiles')
  File "/usr/lib64/python2.7/site-packages/portage/_emirrordist/Config.py", line 112, in _open_shelve
    db = shelve.open(db_file, flag=open_flag)
  File "/usr/lib64/python2.7/shelve.py", line 243, in open
    return DbfilenameShelf(filename, flag, protocol, writeback)
  File "/usr/lib64/python2.7/shelve.py", line 227, in __init__
    Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
  File "/usr/lib64/python2.7/anydbm.py", line 84, in open
    mod = __import__(result)
  File "/usr/lib64/python2.7/dbhash.py", line 7, in <module>
ImportError: No module named bsddb
Comment 1 Zac Medico gentoo-dev 2016-01-04 03:10:16 UTC
Created attachment 421836 [details, diff]
support bsddb3 (untested)
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-01-04 19:46:33 UTC
Your patch is buggy in a few ways, but here's a cleaned up version that works:
if e.message == 'No module named bsddb':
  from bsddb3 import dbshelve
  db = dbshelve.open(db_file, flags=open_flag)


1. e.name doesn't exist (AttributeError: 'exceptions.ImportError' object has no attribute 'name')
2. cannot use shelve before assignment (UnboundLocalError: local variable 'shelve' referenced before assignment)
3. dbshelve calls it 'flags' plural.
Comment 3 Zac Medico gentoo-dev 2016-01-04 21:20:08 UTC
Created attachment 421924 [details, diff]
support bsddb3

Updated patch with fixes from comment #2.
Comment 4 Zac Medico gentoo-dev 2016-01-05 19:09:32 UTC
Given the AGPL-3 license of sys-libs/db-6, we might consider moving away from bsddb{,3} usage.

For cases when the database file doesn't exist yet, we can use something like this to force it to gdbm format:

  shelve.Shelf(gdbm.open(filename, flag))

If the file already exists, we could have it automatically migrate it from bsddb to gdbm.
Comment 5 Zac Medico gentoo-dev 2016-01-05 19:10:15 UTC
(In reply to Zac Medico from comment #3)
> Created attachment 421924 [details, diff] [details, diff]
> support bsddb3
> 
> Updated patch with fixes from comment #2.

Posted for review here:

https://archives.gentoo.org/gentoo-portage-dev/message/322fee5001362fa8975a0f9d0f361644
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2016-01-06 07:00:53 UTC
I'd be fine with any solution that has automatic migration, but might want to check how heavily we're using it, the major different between berkdb, gdbm etc is index performance.
Comment 7 Zac Medico gentoo-dev 2016-01-07 17:06:00 UTC
The bsddb3 patch is in the master branch:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=7c94014a32d173ae61919b762140ac1c32d3b522

(In reply to Robin Johnson from comment #6)
> I'd be fine with any solution that has automatic migration, but might want
> to check how heavily we're using it, the major different between berkdb,
> gdbm etc is index performance.

Yeah, I'll have to do some benchmarks.
Comment 8 Zac Medico gentoo-dev 2016-03-14 02:32:58 UTC
Fixed in 2.2.27.