Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Wed, 27 Mar 2013 19:11:04
Message-Id: 1364411728.37f33e94d7bb3049414c093f6c483041d2c17dc3.vapier@gentoo
1 commit: 37f33e94d7bb3049414c093f6c483041d2c17dc3
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 27 19:14:22 2013 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 27 19:15:28 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=37f33e94
7
8 ebuild: standardize error output a bit
9
10 A bunch of the messages are written to stdout instead of stderr, and
11 lack any sort of general context.
12
13 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
14
15 ---
16 bin/ebuild | 23 ++++++++++-------------
17 1 files changed, 10 insertions(+), 13 deletions(-)
18
19 diff --git a/bin/ebuild b/bin/ebuild
20 index 1ce4c9c..876aaf7 100755
21 --- a/bin/ebuild
22 +++ b/bin/ebuild
23 @@ -77,6 +77,10 @@ from portage.const import VDB_PATH
24 from _emerge.Package import Package
25 from _emerge.RootConfig import RootConfig
26
27 +def err(txt):
28 + portage.writemsg('ebuild: %s\n' % (txt,), noiselevel=-1)
29 + sys.exit(1)
30 +
31 if opts.version:
32 print("Portage", portage.VERSION)
33 sys.exit(os.EX_OK)
34 @@ -115,9 +119,7 @@ if ebuild.endswith(".ebuild"):
35 pf = os.path.basename(ebuild)[:-7]
36
37 if pf is None:
38 - portage.writemsg("'%s' does not end with '.ebuild'.\n" % \
39 - (ebuild,), noiselevel=-1)
40 - sys.exit(1)
41 + err("%s: does not end with '.ebuild'" % (ebuild,))
42
43 if not os.path.isabs(ebuild):
44 mycwd = os.getcwd()
45 @@ -163,8 +165,7 @@ if ebuild_portdir != vdb_path:
46 myrepo = portage.portdb.getRepositoryName(ebuild_portdir)
47
48 if not os.path.exists(ebuild):
49 - print("'%s' does not exist." % ebuild)
50 - sys.exit(1)
51 + err('%s: does not exist' % (ebuild,))
52
53 ebuild_split = ebuild.split("/")
54 cpv = "%s/%s" % (ebuild_split[-3], pf)
55 @@ -175,8 +176,7 @@ with io.open(_unicode_encode(ebuild, encoding=_encodings['fs'], errors='strict')
56 if eapi is None:
57 eapi = "0"
58 if not portage.catpkgsplit(cpv, eapi=eapi):
59 - print("!!! %s does not follow correct package syntax." % (cpv))
60 - sys.exit(1)
61 + err('%s: %s: does not follow correct package syntax' % (ebuild, cpv))
62
63 if ebuild.startswith(vdb_path):
64 mytree = "vartree"
65 @@ -185,8 +185,7 @@ if ebuild.startswith(vdb_path):
66 portage_ebuild = portage.db[portage.root][mytree].dbapi.findname(cpv, myrepo=myrepo)
67
68 if os.path.realpath(portage_ebuild) != ebuild:
69 - print("!!! Portage seems to think that %s is at %s" % (cpv, portage_ebuild))
70 - sys.exit(1)
71 + err('Portage seems to think that %s is at %s' % (cpv, portage_ebuild))
72
73 else:
74 mytree = "porttree"
75 @@ -195,12 +194,10 @@ else:
76 portage_ebuild = portage.portdb.findname(cpv, myrepo=myrepo)
77
78 if not portage_ebuild or portage_ebuild != ebuild:
79 - print("!!! %s does not seem to have a valid PORTDIR structure." % ebuild)
80 - sys.exit(1)
81 + err('%s: does not seem to have a valid PORTDIR structure' % (ebuild,))
82
83 if len(pargs) > 1 and "config" in pargs:
84 - print("config must be called on it's own, not combined with any other phase")
85 - sys.exit(1)
86 + err('"config" must not be called with any other phase')
87
88 def discard_digests(myebuild, mysettings, mydbapi):
89 """Discard all distfiles digests for the given ebuild. This is useful when