summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesus Rivero <neurogeek@gentoo.org>2011-08-13 14:06:30 -0400
committerJesus Rivero <neurogeek@gentoo.org>2011-08-13 14:06:30 -0400
commita61a2f518af0ae586be95ddf21a6c0d6ac6e6dcb (patch)
tree3ae2f00c675e15fa3d989eb0f7c336df51443bfc
parentUpdated version and changed metagenerator import in main.py to from...import ... (diff)
downloadmetagen-a61a2f518af0ae586be95ddf21a6c0d6ac6e6dcb.tar.gz
metagen-a61a2f518af0ae586be95ddf21a6c0d6ac6e6dcb.tar.bz2
metagen-a61a2f518af0ae586be95ddf21a6c0d6ac6e6dcb.zip
Added checks for HERD existance
-rwxr-xr-xmetagen/main.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/metagen/main.py b/metagen/main.py
index 06f0239..22abbd5 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -1,31 +1,31 @@
#!/usr/bin/python
-
"""
NAME - metagen
-
SYNOPSIS - Adds metadata.xml to current directory
-
-AUTHOR - Rob Cakebread <pythonhead@gentoo.org>
-
+AUTHOR - Rob Cakebread <cakebread@gmail.com>
+AUTHOR - Jesus Rivero <neurogeek@gentoo.org>
USE - metagen --help
-
EXAMPLES - man metagen
"""
-import sys
import re
import os
+import sys
from optparse import OptionParser
from commands import getstatusoutput
+from portage import config
+from repoman import herdbase
from portage.output import red, blue
from metagen.version import __version__
from metagen import metagenerator
+PORTDIR = config(local_config=False)["PORTDIR"]
+HB = herdbase.make_herd_base(os.path.sep.join([PORTDIR, 'metadata', 'herds.xml']))
def parse_echangelog_variable(name, email):
"""Extract developer name and email from ECHANGELOG_USER variable"""
@@ -64,6 +64,12 @@ def generate_xml(options):
herds = options.herd.split(",")
else:
herds = ["no-herd"]
+
+ for herd in herds:
+ if not HB.known_herd(herd):
+ print red("!!! Error. Herd %s does not exist." % herd)
+ sys.exit(1)
+
metadata.set_herd(herds)
if options.echangelog: