mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +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 *
|
from samba_utils import *
|
||||||
|
|
||||||
dist_dirs = None
|
dist_dirs = None
|
||||||
|
dist_files = None
|
||||||
dist_blacklist = ""
|
dist_blacklist = ""
|
||||||
|
|
||||||
def add_symlink(tar, fname, abspath, basedir):
|
def add_symlink(tar, fname, abspath, basedir):
|
||||||
@ -157,6 +158,22 @@ def dist(appname='',version=''):
|
|||||||
fname = dist_base + '/' + f
|
fname = dist_base + '/' + f
|
||||||
add_tarfile(tar, fname, abspath, dir)
|
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()
|
tar.close()
|
||||||
|
|
||||||
if Options.options.SIGN_RELEASE:
|
if Options.options.SIGN_RELEASE:
|
||||||
@ -194,6 +211,13 @@ def DIST_DIRS(dirs):
|
|||||||
if not dist_dirs:
|
if not dist_dirs:
|
||||||
dist_dirs = 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
|
@conf
|
||||||
def DIST_BLACKLIST(blacklist):
|
def DIST_BLACKLIST(blacklist):
|
||||||
'''set the files to exclude from packaging, relative to top srcdir'''
|
'''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)
|
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):
|
class SambaVersion(object):
|
||||||
|
|
||||||
def __init__(self, version_dict, path, env=None, is_install=True):
|
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)
|
suffix, self.vcs_fields = git_version_summary(path, env=env)
|
||||||
elif os.path.exists(os.path.join(path, ".bzr")):
|
elif os.path.exists(os.path.join(path, ".bzr")):
|
||||||
suffix, self.vcs_fields = bzr_version_summary(path)
|
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:
|
else:
|
||||||
suffix = "UNKNOWN"
|
suffix = "UNKNOWN"
|
||||||
self.vcs_fields = {}
|
self.vcs_fields = {}
|
||||||
|
self.vcs_fields["SUFFIX"] = suffix
|
||||||
SAMBA_VERSION_STRING += "-" + suffix
|
SAMBA_VERSION_STRING += "-" + suffix
|
||||||
else:
|
else:
|
||||||
self.vcs_fields = {}
|
self.vcs_fields = {}
|
||||||
|
13
wscript
13
wscript
@ -239,7 +239,18 @@ def wafdocs(ctx):
|
|||||||
|
|
||||||
def dist():
|
def dist():
|
||||||
'''makes a tarball for distribution'''
|
'''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()
|
samba_dist.dist()
|
||||||
|
|
||||||
def distcheck():
|
def distcheck():
|
||||||
|
Loading…
Reference in New Issue
Block a user