Merged from trunk -r15123:15130
authorFabian Groffen <grobian@gentoo.org>
Tue, 22 Dec 2009 20:51:16 +0000 (20:51 -0000)
committerFabian Groffen <grobian@gentoo.org>
Tue, 22 Dec 2009 20:51:16 +0000 (20:51 -0000)
   | 15124    | Remove some old debug code that should not have been        |
   | zmedico  | committed.                                                  |

   | 15125    | When integer mtime is desired, use stat_obj[stat.ST_MTIME]  |
   | zmedico  | instead of the float st_mtime in order to avoid rounding    |
   |          | *up* in some rare cases.                                    |

   | 15126    | When integer mtime is desired, use stat_obj[stat.ST_MTIME]  |
   | zmedico  | instead of the float st_mtime in order to avoid rounding    |
   |          | *up* in some rare cases.                                    |

   | 15127    | Add missing stat import.                                    |
   | zmedico  |                                                             |

   | 15128    | Bug #297541 - Make $(no-as-needed) trigger                  |
   | zmedico  | upstream.workaround warning. Thanks to Samuli Suominen      |
   |          | <ssuominen@g.o> for this patch.                             |

   | 15129    | If the TERM environment variable is unset then just use     |
   | zmedico  | internal default term codes since the vt100 codes typically |
   |          | produce strange output. This fixes strange output from      |
   |          | catalyst stage1 builds.                                     |

   | 15130    | Bug #297933: Filter BASHOPTS variable for compatibility     |
   | arfrever | with bash-4.1.                                              |

svn path=/main/branches/prefix/; revision=15132

17 files changed:
bin/ebuild.sh
pym/_emerge/BinpkgFetcher.py
pym/_emerge/JobStatusDisplay.py
pym/_emerge/actions.py
pym/_emerge/main.py
pym/portage/__init__.py
pym/portage/cache/flat_hash.py
pym/portage/cache/flat_list.py
pym/portage/cache/metadata.py
pym/portage/cvstree.py
pym/portage/dbapi/bintree.py
pym/portage/dbapi/porttree.py
pym/portage/dbapi/vartree.py
pym/portage/eclass_cache.py
pym/portage/update.py
pym/repoman/checks.py
pym/repoman/errors.py

index 80392d57ae7135b0140b586c39777ccb2e2f5bc3..e8bfc5721a4ae21f068f9106ff5f809c8a520ec0 100755 (executable)
@@ -1656,8 +1656,8 @@ PORTAGE_MUTABLE_FILTERED_VARS="AA HOSTNAME"
 # variables out and discards them. See bug #190128.
 filter_readonly_variables() {
        local x filtered_vars
-       local readonly_bash_vars="BASHPID DIRSTACK EUID FUNCNAME
-               GROUPS PIPESTATUS PPID SHELLOPTS UID"
+       local readonly_bash_vars="BASHOPTS BASHPID DIRSTACK EUID
+               FUNCNAME GROUPS PIPESTATUS PPID SHELLOPTS UID"
        local bash_misc_vars="BASH BASH_.* COMP_WORDBREAKS HISTCMD
                HISTFILE HOSTNAME HOSTTYPE IFS LINENO MACHTYPE OLDPWD
                OPTERR OPTIND OSTYPE POSIXLY_CORRECT PS4 PWD RANDOM
index fbf34df72506661d0e573a3c807f1e45a7ebfdf0..bd8b141f3ece3d7ca971c3ab0b08105a7f380ba1 100644 (file)
@@ -7,6 +7,7 @@ try:
        from urllib.parse import urlparse as urllib_parse_urlparse
 except ImportError:
        from urlparse import urlparse as urllib_parse_urlparse
+import stat
 import sys
 import portage
 from portage import os
@@ -115,7 +116,7 @@ class BinpkgFetcher(SpawnProcess):
                                                pass
                                        else:
                                                try:
-                                                       local_mtime = long(os.stat(self.pkg_path).st_mtime)
+                                                       local_mtime = os.stat(self.pkg_path)[stat.ST_MTIME]
                                                except OSError:
                                                        pass
                                                else:
index 288e355f694bda3b184d06e0694592561f188a0c..cfc0bfa91ce6419f067741ce15ff5fc002616403 100644 (file)
@@ -87,7 +87,9 @@ class JobStatusDisplay(object):
                        False otherwise.
                """
 
-               term_type = os.environ.get("TERM", "vt100")
+               term_type = os.environ.get("TERM", "").strip()
+               if not term_type:
+                       return False
                tigetstr = None
 
                try:
index 4846930733d4f321d374f393bc5dd1a0c7ba4e6c..bc0dea2ff753084214fc24f97409625c050ef3b4 100644 (file)
@@ -2614,7 +2614,7 @@ def git_sync_timestamps(settings, portdir):
                        if ec in updated_ec_mtimes:
                                continue
                        ec_path = os.path.join(ec_dir, ec + ".eclass")
-                       current_mtime = long(os.stat(ec_path).st_mtime)
+                       current_mtime = os.stat(ec_path)[stat.ST_MTIME]
                        if current_mtime != ec_mtime:
                                os.utime(ec_path, (ec_mtime, ec_mtime))
                        updated_ec_mtimes[ec] = ec_mtime
index a6820589a309c228c2df5556a75418852a848b95..0b597f6c25bb5fe09f2ba89682459bb5dc324d06 100644 (file)
@@ -6,6 +6,7 @@ from __future__ import print_function
 
 import logging
 import signal
+import stat
 import sys
 import textwrap
 import platform
@@ -107,7 +108,7 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                continue
                        inforoot=normpath(root+z)
                        if os.path.isdir(inforoot):
-                               infomtime = long(os.stat(inforoot).st_mtime)
+                               infomtime = os.stat(inforoot)[stat.ST_MTIME]
                                if inforoot not in prev_mtimes or \
                                        prev_mtimes[inforoot] != infomtime:
                                                regen_infodirs.append(inforoot)
@@ -197,7 +198,7 @@ def chk_updated_info_files(root, infodirs, prev_mtimes, retval):
                                                del e
 
                                #update mtime so we can potentially avoid regenerating.
-                               prev_mtimes[inforoot] = long(os.stat(inforoot).st_mtime)
+                               prev_mtimes[inforoot] = os.stat(inforoot)[stat.ST_MTIME]
 
                        if badcount:
                                out.eerror("Processed %d info files; %d errors." % \
index 22b50b0a2095222089cf3b690c0483378d66680d..9a0fe3d03999c2bde2328b80b8fa6e511a4f6e79 100644 (file)
@@ -1135,7 +1135,7 @@ def dolinkingstuff(target_root, specials, prelink_capable, makelinks,
        for lib_dir in portage.util.unique_array(specials["LDPATH"]+['usr/lib','usr/lib64','usr/lib32','lib','lib64','lib32']):
                x = os.path.join(target_root, lib_dir.lstrip(os.sep))
                try:
-                       newldpathtime = long(os.stat(x).st_mtime)
+                       newldpathtime = os.stat(x)[stat.ST_MTIME]
                        lib_dirs.add(normalize_path(x))
                except OSError as oe:
                        if oe.errno == errno.ENOENT:
@@ -9087,7 +9087,7 @@ def _global_updates(trees, prev_mtimes):
                        if len(errors) == 0:
                                # Update our internal mtime since we
                                # processed all of our directives.
-                               timestamps[mykey] = long(mystat.st_mtime)
+                               timestamps[mykey] = mystat[stat.ST_MTIME]
                        else:
                                for msg in errors:
                                        writemsg("%s\n" % msg, noiselevel=-1)
index 49d7ce6a0c756cd4088905fa1b37d21220ddd263..93411580584f943c5c767fd95b2efa8cb09f259d 100644 (file)
@@ -48,7 +48,7 @@ class database(fs_template.FsBased):
                                if '_mtime_' not in d:
                                        # Backward compatibility with old cache
                                        # that uses mtime mangling.
-                                       d['_mtime_'] = long(_os.fstat(myf.fileno()).st_mtime)
+                                       d['_mtime_'] = _os.fstat(myf.fileno())[stat.ST_MTIME]
                                return d
                        finally:
                                myf.close()
index bf465efdb21e929b1636f54636e49c7f5a36e7c4..51231a52a500e1108688500f850f2e7c4263a2f0 100644 (file)
@@ -48,7 +48,7 @@ class database(fs_template.FsBased):
                        raise cache_errors.CacheCorruption(cpv, e)
 
                try:
-                       d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime)
+                       d["_mtime_"] = os.fstat(myf.fileno())[stat.ST_MTIME]
                except OSError as e:    
                        myf.close()
                        raise cache_errors.CacheCorruption(cpv, e)
index 2704bd5135a3fd14cfae5a4a2c0c853a51868400..650658afc41652eb2f7644a8716a9abbcb1eed8a 100644 (file)
@@ -5,6 +5,7 @@
 
 import errno
 import re
+import stat
 import sys
 from portage import os
 from portage import _encodings
@@ -110,7 +111,7 @@ class database(flat_hash.database):
                        except EnvironmentError:
                                pass
                        else:
-                               existing_mtime = long(existing_st.st_mtime)
+                               existing_mtime = existing_st[stat.ST_MTIME]
                                if values['_mtime_'] == existing_mtime and \
                                        existing_content == new_content:
                                        return
index da8b40e15242c67417d17fc2455214fe3c90b46a..ca9d56d2f140fe6221325e8b9777c4714ce6c538 100644 (file)
@@ -7,6 +7,7 @@ from __future__ import print_function
 
 import codecs
 import re
+import stat
 import sys
 import time
 
@@ -251,8 +252,6 @@ def getentries(mydir,recursive=0):
        for file in apply_cvsignore_filter(os.listdir(mydir)):
                if file=="CVS":
                        continue
-               if file=="digest-framerd-2.4.3":
-                       print(mydir,file)
                if os.path.isdir(mydir+"/"+file):
                        if file not in entries["dirs"]:
                                entries["dirs"][file]={"dirs":{},"files":{}}
@@ -267,39 +266,20 @@ def getentries(mydir,recursive=0):
                        else:
                                entries["dirs"][file]["status"]=["exists"]
                elif os.path.isfile(mydir+"/"+file):
-                       if file=="digest-framerd-2.4.3":
-                               print("isfile")
                        if file not in entries["files"]:
                                entries["files"][file]={"revision":"","date":"","flags":"","tags":""}
                        if "status" in entries["files"][file]:
-                               if file=="digest-framerd-2.4.3":
-                                       print("has status")
                                if "exists" not in entries["files"][file]["status"]:
-                                       if file=="digest-framerd-2.4.3":
-                                               print("no exists in status")
                                        entries["files"][file]["status"]+=["exists"]
                        else:
-                               if file=="digest-framerd-2.4.3":
-                                       print("no status")
                                entries["files"][file]["status"]=["exists"]
                        try:
-                               if file=="digest-framerd-2.4.3":
-                                       print("stat'ing")
                                mystat=os.stat(mydir+"/"+file)
-                               mytime = time.asctime(time.gmtime(long(mystat.st_mtime)))
+                               mytime = time.asctime(time.gmtime(mystat[stat.ST_MTIME]))
                                if "status" not in entries["files"][file]:
-                                       if file=="digest-framerd-2.4.3":
-                                               print("status not set")
                                        entries["files"][file]["status"]=[]
-                               if file=="digest-framerd-2.4.3":
-                                       print("date:",entries["files"][file]["date"])
-                                       print("sdate:",mytime)
                                if mytime==entries["files"][file]["date"]:
                                        entries["files"][file]["status"]+=["current"]
-                               if file=="digest-framerd-2.4.3":
-                                       print("stat done")
-                               
-                               del mystat
                        except SystemExit as e:
                                raise
                        except Exception as e:
index ee2cc1b65c7a9b6260cddcd5e42a1a1551174cf2..9fc2973e6b29f6ecb54a3a81ed9aae210684c4ba 100644 (file)
@@ -512,7 +512,7 @@ class binarytree(object):
                                                match = None
                                                for d in possibilities:
                                                        try:
-                                                               if long(d["MTIME"]) != long(s.st_mtime):
+                                                               if long(d["MTIME"]) != s[stat.ST_MTIME]:
                                                                        continue
                                                        except (KeyError, ValueError):
                                                                continue
@@ -617,7 +617,7 @@ class binarytree(object):
                                        d = metadata.get(mycpv, {})
                                        if d:
                                                try:
-                                                       if long(d["MTIME"]) != long(s.st_mtime):
+                                                       if long(d["MTIME"]) != s[stat.ST_MTIME]:
                                                                d.clear()
                                                except (KeyError, ValueError):
                                                        d.clear()
@@ -630,7 +630,7 @@ class binarytree(object):
 
                                        d["CPV"] = mycpv
                                        d["SLOT"] = slot
-                                       d["MTIME"] = str(long(s.st_mtime))
+                                       d["MTIME"] = str(s[stat.ST_MTIME])
                                        d["SIZE"] = str(s.st_size)
 
                                        d.update(zip(self._pkgindex_aux_keys,
@@ -971,7 +971,7 @@ class binarytree(object):
 
                d["CPV"] = cpv
                st = os.stat(pkg_path)
-               d["MTIME"] = str(long(st.st_mtime))
+               d["MTIME"] = str(st[stat.ST_MTIME])
                d["SIZE"] = str(st.st_size)
 
                rel_path = self._pkg_paths[cpv]
index 825ca821c9cf80cf6560071e8b05279461bc3b4c..7536f7972f8aca7e29da155fd32c0c7271bca8dc 100644 (file)
@@ -672,7 +672,7 @@ class portdbapi(dbapi):
                mydata["repository"] = self._repository_map.get(mylocation, "")
 
                mydata["INHERITED"] = ' '.join(mydata.get("_eclasses_", []))
-               mydata["_mtime_"] = long(st.st_mtime)
+               mydata["_mtime_"] = st[stat.ST_MTIME]
 
                eapi = mydata.get("EAPI")
                if not eapi:
index 15ce50490e4d6acdd053418f8fb5296246964f72..7be3a205e628cfba3a756f93115bf16a2aa0c3ac 100644 (file)
@@ -52,6 +52,7 @@ from collections import deque
 import re, shutil, stat, errno, copy, subprocess
 import logging
 import os as _os
+import stat
 import sys
 import time
 import warnings
@@ -1953,7 +1954,7 @@ class vardbapi(dbapi):
                if mysplit[0] == '*':
                        mysplit[0] = mysplit[0][1:]
                try:
-                       mystat = os.stat(self.getpath(mysplit[0]))[stat.ST_MTIME]
+                       mystat = os.stat(self.getpath(mysplit[0])).st_mtime
                except OSError:
                        mystat = 0
                if use_cache and mycp in self.cpcache:
@@ -2229,7 +2230,7 @@ class vardbapi(dbapi):
                        if e.errno != errno.ENOENT:
                                raise
                        raise KeyError(mycpv)
-               mydir_mtime = long(mydir_stat.st_mtime)
+               mydir_mtime = mydir_stat[stat.ST_MTIME]
                pkg_data = self._aux_cache["packages"].get(mycpv)
                pull_me = cache_these.union(wants)
                mydata = {"_mtime_" : mydir_mtime}
@@ -2297,7 +2298,7 @@ class vardbapi(dbapi):
                results = []
                for x in wants:
                        if x == "_mtime_":
-                               results.append(long(st.st_mtime))
+                               results.append(st[stat.ST_MTIME])
                                continue
                        try:
                                myf = codecs.open(
@@ -5281,7 +5282,7 @@ class dblink(object):
                                                                        cfgprot = cfgfiledict["IGNORE"]
                                                                        if not moveme:
                                                                                zing = "---"
-                                                                               mymtime = long(mystat.st_mtime)
+                                                                               mymtime = mystat[stat.ST_MTIME]
                                                                else:
                                                                        moveme = 1
                                                                        cfgprot = 1
index 26019400b89bd8f69ce019a911a61fa9733d8dba..39e29d540c86f0e5ab0fb3720cc2d0422771d8bd 100644 (file)
@@ -5,6 +5,7 @@
 
 __all__ = ["cache"]
 
+import stat
 import sys
 import warnings
 from portage.util import normalize_path
@@ -95,7 +96,7 @@ class cache(object):
                                if not y.endswith(".eclass"):
                                        continue
                                try:
-                                       mtime = long(os.stat(os.path.join(x, y)).st_mtime)
+                                       mtime = os.stat(os.path.join(x, y))[stat.ST_MTIME]
                                except OSError:
                                        continue
                                ys=y[:-eclass_len]
index 3df7b08f3ac3af8eb0869376f676e2afe13dce29..7629179359224e3329794b7ef6367400f7459fae 100644 (file)
@@ -5,6 +5,7 @@
 import codecs
 import errno
 import re
+import stat
 import sys
 
 from portage import os
@@ -122,7 +123,7 @@ def grab_updates(updpath, prev_mtimes=None):
                file_path = os.path.join(updpath, myfile)
                mystat = os.stat(file_path)
                if file_path not in prev_mtimes or \
-               long(prev_mtimes[file_path]) != long(mystat.st_mtime):
+               long(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]:
                        content = codecs.open(_unicode_encode(file_path,
                                encoding=_encodings['fs'], errors='strict'),
                                mode='r', encoding=_encodings['repo.content'], errors='replace'
index 3156894f6feb18995c0f35271f7457df38082f57..4e83e66539fe825e4601d24af7f951ce6362aa94 100644 (file)
@@ -374,6 +374,12 @@ class EMakeParallelDisabledViaMAKEOPTS(LineCheck):
        re = re.compile(r'^\s*MAKEOPTS=(\'|")?.*-j\s*1\b')
        error = errors.EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS
 
+class NoAsNeeded(LineCheck):
+       """Check for calls to the no-as-needed function."""
+       repoman_check_name = 'upstream.workaround'
+       re = re.compile(r'.*\$\(no-as-needed\)')
+       error = errors.NO_AS_NEEDED
+
 class DeprecatedBindnowFlags(LineCheck):
        """Check for calls to the deprecated bindnow-flags function."""
        repoman_check_name = 'ebuild.minorsyn'
@@ -468,7 +474,7 @@ _constant_checks = tuple((c() for c in (
        EbuildUselessCdS, EbuildNestedDie,
        EbuildPatches, EbuildQuotedA, EapiDefinition,
        IUseUndefined, InheritAutotools,
-       EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS,
+       EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded,
        DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue,
        SrcCompileEconf, Eapi4IncompatibleFuncs, Eapi4GoneVars)))
 
index bab2faca7a1abec5346a81cc44e274c0f68359a4..b62af12b366da6e02c44c905460f91599b4059de 100644 (file)
@@ -17,3 +17,4 @@ EMAKE_PARALLEL_DISABLED = 'Upstream parallel compilation bug (ebuild calls emake
 EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS = 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)'
 DEPRECATED_BINDNOW_FLAGS = 'Deprecated bindnow-flags call on line: %d'
 EAPI_DEFINED_AFTER_INHERIT = 'EAPI defined after inherit on line: %d'
+NO_AS_NEEDED = 'Upstream asneeded linking bug (no-as-needed on line: %d)'