Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # Build the required docker image to run package unit tests |
| 4 | # |
| 5 | # Script Variables: |
| 6 | # DOCKER_IMG_NAME: <optional, the name of the docker image to generate> |
| 7 | # default is openbmc/ubuntu-unit-test |
| 8 | # DISTRO: <optional, the distro to build a docker image against> |
| 9 | # default is ubuntu:eoan |
| 10 | # BRANCH: <optional, branch to build from each of the openbmc/ |
| 11 | # repositories> |
| 12 | # default is master, which will be used if input branch not |
| 13 | # provided or not found |
| 14 | # UBUNTU_MIRROR: <optional, the URL of a mirror of Ubuntu to override the |
| 15 | # default ones in /etc/apt/sources.list> |
| 16 | # default is empty, and no mirror is used. |
| 17 | # http_proxy The HTTP address of the proxy server to connect to. |
| 18 | # Default: "", proxy is not setup if this is not set |
| 19 | |
| 20 | import os |
| 21 | import sys |
| 22 | from sh import docker, git, nproc, uname |
| 23 | |
| 24 | # Read a bunch of environment variables. |
| 25 | docker_image_name = os.environ.get("DOCKER_IMAGE_NAME", "openbmc/ubuntu-unit-test") |
| 26 | distro = os.environ.get("DISTRO", "ubuntu:focal") |
| 27 | branch = os.environ.get("BRANCH", "master") |
| 28 | ubuntu_mirror = os.environ.get("UBUNTU_MIRROR") |
| 29 | http_proxy = os.environ.get("http_proxy") |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 30 | prefix = "/usr/local" |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 31 | |
| 32 | # Set up some common variables. |
| 33 | proc_count = nproc().strip() |
| 34 | username = os.environ.get("USER") |
| 35 | homedir = os.environ.get("HOME") |
| 36 | gid = os.getgid() |
| 37 | uid = os.getuid() |
| 38 | |
| 39 | # Determine the architecture for Docker. |
| 40 | arch = uname("-m").strip() |
| 41 | if arch == "ppc64le": |
| 42 | docker_base = "ppc64le/" |
| 43 | elif arch == "x86_64": |
| 44 | docker_base = "" |
| 45 | else: |
| 46 | print(f"Unsupported system architecture({arch}) found for docker image") |
| 47 | sys.exit(1) |
| 48 | |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 49 | # Packages to include in image. |
| 50 | packages = { |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 51 | "boost": { |
| 52 | "rev": "1.74.0", |
| 53 | "url": ( |
| 54 | lambda pkg, rev: f"https://dl.bintray.com/boostorg/release/{rev}/source/{pkg}_{rev.replace('.', '_')}.tar.bz2" |
| 55 | ), |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 56 | "build_type": "custom", |
| 57 | "build_steps": [ |
| 58 | f"./bootstrap.sh --prefix={prefix} --with-libraries=context,coroutine", |
| 59 | "./b2", |
| 60 | f"./b2 install --prefix={prefix}", |
| 61 | ], |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 62 | }, |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 63 | "USCiLab/cereal": { |
| 64 | "rev": "v1.3.0", |
| 65 | "build_type": "custom", |
| 66 | "build_steps": [f"cp -a include/cereal/ {prefix}/include/"], |
| 67 | }, |
| 68 | "catchorg/Catch2": { |
| 69 | "rev": "v2.12.2", |
| 70 | "build_type": "cmake", |
| 71 | "config_flags": ["-DBUILD_TESTING=OFF", "-DCATCH_INSTALL_DOCS=OFF"], |
| 72 | }, |
| 73 | "CLIUtils/CLI11": { |
| 74 | "rev": "v1.9.0", |
| 75 | "build_type": "cmake", |
| 76 | "config_flags": [ |
| 77 | "-DBUILD_TESTING=OFF", |
| 78 | "-DCLI11_BUILD_DOCS=OFF", |
| 79 | "-DCLI11_BUILD_EXAMPLES=OFF", |
| 80 | ], |
| 81 | }, |
| 82 | "fmtlib/fmt": { |
| 83 | "rev": "6.2.1", |
| 84 | "build_type": "cmake", |
| 85 | "config_flags": [ |
| 86 | "-DFMT_DOC=OFF", |
| 87 | "-DFMT_TEST=OFF", |
| 88 | ], |
| 89 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 90 | # Snapshot from 2020-01-03 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 91 | "Naios/function2": { |
| 92 | "rev": "3a0746bf5f601dfed05330aefcb6854354fce07d", |
| 93 | "build_type": "custom", |
| 94 | "build_steps": [ |
| 95 | f"mkdir {prefix}/include/function2", |
| 96 | f"cp include/function2/function2.hpp {prefix}/include/function2/", |
| 97 | ], |
| 98 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 99 | # Snapshot from 2020-02-13 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 100 | "google/googletest": { |
| 101 | "rev": "23b2a3b1cf803999fb38175f6e9e038a4495c8a5", |
| 102 | "build_type": "cmake", |
| 103 | "config_env": ["CXXFLAGS=-std=c++17"], |
| 104 | "config_flags": ["-DTHREADS_PREFER_PTHREAD_FLAG=ON"], |
| 105 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 106 | # Release 2020-08-06 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 107 | "nlohmann/json": { |
| 108 | "rev": "v3.9.1", |
| 109 | "build_type": "custom", |
| 110 | "build_steps": [ |
| 111 | f"mkdir {prefix}/include/nlohmann", |
| 112 | f"cp include/nlohmann/json.hpp {prefix}/include/nlohmann", |
| 113 | f"ln -s {prefix}/include/nlohmann/json.hpp {prefix}/include/json.hpp", |
| 114 | ], |
| 115 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 116 | # Snapshot from 2019-05-24 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 117 | "linux-test-project/lcov": { |
| 118 | "rev": "75fbae1cfc5027f818a0bb865bf6f96fab3202da", |
| 119 | "build_type": "make", |
| 120 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 121 | # dev-5.0 2019-05-03 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 122 | "openbmc/linux": { |
| 123 | "rev": "8bf6567e77f7aa68975b7c9c6d044bba690bf327", |
| 124 | "build_type": "custom", |
| 125 | "build_steps": [ |
| 126 | f"make -j{proc_count} defconfig", |
| 127 | f"make INSTALL_HDR_PATH={prefix} headers_install", |
| 128 | ], |
| 129 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 130 | # Snapshot from 2019-09-03 |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 131 | "LibVNC/libvncserver": { |
| 132 | "rev": "1354f7f1bb6962dab209eddb9d6aac1f03408110", |
| 133 | "build_type": "cmake", |
| 134 | }, |
| 135 | "martinmoene/span-lite": { |
| 136 | "rev": "v0.7.0", |
| 137 | "build_type": "cmake", |
| 138 | "config_flags": [ |
| 139 | "-DSPAN_LITE_OPT_BUILD_TESTS=OFF", |
| 140 | ], |
| 141 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 142 | # version from meta-openembedded/meta-oe/recipes-support/libtinyxml2/libtinyxml2_5.0.1.bb |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 143 | "leethomason/tinyxml2": { |
| 144 | "rev": "37bc3aca429f0164adf68c23444540b4a24b5778", |
| 145 | "build_type": "cmake", |
| 146 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 147 | # version from /meta-openembedded/meta-oe/recipes-devtools/boost-url/boost-url_git.bb |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 148 | "CPPAlliance/url": { |
| 149 | "rev": "a56ae0df6d3078319755fbaa67822b4fa7fd352b", |
| 150 | "build_type": "cmake", |
| 151 | "config_flags": [ |
| 152 | "-DBOOST_URL_BUILD_EXAMPLES=OFF", |
| 153 | "-DBOOST_URL_BUILD_TESTS=OFF", |
| 154 | "-DBOOST_URL_STANDALONE=ON", |
| 155 | ], |
| 156 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 157 | # version from meta-openembedded/meta-oe/recipes-devtools/valijson/valijson_git.bb |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 158 | "tristanpenman/valijson": { |
| 159 | "rev": "c2f22fddf599d04dc33fcd7ed257c698a05345d9", |
| 160 | "build_type": "cmake", |
| 161 | "config_flags": [ |
| 162 | "-DBUILD_TESTS=0", |
| 163 | "-DINSTALL_HEADERS=1", |
| 164 | ], |
| 165 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 166 | # version from meta-openembedded/meta-oe/recipes-devtools/nlohmann-fifo/nlohmann-fifo_git.bb |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 167 | "nlohmann/fifo_map": { |
| 168 | "rev": "0dfbf5dacbb15a32c43f912a7e66a54aae39d0f9", |
| 169 | "build_type": "custom", |
| 170 | "build_steps": [f"cp src/fifo_map.hpp {prefix}/include/"], |
| 171 | }, |
| 172 | "open-power/pdbg": {"build_type": "autoconf"}, |
| 173 | "openbmc/gpioplus": { |
| 174 | "depends": ["openbmc/stdplus"], |
| 175 | "build_type": "meson", |
| 176 | "config_flags": [ |
| 177 | "-Dexamples=false", |
| 178 | "-Dtests=disabled", |
| 179 | ], |
| 180 | }, |
| 181 | "openbmc/phosphor-dbus-interfaces": { |
| 182 | "depends": ["openbmc/sdbusplus"], |
| 183 | "build_type": "meson", |
| 184 | "config_flags": [ |
| 185 | "-Ddata_com_ibm=true", |
| 186 | "-Ddata_org_open_power=true", |
| 187 | ], |
| 188 | }, |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 189 | "openbmc/phosphor-logging": { |
| 190 | "depends": [ |
| 191 | "USCiLab/cereal", |
| 192 | "nlohmann/fifo_map", |
| 193 | "openbmc/phosphor-dbus-interfaces", |
| 194 | "openbmc/sdbusplus", |
| 195 | "openbmc/sdeventplus", |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 196 | ], |
| 197 | "build_type": "autoconf", |
| 198 | "config_flags": [ |
| 199 | "--enable-metadata-processing", |
| 200 | f"YAML_DIR={prefix}/share/phosphor-dbus-yaml/yaml", |
| 201 | ], |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 202 | }, |
| 203 | "openbmc/phosphor-objmgr": { |
| 204 | "depends": [ |
| 205 | "boost", |
| 206 | "leethomason/tinyxml2", |
| 207 | "openbmc/phosphor-logging", |
| 208 | "openbmc/sdbusplus", |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 209 | ], |
| 210 | "build_type": "autoconf", |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 211 | }, |
| 212 | "openbmc/pldm": { |
| 213 | "depends": [ |
| 214 | "CLIUtils/CLI11", |
| 215 | "boost", |
| 216 | "nlohmann/json", |
| 217 | "openbmc/phosphor-dbus-interfaces", |
| 218 | "openbmc/phosphor-logging", |
| 219 | "openbmc/sdbusplus", |
| 220 | "openbmc/sdeventplus", |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 221 | ], |
| 222 | "build_type": "meson", |
| 223 | "config_flags": [ |
| 224 | "-Dlibpldm-only=enabled", |
| 225 | "-Doem-ibm=enabled", |
| 226 | "-Dtests=disabled", |
| 227 | ], |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 228 | }, |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 229 | "openbmc/sdbusplus": { |
| 230 | "build_type": "meson", |
| 231 | "custom_post_dl": [ |
| 232 | "cd tools", |
| 233 | f"./setup.py install --root=/ --prefix={prefix}", |
| 234 | "cd ..", |
| 235 | ], |
| 236 | "config_flags": [ |
| 237 | "-Dexamples=disabled", |
| 238 | "-Dtests=disabled", |
| 239 | ], |
| 240 | }, |
| 241 | "openbmc/sdeventplus": { |
| 242 | "depends": ["Naios/function2", "openbmc/stdplus"], |
| 243 | "build_type": "meson", |
| 244 | "config_flags": [ |
| 245 | "-Dexamples=false", |
| 246 | "-Dtests=disabled", |
| 247 | ], |
| 248 | }, |
| 249 | "openbmc/stdplus": { |
| 250 | "depends": ["fmtlib/fmt", "martinmoene/span-lite"], |
| 251 | "build_type": "meson", |
| 252 | "config_flags": [ |
| 253 | "-Dexamples=false", |
| 254 | "-Dtests=disabled", |
| 255 | ], |
| 256 | }, |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 257 | } |
| 258 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 259 | |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 260 | def pkg_rev(pkg): |
| 261 | return packages[pkg]["rev"] |
| 262 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 263 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 264 | def pkg_stagename(pkg): |
| 265 | if not pkg.startswith("openbmc/"): |
| 266 | pkg = "openbmc/" + pkg |
| 267 | return pkg.replace("/", "-") |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 268 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 269 | |
| 270 | def pkg_url(pkg): |
| 271 | if "url" in packages[pkg]: |
| 272 | return packages[pkg]["url"](pkg, pkg_rev(pkg)) |
| 273 | return f"https://github.com/{pkg}/archive/{pkg_rev(pkg)}.tar.gz" |
| 274 | |
| 275 | |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 276 | def pkg_download(pkg): |
| 277 | url = pkg_url(pkg) |
| 278 | if ".tar." not in url: |
| 279 | raise NotImplementedError(f"Unhandled download type for {pkg}: {url}") |
| 280 | cmd = f"curl -L {url} | tar -x" |
| 281 | if url.endswith(".bz2"): |
| 282 | cmd += "j" |
| 283 | if url.endswith(".gz"): |
| 284 | cmd += "z" |
| 285 | return cmd |
| 286 | |
| 287 | |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 288 | def pkg_copycmds(pkg=None): |
| 289 | pkgs = [] |
| 290 | if pkg: |
| 291 | if "depends" not in packages[pkg]: |
| 292 | return "" |
| 293 | pkgs = sorted(packages[pkg]["depends"]) |
| 294 | else: |
| 295 | pkgs = sorted(packages.keys()) |
| 296 | |
| 297 | copy_cmds = "" |
| 298 | for p in pkgs: |
| 299 | copy_cmds += f"COPY --from={pkg_stagename(p)} {prefix} {prefix}\n" |
| 300 | # Workaround for upstream docker bug and multiple COPY cmds |
| 301 | # https://github.com/moby/moby/issues/37965 |
| 302 | copy_cmds += "RUN true\n" |
| 303 | return copy_cmds |
| 304 | |
| 305 | |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 306 | def pkg_cd_srcdir(pkg): |
| 307 | return f"cd {pkg.split('/')[-1]}* && " |
| 308 | |
| 309 | |
| 310 | def pkg_build(pkg): |
| 311 | result = f"RUN {pkg_download(pkg)} && " |
| 312 | result += pkg_cd_srcdir(pkg) |
| 313 | |
| 314 | if "custom_post_dl" in packages[pkg]: |
| 315 | result += " && ".join(packages[pkg]["custom_post_dl"]) + " && " |
| 316 | |
| 317 | build_type = packages[pkg]["build_type"] |
| 318 | if build_type == "autoconf": |
| 319 | result += pkg_build_autoconf(pkg) |
| 320 | elif build_type == "cmake": |
| 321 | result += pkg_build_cmake(pkg) |
| 322 | elif build_type == "custom": |
| 323 | result += pkg_build_custom(pkg) |
| 324 | elif build_type == "make": |
| 325 | result += pkg_build_make(pkg) |
| 326 | elif build_type == "meson": |
| 327 | result += pkg_build_meson(pkg) |
| 328 | else: |
| 329 | raise NotImplementedError( |
| 330 | f"Unhandled build type for {pkg}: {packages[pkg]['build_type']}" |
| 331 | ) |
| 332 | |
| 333 | return result |
| 334 | |
| 335 | |
| 336 | def pkg_build_autoconf(pkg): |
| 337 | options = " ".join(packages[pkg].get("config_flags", [])) |
| 338 | env = " ".join(packages[pkg].get("config_env", [])) |
| 339 | result = "./bootstrap.sh && " |
| 340 | result += f"{env} ./configure {configure_flags} {options} && " |
| 341 | result += f"make -j{proc_count} && " |
| 342 | result += "make install " |
| 343 | return result |
| 344 | |
| 345 | |
| 346 | def pkg_build_cmake(pkg): |
| 347 | options = " ".join(packages[pkg].get("config_flags", [])) |
| 348 | env = " ".join(packages[pkg].get("config_env", [])) |
| 349 | result = "mkdir builddir && cd builddir && " |
| 350 | result += f"{env} cmake {cmake_flags} {options} .. && " |
| 351 | result += f"make -j{proc_count} && " |
| 352 | result += f"make install &&" |
| 353 | result += "cd .. " |
| 354 | return result |
| 355 | |
| 356 | |
| 357 | def pkg_build_custom(pkg): |
| 358 | return " && ".join(packages[pkg].get("build_steps", [])) |
| 359 | |
| 360 | |
| 361 | def pkg_build_make(pkg): |
| 362 | result = f"make -j{proc_count} && " |
| 363 | result += "make install " |
| 364 | return result |
| 365 | |
| 366 | |
| 367 | def pkg_build_meson(pkg): |
| 368 | options = " ".join(packages[pkg].get("config_flags", [])) |
| 369 | env = " ".join(packages[pkg].get("config_env", [])) |
| 370 | result = f"{env} meson builddir {meson_flags} {options} && " |
| 371 | result += "ninja -C builddir && ninja -C builddir install " |
| 372 | return result |
| 373 | |
| 374 | |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 375 | # Look up the HEAD for missing a static rev. |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 376 | pkg_lookups = {} |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 377 | for pkg in packages.keys(): |
| 378 | if "rev" in packages[pkg]: |
| 379 | continue |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 380 | pkg_lookups[pkg] = git( |
| 381 | "ls-remote", "--heads", f"https://github.com/{pkg}", _bg=True |
| 382 | ) |
| 383 | for pkg, result in pkg_lookups.items(): |
| 384 | for line in result.stdout.decode().split("\n"): |
| 385 | if f"refs/heads/{branch}" in line: |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 386 | packages[pkg]["rev"] = line.strip().split()[0] |
| 387 | elif "refs/heads/master" in line and p not in packages: |
| 388 | packages[pkg]["rev"] = line.strip().split()[0] |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 389 | |
| 390 | # Create the contents of the '/tmp/depcache'. |
| 391 | # This needs to be sorted for consistency. |
| 392 | depcache = "" |
Patrick Williams | 7204324 | 2021-02-02 10:31:45 -0600 | [diff] [blame] | 393 | for pkg in sorted(packages.keys()): |
| 394 | depcache += "%s:%s," % (pkg, pkg_rev(pkg)) |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 395 | |
| 396 | # Define common flags used for builds |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 397 | configure_flags = " ".join( |
| 398 | [ |
| 399 | f"--prefix={prefix}", |
| 400 | ] |
| 401 | ) |
| 402 | cmake_flags = " ".join( |
| 403 | [ |
| 404 | "-DCMAKE_BUILD_TYPE=RelWithDebInfo", |
| 405 | "-DBUILD_SHARED_LIBS=ON", |
| 406 | f"-DCMAKE_INSTALL_PREFIX:PATH={prefix}", |
| 407 | ] |
| 408 | ) |
| 409 | meson_flags = " ".join( |
| 410 | [ |
| 411 | "--wrap-mode=nodownload", |
| 412 | f"-Dprefix={prefix}", |
| 413 | ] |
| 414 | ) |
| 415 | |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 416 | # Build the commands needed to compose our final image |
| 417 | # We must sort the packages, otherwise we might produce an unstable |
| 418 | # docker file and rebuild the image unnecessarily |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 419 | copy_cmds = pkg_copycmds() |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 420 | |
| 421 | # Special flags if setting up a deb mirror. |
| 422 | mirror = "" |
| 423 | if "ubuntu" in distro and ubuntu_mirror: |
| 424 | mirror = f""" |
| 425 | RUN echo "deb {ubuntu_mirror} $(. /etc/os-release && echo $VERSION_CODENAME) main restricted universe multiverse" > /etc/apt/sources.list && \\ |
| 426 | echo "deb {ubuntu_mirror} $(. /etc/os-release && echo $VERSION_CODENAME)-updates main restricted universe multiverse" >> /etc/apt/sources.list && \\ |
| 427 | echo "deb {ubuntu_mirror} $(. /etc/os-release && echo $VERSION_CODENAME)-security main restricted universe multiverse" >> /etc/apt/sources.list && \\ |
| 428 | echo "deb {ubuntu_mirror} $(. /etc/os-release && echo $VERSION_CODENAME)-proposed main restricted universe multiverse" >> /etc/apt/sources.list && \\ |
| 429 | echo "deb {ubuntu_mirror} $(. /etc/os-release && echo $VERSION_CODENAME)-backports main restricted universe multiverse" >> /etc/apt/sources.list |
| 430 | """ |
| 431 | |
| 432 | # Special flags for proxying. |
| 433 | proxy_cmd = "" |
| 434 | proxy_args = [] |
| 435 | if http_proxy: |
| 436 | proxy_cmd = f""" |
| 437 | RUN echo "[http]" >> {homedir}/.gitconfig && \ |
| 438 | echo "proxy = {http_proxy}" >> {homedir}/.gitconfig |
| 439 | """ |
| 440 | proxy_args.extend( |
| 441 | [ |
| 442 | "--build-arg", |
| 443 | f"http_proxy={http_proxy}", |
| 444 | "--build-arg", |
| 445 | "https_proxy={https_proxy}", |
| 446 | ] |
| 447 | ) |
| 448 | |
| 449 | # Create docker image that can run package unit tests |
| 450 | dockerfile = f""" |
| 451 | FROM {docker_base}{distro} as openbmc-base |
| 452 | |
| 453 | {mirror} |
| 454 | |
| 455 | ENV DEBIAN_FRONTEND noninteractive |
| 456 | |
| 457 | ENV PYTHONPATH "/usr/local/lib/python3.8/site-packages/" |
| 458 | |
| 459 | # We need the keys to be imported for dbgsym repos |
| 460 | # New releases have a package, older ones fall back to manual fetching |
| 461 | # https://wiki.ubuntu.com/Debug%20Symbol%20Packages |
| 462 | RUN apt-get update && ( apt-get install ubuntu-dbgsym-keyring || ( apt-get install -yy dirmngr && \ |
| 463 | apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F2EDC64DC5AEE1F6B9C621F0C8CAB6595FDFF622 ) ) |
| 464 | |
| 465 | # Parse the current repo list into a debug repo list |
| 466 | RUN sed -n '/^deb /s,^deb [^ ]* ,deb http://ddebs.ubuntu.com ,p' /etc/apt/sources.list >/etc/apt/sources.list.d/debug.list |
| 467 | |
| 468 | # Remove non-existent debug repos |
| 469 | RUN sed -i '/-\(backports\|security\) /d' /etc/apt/sources.list.d/debug.list |
| 470 | |
| 471 | RUN cat /etc/apt/sources.list.d/debug.list |
| 472 | |
| 473 | RUN apt-get update && apt-get dist-upgrade -yy && apt-get install -yy \ |
| 474 | gcc-10 \ |
| 475 | g++-10 \ |
| 476 | libc6-dbg \ |
| 477 | libc6-dev \ |
| 478 | libtool \ |
| 479 | bison \ |
| 480 | libdbus-1-dev \ |
| 481 | flex \ |
| 482 | cmake \ |
| 483 | python3 \ |
| 484 | python3-dev\ |
| 485 | python3-yaml \ |
| 486 | python3-mako \ |
| 487 | python3-pip \ |
| 488 | python3-setuptools \ |
| 489 | python3-git \ |
| 490 | python3-socks \ |
| 491 | pkg-config \ |
| 492 | autoconf \ |
| 493 | autoconf-archive \ |
| 494 | libsystemd-dev \ |
| 495 | systemd \ |
| 496 | libssl-dev \ |
| 497 | libevdev-dev \ |
| 498 | libevdev2-dbgsym \ |
| 499 | libjpeg-dev \ |
| 500 | libpng-dev \ |
| 501 | ninja-build \ |
| 502 | sudo \ |
| 503 | curl \ |
| 504 | git \ |
| 505 | dbus \ |
| 506 | iputils-ping \ |
| 507 | clang-10 \ |
| 508 | clang-format-10 \ |
| 509 | clang-tidy-10 \ |
| 510 | clang-tools-10 \ |
| 511 | shellcheck \ |
| 512 | npm \ |
| 513 | iproute2 \ |
| 514 | libnl-3-dev \ |
| 515 | libnl-genl-3-dev \ |
| 516 | libconfig++-dev \ |
| 517 | libsnmp-dev \ |
| 518 | valgrind \ |
| 519 | valgrind-dbg \ |
| 520 | libpam0g-dev \ |
| 521 | xxd \ |
| 522 | libi2c-dev \ |
| 523 | wget \ |
| 524 | libldap2-dev \ |
| 525 | libprotobuf-dev \ |
| 526 | libperlio-gzip-perl \ |
| 527 | libjson-perl \ |
| 528 | protobuf-compiler \ |
| 529 | libgpiod-dev \ |
| 530 | device-tree-compiler \ |
| 531 | cppcheck \ |
| 532 | libpciaccess-dev \ |
| 533 | libmimetic-dev \ |
| 534 | libxml2-utils \ |
| 535 | libxml-simple-perl |
| 536 | |
| 537 | RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 1000 \ |
| 538 | --slave /usr/bin/g++ g++ /usr/bin/g++-10 \ |
| 539 | --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \ |
| 540 | --slave /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-10 \ |
| 541 | --slave /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-10 |
| 542 | |
| 543 | |
| 544 | RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 1000 \ |
| 545 | --slave /usr/bin/clang++ clang++ /usr/bin/clang++-10 \ |
| 546 | --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-10 \ |
| 547 | --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-10 \ |
| 548 | --slave /usr/bin/run-clang-tidy.py run-clang-tidy.py /usr/bin/run-clang-tidy-10.py |
| 549 | |
| 550 | RUN pip3 install inflection |
| 551 | RUN pip3 install pycodestyle |
| 552 | RUN pip3 install jsonschema |
| 553 | RUN pip3 install meson==0.54.3 |
| 554 | RUN pip3 install protobuf |
| 555 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 556 | FROM openbmc-base as {pkg_stagename('linux-test-project/lcov')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 557 | {pkg_copycmds('linux-test-project/lcov')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 558 | {pkg_build('linux-test-project/lcov')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 559 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 560 | FROM openbmc-base as {pkg_stagename('Naios/function2')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 561 | {pkg_copycmds('Naios/function2')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 562 | {pkg_build('Naios/function2')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 563 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 564 | FROM openbmc-base as {pkg_stagename('google/googletest')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 565 | {pkg_copycmds('google/googletest')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 566 | {pkg_build('google/googletest')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 567 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 568 | FROM openbmc-base as {pkg_stagename('catchorg/Catch2')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 569 | {pkg_copycmds('catchorg/Catch2')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 570 | {pkg_build('catchorg/Catch2')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 571 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 572 | FROM openbmc-base as {pkg_stagename('USCiLab/cereal')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 573 | {pkg_copycmds('USCiLab/cereal')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 574 | {pkg_build('USCiLab/cereal')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 575 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 576 | FROM openbmc-base as {pkg_stagename('CLIUtils/CLI11')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 577 | {pkg_copycmds('CLIUtils/CLI11')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 578 | {pkg_build('CLIUtils/CLI11')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 579 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 580 | FROM openbmc-base as {pkg_stagename('fmtlib/fmt')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 581 | {pkg_copycmds('fmtlib/fmt')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 582 | {pkg_build('fmtlib/fmt')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 583 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 584 | FROM openbmc-base as {pkg_stagename('nlohmann/json')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 585 | {pkg_copycmds('nlohmann/json')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 586 | {pkg_build('nlohmann/json')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 587 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 588 | FROM openbmc-base as {pkg_stagename('nlohmann/fifo_map')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 589 | {pkg_copycmds('nlohmann/fifo_map')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 590 | {pkg_build('nlohmann/fifo_map')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 591 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 592 | FROM openbmc-base as {pkg_stagename('martinmoene/span-lite')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 593 | {pkg_copycmds('martinmoene/span-lite')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 594 | {pkg_build('martinmoene/span-lite')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 595 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 596 | FROM openbmc-base as {pkg_stagename('openbmc/linux')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 597 | {pkg_copycmds('openbmc/linux')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 598 | {pkg_build('openbmc/linux')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 599 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 600 | FROM openbmc-base as {pkg_stagename('boost')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 601 | {pkg_copycmds('boost')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 602 | {pkg_build('boost')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 603 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 604 | FROM openbmc-base as {pkg_stagename('leethomason/tinyxml2')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 605 | {pkg_copycmds('leethomason/tinyxml2')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 606 | {pkg_build('leethomason/tinyxml2')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 607 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 608 | FROM openbmc-base as {pkg_stagename('CPPAlliance/url')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 609 | {pkg_copycmds('CPPAlliance/url')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 610 | {pkg_build('CPPAlliance/url')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 611 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 612 | FROM openbmc-base as {pkg_stagename('tristanpenman/valijson')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 613 | {pkg_copycmds('tristanpenman/valijson')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 614 | {pkg_build('tristanpenman/valijson')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 615 | |
Patrick Williams | 2abc4a4 | 2021-02-03 06:11:40 -0600 | [diff] [blame] | 616 | FROM openbmc-base as {pkg_stagename('LibVNC/libvncserver')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 617 | {pkg_copycmds('LibVNC/libvncserver')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 618 | {pkg_build('LibVNC/libvncserver')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 619 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 620 | FROM openbmc-base as {pkg_stagename('openbmc/stdplus')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 621 | {pkg_copycmds('openbmc/stdplus')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 622 | {pkg_build('openbmc/stdplus')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 623 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 624 | FROM openbmc-base as {pkg_stagename('openbmc/sdbusplus')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 625 | {pkg_copycmds('openbmc/sdbusplus')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 626 | {pkg_build('openbmc/sdbusplus')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 627 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 628 | FROM openbmc-base as {pkg_stagename('openbmc/sdeventplus')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 629 | {pkg_copycmds('openbmc/sdeventplus')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 630 | {pkg_build('openbmc/sdeventplus')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 631 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 632 | FROM openbmc-base as {pkg_stagename('openbmc/gpioplus')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 633 | {pkg_copycmds('openbmc/gpioplus')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 634 | {pkg_build('openbmc/gpioplus')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 635 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 636 | FROM openbmc-base as {pkg_stagename('openbmc/phosphor-dbus-interfaces')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 637 | {pkg_copycmds('openbmc/phosphor-dbus-interfaces')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 638 | {pkg_build('openbmc/phosphor-dbus-interfaces')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 639 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 640 | FROM openbmc-base as {pkg_stagename('openbmc/phosphor-logging')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 641 | {pkg_copycmds('openbmc/phosphor-logging')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 642 | {pkg_build('openbmc/phosphor-logging')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 643 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 644 | FROM openbmc-base as {pkg_stagename('openbmc/phosphor-objmgr')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 645 | {pkg_copycmds('openbmc/phosphor-objmgr')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 646 | {pkg_build('openbmc/phosphor-objmgr')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 647 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 648 | FROM openbmc-base as {pkg_stagename('open-power/pdbg')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 649 | {pkg_copycmds('open-power/pdbg')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 650 | {pkg_build('open-power/pdbg')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 651 | |
Patrick Williams | e139874 | 2021-02-02 12:20:20 -0600 | [diff] [blame] | 652 | FROM openbmc-base as {pkg_stagename('openbmc/pldm')} |
Patrick Williams | 8339461 | 2021-02-03 07:12:50 -0600 | [diff] [blame] | 653 | {pkg_copycmds('openbmc/pldm')} |
Patrick Williams | aae36d1 | 2021-02-04 16:30:04 -0600 | [diff] [blame^] | 654 | {pkg_build('openbmc/pldm')} |
Patrick Williams | 02871c9 | 2021-02-01 20:57:19 -0600 | [diff] [blame] | 655 | |
| 656 | # Build the final output image |
| 657 | FROM openbmc-base |
| 658 | {copy_cmds} |
| 659 | |
| 660 | # Some of our infrastructure still relies on the presence of this file |
| 661 | # even though it is no longer needed to rebuild the docker environment |
| 662 | # NOTE: The file is sorted to ensure the ordering is stable. |
| 663 | RUN echo '{depcache}' > /tmp/depcache |
| 664 | |
| 665 | # Final configuration for the workspace |
| 666 | RUN grep -q {gid} /etc/group || groupadd -g {gid} {username} |
| 667 | RUN mkdir -p "{os.path.dirname(homedir)}" |
| 668 | RUN grep -q {uid} /etc/passwd || useradd -d {homedir} -m -u {uid} -g {gid} {username} |
| 669 | RUN sed -i '1iDefaults umask=000' /etc/sudoers |
| 670 | RUN echo "{username} ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers |
| 671 | |
| 672 | {proxy_cmd} |
| 673 | |
| 674 | RUN /bin/bash |
| 675 | """ |
| 676 | |
| 677 | # Do the docker build. |
| 678 | for line in docker.build( |
| 679 | proxy_args, |
| 680 | "--network=host", |
| 681 | "-t", |
| 682 | docker_image_name, |
| 683 | "-", |
| 684 | _in=dockerfile, |
| 685 | _iter=True, |
| 686 | ): |
| 687 | print(line, end="", flush=True) |