diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2013-07-09 15:25:03 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2013-07-09 15:25:03 -0400 |
commit | 34abef358862d5e7fb151f74e33bc5e79b40698b (patch) | |
tree | 49e3f43651a13ba48ef764af331baf96584f0aa5 | |
parent | 3e916a8d425c07a91b628f65b1a77c30aa7a442b (diff) | |
download | ipsutils-34abef358862d5e7fb151f74e33bc5e79b40698b.tar.gz |
Implement 'badpath' keyword to circumvent evil archivers (aka programmers)
-rw-r--r-- | ipsutils/config.py | 6 | ||||
-rw-r--r-- | ipsutils/env.py | 5 | ||||
-rw-r--r-- | simple.ips | 30 |
3 files changed, 39 insertions, 2 deletions
diff --git a/ipsutils/config.py b/ipsutils/config.py index 756d8fa..3f4dc08 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() @@ -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), diff --git a/simple.ips b/simple.ips new file mode 100644 index 0000000..08029b2 --- /dev/null +++ b/simple.ips @@ -0,0 +1,30 @@ +name: simple +repackage: +version: +release: 1 +group: +summary: "" +license: +maintainer: "" +upstream_url: +source_url: +arch: +classification: "" +description: "" + + +%prep + +%end + +%build + +%end + +%install + +%end + +%transforms + +%end |