1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/usr/bin/python -O
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/bin/ebuild,v 1.22 2005/05/07 04:46:49 ferringb Exp $
import os,sys
sys.path = ["/usr/lib/portage/pym"]+sys.path
import portage_util
def getroot():
try:
a=os.environ["ROOT"]
if a == '/':
return '/'
except SystemExit, e:
raise # Needed else we can't exit.
except:
return '/'
return os.path.normpath(a)+'/'
os.environ["PORTAGE_CALLER"]="ebuild"
if len(sys.argv)<=2:
print "expecting two arguments."
sys.exit(1)
import getopt
debug=0
opts,pargs=getopt.getopt(sys.argv[1:],'',['debug'])
for opt in opts:
if opt[0]=='--debug':
debug=1
if "merge" in pargs:
print "Disabling noauto in features... merge disables it. (qmerge doesn't)"
os.environ["FEATURES"] = os.environ.get("FEATURES", "") + " -noauto"
import portage, portage_util
for x in pargs[1:]:
try:
tmpsettings = portage.config(clone=portage.settings)
if x in ['clean','config']:
cleanup=1
else:
cleanup=0
a=portage.doebuild(pargs[0],x,getroot(),tmpsettings,debug=debug,cleanup=cleanup)
except KeyboardInterrupt:
print "(interrupted by user -- ctrl-C?)"
a=1
except IOError:
a=1
print "ebuild: this ebuild generated output during the depend phase (bad)"
if a == None:
portage_util.writemsg("Could not run the required binary?\n")
sys.exit(127)
if a:
sys.exit(a)
|