コード例 #1
0
ファイル: rpm.py プロジェクト: jaybuff/Openstack-Anvil
 def __init__(self, *args, **kwargs):
     comp.Component.__init__(self, *args, **kwargs)
     self.tracewriter = tr.TraceWriter(tr.trace_filename(self.get_option('trace_dir'), 'created'),
                                       break_if_there=False)
     self.package_dir = sh.joinpths(self.get_option('component_dir'), 'package')
     self.match_installed = tu.make_bool(kwargs.get('match_installed'))
     self._build_paths = None
     self._details = None
     self._helper = yum_helper.Helper()
コード例 #2
0
ファイル: yum.py プロジェクト: apugachev-gd/anvil
 def __init__(self, distro, root_dir, instances):
     super(YumDependencyHandler, self).__init__(distro, root_dir, instances)
     self.rpmbuild_dir = sh.joinpths(self.deps_dir, "rpmbuild")
     self.deps_repo_dir = sh.joinpths(self.deps_dir, "openstack-deps")
     self.deps_src_repo_dir = sh.joinpths(self.deps_dir,
                                          "openstack-deps-sources")
     self.anvil_repo_filename = sh.joinpths(self.deps_dir, self.REPO_FN)
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.helper = yum_helper.Helper()
コード例 #3
0
 def __init__(self, distro, root_dir, instances, opts, group, prior_groups):
     self.distro = distro
     self.root_dir = root_dir
     self.instances = instances
     self.prior_groups = prior_groups
     self.opts = opts or {}
     self.group = group
     self.retries = max(0, int(opts.get('pip_retries', self.RETRIES)))
     self.retry_delay = max(
         0, float(opts.get('pip_retry_delay', self.RETRY_DELAY)))
     # Various paths we will use while operating
     self.deps_dir = sh.joinpths(self.root_dir, "deps")
     self.download_dir = sh.joinpths(self.deps_dir, "download")
     self.log_dir = sh.joinpths(self.deps_dir, "output")
     sh.mkdir(self.log_dir, recurse=True)
     self.gathered_requires_filename = sh.joinpths(
         self.deps_dir, "pip-requires-group-%s" % group)
     self.forced_requires_filename = sh.joinpths(
         self.deps_dir, "forced-requires-group-%s" % group)
     self.download_requires_filename = sh.joinpths(
         self.deps_dir, "download-requires-group-%s" % group)
     self.multipip = multipip_helper.Helper()
     # List of requirements
     self.pips_to_install = []
     self.forced_pips = []
     # Instances to there app directory (with a setup.py inside)
     self.package_dirs = self._get_package_dirs(instances)
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(self.root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.requirements = {}
     for key in ("build-requires", "requires", "conflicts"):
         req_set = set()
         for inst in self.instances:
             req_set |= set(pkg["name"]
                            for pkg in inst.get_option(key) or [])
         self.requirements[key] = req_set
     ignore_pips = set()
     ignore_distro_pips = self.distro.get_dependency_config(
         "ignoreable_pips", quiet=True)
     if ignore_distro_pips:
         ignore_pips.update(ignore_distro_pips)
     self.ignore_pips = ignore_pips
コード例 #4
0
 def __init__(self, distro, root_dir, instances, opts):
     self.distro = distro
     self.root_dir = root_dir
     self.instances = instances
     self.opts = opts or {}
     # Various paths we will use while operating
     self.deps_dir = sh.joinpths(self.root_dir, "deps")
     self.downloaded_flag_file = sh.joinpths(self.deps_dir,
                                             "pip-downloaded")
     self.download_dir = sh.joinpths(self.deps_dir, "download")
     self.log_dir = sh.joinpths(self.deps_dir, "output")
     sh.mkdir(self.log_dir, recurse=True)
     self.gathered_requires_filename = sh.joinpths(self.deps_dir,
                                                   "pip-requires")
     self.forced_requires_filename = sh.joinpths(self.deps_dir,
                                                 "forced-requires")
     self.download_requires_filename = sh.joinpths(self.deps_dir,
                                                   "download-requires")
     self.multipip = multipip_helper.Helper()
     # List of requirements
     self.pips_to_install = []
     self.forced_packages = []
     # Instances to there app directory (with a setup.py inside)
     self.package_dirs = self._get_package_dirs(instances)
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(self.root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.requirements = {}
     for key in ("build-requires", "requires", "conflicts"):
         req_set = set()
         for inst in self.instances:
             req_set |= set(pkg["name"]
                            for pkg in inst.get_option(key) or [])
         self.requirements[key] = req_set
     # These pip names we will ignore from being converted/analyzed...
     ignore_pips = self.distro.get_dependency_config("ignoreable_pips",
                                                     quiet=True)
     if not ignore_pips:
         self.ignore_pips = set()
     else:
         self.ignore_pips = set(ignore_pips)
コード例 #5
0
 def __init__(self, distro, root_dir, instances, opts=None):
     self.distro = distro
     self.root_dir = root_dir
     self.instances = instances
     self.opts = opts or {}
     # Various paths we will use while operating
     self.deps_dir = sh.joinpths(self.root_dir, "deps")
     self.downloaded_flag_file = sh.joinpths(self.deps_dir,
                                             "pip-downloaded")
     self.download_dir = sh.joinpths(self.deps_dir, "download")
     self.log_dir = sh.joinpths(self.deps_dir, "output")
     self.gathered_requires_filename = sh.joinpths(self.deps_dir,
                                                   "pip-requires")
     self.forced_requires_filename = sh.joinpths(self.deps_dir,
                                                 "forced-requires")
     self.download_requires_filename = sh.joinpths(self.deps_dir,
                                                   "download-requires")
     # Executables we require to operate
     self.multipip_executable = sh.which("multipip", ["tools/"])
     self.pip_executable = sh.which_first(['pip-python', 'pip'])
     self.pipdownload_executable = sh.which("pip-download", ["tools/"])
     # List of requirements
     self.pips_to_install = []
     self.forced_packages = []
     # Instances to there app directory (with a setup.py inside)
     self.package_dirs = self._get_package_dirs(instances)
     # Instantiate this as late as we can.
     self._python_names = None
     # Track what file we create so they can be cleaned up on uninstall.
     trace_fn = tr.trace_filename(self.root_dir, 'deps')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.tracereader = tr.TraceReader(trace_fn)
     self.requirements = {}
     for key in ("build-requires", "requires", "conflicts"):
         req_set = set()
         for inst in self.instances:
             req_set |= set(pkg["name"]
                            for pkg in inst.get_option(key) or [])
         self.requirements[key] = req_set
コード例 #6
0
 def _begin_start(self, app_name, app_pth, app_wkdir, args):
     fork_fns = self._form_file_names(app_name)
     trace_fn = fork_fns.trace
     # Ensure all arguments for this app in string format
     args = [str(i) for i in args if i is not None]
     if trace_fn:
         # Not needed, but useful to know where the files are located at
         #
         # TODO(harlowja): use this info instead of forming the filenames
         # repeatly
         trace_info = {}
         trace_info.update(fork_fns.as_dict())
         # Useful to know what args were sent along
         trace_info[ARGS] = json.dumps(args)
         run_trace = tr.TraceWriter(trace_fn)
         for (k, v) in trace_info.items():
             if v is not None:
                 run_trace.trace(k, v)
     LOG.debug("Forking %r by running command %r with args (%s)" % (app_name, app_pth, " ".join(args)))
     with sh.Rooted(True):
         sh.fork(app_pth, app_wkdir, fork_fns.pid, fork_fns.stdout, fork_fns.stderr, *args)
     return trace_fn
コード例 #7
0
ファイル: base.py プロジェクト: minacel/anvil
 def __init__(self, *args, **kargs):
     super(BasicComponent, self).__init__(*args, **kargs)
     trace_fn = tr.trace_filename(self.get_option('trace_dir'), 'created')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
コード例 #8
0
 def __init__(self, *args, **kargs):
     super(PkgInstallComponent, self).__init__(*args, **kargs)
     trace_fn = tr.trace_filename(self.get_option('trace_dir'), 'created')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=False)
     self.configurator = conf.Configurator(self)
コード例 #9
0
 def __init__(self, *args, **kargs):
     ProgramRuntime.__init__(self, *args, **kargs)
     trace_fn = tr.trace_filename(self.get_option('trace_dir'), 'start')
     self.tracewriter = tr.TraceWriter(trace_fn, break_if_there=True)
     self.tracereader = tr.TraceReader(trace_fn)
コード例 #10
0
 def _do_trace(self, fn, kvs):
     trace_dir = self.runtime.get_option('trace_dir')
     run_trace = tr.TraceWriter(tr.trace_filename(trace_dir, fn))
     for (k, v) in kvs.items():
         run_trace.trace(k, v)
     return run_trace.filename()