Ejemplo n.º 1
0
 def patch(self, package, args):
     #
     # Scan the patches found in the config file for the one we are
     # after. Infos or tags are lists.
     #
     patches = package.patches()
     url = None
     for p in patches:
         if args[0][1:].lower() == p:
             url = patches[p][0]
             break
     if url is None:
         raise error.general('patch tag not found: %s' % (args[0]))
     #
     # Parse the URL first in the source builder's patch directory.
     #
     patch = download.parse_url(url, '_patchdir', self.config, self.opts)
     #
     # If not in the source builder package check the source directory.
     #
     if not path.exists(patch['local']):
         patch = download.parse_url(url, '_patchdir', self.config, self.opts)
     download.get_file(patch['url'], patch['local'], self.opts, self.config)
     if 'compressed' in patch:
         patch['script'] = patch['compressed'] + ' ' +  patch['local']
     else:
         patch['script'] = '%{__cat} ' + patch['local']
     patch['script'] += ' | %{__patch} ' + ' '.join(args[1:])
     self.script.append(self.config.expand(patch['script']))
Ejemplo n.º 2
0
 def patch(self, package, args):
     #
     # Scan the patches found in the config file for the one we are
     # after. Infos or tags are lists.
     #
     patches = package.patches()
     url = None
     for p in patches:
         if args[0][1:].lower() == p:
             url = patches[p][0]
             break
     if url is None:
         raise error.general('patch tag not found: %s' % (args[0]))
     #
     # Parse the URL first in the source builder's patch directory.
     #
     patch = download.parse_url(url, '_patchdir', self.config, self.opts)
     #
     # If not in the source builder package check the source directory.
     #
     if not path.exists(patch['local']):
         patch = download.parse_url(url, '_patchdir', self.config,
                                    self.opts)
     download.get_file(patch['url'], patch['local'], self.opts, self.config)
     if 'compressed' in patch:
         patch['script'] = patch['compressed'] + ' ' + patch['local']
     else:
         patch['script'] = '%{__cat} ' + patch['local']
     patch['script'] += ' | %{__patch} ' + ' '.join(args[1:])
     self.script.append(self.config.expand(patch['script']))
Ejemplo n.º 3
0
 def source(self, name):
     #
     # Return the list of sources. Merge in any macro defined sources as
     # these may be overridden by user loaded macros.
     #
     _map = 'source-%s' % (name)
     src_keys = self.macros.map_keys(_map)
     if len(src_keys) == 0:
         raise error.general('no source set: %s (%s)' % (name, _map))
     srcs = []
     for s in src_keys:
         sm = self.macros.get(s, globals = False, maps = _map)
         if sm is None:
             raise error.internal('source macro not found: %s in %s (%s)' % \
                                      (s, name, _map))
         url = self.config.expand(sm[2])
         src = download.parse_url(url, '_sourcedir', self.config, self.opts)
         download.get_file(src['url'], src['local'], self.opts, self.config)
         if 'symlink' in src:
             src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], name)
         elif 'compressed' in src:
             #
             # Zip files unpack as well so do not use tar.
             #
             src['script'] = '%s %s' % (src['compressed'], src['local'])
             if src['compressed-type'] != 'zip':
                 src['script'] += ' | %{__tar_extract} -'
         else:
             src['script'] = '%%{__tar_extract} %s' % (src['local'])
         srcs += [src]
     return srcs
 def source(self, name):
     #
     # Return the list of sources. Merge in any macro defined sources as
     # these may be overridden by user loaded macros.
     #
     _map = 'source-%s' % (name)
     src_keys = [s for s in self.macros.map_keys(_map) if s != 'setup']
     if len(src_keys) == 0:
         raise error.general('no source set: %s (%s)' % (name, _map))
     srcs = []
     for s in src_keys:
         sm = self.macros.get(s, globals=False, maps=_map)
         if sm is None:
             raise error.internal('source macro not found: %s in %s (%s)' % \
                                      (s, name, _map))
         url = self.config.expand(sm[2])
         src = download.parse_url(url, '_sourcedir', self.config, self.opts)
         download.get_file(src['url'], src['local'], self.opts, self.config)
         if 'symlink' in src:
             sname = name.replace('-', '_')
             src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (
                 src['symlink'], sname)
         elif 'compressed' in src:
             #
             # Zip files unpack as well so do not use tar.
             #
             src['script'] = '%s %s' % (src['compressed'], src['local'])
             if src['compressed-type'] != 'zip':
                 src['script'] += ' | %{__tar_extract} -'
         else:
             src['script'] = '%%{__tar_extract} %s' % (src['local'])
         srcs += [src]
     return srcs
Ejemplo n.º 5
0
 def source(self, package, source_tag):
     #
     # Scan the sources found in the config file for the one we are
     # after. Infos or tags are lists. Merge in any macro defined
     # sources as these may be overridden by user loaded macros.
     #
     sources = package.sources()
     url = None
     for s in sources:
         tag = s[len('source'):]
         if tag.isdigit():
             if int(tag) == source_tag:
                 url = sources[s][0]
                 break
     if url is None:
         raise error.general('source tag not found: source%d' %
                             (source_tag))
     source = download.parse_url(url, '_sourcedir', self.config, self.opts)
     download.get_file(source['url'], source['local'], self.opts,
                       self.config)
     if 'symlink' in source:
         source['script'] = '%%{__ln_s} %s ${source_dir_%d}' % (
             source['symlink'], source_tag)
     elif 'compressed' in source:
         source['script'] = source['compressed'] + ' ' + \
             source['local'] + ' | %{__tar_extract} -'
     else:
         source['script'] = '%{__tar_extract} ' + source['local']
     return source
Ejemplo n.º 6
0
 def source(self, name):
     #
     # Return the list of sources. Merge in any macro defined sources as
     # these may be overridden by user loaded macros.
     #
     _map = "source-%s" % (name)
     src_keys = self.macros.map_keys(_map)
     if len(src_keys) == 0:
         raise error.general("no source set: %s (%s)" % (name, _map))
     srcs = []
     for s in src_keys:
         sm = self.macros.get(s, globals=False, maps=_map)
         if sm is None:
             raise error.internal("source macro not found: %s in %s (%s)" % (s, name, _map))
         url = self.config.expand(sm[2])
         src = download.parse_url(url, "_sourcedir", self.config, self.opts)
         download.get_file(src["url"], src["local"], self.opts, self.config)
         if "symlink" in src:
             src["script"] = "%%{__ln_s} %s ${source_dir_%s}" % (src["symlink"], name)
         elif "compressed" in src:
             #
             # Zip files unpack as well so do not use tar.
             #
             src["script"] = "%s %s" % (src["compressed"], src["local"])
             if src["compressed-type"] != "zip":
                 src["script"] += " | %{__tar_extract} -"
         else:
             src["script"] = "%%{__tar_extract} %s" % (src["local"])
         srcs += [src]
     return srcs
Ejemplo n.º 7
0
 def source(self, package, source_tag):
     #
     # Scan the sources found in the config file for the one we are
     # after. Infos or tags are lists. Merge in any macro defined
     # sources as these may be overridden by user loaded macros.
     #
     sources = package.sources()
     url = None
     for s in sources:
         tag = s[len('source'):]
         if tag.isdigit():
             if int(tag) == source_tag:
                 url = sources[s][0]
                 break
     if url is None:
         raise error.general('source tag not found: source%d' % (source_tag))
     source = download.parse_url(url, '_sourcedir', self.config, self.opts)
     download.get_file(source['url'], source['local'], self.opts, self.config)
     if 'symlink' in source:
         source['script'] = '%%{__ln_s} %s ${source_dir_%d}' % (source['symlink'], source_tag)
     elif 'compressed' in source:
         source['script'] = source['compressed'] + ' ' + \
             source['local'] + ' | %{__tar_extract} -'
     else:
         source['script'] = '%{__tar_extract} ' + source['local']
     return source
 def patch_setup(self, package, args):
     name = args[1]
     args = args[2:]
     _map = 'patch-%s' % (name)
     default_opts = ' '.join(args)
     patch_keys = [p for p in self.macros.map_keys(_map) if p != 'setup']
     patches = []
     for p in patch_keys:
         pm = self.macros.get(p, globals = False, maps = _map)
         if pm is None:
             raise error.internal('patch macro not found: %s in %s (%s)' % \
                                      (p, name, _map))
         opts = []
         url = []
         for pp in pm[2].split():
             if len(url) == 0 and pp[0] == '-':
                 opts += [pp]
             else:
                 url += [pp]
         if len(url) == 0:
             raise error.general('patch URL not found: %s' % (' '.join(opts)))
         #
         # Look for --rsb-file as an option we use as a local file name.
         # This can be used if a URL has no reasonable file name the
         # download URL parser can figure out.
         #
         file_override = None
         if len(opts) > 0:
             for o in opts:
                 if o.startswith('--rsb-file'):
                    os_ = o.split('=')
                    if len(os_) != 2:
                        raise error.general('invalid --rsb-file option: %s' % \
                                            (' '.join(opts)))
                    if os_[0] != '--rsb-file':
                        raise error.general('invalid --rsb-file option: %s' % \
                                            (' '.join(opts)))
                    file_override = os_[1]
             opts = [o for o in opts if not o.startswith('--rsb-')]
         if len(opts) == 0:
             opts = default_opts
         else:
             opts = ' '.join(opts)
         opts = self.config.expand(opts)
         url = self.config.expand(' '.join(url))
         #
         # Parse the URL first in the source builder's patch directory.
         #
         patch = download.parse_url(url, '_patchdir', self.config,
                                    self.opts, file_override)
         #
         # Download the patch
         #
         download.get_file(patch['url'], patch['local'], self.opts, self.config)
         if 'compressed' in patch:
             patch['script'] = patch['compressed'] + ' ' +  patch['local']
         else:
             patch['script'] = '%{__cat} ' + patch['local']
         patch['script'] += ' | %%{__patch} %s' % (opts)
         self.script_build.append(self.config.expand(patch['script']))
 def patch_setup(self, package, args):
     name = args[1]
     args = args[2:]
     _map = 'patch-%s' % (name)
     default_opts = ' '.join(args)
     patch_keys = [p for p in self.macros.map_keys(_map) if p != 'setup']
     patches = []
     for p in patch_keys:
         pm = self.macros.get(p, globals=False, maps=_map)
         if pm is None:
             raise error.internal('patch macro not found: %s in %s (%s)' % \
                                      (p, name, _map))
         opts = []
         url = []
         for pp in pm[2].split():
             if len(url) == 0 and pp[0] == '-':
                 opts += [pp]
             else:
                 url += [pp]
         if len(url) == 0:
             raise error.general('patch URL not found: %s' %
                                 (' '.join(args)))
         if len(opts) == 0:
             opts = default_opts
         else:
             opts = ' '.join(opts)
         opts = self.config.expand(opts)
         url = self.config.expand(' '.join(url))
         #
         # Parse the URL first in the source builder's patch directory.
         #
         patch = download.parse_url(url, '_patchdir', self.config,
                                    self.opts)
         #
         # If not in the source builder package check the source directory.
         #
         if not path.exists(patch['local']):
             patch = download.parse_url(url, '_patchdir', self.config,
                                        self.opts)
         download.get_file(patch['url'], patch['local'], self.opts,
                           self.config)
         if 'compressed' in patch:
             patch['script'] = patch['compressed'] + ' ' + patch['local']
         else:
             patch['script'] = '%{__cat} ' + patch['local']
         patch['script'] += ' | %%{__patch} %s' % (opts)
         self.script.append(self.config.expand(patch['script']))
Ejemplo n.º 10
0
 def patch_setup(self, package, args):
     name = args[1]
     args = args[2:]
     _map = 'patch-%s' % (name)
     default_opts = ' '.join(args)
     patch_keys = [p for p in self.macros.map_keys(_map) if p != 'setup']
     patches = []
     for p in patch_keys:
         pm = self.macros.get(p, globals = False, maps = _map)
         if pm is None:
             raise error.internal('patch macro not found: %s in %s (%s)' % \
                                      (p, name, _map))
         opts = []
         url = []
         for pp in pm[2].split():
             if len(url) == 0 and pp[0] == '-':
                 opts += [pp]
             else:
                 url += [pp]
         if len(url) == 0:
             raise error.general('patch URL not found: %s' % (' '.join(args)))
         #
         # Look for --rsb-file as an option we use as a local file name.
         # This can be used if a URL has no reasonable file name the
         # download URL parser can figure out.
         #
         file_override = None
         if len(opts) > 0:
             for o in opts:
                 if o.startswith('--rsb-file'):
                    os_ = o.split('=')
                    if len(os_) != 2:
                        raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
                    if os_[0] != '--rsb-file':
                        raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
                    file_override = os_[1]
             opts = [o for o in opts if not o.startswith('--rsb-')]
         if len(opts) == 0:
             opts = default_opts
         else:
             opts = ' '.join(opts)
         opts = self.config.expand(opts)
         url = self.config.expand(' '.join(url))
         #
         # Parse the URL first in the source builder's patch directory.
         #
         patch = download.parse_url(url, '_patchdir', self.config, self.opts, file_override)
         #
         # Download the patch
         #
         download.get_file(patch['url'], patch['local'], self.opts, self.config)
         if 'compressed' in patch:
             patch['script'] = patch['compressed'] + ' ' +  patch['local']
         else:
             patch['script'] = '%{__cat} ' + patch['local']
         patch['script'] += ' | %%{__patch} %s' % (opts)
         self.script.append(self.config.expand(patch['script']))
