Will Salmon pushed to branch willsalmon/versionTagRegrex at BuildStream / buildstream
Commits:
-
18acd3ea
by Valentin David at 2018-08-21T08:44:34Z
-
6bd688cf
by Valentin David at 2018-08-21T08:44:34Z
-
4cab18e3
by Qinusty at 2018-08-21T09:38:39Z
-
f3fbdac0
by Jonathan Maw at 2018-08-21T11:33:34Z
-
3a4c147a
by Jonathan Maw at 2018-08-21T12:43:41Z
-
d1bd8c0b
by Chandan Singh at 2018-08-21T12:46:57Z
-
12d1cec2
by Chandan Singh at 2018-08-21T12:46:57Z
-
320b9562
by Tristan Van Berkom at 2018-08-21T13:57:00Z
-
ef606229
by Josh Smith at 2018-08-21T14:49:57Z
-
d8256c74
by Qinusty at 2018-08-21T15:46:14Z
-
ab1caac1
by Chandan Singh at 2018-08-21T23:47:32Z
-
81278f84
by Tristan Van Berkom at 2018-08-22T05:23:33Z
-
3d4e649d
by Tristan Van Berkom at 2018-08-22T05:24:42Z
-
c8bafb68
by Tristan Van Berkom at 2018-08-22T06:24:12Z
-
eeaddbac
by William Salmon at 2018-08-22T08:05:28Z
-
e15f5fa3
by William Salmon at 2018-08-22T08:05:28Z
14 changed files:
- .gitlab-ci.yml
- buildstream/_frontend/linuxapp.py
- buildstream/_includes.py
- buildstream/_loader/loader.py
- buildstream/_pipeline.py
- buildstream/_project.py
- buildstream/_version.py
- buildstream/plugin.py
- buildstream/source.py
- buildstream/utils.py
- dev-requirements.txt
- setup.cfg
- setup.py
- versioneer.py
Changes:
1 |
-image: buildstream/testsuite-debian:9-master-112-a9f63c5e
|
|
1 |
+image: buildstream/testsuite-debian:9-master-114-4cab18e3
|
|
2 | 2 |
|
3 | 3 |
cache:
|
4 | 4 |
key: "$CI_JOB_NAME-"
|
... | ... | @@ -79,25 +79,25 @@ source_dist: |
79 | 79 |
- coverage-linux/
|
80 | 80 |
|
81 | 81 |
tests-debian-9:
|
82 |
- image: buildstream/testsuite-debian:9-master-112-a9f63c5e
|
|
82 |
+ image: buildstream/testsuite-debian:9-master-114-4cab18e3
|
|
83 | 83 |
<<: *linux-tests
|
84 | 84 |
|
85 | 85 |
tests-fedora-27:
|
86 |
- image: buildstream/testsuite-fedora:27-master-112-a9f63c5e
|
|
86 |
+ image: buildstream/testsuite-fedora:27-master-114-4cab18e3
|
|
87 | 87 |
<<: *linux-tests
|
88 | 88 |
|
89 | 89 |
tests-fedora-28:
|
90 |
- image: buildstream/testsuite-fedora:28-master-112-a9f63c5e
|
|
90 |
+ image: buildstream/testsuite-fedora:28-master-114-4cab18e3
|
|
91 | 91 |
<<: *linux-tests
|
92 | 92 |
|
93 | 93 |
tests-ubuntu-18.04:
|
94 |
- image: buildstream/testsuite-ubuntu:18.04-master-112-a9f63c5e
|
|
94 |
+ image: buildstream/testsuite-ubuntu:18.04-master-114-4cab18e3
|
|
95 | 95 |
<<: *linux-tests
|
96 | 96 |
|
97 | 97 |
tests-unix:
|
98 | 98 |
# Use fedora here, to a) run a test on fedora and b) ensure that we
|
99 | 99 |
# can get rid of ostree - this is not possible with debian-8
|
100 |
- image: buildstream/testsuite-fedora:27-master-112-a9f63c5e
|
|
100 |
+ image: buildstream/testsuite-fedora:27-master-114-4cab18e3
|
|
101 | 101 |
stage: test
|
102 | 102 |
variables:
|
103 | 103 |
BST_FORCE_BACKEND: "unix"
|
... | ... | @@ -22,12 +22,43 @@ import click |
22 | 22 |
from .app import App
|
23 | 23 |
|
24 | 24 |
|
25 |
+# This trick is currently only supported on some terminals,
|
|
26 |
+# avoid using it where it can cause garbage to be printed
|
|
27 |
+# to the terminal.
|
|
28 |
+#
|
|
29 |
+def _osc_777_supported():
|
|
30 |
+ |
|
31 |
+ term = os.environ['TERM']
|
|
32 |
+ |
|
33 |
+ if term.startswith('xterm') or term.startswith('vte'):
|
|
34 |
+ |
|
35 |
+ # Since vte version 4600, upstream silently ignores
|
|
36 |
+ # the OSC 777 without printing garbage to the terminal.
|
|
37 |
+ #
|
|
38 |
+ # For distros like Fedora who have patched vte, this
|
|
39 |
+ # will trigger a desktop notification and bring attention
|
|
40 |
+ # to the terminal.
|
|
41 |
+ #
|
|
42 |
+ vte_version = os.environ['VTE_VERSION']
|
|
43 |
+ try:
|
|
44 |
+ vte_version_int = int(vte_version)
|
|
45 |
+ except ValueError:
|
|
46 |
+ return False
|
|
47 |
+ |
|
48 |
+ if vte_version_int >= 4600:
|
|
49 |
+ return True
|
|
50 |
+ |
|
51 |
+ return False
|
|
52 |
+ |
|
53 |
+ |
|
25 | 54 |
# A linux specific App implementation
|
26 | 55 |
#
|
27 | 56 |
class LinuxApp(App):
|
28 | 57 |
|
29 | 58 |
def notify(self, title, text):
|
30 | 59 |
|
31 |
- term = os.environ['TERM']
|
|
32 |
- if term in ('xterm', 'vte'):
|
|
33 |
- click.echo("\033]777;notify;{};{}\007".format(title, text))
|
|
60 |
+ # Currently we only try this notification method
|
|
61 |
+ # of sending an escape sequence to the terminal
|
|
62 |
+ #
|
|
63 |
+ if _osc_777_supported():
|
|
64 |
+ click.echo("\033]777;notify;{};{}\007".format(title, text), err=True)
|
... | ... | @@ -10,11 +10,15 @@ from ._exceptions import LoadError, LoadErrorReason |
10 | 10 |
#
|
11 | 11 |
# Args:
|
12 | 12 |
# loader (Loader): The Loader object
|
13 |
+# copy_tree (bool): Whether to make a copy, of tree in
|
|
14 |
+# provenance. Should be true if intended to be
|
|
15 |
+# serialized.
|
|
13 | 16 |
class Includes:
|
14 | 17 |
|
15 |
- def __init__(self, loader):
|
|
18 |
+ def __init__(self, loader, *, copy_tree=False):
|
|
16 | 19 |
self._loader = loader
|
17 | 20 |
self._loaded = {}
|
21 |
+ self._copy_tree = copy_tree
|
|
18 | 22 |
|
19 | 23 |
# process()
|
20 | 24 |
#
|
... | ... | @@ -96,10 +100,11 @@ class Includes: |
96 | 100 |
directory = project.directory
|
97 | 101 |
file_path = os.path.join(directory, include)
|
98 | 102 |
key = (current_loader, file_path)
|
99 |
- if file_path not in self._loaded:
|
|
103 |
+ if key not in self._loaded:
|
|
100 | 104 |
self._loaded[key] = _yaml.load(os.path.join(directory, include),
|
101 | 105 |
shortname=shortname,
|
102 |
- project=project)
|
|
106 |
+ project=project,
|
|
107 |
+ copy_tree=self._copy_tree)
|
|
103 | 108 |
return self._loaded[key], file_path, current_loader
|
104 | 109 |
|
105 | 110 |
# _process_value()
|
... | ... | @@ -78,7 +78,7 @@ class Loader(): |
78 | 78 |
self._elements = {} # Dict of elements
|
79 | 79 |
self._loaders = {} # Dict of junction loaders
|
80 | 80 |
|
81 |
- self._includes = Includes(self)
|
|
81 |
+ self._includes = Includes(self, copy_tree=True)
|
|
82 | 82 |
|
83 | 83 |
# load():
|
84 | 84 |
#
|
... | ... | @@ -235,6 +235,9 @@ class Pipeline(): |
235 | 235 |
# exceptions removed
|
236 | 236 |
#
|
237 | 237 |
def except_elements(self, targets, elements, except_targets):
|
238 |
+ if not except_targets:
|
|
239 |
+ return elements
|
|
240 |
+ |
|
238 | 241 |
targeted = list(self.dependencies(targets, Scope.ALL))
|
239 | 242 |
visited = []
|
240 | 243 |
|
... | ... | @@ -419,7 +419,7 @@ class Project(): |
419 | 419 |
parent=parent_loader,
|
420 | 420 |
tempdir=tempdir)
|
421 | 421 |
|
422 |
- self._project_includes = Includes(self.loader)
|
|
422 |
+ self._project_includes = Includes(self.loader, copy_tree=False)
|
|
423 | 423 |
|
424 | 424 |
project_conf_first_pass = _yaml.node_copy(self._project_conf)
|
425 | 425 |
self._project_includes.process(project_conf_first_pass, only_local=True)
|
... | ... | @@ -43,6 +43,7 @@ def get_config(): |
43 | 43 |
cfg.VCS = "git"
|
44 | 44 |
cfg.style = "pep440"
|
45 | 45 |
cfg.tag_prefix = ""
|
46 |
+ cfg.tag_regex = "*.*.*"
|
|
46 | 47 |
cfg.parentdir_prefix = "BuildStream-"
|
47 | 48 |
cfg.versionfile_source = "buildstream/_version.py"
|
48 | 49 |
cfg.verbose = False
|
... | ... | @@ -215,7 +216,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
215 | 216 |
|
216 | 217 |
|
217 | 218 |
@register_vcs_handler("git", "pieces_from_vcs")
|
218 |
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
219 |
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
|
|
219 | 220 |
"""Get version from 'git describe' in the root of the source tree.
|
220 | 221 |
|
221 | 222 |
This only gets called if the git-archive 'subst' keywords were *not*
|
... | ... | @@ -237,7 +238,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
237 | 238 |
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
238 | 239 |
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
|
239 | 240 |
"--always", "--long",
|
240 |
- "--match", "%s*" % tag_prefix],
|
|
241 |
+ "--match", "%s%s" % (tag_prefix, tag_regex)],
|
|
241 | 242 |
cwd=root)
|
242 | 243 |
# --long was added in git-1.5.5
|
243 | 244 |
if describe_out is None:
|
... | ... | @@ -505,7 +506,7 @@ def get_versions(): |
505 | 506 |
"date": None}
|
506 | 507 |
|
507 | 508 |
try:
|
508 |
- pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
|
|
509 |
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
|
|
509 | 510 |
return render(pieces, cfg.style)
|
510 | 511 |
except NotThisMethod:
|
511 | 512 |
pass
|
... | ... | @@ -508,6 +508,7 @@ class Plugin(): |
508 | 508 |
project = self._get_project()
|
509 | 509 |
|
510 | 510 |
if project._warning_is_fatal(warning_token):
|
511 |
+ detail = detail if detail else ""
|
|
511 | 512 |
raise PluginError(message="{}\n{}".format(brief, detail), reason=warning_token)
|
512 | 513 |
|
513 | 514 |
self.__message(MessageType.WARN, brief=brief, detail=detail)
|
... | ... | @@ -794,7 +794,7 @@ class Source(Plugin): |
794 | 794 |
# Save the ref in the originating file
|
795 | 795 |
#
|
796 | 796 |
try:
|
797 |
- _yaml.dump(_yaml.node_sanitize(provenance.toplevel), provenance.filename.name)
|
|
797 |
+ _yaml.dump(provenance.toplevel, provenance.filename.name)
|
|
798 | 798 |
except OSError as e:
|
799 | 799 |
raise SourceError("{}: Error saving source reference to '{}': {}"
|
800 | 800 |
.format(self, provenance.filename.name, e),
|
... | ... | @@ -484,7 +484,16 @@ def get_bst_version(): |
484 | 484 |
raise UtilError("Your git repository has no tags - BuildStream can't "
|
485 | 485 |
"determine its version. Please run `git fetch --tags`.")
|
486 | 486 |
|
487 |
- return (int(versions[0]), int(versions[1]))
|
|
487 |
+ try:
|
|
488 |
+ return (int(versions[0]), int(versions[1]))
|
|
489 |
+ except IndexError:
|
|
490 |
+ raise UtilError("Cannot detect Major and Minor parts of the version\n"
|
|
491 |
+ "Version: {} not in XX.YY.whatever format"
|
|
492 |
+ .format(__version__))
|
|
493 |
+ except ValueError:
|
|
494 |
+ raise UtilError("Cannot convert version to integer numbers\n"
|
|
495 |
+ "Version: {} not in Integer.Integer.whatever format"
|
|
496 |
+ .format(__version__))
|
|
488 | 497 |
|
489 | 498 |
|
490 | 499 |
@contextmanager
|
1 | 1 |
coverage == 4.4.0
|
2 | 2 |
pep8
|
3 |
-pytest >= 3.1.0
|
|
3 |
+pylint == 2.1.1
|
|
4 |
+pytest >= 3.7
|
|
4 | 5 |
pytest-cov >= 2.5.0
|
5 | 6 |
pytest-datafiles
|
6 | 7 |
pytest-env
|
... | ... | @@ -4,6 +4,7 @@ style = pep440 |
4 | 4 |
versionfile_source = buildstream/_version.py
|
5 | 5 |
versionfile_build = buildstream/_version.py
|
6 | 6 |
tag_prefix =
|
7 |
+tag_regex = *.*.*
|
|
7 | 8 |
parentdir_prefix = BuildStream-
|
8 | 9 |
|
9 | 10 |
[aliases]
|
... | ... | @@ -224,6 +224,13 @@ def get_cmdclass(): |
224 | 224 |
with open('dev-requirements.txt') as dev_reqs:
|
225 | 225 |
dev_requires = dev_reqs.read().splitlines()
|
226 | 226 |
|
227 |
+#####################################################
|
|
228 |
+# Prepare package description from README #
|
|
229 |
+#####################################################
|
|
230 |
+with open(os.path.join(os.path.dirname(os.path.realpath(__file__)),
|
|
231 |
+ 'README.rst')) as readme:
|
|
232 |
+ long_description = readme.read()
|
|
233 |
+ |
|
227 | 234 |
|
228 | 235 |
#####################################################
|
229 | 236 |
# Main setup() Invocation #
|
... | ... | @@ -233,8 +240,13 @@ setup(name='BuildStream', |
233 | 240 |
version=versioneer.get_version(),
|
234 | 241 |
cmdclass=get_cmdclass(),
|
235 | 242 |
|
243 |
+ author='BuildStream Developers',
|
|
244 |
+ author_email='buildstream-list gnome org',
|
|
236 | 245 |
description='A framework for modelling build pipelines in YAML',
|
237 | 246 |
license='LGPL',
|
247 |
+ long_description=long_description,
|
|
248 |
+ long_description_content_type='text/x-rst; charset=UTF-8',
|
|
249 |
+ url='https://gitlab.com/BuildStream/buildstream',
|
|
238 | 250 |
packages=find_packages(exclude=('tests', 'tests.*')),
|
239 | 251 |
package_data={'buildstream': ['plugins/*/*.py', 'plugins/*/*.yaml',
|
240 | 252 |
'data/*.yaml', 'data/*.sh.in']},
|
... | ... | @@ -355,6 +355,7 @@ def get_config_from_root(root): |
355 | 355 |
cfg.versionfile_source = get(parser, "versionfile_source")
|
356 | 356 |
cfg.versionfile_build = get(parser, "versionfile_build")
|
357 | 357 |
cfg.tag_prefix = get(parser, "tag_prefix")
|
358 |
+ cfg.tag_regex = get(parser, "tag_regex") or "*"
|
|
358 | 359 |
if cfg.tag_prefix in ("''", '""'):
|
359 | 360 |
cfg.tag_prefix = ""
|
360 | 361 |
cfg.parentdir_prefix = get(parser, "parentdir_prefix")
|
... | ... | @@ -463,6 +464,7 @@ def get_config(): |
463 | 464 |
cfg.VCS = "git"
|
464 | 465 |
cfg.style = "%(STYLE)s"
|
465 | 466 |
cfg.tag_prefix = "%(TAG_PREFIX)s"
|
467 |
+ cfg.tag_regex = "%(TAG_REGEX)s"
|
|
466 | 468 |
cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s"
|
467 | 469 |
cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s"
|
468 | 470 |
cfg.verbose = False
|
... | ... | @@ -635,7 +637,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
635 | 637 |
|
636 | 638 |
|
637 | 639 |
@register_vcs_handler("git", "pieces_from_vcs")
|
638 |
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
640 |
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
|
|
639 | 641 |
"""Get version from 'git describe' in the root of the source tree.
|
640 | 642 |
|
641 | 643 |
This only gets called if the git-archive 'subst' keywords were *not*
|
... | ... | @@ -657,7 +659,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
657 | 659 |
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
658 | 660 |
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
|
659 | 661 |
"--always", "--long",
|
660 |
- "--match", "%%s*" %% tag_prefix],
|
|
662 |
+ "--match", "%%s%%s" %% (tag_prefix, tag_regex)],
|
|
661 | 663 |
cwd=root)
|
662 | 664 |
# --long was added in git-1.5.5
|
663 | 665 |
if describe_out is None:
|
... | ... | @@ -925,7 +927,7 @@ def get_versions(): |
925 | 927 |
"date": None}
|
926 | 928 |
|
927 | 929 |
try:
|
928 |
- pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
|
|
930 |
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, cfg.tag_regex, root, verbose)
|
|
929 | 931 |
return render(pieces, cfg.style)
|
930 | 932 |
except NotThisMethod:
|
931 | 933 |
pass
|
... | ... | @@ -1027,7 +1029,7 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose): |
1027 | 1029 |
|
1028 | 1030 |
|
1029 | 1031 |
@register_vcs_handler("git", "pieces_from_vcs")
|
1030 |
-def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
|
|
1032 |
+def git_pieces_from_vcs(tag_prefix, tag_regex, root, verbose, run_command=run_command):
|
|
1031 | 1033 |
"""Get version from 'git describe' in the root of the source tree.
|
1032 | 1034 |
|
1033 | 1035 |
This only gets called if the git-archive 'subst' keywords were *not*
|
... | ... | @@ -1049,7 +1051,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): |
1049 | 1051 |
# if there isn't one, this yields HEX[-dirty] (no NUM)
|
1050 | 1052 |
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
|
1051 | 1053 |
"--always", "--long",
|
1052 |
- "--match", "%s*" % tag_prefix],
|
|
1054 |
+ "--match", "%s%s" % (tag_prefix, tag_regex)],
|
|
1053 | 1055 |
cwd=root)
|
1054 | 1056 |
# --long was added in git-1.5.5
|
1055 | 1057 |
if describe_out is None:
|
... | ... | @@ -1451,7 +1453,7 @@ def get_versions(verbose=False): |
1451 | 1453 |
from_vcs_f = handlers.get("pieces_from_vcs")
|
1452 | 1454 |
if from_vcs_f:
|
1453 | 1455 |
try:
|
1454 |
- pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
|
|
1456 |
+ pieces = from_vcs_f(cfg.tag_prefix, cfg.tag_regex, root, verbose)
|
|
1455 | 1457 |
ver = render(pieces, cfg.style)
|
1456 | 1458 |
if verbose:
|
1457 | 1459 |
print("got version from VCS %s" % ver)
|
... | ... | @@ -1586,6 +1588,7 @@ def get_cmdclass(): |
1586 | 1588 |
{"DOLLAR": "$",
|
1587 | 1589 |
"STYLE": cfg.style,
|
1588 | 1590 |
"TAG_PREFIX": cfg.tag_prefix,
|
1591 |
+ "TAG_REGEX": cfg.tag_regex,
|
|
1589 | 1592 |
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
1590 | 1593 |
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
1591 | 1594 |
})
|
... | ... | @@ -1615,6 +1618,7 @@ def get_cmdclass(): |
1615 | 1618 |
{"DOLLAR": "$",
|
1616 | 1619 |
"STYLE": cfg.style,
|
1617 | 1620 |
"TAG_PREFIX": cfg.tag_prefix,
|
1621 |
+ "TAG_REGEX": cfg.tag_regex,
|
|
1618 | 1622 |
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
1619 | 1623 |
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
1620 | 1624 |
})
|
... | ... | @@ -1716,6 +1720,7 @@ def do_setup(): |
1716 | 1720 |
f.write(LONG % {"DOLLAR": "$",
|
1717 | 1721 |
"STYLE": cfg.style,
|
1718 | 1722 |
"TAG_PREFIX": cfg.tag_prefix,
|
1723 |
+ "TAG_REGEX": cfg.tag_regex,
|
|
1719 | 1724 |
"PARENTDIR_PREFIX": cfg.parentdir_prefix,
|
1720 | 1725 |
"VERSIONFILE_SOURCE": cfg.versionfile_source,
|
1721 | 1726 |
})
|