aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2013-06-04 13:02:02 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2013-06-04 13:02:02 -0400
commit8001e332bb03904a08d5ddbc1ee970c643d8e8a9 (patch)
tree2b29a246190f02fb28224eee3b8f119e92ca7cfa
parent401574c5843e6c479bf05367116b02300787124b (diff)
downloadipsutils-8001e332bb03904a08d5ddbc1ee970c643d8e8a9.tar.gz
Implement keyword checking in ips file parsing
-rw-r--r--ipsutils/config.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ipsutils/config.py b/ipsutils/config.py
index 41400a3..3ef79f8 100644
--- a/ipsutils/config.py
+++ b/ipsutils/config.py
@@ -70,6 +70,7 @@ class Config(object):
if key + ":" in parts:
key_dict[key] = parts[1]
+ #Parse user defined scripts by section and store them in script_dict
found_data = False
code_section = ['%build', '%prep', '%install', '%transforms']
@@ -91,3 +92,16 @@ class Config(object):
#Assign completed dictionaries to global class scope
self.key_dict = key_dict
self.script_dict = script_dict
+ if not self.check_keywords():
+ exit(1)
+
+ def check_keywords(self):
+ mandatory = ['arch', 'classification', 'description', 'group',
+ 'license', 'maintainer', 'name', 'release', 'source_url', 'summary',
+ 'version']
+ #Get list of keys without data
+ for k, v in sorted(self.key_dict.items()):
+ if k in mandatory and not v:
+ print("Mandatory keyword \'{}\' has no value".format(k))
+ return False
+ return True