mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
wafsamba: samba_version: add samba version suffix to vcs_fields
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
ec3d1f09fa
commit
f48f65e695
@ -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'''
|
||||
|
@ -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 = {}
|
||||
|
13
wscript
13
wscript
@ -239,7 +239,18 @@ def wafdocs(ctx):
|
||||
|
||||
def dist():
|
||||
'''makes a tarball for distribution'''
|
||||
samba_version.load_version(env=None)
|
||||
sambaversion = samba_version.load_version(env=None)
|
||||
|
||||
if sambaversion.IS_SNAPSHOT:
|
||||
# write .distversion file and add to tar
|
||||
f = '.distversion'
|
||||
distversionf = open(f, 'w')
|
||||
for field in sambaversion.vcs_fields:
|
||||
distveroption = field + '=' + str(sambaversion.vcs_fields[field])
|
||||
distversionf.write(distveroption + '\n')
|
||||
distversionf.close()
|
||||
samba_dist.DIST_FILES('.distversion')
|
||||
|
||||
samba_dist.dist()
|
||||
|
||||
def distcheck():
|
||||
|
Loading…
Reference in New Issue
Block a user