diff options
Diffstat (limited to 'ipsutils')
-rw-r--r-- | ipsutils/config.py | 12 | ||||
-rw-r--r-- | ipsutils/env.py | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/ipsutils/config.py b/ipsutils/config.py index 756d8fa..eed142c 100644 --- a/ipsutils/config.py +++ b/ipsutils/config.py @@ -38,6 +38,7 @@ class Config(object): key_dict['arch'] = '' key_dict['classification'] = '' key_dict['description'] = '' + key_dict['badpath'] = '' #Define valid build script sections in SPEC file script_dict = collections.OrderedDict() @@ -56,7 +57,7 @@ class Config(object): for line in file(ipsfile).readlines(): parts = shlex.split(line) if key + ":" in parts: - key_dict[key] = parts[1] + key_dict[key] = line[line.find(':')+1:].lstrip(' ').rstrip('\n').rstrip(' ') #Drop using the original file in favor of a StringIO buffer #Because we need room to breathe without rewriting the file @@ -76,8 +77,8 @@ class Config(object): for line in ipsfile_output: parts = shlex.split(line) if key + ":" in parts: - key_dict[key] = parts[1] - + key_dict[key] = line[line.find(':')+1:].lstrip(' ').rstrip('\n').rstrip(' ') + #Parse user defined scripts by section and store them in script_dict found_data = False code_section = ['%build', '%prep', '%install', '%transforms'] @@ -88,7 +89,7 @@ class Config(object): continue if line.startswith('#'): continue - parts = shlex.split(line) + parts = shlex.split(line, posix=False) if '%end' in parts: found_data = False if section in parts: @@ -103,6 +104,9 @@ class Config(object): if not self.check_keywords(): exit(1) + def _quote(self, s): + return "'" + s.replace("'", "'\\''") + "'" + def check_keywords(self): """Validate SPEC file's FMRI section """ diff --git a/ipsutils/env.py b/ipsutils/env.py index ce9dd21..0551b3c 100644 --- a/ipsutils/env.py +++ b/ipsutils/env.py @@ -46,9 +46,12 @@ class Environment(config.Config): 'PKGS': self.pathgen('PKGS'), 'SPKGS': self.pathgen('SPKGS') } + # complete_name is required to build proper path names. - # The use of "self" in this case may be deprecated in the future. self.complete_name = self.key_dict['name'] + '-' + self.key_dict['version'] + if self.key_dict['badpath']: + self.complete_name = self.key_dict['badpath'] + # Dictionary of package-level directories self.env_pkg = { 'BUILDROOT': os.path.join(self.env['BUILDROOT'], self.complete_name), |