def rev_parse(self, name, *args):
""" Find the SHA1 of a given name commit id"""
- options = ["--quiet", "--verify", name]
+ options = ["--quiet", "--verify", "%s^{commit}" % name]
options += list(args)
with Workdir(self.path):
ret, outs = self._exec_git('rev-parse', options)
for line in lines:
log.write(line)
+def update_gerritinfo(obspkg, gitprj, commitid):
+ """ update the _gerritinfo file"""
+ workdingdir = obspkg.get_workdir()
+
+ lines = 'PROJECT: %s\nCOMMIT_ID: %s' % (gitprj, commitid)
+ print '_gerritinfo:\n', lines
+ gerritinfo = os.path.join(workdingdir, '_gerritinfo')
+ with open(gerritinfo, 'w') as log:
+ for line in lines:
+ log.write(line)
+
def end(result = 'success'):
print 'execute result: %s' % result
db = mysql.Database(MYSQL_HOSTNAME, MYSQL_USERNAME, MYSQL_PASSWORD, MYSQL_DB_NAME)
# update changelog with git tag info
update_changelog(localpkg, mygit, tag)
+ # update gerritinfo with git info
+ update_gerritinfo(localpkg, GERRIT_PROJECT, GERRIT_PATCHSET_REVISION)
+
localpkg.update_local()
retry_count = 3
for key in mail_env.keys():
f.write('%s=%s\n' %(key, mail_env[key]))
+def update_gerritinfo(obspkg, gitprj, commitid):
+ """ update the _gerritinfo file """
+ workdingdir = obspkg.get_workdir()
+
+ lines = 'PROJECT: %s\nCOMMIT_ID: %s' % (gitprj, commitid)
+ print '_gerritinfo:\n', lines
+ gerritinfo = os.path.join(workdingdir, '_gerritinfo')
+ with open(gerritinfo, 'w') as log:
+ for line in lines:
+ log.write(line)
+
def end(result = 'success'):
print 'execute result: %s' % result
# cleanup workspace
localpkg.remove_all()
for myfile in os.listdir(tarballdir):
shutil.copy2(os.path.join(tarballdir, myfile), os.path.join(oscworkdir, myfile))
+
+ # update gerritinfo with git info
+ update_gerritinfo(localpkg, GERRIT_PROJECT, GERRIT_PATCHSET_REVISION)
+
localpkg.update_local()
retry_count = 3