def checkout(self, *args): with pwd(self.source_dir): with log_file('git.log') as git_out: # NB: args is a tuple, must be converted p = Popen(['git', 'checkout'] + list(args), stdout=git_out, stderr=git_out) log.info('git checkout %s, please wait....' % str(args)) p.communicate()
def get(self, src, tgt, *args): '''sets up a branch given arguments, taken from a source with a target the idioms of branching in different VCSes vary, and a common api for this in devshell has not yet been realized currently, this creates a new temporary local branch in darcs and sets the source to it ''' with log_file('darcs.log') as darcs_out: # NB: args is a tuple, must be converted p = Popen(['darcs', 'get'] + list(args) + [src, tgt], stdout = darcs_out, stderr = darcs_out) log.info('darcs get %s %s, please wait....' % (src, tgt)) p.communicate()
def setup_sourceball(self, ver, delete_old=False): '''gets darcs to spit out a sourceball to be used in rpm making by other modules''' log.debug('someone set us up the bomb') if delete_old: with pwd(self.pkg_src_dir): rm(self.sourceball) name = self.upstream_name date = self.date full_name = '%s-%s.%sdarcs' % (name, ver, date) log.debug('full name is ' + full_name) sourceball = full_name + '.tar.gz' with pwd(self.source_dir): with log_file('darcs.log') as darcs_out: log.debug('we get signal') p = Popen(['darcs', 'dist', '-d', full_name], stdout=darcs_out, stderr=darcs_out) log.info('generating tarball %s.tar.gz, please wait...' % full_name) p.communicate() with pwd(self.pkg_src_dir): move(join(self.source_dir, sourceball), sourceball) self.cfg['sourceball'] = sourceball
def setup_sourceball(self, ver, delete_old=False): '''gets darcs to spit out a sourceball to be used in rpm making by other modules''' log.debug('someone set us up the bomb') if delete_old: with pwd(self.pkg_src_dir): rm(self.sourceball) name = self.upstream_name date = self.date full_name = '%s-%s.%s' % (name, ver, self.alphatag) log.debug('full name is ' + full_name) sourceball = full_name + '.tar.gz' with pwd(self.source_dir): with log_file('git.log') as git_out: p1 = Popen(['git', 'archive', '--format=tar', "--prefix=%s/" % full_name, "HEAD"], stdout=PIPE, stderr=git_out) log.info('generating tarball %s.tar.gz, please wait...' % full_name) with pwd(self.pkg_src_dir): with file(sourceball, "wb") as sourceball_file: p2 = Popen(['gzip'], stdin=p1.stdout, stdout=sourceball_file, stderr=git_out) p2.communicate() self.cfg['sourceball'] = sourceball self.cfg['full_name'] = full_name
def print_hash(self): '''prints the hash of the latest patch on HEAD of the current branch''' log.info('The hash is ' + self.hash)
def print_date(self): '''prints the timestamp of the latest patch on HEAD of the current branch''' log.info('The timestamp is ' + self.date)