def get_repostatus(self):
return self.bs.getRepoState(self.project)
+ def cleanup(self):
+ return self.bs.deleteProject(self.project)
+
def is_published(self):
try:
return set(self.get_repostatus().values()) == set(['published'])
if not found:
print "did not find any image configurations"
- def disable_build(self, src, user):
- targetmeta = PRJ_TEMPLATE % {'target': self.project, 'src': src,
- 'user': user, 'build': 'disable'}
+ def disable_build(self, user):
+
+ targetmeta = """<project name="%(target)s">
+ <title></title>
+ <description></description>
+ <person role="maintainer" userid="%(user)s"/>
+ <person role="bugowner" userid="%(user)s"/>
+ <build>
+ <%(build)s/>
+ </build>
+</project>"""% {'target': self.project, 'user': user, 'build': 'disable'}
print targetmeta
fileh, filename = tempfile.mkstemp(prefix="osc_metafile.",
suffix=".xml", text=True)
os.write(fileh, targetmeta)
os.close(fileh)
- os.system("osc meta prj %s -F %s" %(self.project, filename))
+ os.system("osc -d -v meta prj %s -F %s" %(self.project, filename))
+ sys.stdout.flush()
os.unlink(filename)
-
+
def link_project(self, src, user):
targetmeta = PRJ_TEMPLATE % {'target': self.project, 'src': src,
'user': user, 'build': 'enable'}
from common import utils
from common import git
from common import buildservice
+from common.buildtrigger import trigger_info
import os
import tempfile
import time
envparas = ['JENKINS_HOME',
'WORKSPACE',
- 'GIT_PROJECT',
- 'GIT_TAG',
- 'OBS_REQ_PRJ_SRC',
- 'OBS_REQ_PRJ',
- 'OBS_REQ_PKG',
- 'OBS_REQ_ID',
+ 'TRIGGER_INFO',
'OBS_API_URL',
'OBS_OSCRC_PATH',
- 'COMMITID',
- 'OBS_REQ_WHO',
'GERRIT_HOSTNAME',
'GERRIT_USERNAME',
'GERRIT_SSHPORT',
print '---[JOB STARTED]----------------------------------------'
+ locals().update(trigger_info(TRIGGER_INFO))
+
# update local git tree from remote
try:
if os.path.exists(os.path.join(GIT_CACHE_DIR, GIT_PROJECT)):
"target": repo,
"release": "sr.%s" %sr_id,
"arch":["ia32"],
- "reporequire": ["Tizen:2.0:Base"] #FIXME
+ "reporequire": ["Tizen:Base"] #FIXME
}
print "====LOG:REPO_MAKER:TEMP_CONF===="
if __name__ == "__main__":
+ print '---[JOB STARTED]----------------------------------------'
+ sys.stdout.flush()
+
server_conf = ServerConf()
server_conf.raw_repos = PATH_RAW_REPOS
server_conf.repos_conf = PATH_REPO_CONF
tempbuild=TempBuildService(temp_repo_define_dict['Project'], OBS_API_URL, PATH_OSCRC)
time.sleep(10)
assert(tempbuild.is_published())
- tempbuild.disable_build(temp_repo_define_dict['SandboxOf'], OBS_USERNAME)
+ tempbuild.disable_build(OBS_USERNAME)
builds_dir = server_conf.builds
if not os.path.exists(builds_dir):
"""
from common.envparas import export
-from common.buildservice import BuildService
+from common.buildservice import TempBuildService
+from common.buildtrigger import trigger_info
import os
envparas = ['JENKINS_HOME',
'WORKSPACE',
- 'GIT_PROJECT',
- 'GIT_TAG',
- 'OBS_REQ_PRJ_SRC',
- 'OBS_REQ_PRJ',
- 'OBS_REQ_PKG',
- 'OBS_REQ_ID',
+ 'TRIGGER_INFO',
'OBS_API_URL',
'PATH_BUILDS',
'PATH_OSCRC',
'OBS_OSCRC_PATH',
- 'COMMITID',
- 'OBS_REQ_WHO',
'GERRIT_HOSTNAME',
'GERRIT_USERNAME',
'GERRIT_SSHPORT',
export(envparas, locals())
-GIT_URL = 'ssh://%s@%s:%s' % (GERRIT_USERNAME, GERRIT_HOSTNAME, GERRIT_SSHPORT)
-
-
def search_published_repo(repo_path_base, project, sr_id):
-
+ """ Search publised repository, which releated with this sr
+ return is a list.
+ """
+ ret_list = []
reviewrepo_base = os.path.join(repo_path_base,'pre-release', project)
if os.path.isdir(reviewrepo_base):
for dir_name in os.listdir(reviewrepo_base):
if dir_name.endswith("sr.%s" %sr_id):
- return os.path.join(reviewrepo_base, dir_name)
- else:
- print "WARN: reviewrepo %s doesn't exist" %reviewrepo_base
+ ret_list.append(os.path.join(reviewrepo_base, dir_name))
+
+ return ret_list
if __name__ == '__main__':
print '---[JOB STARTED]----------------------------------------'
-
+ sys.stdout.flush()
+
+ locals().update(trigger_info(TRIGGER_INFO))
obs_project = "%s:prerelease:%s:%s" %( OBS_REQ_PRJ, OBS_REQ_ID, OBS_REQ_PKG)
- bs = BuildService(OBS_API_URL, PATH_OSCRC)
- bs.deleteProject(obs_project)
+ bs = TempBuildService(obs_project, OBS_API_URL, PATH_OSCRC)
+ bs.cleanup()
print "OBS Project %s deleted" %obs_project
+ # Try again # FIX ME
+ os.system("osc -d -c /etc/repos/oscrc rdelete %s -m 'deleted'" %obs_project)
- reviewrepo_path = search_published_repo(PATH_BUILDS, OBS_REQ_PKG, OBS_REQ_ID)
- if reviewrepo_path:
- print "Removing temporary repo: %s" %reviewrepo_path
- os.system("rm -rf %s" %reviewrepo_path)
+ reviewrepo_paths = search_published_repo(PATH_BUILDS, OBS_REQ_PKG, OBS_REQ_ID)
+ if reviewrepo_paths:
+ for repodir in reviewrepo_paths:
+ print "Removing temporary repo: %s" %repodir
+ os.system("rm -rf %s" %repodir)
+ # Remove the parent dir if empty
+ parent_dir = os.path.abspath('%s/../../%s' %(reviewrepo_paths[0], OBS_REQ_PKG))
+ if not os.listdir(parent_dir):
+ os.system("rm -r %s" %parent_dir)
+ print "Removing temporary repo parent: %s" %parent_dir
else:
- print "WARN: Temporary %s has been removed" %reviewrepo_path
+ print "WARN: Temporary repo doesn't exist!"