Skip to content

Instantly share code, notes, and snippets.

@soyo42
Last active January 3, 2016 05:49
Show Gist options
  • Save soyo42/8418055 to your computer and use it in GitHub Desktop.
Save soyo42/8418055 to your computer and use it in GitHub Desktop.
ODL - analyze dependency convergence log
#!/usr/bin/python
import sys
import re
if len(sys.argv) != 2:
sys.stderr.write('usage:: {0} <project name>\n'.format(sys.argv[0]))
sys.stderr.write('usage:: + redirect log into std input')
sys.exit(1)
prjName = sys.argv[1]
startDepError = re.compile('^Dependency convergence error for ')
depLine = re.compile('^ *\+-(.+)$')
depLineSeparator = re.compile('^(|and)$')
inError = False
versions = []
lastDepLine = None
nameFound = False
myDependency = False
for i in sys.stdin:
i = i.strip()
if not inError:
mach = startDepError.match(i)
if mach:
inError = True
print i
else:
mach = depLine.match(i)
if mach:
#print '.',
lastDepLine = mach.group(1)
if lastDepLine.find(prjName) > -1:
nameFound = True
myDependency = True
continue
mach = depLineSeparator.match(i)
if mach:
#print '+',
if myDependency:
lastDepLine += ' *'
myDependency = False
versions.append(lastDepLine)
if mach.group(1) != '':
continue
inError = False
if nameFound:
for v in versions:
print v
versions = []
lastDepLine = None
nameFound = False
#!/bin/bash
if [ -z "$2" ]; then
echo "usage:: $0 <convergence log file> <project name, e.g.:openflowplugin>"
exit 1
fi
sed -nr '30,/Failed while enforcing releasability the error/ p' "$1" \
| sed -nr '/^Dependency convergence error/,/^\]?$/ p' \
| ./analyzeDepVersions.py "$2"
# help
./digConvergenceErrors.sh
# read "logFile" and focus on project "openflowplugin"
./digConvergenceErrors.sh logFile openflowplugin | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment