# 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)"
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
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"])
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:
"""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):
_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")
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)