From d159be545ecb431addc3e7bb31a8ed8cfd9984af Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 17 Oct 2012 22:34:17 -0700 Subject: Remove old binhost protocol for bug #438640. The old protocol has been deprecated since portage-2.1.6 (2009), so it should be completely irrelevant now. --- cnf/make.globals | 3 - man/make.conf.5 | 10 +--- pym/portage/dbapi/bintree.py | 70 +--------------------- pym/portage/getbinpkg.py | 40 +++++++++++++ .../package/ebuild/_config/special_env_vars.py | 2 +- 5 files changed, 45 insertions(+), 80 deletions(-) diff --git a/cnf/make.globals b/cnf/make.globals index bc69abe12..e53f1867f 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -66,9 +66,6 @@ FEATURES="assume-digests binpkg-logs COLLISION_IGNORE="/lib/modules/* *.py[co]" UNINSTALL_IGNORE="/lib/modules/*" -# Default chunksize for binhost comms -PORTAGE_BINHOST_CHUNKSIZE="3000" - # By default wait 5 secs before cleaning a package CLEAN_DELAY="5" diff --git a/man/make.conf.5 b/man/make.conf.5 index 0f5bd54de..4c86d38e6 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -663,14 +663,10 @@ unless \fBclean\-logs\fR is enabled in \fBFEATURES\fR. \fBPORTAGE_BINHOST\fR = \fI[space delimited URI list]\fR This is a list of hosts from which portage will grab prebuilt\-binary packages. Each entry in the list must specify the full address of a directory -serving tbz2's for your system. This is only used when running with +serving tbz2's for your system (this directory must contain a 'Packages' index +file). This is only used when running with the get binary pkg options are given to \fBemerge\fR. Review \fBemerge\fR(1) -for more information. For versions of portage less that 2.1.6, this variable -should point to the 'All' directory on the host that creates the binary -packages and not to the root of the \fBPKGDIR\fR. Starting with portage 2.1.6, -it should point to a directory containing a 'Packages' index file. If -${PORTAGE_BINHOST}/Packages does not exist then portage will attempt to use -the older protocol. +for more information. .TP \fBPORTAGE_BINHOST_HEADER_URI\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp/"\fR This variable only makes sense on a system that will serve as a binhost and diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index f90a4936f..0cc46268c 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -1019,75 +1019,7 @@ class binarytree(object): # Local package instances override remote instances. for cpv in metadata: self._remotepkgs.pop(cpv, None) - continue - try: - chunk_size = long(self.settings["PORTAGE_BINHOST_CHUNKSIZE"]) - if chunk_size < 8: - chunk_size = 8 - except (ValueError, KeyError): - chunk_size = 3000 - writemsg_stdout("\n") - writemsg_stdout( - colorize("GOOD", _("Fetching bininfo from ")) + \ - _hide_url_passwd(base_url) + "\n") - remotepkgs = portage.getbinpkg.dir_get_metadata( - base_url, chunk_size=chunk_size) - - for mypkg, remote_metadata in remotepkgs.items(): - mycat = remote_metadata.get("CATEGORY") - if mycat is None: - #old-style or corrupt package - writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, - noiselevel=-1) - continue - mycat = mycat.strip() - try: - fullpkg = _pkg_str(mycat+"/"+mypkg[:-5]) - except InvalidData: - writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, - noiselevel=-1) - continue - - if fullpkg in metadata: - # When using this old protocol, comparison with the remote - # package isn't supported, so the local package is always - # preferred even if getbinpkgsonly is enabled. - continue - - if not self.dbapi._category_re.match(mycat): - writemsg(_("!!! Remote binary package has an " \ - "unrecognized category: '%s'\n") % fullpkg, - noiselevel=-1) - writemsg(_("!!! '%s' has a category that is not" \ - " listed in %setc/portage/categories\n") % \ - (fullpkg, self.settings["PORTAGE_CONFIGROOT"]), - noiselevel=-1) - continue - mykey = portage.cpv_getkey(fullpkg) - try: - # invalid tbz2's can hurt things. - self.dbapi.cpv_inject(fullpkg) - for k, v in remote_metadata.items(): - remote_metadata[k] = v.strip() - remote_metadata["BASE_URI"] = base_url - - # Eliminate metadata values with names that digestCheck - # uses, since they are not valid when using the old - # protocol. Typically this is needed for SIZE metadata - # which corresponds to the size of the unpacked files - # rather than the binpkg file size, triggering digest - # verification failures as reported in bug #303211. - remote_metadata.pop('SIZE', None) - for k in portage.checksum.hashfunc_map: - remote_metadata.pop(k, None) - - self._remotepkgs[fullpkg] = remote_metadata - except SystemExit as e: - raise - except: - writemsg(_("!!! Failed to inject remote binary package: %s\n") % fullpkg, - noiselevel=-1) - continue + self.populated=1 def inject(self, cpv, filename=None): diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 538f8c23c..28b18a00f 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -18,6 +18,7 @@ import socket import time import tempfile import base64 +import warnings _all_errors = [NotImplementedError, ValueError, socket.error] @@ -65,6 +66,10 @@ if sys.hexversion >= 0x3000000: long = int def make_metadata_dict(data): + + warnings.warn("portage.getbinpkg.make_metadata_dict() is deprecated", + DeprecationWarning, stacklevel=2) + myid,myglob = data mydict = {} @@ -84,6 +89,10 @@ class ParseLinks(html_parser_HTMLParser): """Parser class that overrides HTMLParser to grab all anchors from an html page and provide suffix and prefix limitors""" def __init__(self): + + warnings.warn("portage.getbinpkg.ParseLinks is deprecated", + DeprecationWarning, stacklevel=2) + self.PL_anchors = [] html_parser_HTMLParser.__init__(self) @@ -122,6 +131,9 @@ def create_conn(baseurl,conn=None): optional connection. If connection is already active, it is passed on. baseurl is reduced to address and is returned in tuple (conn,address)""" + warnings.warn("portage.getbinpkg.create_conn() is deprecated", + DeprecationWarning, stacklevel=2) + parts = baseurl.split("://",1) if len(parts) != 2: raise ValueError(_("Provided URI does not " @@ -221,6 +233,10 @@ def create_conn(baseurl,conn=None): def make_ftp_request(conn, address, rest=None, dest=None): """(conn,address,rest) --- uses the conn object to request the data from address and issuing a rest if it is passed.""" + + warnings.warn("portage.getbinpkg.make_ftp_request() is deprecated", + DeprecationWarning, stacklevel=2) + try: if dest: @@ -270,6 +286,9 @@ def make_http_request(conn, address, params={}, headers={}, dest=None): the data from address, performing Location forwarding and using the optional params and headers.""" + warnings.warn("portage.getbinpkg.make_http_request() is deprecated", + DeprecationWarning, stacklevel=2) + rc = 0 response = None while (rc == 0) or (rc == 301) or (rc == 302): @@ -312,6 +331,10 @@ def make_http_request(conn, address, params={}, headers={}, dest=None): def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): + + warnings.warn("portage.getbinpkg.match_in_array() is deprecated", + DeprecationWarning, stacklevel=2) + myarray = [] if not (prefix and suffix): @@ -352,6 +375,9 @@ def dir_get_list(baseurl,conn=None): URI should be in the form ://[:port] Connection is used for persistent connection instances.""" + warnings.warn("portage.getbinpkg.dir_get_list() is deprecated", + DeprecationWarning, stacklevel=2) + if not conn: keepconnection = 0 else: @@ -400,6 +426,9 @@ def file_get_metadata(baseurl,conn=None, chunk_size=3000): URI should be in the form ://[:port] Connection is used for persistent connection instances.""" + warnings.warn("portage.getbinpkg.file_get_metadata() is deprecated", + DeprecationWarning, stacklevel=2) + if not conn: keepconnection = 0 else: @@ -451,6 +480,10 @@ def file_get(baseurl,dest,conn=None,fcmd=None,filename=None): URI should be in the form ://[user[:pass]@][:port]""" if not fcmd: + + warnings.warn("Use of portage.getbinpkg.file_get() without the fcmd " + "parameter is deprecated", DeprecationWarning, stacklevel=2) + return file_get_lib(baseurl,dest,conn) if not filename: filename = os.path.basename(baseurl) @@ -483,6 +516,9 @@ def file_get_lib(baseurl,dest,conn=None): URI should be in the form ://[:port] Connection is used for persistent connection instances.""" + warnings.warn("portage.getbinpkg.file_get_lib() is deprecated", + DeprecationWarning, stacklevel=2) + if not conn: keepconnection = 0 else: @@ -526,6 +562,10 @@ def file_get_lib(baseurl,dest,conn=None): def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=1, makepickle=None): """(baseurl,conn,chunk_size,verbose) -- """ + + warnings.warn("portage.getbinpkg.dir_get_metadata() is deprecated", + DeprecationWarning, stacklevel=2) + if not conn: keepconnection = 0 else: diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index a3a95404b..3ca9687ec 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -151,7 +151,7 @@ environ_filter += [ "GENTOO_MIRRORS", "NOCONFMEM", "O", "PORTAGE_BACKGROUND", "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BINHOST", - "PORTAGE_BINHOST_CHUNKSIZE", "PORTAGE_BUILDIR_LOCKED", + "PORTAGE_BUILDIR_LOCKED", "PORTAGE_CHECKSUM_FILTER", "PORTAGE_ELOG_CLASSES", "PORTAGE_ELOG_MAILFROM", "PORTAGE_ELOG_MAILSUBJECT", -- cgit v1.2.3-1-g7c22