def _unpack(self, destdir, tarball): strip_components = self.strip_components _v = "-v" # fixme # if self.oslog: #urg, will be fixed when .source is mandatory # _v = self.oslog.verbose_flag () _z = misc.compression_flag(tarball) self.system("tar -C %(destdir)s --strip-component=%(strip_components)d %(_v)s%(_z)s -xf %(tarball)s" % locals())
def _unpack_promise_well_behaved(self, destdir, tarball): assert self.strip_components == 1 _v = "-v" # fixme # if self.oslog: #urg, will be fixed when .source is mandatory # _v = self.oslog.verbose_flag () _z = misc.compression_flag(tarball) status = self.system("tar -C %(destdir)s/.. %(_v)s%(_z)s -xf %(tarball)s" % locals(), ignore_errors=True) if status: self.error("retry using gzip pipe") self.system("gzip -dc %(tarball)s | tar -C %(destdir)s/.. %(_v)s -xf-" % locals())
def install_tarball(self, ball, name, prefix_dir): gub_log.action('untarring: %(ball)s\n' % locals()) _z = misc.compression_flag(ball) _v = '' # self.os_interface.verbose_flag () lst = loggedos.read_pipe(gub_log.default_logger, 'tar -t%(_z)s -f "%(ball)s"' % locals()).split('\n') conflicts = False installed_files = self.installed_files() installed_files_string = ':'.join([''] + installed_files + ['']) misc.timing() for f in lst: if (':' + f + ':' in installed_files_string and not os.path.isdir(os.path.join(self.root, f))): package = self._file_package_db[f] gub_log.error('already have file %(f)s: %(package)s\n' % locals()) conflicts = True gub_log.command('GUP: for f in lst:' + misc.timing() + '\n') if conflicts and not self.is_distro: raise Exception('Duplicate files found.') root = self.root loggedos.system( gub_log.default_logger, # cd %(root)s to avoid open(2) of cwd, see # http://lists.gnu.org/archive/html/lilypond-devel/2009-03/msg00304.html 'cd %(root)s && tar -C %(root)s -p -x%(_z)s%(_v)s -f %(ball)s' % locals()) for f in lst: if f.endswith('.la'): self.libtool_la_fixup(root, f) if f.endswith('.pc'): self.pkgconfig_pc_fixup(root, f, prefix_dir) self._package_file_db[name] = '\n'.join(lst) for f in lst: # ignore directories. if not f.endswith('/'): self._file_package_db[f] = name if os.path.exists('%(root)s/usr/etc/postinstall/%(name)s' % locals()): loggedos.system( gub_log.default_logger, 'PATH=%(root)s/usr/bin:$PATH %(root)s/usr/etc/postinstall/%(name)s && mv %(root)s/usr/etc/postinstall/%(name)s %(root)s/usr/etc/postinstall/%(name)s.done || :' % locals())
def install_tarball (self, ball, name, prefix_dir): logging.action ('untarring: %(ball)s\n' % locals ()) _z = misc.compression_flag (ball) _v = '' # self.os_interface.verbose_flag () lst = loggedos.read_pipe (logging.default_logger, 'tar -t%(_z)s -f "%(ball)s"' % locals ()).split ('\n') conflicts = False installed_files = self.installed_files () installed_files_string = ':'.join ([''] + installed_files + ['']) misc.timing () for f in lst: if (':' + f + ':' in installed_files_string and not os.path.isdir (os.path.join (self.root, f))): package = self._file_package_db[f] logging.error ('already have file %(f)s: %(package)s\n' % locals ()) conflicts = True logging.command ('GUP: for f in lst:' + misc.timing () + '\n') if conflicts and not self.is_distro: raise Exception ('Duplicate files found.') root = self.root loggedos.system (logging.default_logger, # cd %(root)s to avoid open(2) of cwd, see # http://lists.gnu.org/archive/html/lilypond-devel/2009-03/msg00304.html 'cd %(root)s && tar -C %(root)s -p -x%(_z)s%(_v)s -f %(ball)s' % locals ()) for f in lst: if f.endswith ('.la'): self.libtool_la_fixup (root, f) if f.endswith ('.pc'): self.pkgconfig_pc_fixup (root, f, prefix_dir) self._package_file_db[name] = '\n'.join (lst) for f in lst: # ignore directories. if not f.endswith ('/'): self._file_package_db[f] = name if os.path.exists ('%(root)s/usr/etc/postinstall/%(name)s' % locals ()): loggedos.system (logging.default_logger, 'PATH=%(root)s/usr/bin:$PATH %(root)s/usr/etc/postinstall/%(name)s && mv %(root)s/usr/etc/postinstall/%(name)s %(root)s/usr/etc/postinstall/%(name)s.done || :' % locals ())
def execute (self, logger): logger.write_log ('Creating shar file from %s\n' % repr (self.kwargs), 'info') name = self.kwargs['name'] pretty_name = self.kwargs['pretty_name'] release = self.kwargs['release'] shar_file = self.kwargs['shar_file'] shar_head = self.kwargs['shar_head'] tarball = self.kwargs['tarball'] version = self.kwargs['version'] length = os.stat (tarball)[6] base_file = os.path.split (tarball)[1] script = loggedos.read_file (logger, shar_head) header_length = 0 _z = misc.compression_flag (tarball) header_length = len (script % locals ()) + 1 used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(_z)s' used_in_sharhead % locals () loggedos.dump_file (logger, script % locals (), shar_file) loggedos.system (logger, 'cat %(tarball)s >> %(shar_file)s' % locals ()) loggedos.chmod (logger, shar_file, octal.o755) loggedos.system (logger, 'rm %(tarball)s' % locals ())
def execute(self, logger): logger.write_log('Creating shar file from %s\n' % repr(self.kwargs), 'info') name = self.kwargs['name'] pretty_name = self.kwargs['pretty_name'] release = self.kwargs['release'] shar_file = self.kwargs['shar_file'] shar_head = self.kwargs['shar_head'] tarball = self.kwargs['tarball'] version = self.kwargs['version'] target_cpu = self.kwargs['target_cpu'] length = os.stat(tarball)[6] base_file = os.path.split(tarball)[1] script = loggedos.read_file(logger, shar_head) header_length = 0 _z = misc.compression_flag(tarball) header_length = len(script % locals()) + 1 used_in_sharhead = '%(base_file)s %(name)s %(pretty_name)s %(version)s %(release)s %(header_length)s %(target_cpu)s %(_z)s' used_in_sharhead % locals() loggedos.dump_file(logger, script % locals(), shar_file) loggedos.system(logger, 'cat %(tarball)s >> %(shar_file)s' % locals()) loggedos.chmod(logger, shar_file, octal.o755) loggedos.system(logger, 'rm %(tarball)s' % locals())