You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2019/07/17 10:59:52 UTC
[kibble-scanners] 02/02: fix old typo,
pass on KibbleBit to allow for custom branch detection
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble-scanners.git
commit 5dd93539ef7e7149a719a7af8aa484e802678fff
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Jul 17 12:59:35 2019 +0200
fix old typo, pass on KibbleBit to allow for custom branch detection
---
src/plugins/scanners/git-sync.py | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/plugins/scanners/git-sync.py b/src/plugins/scanners/git-sync.py
index c497e52..5997f3e 100644
--- a/src/plugins/scanners/git-sync.py
+++ b/src/plugins/scanners/git-sync.py
@@ -35,12 +35,12 @@ def accepts(source):
return True
return False
-def scan(KibbletBit, source):
+def scan(KibbleBit, source):
# Get some vars, construct a data path for the repo
path = source['sourceID']
url = source['sourceURL']
- rootpath = "%s/%s/git" % (KibbletBit.config['scanner']['scratchdir'], source['organisation'])
+ rootpath = "%s/%s/git" % (KibbleBit.config['scanner']['scratchdir'], source['organisation'])
# If the root path does not exist, try to make it recursively.
if not os.path.exists(rootpath):
@@ -54,13 +54,13 @@ def scan(KibbletBit, source):
'running': False,
'good': False
}
- KibbletBit.updateSource(source)
+ KibbleBit.updateSource(source)
return
# This is were the repo should be cloned
datapath = os.path.join(rootpath, path)
- KibbletBit.pprint("Checking out %s as %s" % (url, path))
+ KibbleBit.pprint("Checking out %s as %s" % (url, path))
try:
source['steps']['sync'] = {
@@ -69,14 +69,14 @@ def scan(KibbletBit, source):
'running': True,
'good': True
}
- KibbletBit.updateSource(source)
+ KibbleBit.updateSource(source)
# If we already checked this out earlier, just sync it.
if os.path.exists(datapath):
- KibbletBit.pprint("Repo %s exists, fetching changes..." % datapath)
+ KibbleBit.pprint("Repo %s exists, fetching changes..." % datapath)
# Do we have a default branch here?
- branch = plugins.utils.git.defaultBranch(source, datapath)
+ branch = plugins.utils.git.defaultBranch(source, datapath, KibbleBit)
if len(branch) == 0:
source['default_branch'] = branch
source['steps']['sync'] = {
@@ -86,11 +86,11 @@ def scan(KibbletBit, source):
'running': False,
'good': False
}
- KibbletBit.updateSource(source)
- KibbletBit.pprint("No default branch found for %s (%s)" % (source['sourceID'], source['sourceURL']))
+ KibbleBit.updateSource(source)
+ KibbleBit.pprint("No default branch found for %s (%s)" % (source['sourceID'], source['sourceURL']))
return
- KibbletBit.pprint("Using branch %s" % branch)
+ KibbleBit.pprint("Using branch %s" % branch)
# Try twice checking out the main branch and fetching changes.
# Sometimes we need to clean up after older scanners, which is
# why we try twice. If first attempt fails, clean up and try again.
@@ -115,12 +115,12 @@ def scan(KibbletBit, source):
pass
# This is a new repo, clone it!
else:
- KibbletBit.pprint("%s is new, cloning...!" % datapath)
+ KibbleBit.pprint("%s is new, cloning...!" % datapath)
subprocess.check_output("GIT_TERMINAL_PROMPT=0 cd %s && git clone %s %s" % (rootpath, url, path), shell = True, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as err:
- KibbletBit.pprint("Repository sync failed (no master?)")
- KibbletBit.pprint(str(err.output))
+ KibbleBit.pprint("Repository sync failed (no master?)")
+ KibbleBit.pprint(str(err.output))
source['steps']['sync'] = {
'time': time.time(),
'status': 'Sync failed at ' + time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()),
@@ -128,7 +128,7 @@ def scan(KibbletBit, source):
'good': False,
'exception': str(err.output)
}
- KibbletBit.updateSource(source)
+ KibbleBit.updateSource(source)
return
# All good, yay!
@@ -138,5 +138,5 @@ def scan(KibbletBit, source):
'running': False,
'good': True
}
- KibbletBit.updateSource(source)
+ KibbleBit.updateSource(source)