Ejemplo n.º 11
0
 def source(self, name):
     #
     # Return the list of sources. Merge in any macro defined sources as
     # these may be overridden by user loaded macros.
     #
     _map = 'source-%s' % (name)
     src_keys = [s for s in self.macros.map_keys(_map) if s != 'setup']
     if len(src_keys) == 0:
         raise error.general('no source set: %s (%s)' % (name, _map))
     srcs = []
     for s in src_keys:
         sm = self.macros.get(s, globals = False, maps = _map)
         if sm is None:
             raise error.internal('source macro not found: %s in %s (%s)' % \
                                      (s, name, _map))
         opts = []
         url = []
         for sp in sm[2].split():
             if len(url) == 0 and sp[0] == '-':
                 opts += [sp]
             else:
                 url += [sp]
         if len(url) == 0:
             raise error.general('source URL not found: %s' % (' '.join(args)))
         #
         # Look for --rsb-file as an option we use as a local file name.
         # This can be used if a URL has no reasonable file name the
         # download URL parser can figure out.
         #
         file_override = None
         if len(opts) > 0:
             for o in opts:
                 if o.startswith('--rsb-file'):
                    os_ = o.split('=')
                    if len(os_) != 2:
                        raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
                    if os_[0] != '--rsb-file':
                        raise error.general('invalid --rsb-file option: %s' % (' '.join(args)))
                    file_override = os_[1]
             opts = [o for o in opts if not o.startswith('--rsb-')]
         url = self.config.expand(' '.join(url))
         src = download.parse_url(url, '_sourcedir', self.config, self.opts, file_override)
         download.get_file(src['url'], src['local'], self.opts, self.config)
         if 'symlink' in src:
             sname = name.replace('-', '_')
             src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], sname)
         elif 'compressed' in src:
             #
             # Zip files unpack as well so do not use tar.
             #
             src['script'] = '%s %s' % (src['compressed'], src['local'])
             if src['compressed-type'] != 'zip':
                 src['script'] += ' | %{__tar_extract} -'
         else:
             src['script'] = '%%{__tar_extract} %s' % (src['local'])
         srcs += [src]
     return srcs
Ejemplo n.º 12
0
 def patch_setup(self, package, args):
     name = args[1]
     args = args[2:]
     _map = 'patch-%s' % (name)
     default_opts = ' '.join(args)
     patch_keys = self.macros.map_keys(_map)
     patches = []
     for p in patch_keys:
         pm = self.macros.get(p, globals = False, maps = _map)
         if pm is None:
             raise error.internal('patch macro not found: %s in %s (%s)' % \
                                      (p, name, _map))
         opts = []
         url = []
         for pp in pm[2].split():
             if len(url) == 0 and pp[0] == '-':
                 opts += [pp]
             else:
                 url += [pp]
         if len(url) == 0:
             raise error.general('patch URL not found: %s' % (' '.join(args)))
         if len(opts) == 0:
             opts = default_opts
         else:
             opts = ' '.join(opts)
         opts = self.config.expand(opts)
         url = self.config.expand(' '.join(url))
         #
         # Parse the URL first in the source builder's patch directory.
         #
         patch = download.parse_url(url, '_patchdir', self.config, self.opts)
         #
         # If not in the source builder package check the source directory.
         #
         if not path.exists(patch['local']):
             patch = download.parse_url(url, '_patchdir', self.config, self.opts)
         download.get_file(patch['url'], patch['local'], self.opts, self.config)
         if 'compressed' in patch:
             patch['script'] = patch['compressed'] + ' ' +  patch['local']
         else:
             patch['script'] = '%{__cat} ' + patch['local']
         patch['script'] += ' | %%{__patch} %s' % (opts)
         self.script.append(self.config.expand(patch['script']))
