[Notes] [Git][BuildStream/buildstream][tristan/debug-symbols-location] 4 commits: Catch Non Numeric versions



Title: GitLab

Tristan Van Berkom pushed to branch tristan/debug-symbols-location at BuildStream / buildstream

Commits:

13 changed files:

Changes:

  • buildstream/_version.py
    ... ... @@ -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
    

  • buildstream/data/projectconfig.yaml
    ... ... @@ -68,7 +68,7 @@ variables:
    68 68
       # Generic implementation for stripping debugging symbols
    
    69 69
       strip-binaries: |
    
    70 70
     
    
    71
    -    find "%{install-root}" -type f \
    
    71
    +    cd "%{install-root}" && find -type f \
    
    72 72
           '(' -perm -111 -o -name '*.so*' \
    
    73 73
               -o -name '*.cmxs' -o -name '*.node' ')' \
    
    74 74
           -exec sh -ec \
    
    ... ... @@ -76,7 +76,7 @@ variables:
    76 76
            if [ "$hdr" != "$(printf \\x7fELF)" ]; then
    
    77 77
                exit 0
    
    78 78
            fi
    
    79
    -       debugfile="%{install-root}%{debugdir}/$(basename "$1")"
    
    79
    +       debugfile="%{install-root}%{debugdir}/$1"
    
    80 80
            mkdir -p "$(dirname "$debugfile")"
    
    81 81
            objcopy %{objcopy-extract-args} "$1" "$debugfile"
    
    82 82
            chmod 644 "$debugfile"
    

  • buildstream/utils.py
    ... ... @@ -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
    

  • setup.cfg
    ... ... @@ -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]
    

  • tests/cachekey/project/elements/build1.expected
    1
    -90fa9c1b5334aac3bfd8956d92af0a91e2f2bbcbcac73861957165e577bc8768
    \ No newline at end of file
    1
    +05429485dff08bdb968f7d10c2cdda63be49c8a783d54863a0d4abce44bbebe9
    \ No newline at end of file

  • tests/cachekey/project/elements/build2.expected
    1
    -a62c29fe4e05820412e391430f61aa88a1a82e138de8cac726a9dc4fcd7ed8b9
    \ No newline at end of file
    1
    +4155c7bc836cdb092de3241fa92883bd8c7dd94c55affa406e559aeb6252c669
    \ No newline at end of file

  • tests/cachekey/project/target.expected
    1
    -09620aa58875d96611d22632b7585a0f22f88f5ecca6f5d1915d3e529d036bd8
    \ No newline at end of file
    1
    +f5affaacd3ac724f5415a7a8349c6dca6122841dd7f9769de4f9d6cb7185f9b8
    \ No newline at end of file

  • tests/examples/autotools.py
    ... ... @@ -28,7 +28,9 @@ def test_autotools_build(cli, tmpdir, datafiles):
    28 28
     
    
    29 29
         assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
    
    30 30
                                    '/usr/share', '/usr/lib/debug',
    
    31
    -                               '/usr/lib/debug/hello', '/usr/bin/hello',
    
    31
    +                               '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    32
    +                               '/usr/lib/debug/usr/bin/hello',
    
    33
    +                               '/usr/bin/hello',
    
    32 34
                                    '/usr/share/doc', '/usr/share/doc/amhello',
    
    33 35
                                    '/usr/share/doc/amhello/README'])
    
    34 36
     
    

  • tests/examples/flatpak-autotools.py
    ... ... @@ -47,8 +47,10 @@ def test_autotools_build(cli, tmpdir, datafiles):
    47 47
     
    
    48 48
         assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
    
    49 49
                                    '/usr/share', '/usr/lib/debug',
    
    50
    -                               '/usr/lib/debug/hello', '/usr/bin/hello',
    
    51
    -                               '/usr/share/doc', '/usr/share/doc/amhello',
    
    50
    +                               '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    51
    +                               '/usr/lib/debug/usr/bin/hello',
    
    52
    +                               '/usr/bin/hello', '/usr/share/doc',
    
    53
    +                               '/usr/share/doc/amhello',
    
    52 54
                                    '/usr/share/doc/amhello/README'])
    
    53 55
     
    
    54 56
     
    

  • tests/integration/autotools.py
    ... ... @@ -31,8 +31,10 @@ def test_autotools_build(cli, tmpdir, datafiles):
    31 31
     
    
    32 32
         assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
    
    33 33
                                    '/usr/share', '/usr/lib/debug',
    
    34
    -                               '/usr/lib/debug/hello', '/usr/bin/hello',
    
    35
    -                               '/usr/share/doc', '/usr/share/doc/amhello',
    
    34
    +                               '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    35
    +                               '/usr/lib/debug/usr/bin/hello',
    
    36
    +                               '/usr/bin/hello', '/usr/share/doc',
    
    37
    +                               '/usr/share/doc/amhello',
    
    36 38
                                    '/usr/share/doc/amhello/README'])
    
    37 39
     
    
    38 40
     
    

  • tests/integration/cmake.py
    ... ... @@ -27,7 +27,9 @@ def test_cmake_build(cli, tmpdir, datafiles):
    27 27
         assert result.exit_code == 0
    
    28 28
     
    
    29 29
         assert_contains(checkout, ['/usr', '/usr/bin', '/usr/bin/hello',
    
    30
    -                               '/usr/lib/debug', '/usr/lib/debug/hello'])
    
    30
    +                               '/usr/lib/debug', '/usr/lib/debug/usr',
    
    31
    +                               '/usr/lib/debug/usr/bin',
    
    32
    +                               '/usr/lib/debug/usr/bin/hello'])
    
    31 33
     
    
    32 34
     
    
    33 35
     @pytest.mark.datafiles(DATA_DIR)
    

  • tests/integration/compose.py
    ... ... @@ -39,7 +39,8 @@ def create_compose_element(name, path, config={}):
    39 39
         # Test flat inclusion
    
    40 40
         ([], [], ['/usr', '/usr/lib', '/usr/bin',
    
    41 41
                   '/usr/share', '/usr/lib/debug',
    
    42
    -              '/usr/lib/debug/hello', '/usr/bin/hello',
    
    42
    +              '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    43
    +              '/usr/lib/debug/usr/bin/hello', '/usr/bin/hello',
    
    43 44
                   '/usr/share/doc', '/usr/share/doc/amhello',
    
    44 45
                   '/usr/share/doc/amhello/README',
    
    45 46
                   '/tests', '/tests/test']),
    
    ... ... @@ -53,13 +54,17 @@ def create_compose_element(name, path, config={}):
    53 54
                                   '/usr/share/doc/amhello/README']),
    
    54 55
         # Test with only runtime excluded
    
    55 56
         ([], ['runtime'], ['/usr', '/usr/lib', '/usr/share',
    
    56
    -                       '/usr/lib/debug', '/usr/lib/debug/hello',
    
    57
    +                       '/usr/lib/debug', '/usr/lib/debug/usr',
    
    58
    +                       '/usr/lib/debug/usr/bin',
    
    59
    +                       '/usr/lib/debug/usr/bin/hello',
    
    57 60
                            '/usr/share/doc', '/usr/share/doc/amhello',
    
    58 61
                            '/usr/share/doc/amhello/README',
    
    59 62
                            '/tests', '/tests/test']),
    
    60 63
         # Test with runtime and doc excluded
    
    61 64
         ([], ['runtime', 'doc'], ['/usr', '/usr/lib', '/usr/share',
    
    62
    -                              '/usr/lib/debug', '/usr/lib/debug/hello',
    
    65
    +                              '/usr/lib/debug', '/usr/lib/debug/usr',
    
    66
    +                              '/usr/lib/debug/usr/bin',
    
    67
    +                              '/usr/lib/debug/usr/bin/hello',
    
    63 68
                                   '/tests', '/tests/test']),
    
    64 69
         # Test with runtime simultaneously in- and excluded
    
    65 70
         (['runtime'], ['runtime'], ['/usr', '/usr/lib', '/usr/share']),
    
    ... ... @@ -72,7 +77,8 @@ def create_compose_element(name, path, config={}):
    72 77
         # Test excluding a custom 'test' domain
    
    73 78
         ([], ['test'], ['/usr', '/usr/lib', '/usr/bin',
    
    74 79
                         '/usr/share', '/usr/lib/debug',
    
    75
    -                    '/usr/lib/debug/hello', '/usr/bin/hello',
    
    80
    +                    '/usr/lib/debug/usr', '/usr/lib/debug/usr/bin',
    
    81
    +                    '/usr/lib/debug/usr/bin/hello', '/usr/bin/hello',
    
    76 82
                         '/usr/share/doc', '/usr/share/doc/amhello',
    
    77 83
                         '/usr/share/doc/amhello/README'])
    
    78 84
     ])
    

  • versioneer.py
    ... ... @@ -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
                             })
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]