[PATCH] ktl: simplify and fix debian changelog detection
Leann Ogasawara
leann.ogasawara at canonical.com
Fri Jun 10 14:46:47 UTC 2011
On Fri, 2011-06-10 at 14:28 +0100, Andy Whitcroft wrote:
> The debian changelog is in one of three places. It is either in a branch
> specific changelog, debian/changelog, or meta-source/debian/changelog.
> Where a branch specific changelog is present it is always identified via
> the debian/debian.env DEBIAN=<directory> stanza. Move to using this to
> identify the correct debian changelog. Also move to using a loop over
> the possible locations.
>
> Signed-off-by: Andy Whitcroft <apw at canonical.com>
Acked-by: Leann Ogasawara <leann.ogasawara at canonical.com>
And just in case it's not obvious to everyone:
http://people.canonical.com/~kernel/reports/scripts/ktl/README
"ktl - kteam-tools library
A python module for use in any kteam-tools scripts. A module gives you
namespace separation and a cleaner design."
> ---
> ktl/debian.py | 54 ++++++++++++++++++------------------------------------
> 1 files changed, 18 insertions(+), 36 deletions(-)
>
> diff --git a/ktl/debian.py b/ktl/debian.py
> index 002ecf4..789e795 100644
> --- a/ktl/debian.py
> +++ b/ktl/debian.py
> @@ -41,52 +41,34 @@ class Debian:
> #
> current_branch = Git.current_branch()
>
> - # The standard location for a changelog is in a directory named 'debian'.
> - #
> - cl_path = 'debian/changelog'
> - debug("Trying '%s': " % cl_path, cls.debug)
> + # If we have a debian/debian.env then open and extract the DEBIAN=...
> + # location.
> + debug("Checking debian/debian.env", cls.debug)
> + cl_paths = []
> try:
> - retval = Git.show(cl_path, branch=current_branch)
> + debian_env = Git.show("debian/debian.env", branch=current_branch)
> + for line in debian_env:
> + (var, val) = line.split('=', 1)
> + val = val.rstrip()
> +
> + if var == 'DEBIAN':
> + cl_paths.append(val + "/changelog")
> debug("SUCCEEDED\n", cls.debug, False)
> except GitError:
> debug("FAILED\n", cls.debug, False)
> - # If this is a kernel tree, the changelog is in a debian.<branch> directory.
> - #
> - cl_path = 'debian.' + current_branch + '/changelog'
> +
> + # Try probabal paths.
> + cl_paths += [ 'debian/changelog', 'meta-source/debian/changelog' ]
> + for cl_path in cl_paths:
> debug("Trying '%s': " % cl_path, cls.debug)
> try:
> retval = Git.show(cl_path, branch=current_branch)
> - debug("SUCCEEDED\n", cls.debug, False)
> + return retval, cl_path
> except GitError:
> debug("FAILED\n", cls.debug, False)
> - # If this is a 'backport' kernel then it could be in the debian.<series>
> - # directory.
> - #
> - debug('Getting the series from the Makefile: ', cls.debug)
> - try:
> - series = Kernel.series_name()
> - debug("SUCCEEDED\n", cls.debug, False)
> -
> - cl_path = 'debian.' + series + '/changelog'
> - debug("Trying '%s': " % cl_path, cls.debug)
> - retval = Git.show(cl_path, branch=current_branch)
> - debug("SUCCEEDED\n", cls.debug, False)
> - except GitError:
> - debug("FAILED\n", cls.debug, False)
> -
> - # If this is a kernel meta package, its in a sub-directory of meta-source.
> - #
> - if path.exists('meta-source'):
> - cl_path = 'meta-source/debian/changelog'
> - debug("Trying '%s': " % cl_path, cls.debug)
> - try:
> - retval = Git.show(cl_path, branch=current_branch)
> - except GitError:
> - debug("FAILED\n", cls.debug, False)
> - raise DebianError('Failed to find the changelog.')
> - else:
> - raise DebianError('Failed to find the changelog.')
> - return retval, cl_path
> +
> + # Not there anywhere, barf
> + raise DebianError('Failed to find the changelog.')
>
> # changelog
> #
> --
> 1.7.4.1
>
>
More information about the kernel-team
mailing list