Ejemplo n.º 13
0
 def patch_setup(self, package, args):
     name = args[1]
     args = args[2:]
     _map = "patch-%s" % (name)
     default_opts = " ".join(args)
     patch_keys = self.macros.map_keys(_map)
     patches = []
     for p in patch_keys:
         pm = self.macros.get(p, globals=False, maps=_map)
         if pm is None:
             raise error.internal("patch macro not found: %s in %s (%s)" % (p, name, _map))
         opts = []
         url = []
         for pp in pm[2].split():
             if len(url) == 0 and pp[0] == "-":
                 opts += [pp]
             else:
                 url += [pp]
         if len(url) == 0:
             raise error.general("patch URL not found: %s" % (" ".join(args)))
         if len(opts) == 0:
             opts = default_opts
         else:
             opts = " ".join(opts)
         opts = self.config.expand(opts)
         url = self.config.expand(" ".join(url))
         #
         # Parse the URL first in the source builder's patch directory.
         #
         patch = download.parse_url(url, "_patchdir", self.config, self.opts)
         #
         # If not in the source builder package check the source directory.
         #
         if not path.exists(patch["local"]):
             patch = download.parse_url(url, "_patchdir", self.config, self.opts)
         download.get_file(patch["url"], patch["local"], self.opts, self.config)
         if "compressed" in patch:
             patch["script"] = patch["compressed"] + " " + patch["local"]
         else:
             patch["script"] = "%{__cat} " + patch["local"]
         patch["script"] += " | %%{__patch} %s" % (opts)
         self.script.append(self.config.expand(patch["script"]))
Ejemplo n.º 14
0
 def source(self, name, strip_components, download_only):
     #
     # Return the list of sources. Merge in any macro defined sources as
     # these may be overridden by user loaded macros.
     #
     _map = 'source-%s' % (name)
     src_keys = [s for s in self.macros.map_keys(_map) if s != 'setup']
     if len(src_keys) == 0:
         raise error.general('no source set: %s (%s)' % (name, _map))
     srcs = []
     for s in src_keys:
         sm = self.macros.get(s, globals=False, maps=_map)
         if sm is None:
             raise error.internal('source macro not found: %s in %s (%s)' % \
                                      (s, name, _map))
         opts = []
         url = []
         for sp in sm[2].split():
             if len(url) == 0 and sp[0] == '-':
                 opts += [sp]
             else:
                 url += [sp]
         if len(url) == 0:
             raise error.general('source URL not found: %s' %
                                 (' '.join(args)))
         #
         # Look for --rsb-file as an option we use as a local file name.
         # This can be used if a URL has no reasonable file name the
         # download URL parser can figure out.
         #
         file_override = None
         if len(opts) > 0:
             for o in opts:
                 if o.startswith('--rsb-file'):
                     os_ = o.split('=')
                     if len(os_) != 2:
                         raise error.general('invalid --rsb-file option: %s' % \
                                             (' '.join(args)))
                     if os_[0] != '--rsb-file':
                         raise error.general('invalid --rsb-file option: %s' % \
                                             (' '.join(args)))
                     file_override = os_[1]
             opts = [o for o in opts if not o.startswith('--rsb-')]
         url = self.config.expand(' '.join(url))
         src = download.parse_url(url, '_sourcedir', self.config, self.opts,
                                  file_override)
         download.get_file(src['url'], src['local'], self.opts, self.config)
         if not download_only:
             if strip_components > 0:
                 tar_extract = '%%{__tar_extract} --strip-components %d' % \
                     (strip_components)
             else:
                 tar_extract = '%{__tar_extract}'
             if 'symlink' in src:
                 sname = name.replace('-', '_')
                 src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % \
                     (src['symlink'], sname)
             elif 'compressed' in src:
                 #
                 # Zip files unpack as well so do not use tar.
                 #
                 src['script'] = '%s %s' % (src['compressed'], src['local'])
                 if src['compressed-type'] != 'zip':
                     src['script'] += ' | %s -f -' % (tar_extract)
             else:
                 src['script'] = '%s -f %s' % (tar_extract, src['local'])
             srcs += [src]
     return srcs