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



Title: GitLab

Tristan Van Berkom pushed to branch tristan/debug-symbols-location-1.2 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
    ... ... @@ -72,7 +72,7 @@ variables:
    72 72
       # Generic implementation for stripping debugging symbols
    
    73 73
       strip-binaries: |
    
    74 74
     
    
    75
    -    find "%{install-root}" -type f \
    
    75
    +    cd "%{install-root}" && find -type f \
    
    76 76
           '(' -perm -111 -o -name '*.so*' \
    
    77 77
               -o -name '*.cmxs' -o -name '*.node' ')' \
    
    78 78
           -exec sh -ec \
    
    ... ... @@ -80,7 +80,7 @@ variables:
    80 80
            if [ "$hdr" != "$(printf \\x7fELF)" ]; then
    
    81 81
                exit 0
    
    82 82
            fi
    
    83
    -       debugfile="%{install-root}%{debugdir}/$(basename "$1")"
    
    83
    +       debugfile="%{install-root}%{debugdir}/$1"
    
    84 84
            mkdir -p "$(dirname "$debugfile")"
    
    85 85
            objcopy %{objcopy-extract-args} "$1" "$debugfile"
    
    86 86
            chmod 644 "$debugfile"
    

  • buildstream/utils.py
    ... ... @@ -481,7 +481,16 @@ def get_bst_version():
    481 481
             raise UtilError("Your git repository has no tags - BuildStream can't "
    
    482 482
                             "determine its version. Please run `git fetch --tags`.")
    
    483 483
     
    
    484
    -    return (int(versions[0]), int(versions[1]))
    
    484
    +    try:
    
    485
    +        return (int(versions[0]), int(versions[1]))
    
    486
    +    except IndexError:
    
    487
    +        raise UtilError("Cannot detect Major and Minor parts of the version\n"
    
    488
    +                        "Version: {} not in XX.YY.whatever format"
    
    489
    +                        .format(__version__))
    
    490
    +    except ValueError:
    
    491
    +        raise UtilError("Cannot convert version to integer numbers\n"
    
    492
    +                        "Version: {} not in Integer.Integer.whatever format"
    
    493
    +                        .format(__version__))
    
    485 494
     
    
    486 495
     
    
    487 496
     @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
    -e7de3dd12a1e5307e07859ddf2192443a0ccb1ff48e0adcc6c18f9edc2bd0d7d
    \ No newline at end of file
    1
    +afab4c1a67d1e06489083fa1559bda0b2c8df9b7bc239820ed7cdab30c988a4e
    \ No newline at end of file

  • tests/cachekey/project/elements/build2.expected
    1
    -d74957e0f20a7664e9ceed6cc2ba6c140bd8d8d0712d02066feb442638e8e6ed
    \ No newline at end of file
    1
    +47395a4e6c86372b181ad1fd6443e11b1ab54c480b7be5e5fe816d84eec3b369
    \ No newline at end of file

  • tests/cachekey/project/target.expected
    1
    -01f611e61e948f32035b659d33cdae662d863c99051d0e6746f9c5626138655f
    \ No newline at end of file
    1
    +46f48e5c0ff52370ff0cf2bb23bd2c79da23141e6c17b9aa720f7d97b7194340
    \ 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]