diff --git a/debian/changelog b/debian/changelog index b004221..b612330 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,10 @@ ubuntu-dev-tools (0.177) UNRELEASED; urgency=medium * ubuntu-build: + Add support for riscv64. + [ Bryce Harrington ] + * update-maintainer: + + Try to recurse upwards to find a valid debian directory. LP: #1885233 + -- Dan Streetman Fri, 13 Mar 2020 10:02:36 -0400 ubuntu-dev-tools (0.176) unstable; urgency=medium diff --git a/update-maintainer b/update-maintainer index 95f551c..ccd1323 100755 --- a/update-maintainer +++ b/update-maintainer @@ -22,6 +22,19 @@ from ubuntutools.update_maintainer import (update_maintainer, restore_maintainer, MaintainerUpdateException) +def find_debian_dir(depth=6): + """Scans up the directory hierarchy looking for a ./debian dir + + :param int depth: Levels to scan up the directory tree. + :rtype: str + :returns: a path to an existing debian/ directory, or None + """ + for path in ['../'*n or './' for n in list(range(0,depth+1))]: + debian_path = '{}debian'.format(path) + if os.path.exists(os.path.join(debian_path, 'control')) \ + and os.path.exists(os.path.join(debian_path, 'changelog')): + return debian_path + return None def main(): script_name = os.path.basename(sys.argv[0]) @@ -30,7 +43,8 @@ def main(): parser = optparse.OptionParser(usage=usage, epilog=epilog) parser.add_option("-d", "--debian-directory", dest="debian_directory", help="location of the 'debian' directory (default: " - "%default).", metavar="PATH", default="./debian") + "%default).", metavar="PATH", + default=find_debian_dir() or './debian') parser.add_option("-r", "--restore", help="Restore the original maintainer", action='store_true', default=False)