Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
obs-service-tar_scm
utils.py
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File utils.py of Package obs-service-tar_scm
#!/usr/bin/python import os import re import shutil import subprocess def mkfreshdir(path): if not re.search('.{10}/tmp(/|$)', path): raise RuntimeError, 'unsafe call: mkfreshdir(%s)' % path cwd = os.getcwd() os.chdir('/') if os.path.exists(path): shutil.rmtree(path) os.makedirs(path) def run_cmd(cmd): p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = p.communicate() return (stdout, stderr, p.returncode) def quietrun(cmd): (stdout, stderr, ret) = run_cmd(cmd) if ret != 0: print cmd, " failed!" print stdout print stderr return (stdout, stderr, ret) def run_scm(scm, repo, opts): cmd = 'cd %s && %s %s' % (repo, scm, opts) #return subprocess.check_output(cmd, shell=True) return quietrun(cmd) def run_git(repo, opts): return run_scm('git', repo, opts) def run_svn(repo, opts): return run_scm('svn', repo, opts) def run_hg(repo, opts): return run_scm('hg', repo, opts) def run_bzr(repo, opts): return run_scm('bzr', repo, opts)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor