Merged from trunk 10709:10715
authorFabian Groffen <grobian@gentoo.org>
Wed, 18 Jun 2008 15:41:54 +0000 (15:41 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 18 Jun 2008 15:41:54 +0000 (15:41 -0000)
   | 10710   | Use optparse instead of getopt.                              |
   | zmedico |                                                              |

   | 10711   | Add a help string for --debug.                               |
   | zmedico |                                                              |

   | 10712   | Bug #225285 - Add a --skip-manifest option that disables all |
   | zmedico | interaction with the manifest.                               |

   | 10713   | Bug #225285 - Add support for persistent options stored in   |
   | zmedico | the EBUILD_DEFAULT_OPTS environment variable (similar to     |
   |         | {EMERGE,QUICKPKG}_DEFAULT_OPTS).                             |

   | 10714   | Add an exemption for x-modular in the "inherit.autotools"    |
   | zmedico | check. Thanks to remi` for reporting.                        |

   | 10715   | As suggested by remi`, make the 'inherit.autotools' check    |
   | zmedico | only ebuilds that inherit the autotools eclass directly      |
   |         | (rather than indirectly through an eclass such as apache-2   |
   |         | or x-modular).                                               |

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

bin/ebuild
pym/portage/__init__.py
pym/repoman/checks.py

index 53fa7cdd4e466f122bf6b815f3464fff4510cc87..1f6088654e850c2020211db39e5026d3c0e0e703 100755 (executable)
@@ -3,22 +3,32 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.18.2.3 2005/05/07 04:32:59 ferringb Exp $
 
-import getopt, os, sys
+import optparse
+import os
+import sys
 
-if len(sys.argv) <= 2:
-       print "Usage: ebuild <ebuild file> <command> [command] ..."
-       print ""
-       print "See the ebuild(1) man page for more info"
-       sys.exit(1)
+description = "See the ebuild(1) man page for more info"
+usage = "Usage: ebuild <ebuild file> <command> [command] ..."
+parser = optparse.OptionParser(description=description, usage=usage)
 
+force_help = "When used together with the digest or manifest " + \
+       "command, this option forces regeneration of digests for all " + \
+       "distfiles associated with the current ebuild. Any distfiles " + \
+       "that do not already exist in ${DISTDIR} will be automatically fetched."
 
-try:
-       opts, pargs = getopt.getopt(sys.argv[1:], '', ['debug', 'force'])
-except getopt.GetoptError, e:
-       print e
-       sys.exit(1)
-debug = ("--debug",'') in opts
-force = ("--force",'') in opts
+parser.add_option("--force", help=force_help, action="store_true", dest="force")
+parser.add_option("--debug", help="show debug output",
+       action="store_true", dest="debug")
+parser.add_option("--ignore-default-opts",
+       action="store_true",
+       help="do not use the EBUILD_DEFAULT_OPTS environment variable")
+parser.add_option("--skip-manifest", help="skip all manifest checks",
+       action="store_true", dest="skip_manifest")
+
+opts, pargs = parser.parse_args(args=sys.argv[1:])
+
+if len(pargs) < 2:
+       parser.error("missing required args")
 
 if "merge" in pargs:
        print "Disabling noauto in features... merge disables it. (qmerge doesn't)"
@@ -35,6 +45,13 @@ else:
        sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "pym"))
 import portage
 
+if not opts.ignore_default_opts:
+       default_opts = portage.settings.get("EBUILD_DEFAULT_OPTS", "").split()
+       opts, pargs = parser.parse_args(default_opts + sys.argv[1:])
+
+debug = opts.debug
+force = opts.force
+
 import portage.util, portage.const
 import portage.dep
 portage.dep._dep_check_strict = True
@@ -148,6 +165,11 @@ if "test" in pargs:
                tmpsettings["FEATURES"] = " ".join(tmpsettings.features)
                tmpsettings.backup_changes("FEATURES")
 
+if opts.skip_manifest:
+       tmpsettings["EBUILD_SKIP_MANIFEST"] = "1"
+       tmpsettings.backup_changes("EBUILD_SKIP_MANIFEST")
+       portage._doebuild_manifest_exempt_depend += 1
+
 build_dir_phases = set(["setup", "unpack", "compile",
        "test", "install", "package", "rpm"])
 
index 639056a1eddb3e7ca8814fffef42cb27983fb82e..238af6cda0f090d32b4449768ef621e3016d837a 100644 (file)
@@ -3316,8 +3316,9 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                if try_mirrors:
                        mymirrors += [x.rstrip("/") for x in mysettings["GENTOO_MIRRORS"].split() if x]
 
+       skip_manifest = mysettings.get("EBUILD_SKIP_MANIFEST") == "1"
        pkgdir = mysettings.get("O")
-       if pkgdir is not None:
+       if not (pkgdir is None or skip_manifest):
                mydigests = Manifest(
                        pkgdir, mysettings["DISTDIR"]).getTypeDigests("DIST")
        else:
@@ -4083,6 +4084,8 @@ def digestcheck(myfiles, mysettings, strict=0, justmanifest=0):
        """Verifies checksums.  Assumes all files have been downloaded.
        DEPRECATED: this is now only a compability wrapper for 
                    portage.manifest.Manifest()."""
+       if mysettings.get("EBUILD_SKIP_MANIFEST") == "1":
+               return 1
        pkgdir = mysettings["O"]
        manifest_path = os.path.join(pkgdir, "Manifest")
        if not os.path.exists(manifest_path):
index 0f339adbcd0060ed79d4dfefe23384ae861e724c..b4caff27ff1537b72b66d0ac54ef383bae9b5f8b 100644 (file)
@@ -219,6 +219,7 @@ _constant_checks = tuple((c() for c in (
 
 _iuse_def_re = re.compile(r'^IUSE=.*')
 _comment_re = re.compile(r'(^|\s*)#')
+_inherit_autotools_re = re.compile(r'^\s*inherit\s(.*\s)?autotools(\s|$)')
 _autotools_funcs = (
        "eaclocal", "eautoconf", "eautoheader",
        "eautomake", "eautoreconf", "_elibtoolize")
@@ -229,17 +230,15 @@ def run_checks(contents, pkg):
        checks = list(_constant_checks)
        checks.append(EbuildHeader(pkg.mtime))
        iuse_def = None
-       inherit_autotools = "autotools" in pkg.inherited
-       if inherit_autotools:
-               if "apache-2" in pkg.inherited:
-                       # eautoreconf is called by apache-2_src_unpack(),
-                       # so the ebuild doesn't need to call it.
-                       inherit_autotools = False
+       inherit_autotools = None
        autotools_func_call = None
        for num, line in enumerate(contents):
                comment = _comment_re.match(line)
                if comment is None:
-                       if inherit_autotools and autotools_func_call is None:
+                       if inherit_autotools is None:
+                               inherit_autotools = _inherit_autotools_re.match(line)
+                       if inherit_autotools is not None and \
+                               autotools_func_call is None:
                                autotools_func_call = _autotools_func_re.search(line)
                        if iuse_def is None:
                                iuse_def = _iuse_def_re.match(line)