store git commit hash to build.source
Git HEAD commit hash is now stored in build.info field. this field is currently used by content generators, but not by other builds. Also original checked out url is stored in build.extra.url field. Fixes: https://pagure.io/koji/issue/550
This commit is contained in:
parent
c78a53167b
commit
4a96ee5474
2 changed files with 26 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ import urlparse
|
|||
from fnmatch import fnmatch
|
||||
import base64
|
||||
import time
|
||||
import subprocess
|
||||
import sys
|
||||
import traceback
|
||||
import errno
|
||||
|
|
@ -501,9 +502,28 @@ class SCM(object):
|
|||
rel_path = '../' * len(path_comps.split('/'))
|
||||
os.symlink(rel_path + 'common', '%s/../common' % sourcedir)
|
||||
|
||||
self.sourcedir = sourcedir
|
||||
return sourcedir
|
||||
|
||||
## END kojikamid dup
|
||||
def get_source(self):
|
||||
r = {
|
||||
'url': self.url,
|
||||
'source': '',
|
||||
}
|
||||
if self.scmtype.startswith('GIT'):
|
||||
cmd = ['git', 'rev-parse', 'HEAD']
|
||||
fragment = subprocess.check_output(cmd, cwd=self.sourcedir).strip()
|
||||
scheme = self.scheme[:-3]
|
||||
if self.user:
|
||||
netloc = '%s@%s' % (self.user, self.host)
|
||||
else:
|
||||
netloc = self.host
|
||||
path = self.repository
|
||||
query = self.module
|
||||
r['source'] = urlparse.urlunsplit([scheme, netloc, path, query, fragment])
|
||||
return r
|
||||
|
||||
|
||||
|
||||
class TaskManager(object):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue