I still need to handle some corner cases like preventing a buildup of notices when forward porting from a forward port and handling the case where the local part of the version number needs to go somewhere other than the end to satisfy version constraints.
Pabs suggested that something like this should go in devscripts but it will need a fair bit of cleanup and generalisation before that can happen.
Anyway here it is in it's first rough-cut form. Please feel free to comment/criticise/improve
autoforwardporter.sh
Description: application/shellscript
#!/usr/bin/python3 #(C) 2015 Peter Michael Green <plugw...@debian.org> #This software is provided 'as-is', without any express or implied warranty. In #no event will the authors be held liable for any damages arising from the use #of this software. # #Permission is granted to anyone to use this software for any purpose, including #commercial applications, and to alter it and redistribute it freely, subject to #the following restrictions: # #1. The origin of this software must not be misrepresented; you must not claim. #that you wrote the original software. If you use this software in a product, #an acknowledgment in the product documentation would be appreciated but is. #not required. # #2. Altered source versions must be plainly marked as such, and must not be #misrepresented as being the original software. # #3. This notice may not be removed or altered from any source distribution. from debian import changelog import sys oldchangelogfile = sys.argv[1] newchangelogfile = sys.argv[2] distribution = sys.argv[3] date = sys.argv[4] f = open(oldchangelogfile) c = changelog.Changelog(f) entries = [] #unfortunately the changelog module doesn't let us directly access it's list #of changes, only an iterator over it, so we have to make our own list. #so we can perform a reverse iteration (the changelog module gives us the most #recent entry first, we want oldest first) for entry in c: entries.append(entry) newf = open(newchangelogfile) newc = changelog.Changelog(newf) #mutter (3.14.4-1+rpi1) stretch-staging; urgency=medium print(newc.package+' ('+str(newc.get_version())+'+rpi1) '+distribution+'; urgency=medium') print() for entry in reversed(entries): print(' [changes brought forward from '+str(entry.version)+' by '+entry.author+' at '+entry.date+']') lines = entry.changes()[:] #copy this so we don't modify the libraries #version of it. while (lines[0] == ''): del lines[0] for line in lines: print(line) print(' -- Raspbian forward porter <r...@raspbian.org> '+date) print()