diff options
Diffstat (limited to 'slave/autotua/__init__.py')
-rw-r--r-- | slave/autotua/__init__.py | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/slave/autotua/__init__.py b/slave/autotua/__init__.py index 15d68a4..bdcd56b 100644 --- a/slave/autotua/__init__.py +++ b/slave/autotua/__init__.py @@ -84,18 +84,32 @@ class Job: stage = fetch.Fetchable(uri=uri) return stage - # - Get jobuild SRC_URI -> tarball dir - def _fetch_src(self): + # Get jobuild SRC_URI -> $tmpdir/jobfiles + # jobfile -(link)-> $chroot_tmpdir/jobfiles + def _setup_jobfiles(self): job_src = [] + action = 'link' fetcher = fetch.Fetcher(const.JOBFILE_DIR) processor = jobuild.Processor(None, self.chroot) - for one in self.jobuilds: - processor.jobuild = one + for jbld in self.jobuilds: + processor.jobuild = jbld src_uri = processor.get_var('SRC_URI').split() for i in src_uri: job_src.append(fetch.Fetchable(uri=[i])) + src = fetcher.tarballdir+'/%s' + dest = self.chroot.chrootdir+const.CHAUTOTUA_DIR+'/jobfiles/%s' for fetchable in job_src: fetcher.fetch(fetchable) + src = src % fetchable.filename + dest = dest % fetchable.filename + if action == 'link': + try: + os.link(src, dest) + except OSError: + print "Chroot and Jobfiles are on different devices. Falling back to copying..." + action = 'copy' + if action == 'copy': + shutil.copyfile(src, dest) def fetch(self): # Job metadata stuff @@ -121,11 +135,15 @@ class Job: # Create jobuild objects for parsing for atom in self.atoms: self.jobuilds.append(jobuild.Jobuild(self.jobdir, atom)) - print 'Fetch jobuild SRC_URI...' - self._fetch_src() + print 'Fetch jobuild SRC_URI and hardlink/copy into chroot' + self._setup_jobfiles() def run(self): - print "Rheeet, it's running!~ NOT." + processor = jobuild.Processor(None, self.chroot) + for jbld in self.jobuilds: + processor.jobuild = jbld + print 'Running jobuild "%s"' % jbld.name + processor.run_phase('all') def tidy(self): print 'Tidying up..' |