From f48f65e695da57cb12e68a5b1d82d05874863344 Mon Sep 17 00:00:00 2001 From: Björn Baumbach Date: Thu, 14 Jun 2012 19:07:23 +0200 Subject: wafsamba: samba_version: add samba version suffix to vcs_fields Signed-off-by: Andrew Bartlett --- buildtools/wafsamba/samba_dist.py | 24 +++++++++++++++++++++++ buildtools/wafsamba/samba_version.py | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'buildtools/wafsamba') diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py index 79cb721b25..1f56f2e3ec 100644 --- a/buildtools/wafsamba/samba_dist.py +++ b/buildtools/wafsamba/samba_dist.py @@ -5,6 +5,7 @@ import Utils, os, sys, tarfile, stat, Scripting, Logs, Options from samba_utils import * dist_dirs = None +dist_files = None dist_blacklist = "" def add_symlink(tar, fname, abspath, basedir): @@ -157,6 +158,22 @@ def dist(appname='',version=''): fname = dist_base + '/' + f add_tarfile(tar, fname, abspath, dir) + if dist_files: + for file in dist_files.split(): + if file.find(':') != -1: + destfile = file.split(':')[1] + file = file.split(':')[0] + else: + destfile = file + + absfile = os.path.join(srcdir, file) + + if destfile != file: + file = destfile + + fname = dist_base + '/' + file + add_tarfile(tar, fname, absfile, file) + tar.close() if Options.options.SIGN_RELEASE: @@ -194,6 +211,13 @@ def DIST_DIRS(dirs): if not dist_dirs: dist_dirs = dirs +@conf +def DIST_FILES(files): + '''set additional files for packaging, relative to top srcdir''' + global dist_files + if not dist_files: + dist_files = files + @conf def DIST_BLACKLIST(blacklist): '''set the files to exclude from packaging, relative to top srcdir''' diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py index 9dae23a908..e82fd4723e 100644 --- a/buildtools/wafsamba/samba_version.py +++ b/buildtools/wafsamba/samba_version.py @@ -92,6 +92,41 @@ def git_version_summary(path, env=None): return (ret, fields) +def distversion_version_summary(path): + #get version from .distversion file + f = open(path + '/.distversion', 'r') + suffix = None + fields = {} + + for line in f: + line = line.strip() + if line == '': + continue + if line.startswith("#"): + continue + try: + split_line = line.split("=") + if split_line[1] != "": + key = split_line[0] + value = split_line[1] + if key == "SUFFIX": + suffix = value + continue + fields[key] = value + except: + print("Failed to parse line %s from .distversion file." % (line)) + raise + f.close() + + if "COMMIT_TIME" in fields: + fields["COMMIT_TIME"] = int(fields["COMMIT_TIME"]) + + if suffix is None: + return ("UNKNOWN", fields) + + return (suffix, fields) + + class SambaVersion(object): def __init__(self, version_dict, path, env=None, is_install=True): @@ -167,9 +202,12 @@ also accepted as dictionary entries here suffix, self.vcs_fields = git_version_summary(path, env=env) elif os.path.exists(os.path.join(path, ".bzr")): suffix, self.vcs_fields = bzr_version_summary(path) + elif os.path.exists(os.path.join(path, ".distversion")): + suffix, self.vcs_fields = distversion_version_summary(path) else: suffix = "UNKNOWN" self.vcs_fields = {} + self.vcs_fields["SUFFIX"] = suffix SAMBA_VERSION_STRING += "-" + suffix else: self.vcs_fields = {} -- cgit