• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 26342152999

23 May 2026 07:59PM UTC coverage: 91.165% (-1.6%) from 92.792%
26342152999

push

github

web-flow
Run Linux ARM CI on Depot runners (#23363)

RunsOn is deprecating their v2 stack, and rather than migrate
to v3 we should use the resources kindly donated by Depot.

GitHub also now has Linux ARM runners, should we need them.

87305 of 95766 relevant lines covered (91.16%)

3.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.18
/src/python/pants/backend/debian/target_types.py
1
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from collections.abc import Sequence
1✔
4
from pathlib import PurePath
1✔
5

6
from pants.core.goals.package import OutputPathField
1✔
7
from pants.engine.target import (
1✔
8
    COMMON_TARGET_FIELDS,
9
    DictStringToStringField,
10
    InvalidFieldException,
11
    MultipleSourcesField,
12
    SpecialCasedDependencies,
13
    StringField,
14
    Target,
15
)
16
from pants.util.docutil import bin_name, doc_url
1✔
17
from pants.util.strutil import help_text, softwrap
1✔
18

19

20
class DebianSources(MultipleSourcesField):
1✔
21
    required = True
1✔
22
    help = help_text(
1✔
23
        """
24
        Paths that will be included in the package to be produced such as Debian metadata files.
25
        You must include a DEBIAN/control file.
26

27
        Paths are relative to the BUILD file's directory and all paths must belong to the same parent directory.
28
        For example, `sources=['dir/**']` is valid, but `sources=['top_level_file.txt']`
29
        and `sources=['dir1/*', 'dir2/*']` are not.
30
        """
31
    )
32

33
    def validate_resolved_files(self, files: Sequence[str]) -> None:
1✔
34
        """Check that all files are coming from the same directory."""
35
        super().validate_resolved_files(files)
1✔
36
        if not files:
1✔
37
            raise InvalidFieldException(
×
38
                softwrap(
39
                    f"""
40
                    The `{self.alias}` field in target `{self.address}` must
41
                    resolve to at least one file.
42
                    """
43
                )
44
            )
45

46
        files_outside_dirs = [f for f in files if len(PurePath(f).parts) == 1]
1✔
47
        if files_outside_dirs:
1✔
48
            raise InvalidFieldException(
×
49
                softwrap(
50
                    f"""
51
                    The `{self.alias}` field in target `{self.address}` must be paths to
52
                    files in a single sources directory. Individual files
53
                    were found: {files_outside_dirs}
54
                    """
55
                )
56
            )
57

58
        directory_prefixes = {PurePath(f).parts[0] for f in files}
1✔
59
        if len(directory_prefixes) > 1:
1✔
60
            raise InvalidFieldException(
×
61
                softwrap(
62
                    f"""
63
                    The `{self.alias}` field in target `{self.address}` must be paths to
64
                    files in a single sources directory. Multiple directories
65
                    were found: {directory_prefixes}
66
                    """
67
                )
68
            )
69

70

71
class DebianSymlinks(DictStringToStringField):
1✔
72
    alias = "symlinks"
1✔
73
    help = help_text(
1✔
74
        """
75
        Symlinks to create for each target being packaged.
76

77
        For example, you could set symlinks={'command-name': 'entrypoint-name'}.
78
        """
79
    )
80

81

82
class DebianInstallPrefix(StringField):
1✔
83
    alias = "install_prefix"
1✔
84
    default = "/opt"
1✔
85
    help = "Absolute path to a directory where Debian package will be installed to."
1✔
86

87

88
class DebianPackageDependencies(SpecialCasedDependencies):
1✔
89
    alias = "packages"
1✔
90
    required = True
1✔
91
    help = help_text(
1✔
92
        f"""
93
        Addresses to any targets that can be built with `{bin_name()} package`, e.g.
94
        `["project:app"]`.
95

96
        Pants will build the assets as if you had run `{bin_name()} package`.
97
        It will include the results in your Debian package using the same name they would normally have,
98
        but without the `--distdir` prefix (e.g. `dist/`).
99

100
        You can include anything that can be built by `{bin_name()} package`, e.g. a `pex_binary`,
101
        a `python_distribution`, or an `archive`.
102
        """
103
    )
104

105

106
class DebianPackage(Target):
1✔
107
    alias = "debian_package"
1✔
108
    core_fields = (
1✔
109
        *COMMON_TARGET_FIELDS,
110
        OutputPathField,
111
        DebianSources,
112
        DebianSymlinks,
113
        DebianInstallPrefix,
114
        DebianPackageDependencies,
115
    )
116
    help = help_text(
1✔
117
        f"""
118
        A Debian package containing an artifact.
119

120
        This will not install the package, only create a `.deb` file
121
        that you can then distribute and install, e.g. via `dpkg`.
122

123
        See {doc_url("reference/targets/debian_package")}.
124
        """
125
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc