summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2009-12-18 04:57:39 +0000
committerRaphael Geissert <geissert@debian.org>2009-12-18 04:57:39 +0000
commit3de40ed4e03cc3d0757861d7322573cd9a4da9e8 (patch)
treeeda6e085e965ee05c60ac061705a887f378bd0ca /scripts
parent9147db7126c322cb5a7bb4516b2661d72cc65642 (diff)
don't search the same file more than once and reverse file order so
newest kernel versions are search first git-svn-id: svn+ssh://svn.debian.org/svn/kernel-sec@1655 e094ebfe-e918-0410-adfb-c712417f3574
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/find-commit37
1 files changed, 19 insertions, 18 deletions
diff --git a/scripts/find-commit b/scripts/find-commit
index 738ae15f..b89b945f 100755
--- a/scripts/find-commit
+++ b/scripts/find-commit
@@ -74,7 +74,6 @@ tags.reverse()
pipe.close()
# generate changelog+diff files
-fnames = []
lastversion = ''
ismainline = True
rootname = 'changelog+diff'
@@ -89,7 +88,6 @@ for tag in tags:
if onlyrc and ( lastversion.find( '-rc' ) < 0 ):
break
elif ( int( version.split( '.' )[2].split( '-' )[0] ) >= oldest_version ):
- fnames.append( fname )
if not os.path.exists( fname ):
tmpname = tempfile.mkstemp()[1]
sys.stdout.write( 'generating: %s\n' % fname )
@@ -103,25 +101,28 @@ for tag in tags:
lastversion = version
# search thru the generated files for text of interest
+lastfname = ''
foundtext = False
-pipe = os.popen( 'grep %s %s*' % ( sys.argv[1] , rootname ) )
+pipe = os.popen( 'grep \'%s\' $(ls -r %s*)' % ( sys.argv[1] , rootname ) )
pline = pipe.readline()
while pline:
fname = pline.split( ':' )[0]
- fread = open( fname , 'r' )
- line = fread.readline()
- while line:
- if line.startswith( 'commit' ):
- if foundtext:
- sys.stdout.write( 'found search text \'%s\' in release %s:\n' % ( sys.argv[1] , fname[len( rootname )+1::] ) )
- sys.stdout.write( commit )
- foundtext = False
- commit = '| %s' % line
- else:
- commit += '| %s' % line
- if ( line.find( sys.argv[1] ) >= 0 ):
- foundtext = True
- line = fread.readline()
- fread.close()
+ if fname != lastfname:
+ fread = open( fname , 'r' )
+ line = fread.readline()
+ while line:
+ if line.startswith( 'commit' ):
+ if foundtext:
+ sys.stdout.write( 'found search text \'%s\' in release %s:\n' % ( sys.argv[1] , fname[len( rootname )+1::] ) )
+ sys.stdout.write( commit )
+ foundtext = False
+ commit = '| %s' % line
+ else:
+ commit += '| %s' % line
+ if ( line.find( sys.argv[1] ) >= 0 ):
+ foundtext = True
+ line = fread.readline()
+ fread.close()
+ lastfname = fname
pline = pipe.readline()
pipe.close()

© 2014-2024 Faster IT GmbH | imprint | privacy policy