Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 382233 - sys-apps/portage breaks for py3 and FEATURES=getbinpkg
Summary: sys-apps/portage breaks for py3 and FEATURES=getbinpkg
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 381649
  Show dependency tree
 
Reported: 2011-09-08 07:10 UTC by Blu3
Modified: 2011-09-09 22:38 UTC (History)
0 users

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


Attachments
bytes to str fix (portage_2.2.0_alpha52_strbytes.patch,508 bytes, patch)
2011-09-08 07:13 UTC, Blu3
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blu3 2011-09-08 07:10:03 UTC
glasscat ~ # emerge -uDNpv


!!! Error fetching binhost package info from 'http://internal.server/i686-x86/'
!!! HTTP Error 404: Not Found


Fetching bininfo from http://internal.server/i686-x86/
Traceback (most recent call last):
  File "/usr/bin/emerge", line 43, in <module>
    retval = emerge_main()
  File "/usr/lib/portage/pym/_emerge/main.py", line 1644, in emerge_main
    getbinpkgs="--getbinpkg" in myopts)
  File "/usr/lib/portage/pym/portage/dbapi/bintree.py", line 526, in populate
    self._populate(getbinpkgs)
  File "/usr/lib/portage/pym/portage/dbapi/bintree.py", line 940, in _populate
    base_url, chunk_size=chunk_size)
  File "/usr/lib/portage/pym/portage/getbinpkg.py", line 565, in dir_get_metadata
    filelist = dir_get_list(baseurl, conn)
  File "/usr/lib/portage/pym/portage/getbinpkg.py", line 357, in dir_get_list
    parser.feed(page)
  File "/usr/lib/python3.2/html/parser.py", line 132, in feed
    self.rawdata = self.rawdata + data
TypeError: Can't convert 'bytes' object to str implicitly
glasscat ~ #


Reproducible: Always




shorthand fix:

--- /usr/lib/portage/pym/portage/getbinpkg.py.orig      2011-09-03 04:21:14.746443972 -0400
+++ /usr/lib/portage/pym/portage/getbinpkg.py   2011-09-08 03:01:57.287674953 -0400
@@ -292,8 +292,13 @@
        if dest:
                dest.write(response.read())
                return "",0,""
+
+       # portage likes strings
+       resp = response.read()
+       if isinstance(resp, bytes):
+               resp=str(resp, encoding='latin-1')
 
-       return response.read(),0,""
+       return resp,0,""
 
 
 def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0):
Comment 1 Blu3 2011-09-08 07:13:05 UTC
Created attachment 285827 [details, diff]
bytes to str fix

patch to check if response is bytes and convert it to str, against sys-apps/portage-2.2.0_alpha52
Comment 2 Zac Medico gentoo-dev 2011-09-09 04:12:08 UTC
Thanks, this is fixed in git:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=58eb89592bfc3ac40ac0235ebcc52910b51a826c

Please note that this fix is for the legacy binhost protocol which only applies when the $PORTAGE_BINHOST/Packages file is not fetchable. In order to use the newer protocol, you need to share $PKGDIR such that $PORTAGE_BINHOST/Packages can be fetched by clients.
Comment 3 Zac Medico gentoo-dev 2011-09-09 22:38:42 UTC
This is fixed in 2.1.10.15 and 2.2.0_alpha55.