diff options
Diffstat (limited to 'buildtools/build-debian-packages.py')
-rw-r--r-- | buildtools/build-debian-packages.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/buildtools/build-debian-packages.py b/buildtools/build-debian-packages.py index 0a326da8..ee2cfdd2 100644 --- a/buildtools/build-debian-packages.py +++ b/buildtools/build-debian-packages.py @@ -2,11 +2,11 @@ # # Copyright (C) 2014 Dragon Research Labs ("DRL") # Portions copyright (C) 2013 Internet Systems Consortium ("ISC") -# +# # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notices and this permission notice appear in all copies. -# +# # THE SOFTWARE IS PROVIDED "AS IS" AND DRL AND ISC DISCLAIM ALL # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL OR @@ -39,7 +39,19 @@ parser.add_argument("-s", "--version-suffix", nargs = "?", const = platform.linu help = "suffix to add to version string") args = parser.parse_args() -version = "0." + subprocess.check_output(("svnversion", "-c")).strip().split(":")[-1] +if os.path.exists(".svn"): + version = "0.{rev}".format( + rev = subprocess.check_output(("svnversion", "-c")).strip().split(":")[-1]) +elif os.path.exists(".git/svn"): + git_svn_log = subprocess.check_output(("git", "svn", "log", "--show-commit", "--oneline", "--limit=1")).split() + version = "0.{rev}.{count}.{time}.{commit}".format( + rev = git_svn_log[0][1:], + count = subprocess.check_output(("git", "rev-list", "--count", git_svn_log[2] + "..HEAD")).strip(), + time = subprocess.check_output(("git", "show", "--no-patch", "--format=%ct", "HEAD")).strip(), + commit = subprocess.check_output(("git", "rev-parse", "HEAD")).strip()) + del git_svn_log +else: + sys.exit("Sorry, don't know how to extract version number from this source tree") if os.path.exists("debian"): shutil.rmtree("debian") |