diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0cb22d5..cef97e7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -78,17 +78,20 @@ jobs: fi # Every tool for every platform, cross-built on linux hosts with the pinned - # zig, one runner a group of tools, the way a release builds them. The - # verify legs build their own platform and run it (`just test`). + # zig, one runner a group of tools, the way a release builds them; and the + # tools nothing cross-compiles (hadolint, in a container), on a runner of + # each linux architecture. The verify legs build their own platform and run + # it (`just test`). build: needs: plan strategy: fail-fast: false matrix: - tools: ${{ fromJSON(needs.plan.outputs.groups) }} - name: build (${{ matrix.tools }}) - runs-on: ubuntu-24.04 - timeout-minutes: 30 + include: ${{ fromJSON(needs.plan.outputs.groups) }} + name: build (${{ matrix.name }}) + runs-on: ${{ matrix.runner }} + # hadolint is a compiler's work, twice: built, then built again. + timeout-minutes: 60 permissions: contents: read steps: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 27be9eb..512cc8f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,13 +3,15 @@ # per-job permissions, bash everywhere). # # A pushed v* tag builds every tool for every platform on linux hosts (zig -# cross-compiles them all), one runner a group of tools, runs each archive's +# cross-compiles them all but hadolint, which a container builds on a runner +# of each linux architecture), one runner a group of tools, runs each archive's # binaries on its own platform, then attests every archive and checksums.txt # and attaches them to the release. workflow_dispatch is the dry run: build # and smoke, no publish. # # Nothing here is restored from a cache, and nothing is saved to one: what is -# published is built from the pinned sources by this run alone. ci.yaml keeps +# published is built from the pinned sources by this run alone (hadolint's +# from its pinned image as well, and the alpine packages its lock names). ci.yaml keeps # zig's runtime libraries between runs; this file must not. name: release @@ -59,10 +61,10 @@ jobs: strategy: # Every group or no release: a failed group stops the others. matrix: - tools: ${{ fromJSON(needs.plan.outputs.groups) }} - name: build (${{ matrix.tools }}) - runs-on: ubuntu-24.04 - timeout-minutes: 30 + include: ${{ fromJSON(needs.plan.outputs.groups) }} + name: build (${{ matrix.name }}) + runs-on: ${{ matrix.runner }} + timeout-minutes: 40 permissions: contents: read steps: @@ -94,7 +96,7 @@ jobs: run: | read -r -a tools <<< "$TOOLS" just build-group "${tools[@]}" - echo "name=${TOOLS// /+}" >> "$GITHUB_OUTPUT" + echo "name=${TOOLS// /+}-${RUNNER_ARCH}" >> "$GITHUB_OUTPUT" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dist-${{ steps.group.outputs.name }} @@ -147,6 +149,11 @@ jobs: bash erofs/smoke.sh "unpacked/erofs-${PLATFORM}" bash xz/smoke.sh "unpacked/xz-${PLATFORM}" bash graphviz/smoke.sh "unpacked/graphviz-${PLATFORM}" + # hadolint is built for linux alone. + case "${PLATFORM}" in + linux-*) bash hadolint/smoke.sh "unpacked/hadolint-${PLATFORM}" ;; + *) ;; + esac bash claxon/smoke.sh "unpacked/claxon-${PLATFORM}" "${flac}" bash symphonia/smoke.sh "unpacked/symphonia-${PLATFORM}" "${flac}" diff --git a/.justfile b/.justfile index 47ddd6c..9ebbacd 100644 --- a/.justfile +++ b/.justfile @@ -16,6 +16,11 @@ platforms := "linux-amd64 linux-arm64 darwin-arm64 windows-amd64 windows-arm64" # a runner of their own. A tool missing here is built by nothing. build_groups := "flac|microflac|xz|erofs|graphviz|drflac foxenflac|flake cscoreflac|claxon symphonia" +# The tools no runner cross-compiles, in groups as above: each is built on a +# runner of every architecture it has a platform for, for that runner's own +# platform alone (hadolint: GHC compiles for the machine it runs on). +native_groups := "hadolint" + # The FIRST recipe defined here becomes `just`'s default. lint: do::lint::default do::lint::rust::default do::lint::converge fix: do::fix::default do::fix::rust::default @@ -23,8 +28,9 @@ fix: do::fix::default do::fix::rust::default test: flac-test drflac-test foxenflac-test microflac-test cscoreflac-test flake-test erofs-test xz-test graphviz-test claxon-test symphonia-test security: do::security::default -# Build every tool for every platform into $LIMEN_BUILD/dist. -build: (build-group replace(build_groups, "|", " ")) +# Build every tool for every platform into $LIMEN_BUILD/dist; of the native +# tools, this host's platform. +build: (build-group replace(build_groups, "|", " ")) (build-group replace(native_groups, "|", " ")) # Build the named tools for every platform into $LIMEN_BUILD/dist. build-group +tools: @@ -66,16 +72,25 @@ rebuild +tools: done exit "${failed}" -# build_groups as the JSON array a workflow's matrix reads, one string a group. +# The groups as the JSON array a workflow's matrix reads, one object a build: +# its tools, the runner that builds them, and the name the two make. A group +# of build_groups is one build, on the runner that cross-compiles; a group of +# native_groups is one build a linux architecture, on a runner of it. build-matrix: #!/usr/bin/env bash set -euo pipefail IFS='|' read -r -a groups <<< "{{ build_groups }}" + IFS='|' read -r -a native <<< "{{ native_groups }}" printf '[' sep="" for group in "${groups[@]}"; do - printf '%s"%s"' "${sep}" "${group}" + printf '%s{"tools":"%s","runner":"ubuntu-24.04","name":"%s"}' "${sep}" "${group}" "${group}" + sep="," + done + for group in "${native[@]}"; do + printf '%s{"tools":"%s","runner":"ubuntu-24.04","name":"%s, linux-amd64"}' "${sep}" "${group}" "${group}" sep="," + printf '%s{"tools":"%s","runner":"ubuntu-24.04-arm","name":"%s, linux-arm64"}' "${sep}" "${group}" "${group}" done printf ']\n' @@ -593,6 +608,61 @@ _dotnet-rid platform: *) echo "unknown platform {{ platform }} (one of {{ platforms }})" >&2; exit 1 ;; esac +# Build hadolint, static on musl, for the linux platform of this host's +# architecture among those given, archived with upstream's licence into +# $LIMEN_BUILD/dist/hadolint-.tar.gz. The other platforms given are +# passed over: GHC builds for the machine it runs on, so the other linux +# architecture is built on a runner of it, and there is no hadolint here for +# macOS or windows. +hadolint +targets: (_fetch "hadolint") + #!/usr/bin/env bash + set -euo pipefail + case "$(uname -m)" in + x86_64) arch=amd64 ;; + arm64 | aarch64) arch=arm64 ;; + *) echo "hadolint: no build on $(uname -m)" >&2; exit 1 ;; + esac + version=$(limen pins get hadolint version) + src="${LIMEN_BUILD}/src/hadolint-${version}" + mkdir -p "${LIMEN_BUILD}/dist" + set -- {{ targets }} + for platform in "$@"; do + if [ "${platform}" != "linux-${arch}" ]; then + echo "hadolint: ${platform} is not built on this host (linux-${arch} is)" + continue + fi + just _fetch-file "ghc-${platform}" + just _fetch-file "cabal-${platform}" + out="${LIMEN_BUILD}/hadolint/${platform}" + rm -rf "${out}" + HADOLINT_COMMIT="${version}" HADOLINT_URL="$(limen pins get hadolint url)" hadolint/build.sh "${src}" \ + "${LIMEN_BUILD}/src/ghc-${platform}-$(limen pins get "ghc-${platform}" version).tar.xz" \ + "${LIMEN_BUILD}/src/cabal-${platform}-$(limen pins get "cabal-${platform}" version).tar.xz" \ + "${arch}" "${out}/bin" + # Run where it was built, which is always here: no leg of `just test` + # pays for a compiler's build to do it. + hadolint/smoke.sh "${out}/bin" + name="hadolint-${platform}" + stage="${LIMEN_BUILD}/stage/${name}" + rm -rf "${stage}" + mkdir -p "${stage}" + cp "${out}/bin/hadolint" "${out}/bin/NOTICES" "${out}/bin/SOURCE" "${out}/bin/COPYING.LESSER" "${stage}/" + cp "${src}/LICENSE" "${stage}/" + scripts/archive.sh "${LIMEN_BUILD}/stage" "${name}" "${LIMEN_BUILD}/dist" + done + +# Build hadolint for this host, where it is a linux one, and run it. +hadolint-test: + #!/usr/bin/env bash + set -euo pipefail + platform=$(just _host-platform) + case "${platform}" in + linux-*) ;; + *) echo "hadolint: built for linux alone, nothing to run on ${platform}"; exit 0 ;; + esac + just hadolint "${platform}" + hadolint/smoke.sh "${LIMEN_BUILD}/hadolint/${platform}/bin" + # The release notes' source section: each tool's upstream release, as pins.yaml # pins it, the corresponding source of the binaries built from it. release-notes: @@ -615,6 +685,12 @@ release-notes: echo "- XZ Utils $(limen pins get xz version): $(limen pins get xz url)" echo "- Graphviz $(limen pins get graphviz version): $(limen pins get graphviz url)" echo "- expat $(limen pins get expat version): $(limen pins get expat url)" + echo "- hadolint $(limen pins get hadolint version): $(limen pins get hadolint url)," + echo " a GPL-3 binary, statically linked: the SOURCE file in its archive names every component in it at" + echo " its exact version and where its source is (GHC's release, each Hackage package of this repository's" + echo " hadolint/cabal.project.freeze, the alpine packages of hadolint/apk-linked), and this repository's" + echo " hadolint/ at this release's tag builds it again, to the same bytes for as long as Alpine serves the" + echo " packages hadolint/apk.lock names" echo "- Claxon $(just _crate-version claxon): https://static.crates.io/crates/claxon/claxon-$(just _crate-version claxon).crate" echo "- Symphonia $(just _crate-version symphonia) and the crates it links, each from crates.io at the version and" echo " checksum Cargo.lock records: $(just _crate-closure testbin-symphonia | tr '\n' ' ')" @@ -623,7 +699,25 @@ release-notes: # against pins.yaml on every run (a reused build directory keeps the tarball), # and unpack it into $LIMEN_BUILD/src/-, whatever the top # directory upstream's tarball has. -_fetch name: +_fetch name: (_fetch-file name) + #!/usr/bin/env bash + set -euo pipefail + version=$(limen pins get {{ name }} version) + url=$(limen pins get {{ name }} url) + case "${url}" in + *.tar.xz) ext=tar.xz ;; + *) ext=tar.gz ;; + esac + dir="${LIMEN_BUILD}/src" + archive="${dir}/{{ name }}-${version}.${ext}" + rm -rf "${dir:?}/{{ name }}-${version}" + mkdir -p "${dir}/{{ name }}-${version}" + tar -xf "${archive}" -C "${dir}/{{ name }}-${version}" --strip-components=1 + +# Fetch a pinned artifact to $LIMEN_BUILD/src/-. and +# verify it against pins.yaml on every run, without unpacking it: a toolchain +# is unpacked where it is installed. +_fetch-file name: #!/usr/bin/env bash set -euo pipefail version=$(limen pins get {{ name }} version) @@ -643,9 +737,6 @@ _fetch name: rm -f "${archive}" exit 1 fi - rm -rf "${dir:?}/{{ name }}-${version}" - mkdir -p "${dir}/{{ name }}-${version}" - tar -xf "${archive}" -C "${dir}/{{ name }}-${version}" --strip-components=1 # The rustc flags that keep the build out of a Rust binary, as # CARGO_ENCODED_RUSTFLAGS takes them. Its directories: the checkout, cargo's diff --git a/README.md b/README.md index 5efe8e6..043a841 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ other uses, or covered by any compatibility promise. | [`erofs/`](erofs/) | `mkfs.erofs`, `fsck.erofs` (not windows) | [erofs/erofs-utils](https://github.com/erofs/erofs-utils), with [lz4](https://github.com/lz4/lz4) | | [`xz/`](xz/) | `xz` | [tukaani-project/xz](https://github.com/tukaani-project/xz) | | [`graphviz/`](graphviz/) | `dot` | [graphviz](https://gitlab.com/graphviz/graphviz), with [expat](https://github.com/libexpat/libexpat) | +| [`hadolint/`](hadolint/) | `hadolint` (linux alone; a GPL-3 binary, published to be run by tests and linked by nothing) | [hadolint/hadolint](https://github.com/hadolint/hadolint), at a commit, not a release | | [`claxon/`](claxon/) | `claxon`, a FLAC decoder on Claxon | [ruuda/claxon](https://github.com/ruuda/claxon) | | [`symphonia/`](symphonia/) | `symphonia`, a FLAC decoder on Symphonia | [pdeljanov/Symphonia](https://github.com/pdeljanov/Symphonia) | @@ -32,7 +33,9 @@ sources, and states the upstream licence its sources, patches and binaries are u `.hermetic/hermetic.yaml`, and the Rust tools link through it (limen's Rust lanes, the toolchain pinned by `rust-toolchain.toml`), with the target always explicit: linux (static, musl) and windows, amd64 and arm64, and darwin arm64, cross-compiled from any of them. No runner - package manager, no container. + package manager, no container. One exception: `hadolint` is a Haskell program, which nothing + here cross-compiles; it is built for linux alone, in a container, on a runner of each + architecture ([`hadolint/`](hadolint/)). - **Third-party source only.** Everything here builds an upstream project's own sources, patched only where a platform needs it (`erofs/patches`, for windows); a library that ships no program gets the smallest one around it that exercises it (`drflac`, `foxenflac`, @@ -44,6 +47,8 @@ sources, and states the upstream licence its sources, patches and binaries are u - **A build is its commit's.** Built again from the same commit, in another directory and at another time, every archive is the same bytes, so a published one can be checked by building it: `just build-group `, then `just rebuild `, which CI runs for every group. + (`hadolint` for as long as Alpine serves the packages its lock names: after that its build + stops, and says which moved.) Nothing of the build is recorded. The binaries carry no debug information and no symbols (they name the build's directories); a Rust binary's paths are remapped and a .NET one's mapped; a windows executable's time stamp is a hash of its content; and every archive entry has the diff --git a/hadolint/README.md b/hadolint/README.md new file mode 100644 index 0000000..bfd2dde --- /dev/null +++ b/hadolint/README.md @@ -0,0 +1,58 @@ +# hadolint + +`hadolint` from [hadolint/hadolint](https://github.com/hadolint/hadolint), built for linux amd64 +and arm64, static on musl, from the commit `pins.yaml` pins: a commit of upstream's master, not +a release. A consumer runs it as an oracle against that exact commit. The binary prints the +version of upstream's last release (`Haskell Dockerfile Linter 2.15.1`), which is not the pin: +the pin is the commit, and the archive's `SOURCE` file names it. + +There is no hadolint here for macOS or windows. An oracle is needed on one platform, and linux +is the one upstream's static build exists for: one container recipe covers both architectures +and every input of it can be held. A macOS binary would be another build (Apple's toolchain, no +static C library, about twice the time on a runner), and GHC has no compiler for windows arm64. + +It is built the way upstream builds its own static release, in an alpine container. Its inputs, +and how each is held: + +- `versions.env`: the alpine image, by digest. +- `pins.yaml` (repository root): hadolint's source, GHC (each tarball checked against its + release manager's PGP signature) and cabal-install, one entry an architecture. +- `apk.lock`: every alpine package the container holds once the build's own are installed, the + linker and the assembler as much as the libraries. The image fixes what it ships; these are + installed into it at whatever alpine serves, so the build compares and stops when one moved. + Alpine keeps one version of a package, so a build at an old tag stops then, and says so. +- `apk-linked`: of those, the ones whose code is in the binary (musl, GMP, gcc's runtime). + Measured, not listed: the build reads the linker's map and stops when the packages it took + from are not exactly these. +- `cabal.project.freeze` and `cabal.project.local`: every Haskell package at one version, at + one state of Hackage. Upstream commits no freeze file and resolves on the day of the build; + this one is ours, and the build stops if cabal would resolve anything else. +- `build.sh` starts the container; `in-container.sh` is what runs in it. GHC compiles for the + machine it runs on, so each architecture is built on a runner of it. +- `smoke.sh` runs the binary on a fixed Dockerfile and requires the JSON report of the one rule + it breaks, and the licence files beside it. + +Two builds of one commit give the same bytes, while alpine serves the locked packages: the +build job builds it twice and compares. + +## Licence + +hadolint is GPL-3 (`LICENSE` in the archive), and the binary is statically linked, so the +archive is a GPL work: it is published to be run by tests, and nothing in this organisation +links it. Each archive carries: + +- `LICENSE`, the GNU GPL version 3, and `COPYING.LESSER`, the GNU LGPL version 3, under which + GMP is linked in. +- `NOTICES`: the licence files of what is in the binary, taken from the build's own plan (the + libraries the executable depends on, to the end): each Hackage package's licence files from + the top of its source archive, GHC's libraries' from GHC's release, and the texts kept in + `licenses/` by version for what those do not carry: musl, gcc's runtime exception, the + libffi GHC links into its runtime, and the xxHash that GHC's runtime and `hashable` each + compile into themselves, whose terms are in a header. A licence carried only inside a source file is found by reading, as + that one was, not by the build. +- `SOURCE`: the offer of the corresponding source. Every component at its exact version and + where its source is: hadolint at the commit, GHC's release, each Hackage package, each alpine + package with the commit of alpine's aports that built it, and this recipe, which builds it + again, to the same bytes while alpine serves the locked packages. + +This directory's own files are under the repository's Apache-2.0 licence. diff --git a/hadolint/apk-linked b/hadolint/apk-linked new file mode 100644 index 0000000..1dafd59 --- /dev/null +++ b/hadolint/apk-linked @@ -0,0 +1,11 @@ +# The alpine packages whose code is in the binary, each at its version: the C +# library, GMP (GHC's integers), and gcc's own runtime (its start files, and +# libgcc). Not a claim: the build reads the link map and stops when the +# packages the linker took from are not exactly these. zlib and libstdc++ +# are installed and nothing is taken from them. Each package here has its +# licence in the archive's NOTICES and its source in SOURCE, so a line that +# moves here is read again there. +musl-dev 1.2.6-r3 +gmp-static 6.3.0-r4 +gcc 15.2.0-r5 +libgcc-static 15.2.0-r5 diff --git a/hadolint/apk.lock b/hadolint/apk.lock new file mode 100644 index 0000000..cc3c4ff --- /dev/null +++ b/hadolint/apk.lock @@ -0,0 +1,81 @@ +# Every alpine package the build's container holds once the build's own are +# installed into the pinned image, as `apk info -v | sort` gives them. The +# build compares and stops on any difference: alpine keeps one version of a +# package in a release's repository, so a package it moves stops the build +# until this file is moved, with hadolint/apk-linked when it is one of those. +acl-libs-2.3.2-r1 +alpine-baselayout-3.7.2-r1 +alpine-baselayout-data-3.7.2-r1 +alpine-keys-2.6-r0 +alpine-release-3.24.4-r0 +apk-tools-3.0.9-r0 +binutils-2.45.1-r1 +binutils-gold-2.45.1-r1 +brotli-libs-1.2.1-r0 +busybox-1.37.0-r31 +busybox-binsh-1.37.0-r31 +c-ares-1.34.9-r0 +ca-certificates-bundle-20261020-r0 +curl-8.23.0-r0 +g++-15.2.0-r5 +gcc-15.2.0-r5 +git-2.54.1-r0 +git-init-template-2.54.1-r0 +git-perl-2.54.1-r0 +gmp-6.3.0-r4 +gmp-dev-6.3.0-r4 +gmp-static-6.3.0-r4 +gzip-1.15-r0 +isl26-0.26-r2 +jansson-2.15.0-r0 +jq-1.8.2-r0 +less-702-r0 +libapk-3.0.9-r0 +libatomic-15.2.0-r5 +libbz2-1.0.8-r6 +libcrypto3-3.5.9-r0 +libcurl-8.23.0-r0 +libexpat-2.10.0-r0 +libffi-3.5.2-r1 +libffi-dev-3.5.2-r1 +libformw-6.6_p20260516-r0 +libgcc-15.2.0-r5 +libgcc-static-15.2.0-r5 +libgmpxx-6.3.0-r4 +libgomp-15.2.0-r5 +libidn2-2.3.8-r0 +libmenuw-6.6_p20260516-r0 +libncurses++-6.6_p20260516-r0 +libncursesw-6.6_p20260516-r0 +libpanelw-6.6_p20260516-r0 +libpsl-0.21.5-r3 +libssl3-3.5.9-r0 +libstdc++-15.2.0-r5 +libstdc++-dev-15.2.0-r5 +libunistring-1.4.2-r0 +linux-headers-7.0.0-r1 +make-4.4.1-r4 +mpc1-1.3.1-r1 +mpfr4-4.2.2-r0 +musl-1.2.6-r3 +musl-dev-1.2.6-r3 +musl-utils-1.2.6-r3 +ncurses-dev-6.6_p20260516-r0 +ncurses-static-6.6_p20260516-r0 +ncurses-terminfo-base-6.6_p20260516-r0 +nghttp2-libs-1.70.0-r0 +oniguruma-6.9.10-r0 +pcre2-10.49-r0 +perl-5.42.3-r0 +perl-error-0.17030-r0 +perl-git-2.54.1-r0 +pkgconf-2.5.1-r0 +scanelf-1.3.9-r1 +ssl_client-1.37.0-r31 +tar-1.35-r5 +xz-5.8.4-r0 +xz-libs-5.8.4-r0 +zlib-1.4-r0 +zlib-dev-1.4-r0 +zlib-static-1.4-r0 +zstd-libs-1.5.7-r2 diff --git a/hadolint/build.sh b/hadolint/build.sh new file mode 100755 index 0000000..a52b8dd --- /dev/null +++ b/hadolint/build.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Build hadolint for linux, static on musl, in the alpine image +# hadolint/versions.env pins by digest, as upstream's own release does. +# build.sh +# The tree and the two tarballs are pins.yaml's, fetched and verified by the +# recipe that calls this. GHC compiles for the machine it runs on and nothing +# else, so the architecture is the host's: amd64 on an amd64 host, arm64 on +# an arm64 one. Everything is mounted read-only but the output directory, and +# the build runs at fixed paths inside the container, whatever the checkout's. +set -euo pipefail + +src=${1:?source tree} +ghc=${2:?ghc tarball} +cabal=${3:?cabal-install tarball} +arch=${4:?linux architecture, amd64 or arm64} +out=${5:?output directory} + +here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=hadolint/versions.env +. "${here}/versions.env" +case "${BUILD_IMAGE}" in +*@sha256:*) ;; +*) echo "hadolint: the build image is not pinned by digest: ${BUILD_IMAGE}" >&2; exit 1 ;; +esac + +mkdir -p "${out}" +out=$(cd "${out}" && pwd) +docker run --rm --platform "linux/${arch}" \ + --volume "$(cd "${src}" && pwd):/in/src:ro" \ + --volume "$(cd "$(dirname "${ghc}")" && pwd)/$(basename "${ghc}"):/in/ghc.tar.xz:ro" \ + --volume "$(cd "$(dirname "${cabal}")" && pwd)/$(basename "${cabal}"):/in/cabal.tar.xz:ro" \ + --volume "${here}:/in/recipe:ro" \ + --volume "${out}:/out" \ + --env "SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:?the time of the build}" \ + --env "HADOLINT_COMMIT=${HADOLINT_COMMIT:?the pinned commit}" \ + --env "HADOLINT_URL=${HADOLINT_URL:?the pinned source url}" \ + "${BUILD_IMAGE}" sh /in/recipe/in-container.sh diff --git a/hadolint/cabal.project.freeze b/hadolint/cabal.project.freeze new file mode 100644 index 0000000..47e58b0 --- /dev/null +++ b/hadolint/cabal.project.freeze @@ -0,0 +1,177 @@ +active-repositories: hackage.haskell.org:merge +constraints: any.Cabal ==3.12.1.0, + any.Cabal-syntax ==3.12.1.0, + any.Diff ==1.0.2, + any.HUnit ==1.6.2.0, + any.HsYAML ==0.2.1.6, + HsYAML -exe, + any.OneTuple ==0.4.3, + OneTuple +base-ge-4-15 +base-ge-4-16, + any.QuickCheck ==2.16.0.0, + QuickCheck -old-random +templatehaskell, + any.ShellCheck ==0.11.0, + any.StateVar ==1.2.2, + any.aeson ==2.2.5.1, + aeson +ordered-keymap, + any.alex ==3.5.4.2, + any.ansi-terminal ==1.1.5, + ansi-terminal -example, + any.ansi-terminal-types ==1.1.3, + any.array ==0.5.8.0, + any.assoc ==1.1.1, + assoc -tagged, + any.async ==2.2.6, + async -bench -debug-auto-label, + any.attoparsec ==0.14.4, + attoparsec -developer, + any.base ==4.20.1.0, + any.base-orphans ==0.9.4, + any.base16-bytestring ==1.0.2.0, + any.bifunctors ==5.6.3, + bifunctors +tagged, + any.binary ==0.8.9.3, + any.bitvec ==1.1.6.0, + bitvec +simd, + any.blaze-builder ==0.4.4.1, + any.blaze-html ==0.9.2.0, + any.blaze-markup ==0.8.3.0, + any.bytestring ==0.12.2.0, + any.cabal-doctest ==1.0.13, + any.call-stack ==0.4.0, + any.case-insensitive ==1.2.2.0, + any.character-ps ==0.1, + any.colour ==2.3.7, + any.colourista ==0.1.0.2, + any.commutative-semigroups ==0.2.0.2, + any.comonad ==5.0.10, + comonad +containers +distributive +indexed-traversable, + any.conduit ==1.3.6.1, + any.conduit-extra ==1.3.8, + any.containers ==0.7, + any.contravariant ==1.5.6, + contravariant +statevar, + any.cryptohash-sha1 ==0.11.101.0, + any.data-default ==0.8.0.2, + any.data-default-class ==0.2.0.0, + any.data-fix ==0.3.4, + any.deepseq ==1.5.0.0, + any.directory ==1.3.11.0, + any.distributive ==0.6.3, + distributive +tagged, + any.dlist ==1.0, + dlist -werror, + any.email-validate ==2.3.2.21, + any.exceptions ==0.10.9, + any.fgl ==5.8.3.1, + fgl +containers042, + any.file-io ==0.2.0, + file-io +long-paths +os-string, + any.filepath ==1.5.4.0, + any.foldl ==1.4.18, + any.ghc-bignum ==1.3, + any.ghc-boot-th ==9.10.2, + any.ghc-internal ==9.1002.0, + any.ghc-prim ==0.12.0, + any.hashable ==1.5.1.0, + hashable -arch-native -random-initial-seed, + any.haskell-lexer ==1.2.1, + any.hsc2hs ==0.68.10, + hsc2hs -in-ghc-tree, + any.hspec ==2.11.18, + any.hspec-core ==2.11.18, + any.hspec-discover ==2.11.18, + any.hspec-expectations ==0.8.4, + any.indexed-traversable ==0.1.5, + indexed-traversable +base-ge-4-18, + any.indexed-traversable-instances ==0.1.2.1, + any.integer-conversion ==0.1.1, + any.integer-logarithms ==1.0.5, + integer-logarithms -check-bounds +integer-gmp, + any.language-docker ==16.0.0, + any.megaparsec ==9.7.1, + megaparsec -dev, + any.mono-traversable ==1.0.21.0, + any.monoid-subclasses ==1.2.6.1, + any.mtl ==2.3.1, + any.network ==3.2.13.0, + network -devel, + any.network-uri ==2.6.4.2, + any.optparse-applicative ==0.19.0.0, + optparse-applicative +process, + any.os-string ==2.0.4, + any.parallel ==3.2.2.0, + any.parsec ==3.1.18.0, + any.parser-combinators ==1.3.1, + parser-combinators -dev, + any.pretty ==1.1.3.6, + any.prettyprinter ==1.7.2, + prettyprinter -buildreadme +text, + any.prettyprinter-ansi-terminal ==1.1.4, + prettyprinter-ansi-terminal +text, + any.primes ==0.2.1.0, + any.primitive ==0.9.1.0, + any.process ==1.6.30.0, + process +os-string, + any.profunctors ==5.6.3, + any.puresat ==0.1.0.1, + puresat -exe, + any.quickcheck-io ==0.2.0, + any.random ==1.3.1, + any.regex-base ==0.94.0.3, + any.regex-tdfa ==1.3.2.7, + regex-tdfa +doctest -force-o2, + any.resourcet ==1.3.0, + any.rts ==1.0.2, + any.scientific ==0.3.10.0, + scientific -integer-simple, + any.semialign ==1.4, + semialign +semigroupoids, + any.semigroupoids ==6.0.2, + semigroupoids +comonad +containers +contravariant +tagged +unordered-containers, + any.semver ==0.4.0.1, + any.silently ==1.2.5.4, + any.spdx ==1.1.0.1, + any.split ==0.2.5.1, + any.splitmix ==0.1.3.2, + splitmix -optimised-mixer, + any.stm ==2.5.3.1, + any.streaming-commons ==0.2.3.1, + streaming-commons -use-bytestring-builder, + any.strict ==0.5.1, + any.tagged ==0.8.11, + tagged +deepseq +template-haskell, + any.tasty ==1.5.5, + tasty +terminal-size +unix, + any.template-haskell ==2.22.0.0, + any.terminal-size ==0.3.4, + any.text ==2.1.2, + any.text-iso8601 ==0.1.1.2, + any.text-short ==0.1.6.1, + text-short -asserts, + any.th-abstraction ==0.7.2.0, + any.th-compat ==0.1.7, + any.these ==1.2.1, + any.time ==1.16.0.1, + any.time-compat ==1.9.9, + any.timerep ==2.1.0.0, + any.transformers ==0.6.1.1, + any.transformers-compat ==0.8, + transformers-compat -five +five-three +generic-deriving +mtl, + any.typed-process ==0.2.13.0, + any.unix ==2.8.8.0, + unix -non-portable-tests +os-string, + any.unliftio-core ==0.2.1.0, + any.unordered-containers ==0.2.21, + unordered-containers -debug, + any.uuid-types ==1.0.6.1, + any.vector ==0.13.2.0, + vector +boundschecks -internalchecks -unsafechecks -wall, + any.vector-algorithms ==0.9.1.0, + vector-algorithms +bench +boundschecks -internalchecks -llvm -unsafechecks, + any.vector-stream ==0.1.0.1, + any.witherable ==0.5, + any.xml-conduit ==1.10.1.0, + any.xml-types ==0.3.8, + any.zlib ==0.7.1.1, + zlib -bundled-c-zlib +non-blocking-ffi +pkg-config +index-state: hackage.haskell.org 2026-11-14T23:39:41Z diff --git a/hadolint/cabal.project.local b/hadolint/cabal.project.local new file mode 100644 index 0000000..9c3326d --- /dev/null +++ b/hadolint/cabal.project.local @@ -0,0 +1,3 @@ +-- Hackage as it stood then: with cabal.project.freeze beside it, every +-- package of the build is one version, checked against that index. +index-state: 2026-11-15T00:00:00Z diff --git a/hadolint/in-container.sh b/hadolint/in-container.sh new file mode 100755 index 0000000..71502df --- /dev/null +++ b/hadolint/in-container.sh @@ -0,0 +1,205 @@ +#!/bin/sh +# The half of hadolint/build.sh that runs inside the alpine image: the +# packages upstream's release installs, the pinned GHC and cabal-install from +# the tarballs mounted at /in, then upstream's own two cabal commands, with +# the dependencies this repository froze. +set -eu +export LC_ALL=C +commit=${HADOLINT_COMMIT:?the pinned hadolint commit} +url=${HADOLINT_URL:?the pinned hadolint source url} + +# The packages upstream's release installs, and jq for the plan. The image is +# pinned by digest and these are installed into it at whatever alpine serves: +# so every package the container then holds is compared with +# hadolint/apk.lock, the linker and the assembler as much as the libraries, +# and the build stops when alpine has moved one. +apk add --no-cache \ + curl gcc g++ ncurses-dev libffi-dev make xz gzip tar perl git jq \ + binutils-gold zlib zlib-dev zlib-static gmp gmp-dev gmp-static \ + ncurses-static libc-dev musl-dev > /dev/null +apk info -v 2> /dev/null | sort > /apk.installed +# grep finds nothing in a lock that names no package yet, and says so by its +# exit status. +grep -v '^#' /in/recipe/apk.lock > /apk.locked || true +cmp -s /apk.locked /apk.installed || { + echo "hadolint: the container does not hold the packages hadolint/apk.lock names (-: the lock, +: installed):" >&2 + diff /apk.locked /apk.installed >&2 || true + echo "hadolint: when alpine has moved a package, read hadolint/apk-linked: one of those is in the binary, with its licence and its source" >&2 + exit 1 +} + +mkdir -p /build/ghc /build/src /build/cabal +tar -xJf /in/ghc.tar.xz -C /build/ghc --strip-components=1 +(cd /build/ghc && ./configure --prefix=/opt/ghc > /build/ghc-configure.log 2>&1 && make install > /build/ghc-install.log 2>&1) || + { tail -n 30 /build/ghc-configure.log /build/ghc-install.log >&2; exit 1; } +tar -xJf /in/cabal.tar.xz -C /usr/local/bin +export PATH="/opt/ghc/bin:${PATH}" +echo "toolchain: $(ghc --numeric-version), $(cabal --numeric-version)" + +cp -R /in/src/. /build/src/ +# Upstream commits no freeze file and resolves its dependencies on the day of +# the build. This repository's own pins every package to one version, at the +# state of Hackage it names; cabal checks each against that index. +cp /in/recipe/cabal.project.local /build/src/cabal.project.local +cp /in/recipe/cabal.project.freeze /build/src/cabal.project.freeze +cd /build/src +export CABAL_DIR=/build/cabal +cabal update > /build/cabal-update.log 2>&1 || { cat /build/cabal-update.log >&2; exit 1; } +# The freeze file is the whole plan: resolved again, nothing in it moves. +cp cabal.project.freeze /build/freeze.committed +cabal freeze > /dev/null +cmp -s cabal.project.freeze /build/freeze.committed || { + echo "hadolint: cabal resolves another plan than hadolint/cabal.project.freeze holds:" >&2 + diff /build/freeze.committed cabal.project.freeze >&2 || true + exit 1 +} + +cabal build --only-dependencies --disable-shared \ + --ghc-options='-split-sections -optl-static -fPIC' > /build/deps.log 2>&1 || { tail -n 60 /build/deps.log >&2; exit 1; } +# The link writes its map: what the linker took, read below. +cabal build --enable-executable-static --disable-executable-dynamic --disable-shared \ + --ghc-options='-split-sections -optl-static -optl-pthread -fPIC -optl-Wl,-Map=/build/link.map' exe:hadolint > /build/build.log 2>&1 || { tail -n 60 /build/build.log >&2; exit 1; } +cp "$(cabal list-bin hadolint)" /out/hadolint +strip /out/hadolint +chmod 0755 /out/hadolint + +# Which alpine packages are in the binary, measured: every archive and object +# the link map names, asked of apk, is one of hadolint/apk-linked's packages, +# and each of those is there. What GHC and cabal built is not apk's. +[ -s /build/link.map ] || { echo "hadolint: the link wrote no map" >&2; exit 1; } +grep -o '/[^ ()]*\.[ao]' /build/link.map | sort -u | while read -r path; do + real=$(readlink -f "${path}" 2> /dev/null || true) + [ -n "${real}" ] || continue + apk info --who-owns "${real}" 2> /dev/null | sed -n 's/^.* is owned by //p' +done | sort -u > /build/linked.measured +sed -n 's/^\([a-z][^ ]*\) \(.*\)$/\1-\2/p' /in/recipe/apk-linked | sort > /build/linked.named +[ -s /build/linked.measured ] || { echo "hadolint: the link map names nothing of alpine's" >&2; exit 1; } +cmp -s /build/linked.named /build/linked.measured || { + echo "hadolint: the alpine packages in the binary are not those hadolint/apk-linked names (-: named, +: in the link map):" >&2 + diff /build/linked.named /build/linked.measured >&2 || true + exit 1 +} + +# What the binary is made of, from the build's own plan: the libraries the +# executable depends on, and theirs, to the end; GHC's (pre-existing) and +# Hackage's (configured). The plan also holds what only the tests need, the +# tools that run during the build, and what a package's own Setup needs, +# none of which is linked: of a package cabal builds whole, the libraries' +# dependencies alone are followed. +tab=$(printf '\t') +# shellcheck disable=SC2016 # jq's variables, not the shell's +jq -r ' + ."install-plan" as $plan + | ($plan | map({key: .id, value: .}) | from_entries) as $unit + | def close: . as $seen + | ([$seen[] | $unit[.] | ((.depends // []) + [(.components // {}) | to_entries[] | select(.key == "lib" or (.key | startswith("lib:"))) | (.value.depends // [])[]])[]] + $seen | unique) as $next + | if ($next | length) == ($seen | length) then $seen else ($next | close) end; + [$plan[] | select(."pkg-name" == "hadolint" and ."component-name" == "exe:hadolint") | .id] + | if length == 0 then error("no exe:hadolint in the plan") else . end + | close | .[] | $unit[.] | select(."pkg-name" != "hadolint") + | [.type, ."pkg-name", ."pkg-version"] | @tsv' \ + dist-newstyle/cache/plan.json | sort -u > /build/units +[ -s /build/units ] || { echo "hadolint: the build plan names no package" >&2; exit 1; } +echo "in the binary: $(grep -c '^pre-existing' /build/units) packages of GHC's, $(grep -c '^configured' /build/units) of Hackage's, and of alpine's: $(tr '\n' ' ' < /build/linked.measured)" +ghc_version=$(ghc --numeric-version) +version_of() { sed -n "s/^$1 \(.*\)-r[0-9]*\$/\1/p" /in/recipe/apk-linked; } +musl=$(version_of musl-dev) +gmp=$(version_of gmp-static) +gcc=$(version_of gcc) +# xxHash is compiled into the binary twice, by GHC's runtime (rts/Hash.c) and +# by hashable, each from a header that carries its terms where no licence +# file does. One text, kept by the versions of whatever compiles it in: with +# hashable gone it is still the runtime's, under another name, read again. +hashable=$(awk -F "${tab}" '$2 == "hashable" { print $3 }' /build/units) +xxhash="LICENSE-xxhash-in-ghc-${ghc_version}" +xxhash_of="GHC ${ghc_version}'s runtime compiles" +if [ -n "${hashable}" ]; then + xxhash="${xxhash}-and-hashable-${hashable}" + xxhash_of="GHC ${ghc_version}'s runtime and hashable ${hashable} each compile" +fi +for text in "LICENSE-musl-${musl}" "LICENSE-gcc-runtime-${gcc}" "LICENSE-libffi-ghc-${ghc_version}" "${xxhash}" LICENSE-lgpl-3.0; do + [ -s "/in/recipe/licenses/${text}" ] || { echo "hadolint: no hadolint/licenses/${text} for a library the binary links" >&2; exit 1; } +done + +# NOTICES: each package's own licence files, as its source carries them; a +# package with none stops the build. +{ + echo "hadolint is statically linked: everything below is in the binary beside" + echo "this file. hadolint's own licence is LICENSE, the GNU GPL version 3." + echo + echo "================================================================" + echo "GMP ${gmp}, the GNU Multiple Precision Arithmetic Library" + echo "================================================================" + echo + echo "This program uses GMP, which is linked into it. GMP and its use are" + echo "covered by the GNU Lesser General Public License version 3, a copy of" + echo "which is COPYING.LESSER beside this file; the GNU General Public" + echo "License it refers to is LICENSE. Where GMP's source is, and how this" + echo "program is built again against another GMP, is in SOURCE." + for part in "musl ${musl}:LICENSE-musl-${musl}" "GCC ${gcc}, its runtime, under the GNU GPL version 3 (LICENSE) with this exception:LICENSE-gcc-runtime-${gcc}" \ + "libffi, the copy GHC ${ghc_version} carries and links into its runtime:LICENSE-libffi-ghc-${ghc_version}" \ + "xxHash, which ${xxhash_of} in:${xxhash}"; do + echo + echo "================================================================" + echo "${part%%:*}" + echo "================================================================" + echo + cat "/in/recipe/licenses/${part##*:}" + done + while IFS="${tab}" read -r type name version; do + echo + echo "================================================================" + echo "${name} ${version}" + echo "================================================================" + echo + if [ "${type}" = pre-existing ]; then + # GHC's runtime has no directory of its own: it is under GHC's licence. + [ "${name}" != rts ] || { name=ghc; version=${ghc_version}; } + file=$(find /opt/ghc/share/doc -path "*/${name}-${version}/LICENSE" | head -n 1) + [ -n "${file}" ] || { echo "hadolint: GHC ships no LICENSE for ${name} ${version}" >&2; exit 1; } + cat "${file}" + else + sdist="${CABAL_DIR}/packages/hackage.haskell.org/${name}/${version}/${name}-${version}.tar.gz" + [ -f "${sdist}" ] || { echo "hadolint: no source archive for ${name} ${version} in cabal's store" >&2; exit 1; } + files=$(tar -tzf "${sdist}" | awk -F/ 'NF == 2 && tolower($2) ~ /licen[sc]e|copying|notice|copyright/' | sort) + [ -n "${files}" ] || { echo "hadolint: ${name} ${version} carries no licence file" >&2; exit 1; } + for file in ${files}; do + tar -xzOf "${sdist}" "${file}" + done + fi + done < /build/units +} > /out/NOTICES +cp /in/recipe/licenses/LICENSE-lgpl-3.0 /out/COPYING.LESSER + +# SOURCE: the offer of the corresponding source, in the archive itself, every +# component at its exact version and where its source is. +{ + echo "The corresponding source of this hadolint binary. It is statically linked:" + echo "every component below is in it. Built by forkcloser/testbin, whose recipe" + echo "(hadolint/, at the tag of the release this archive belongs to) builds it" + echo "again from these sources, to the same bytes for as long as Alpine serves" + echo "the packages hadolint/apk.lock names, and against another GMP by moving" + echo "that file's gmp lines and hadolint/apk-linked's:" + echo " https://github.com/forkcloser/testbin" + echo + echo "hadolint, GPL-3, at commit ${commit}:" + echo " ${url}" + echo + echo "GHC ${ghc_version}: its runtime and these libraries of its release:" + awk -F "${tab}" '$1 == "pre-existing" { printf " %s %s\n", $2, $3 }' /build/units + echo " and the libffi its runtime links (libffi-tarballs/ in the same archive)," + echo " all in https://downloads.haskell.org/~ghc/${ghc_version}/ghc-${ghc_version}-src.tar.xz" + echo + echo "From Hackage, each at the version hadolint/cabal.project.freeze holds:" + awk -F "${tab}" '$1 == "configured" { printf " https://hackage.haskell.org/package/%s-%s/%s-%s.tar.gz\n", $2, $3, $2, $3 }' /build/units + echo + echo "From Alpine Linux, each package at its version and the commit of" + echo "https://gitlab.alpinelinux.org/alpine/aports that built it, whose APKBUILD" + echo "names the upstream source and the patches applied:" + sed -n 's/^\([a-z][^ ]*\) .*$/\1/p' /in/recipe/apk-linked | while read -r package; do + awk -v want="${package}" ' + /^P:/ { name = substr($0, 3) } /^V:/ { version = substr($0, 3) } /^o:/ { origin = substr($0, 3) } /^c:/ { commit = substr($0, 3) } + /^$/ { if (name == want) { printf " %s %s: main/%s at %s\n", name, version, origin, commit; found = 1 } name = "" } + END { if (!found) exit 1 }' /lib/apk/db/installed || { echo "hadolint: ${package} is not installed" >&2; exit 1; } + done +} > /out/SOURCE diff --git a/hadolint/licenses/LICENSE-gcc-runtime-15.2.0 b/hadolint/licenses/LICENSE-gcc-runtime-15.2.0 new file mode 100644 index 0000000..e1b3c69 --- /dev/null +++ b/hadolint/licenses/LICENSE-gcc-runtime-15.2.0 @@ -0,0 +1,73 @@ +GCC RUNTIME LIBRARY EXCEPTION + +Version 3.1, 31 March 2009 + +Copyright (C) 2009 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +This GCC Runtime Library Exception ("Exception") is an additional +permission under section 7 of the GNU General Public License, version +3 ("GPLv3"). It applies to a given file (the "Runtime Library") that +bears a notice placed by the copyright holder of the file stating that +the file is governed by GPLv3 along with this Exception. + +When you use GCC to compile a program, GCC may combine portions of +certain GCC header files and runtime libraries with the compiled +program. The purpose of this Exception is to allow compilation of +non-GPL (including proprietary) programs to use, in this way, the +header files and runtime libraries covered by this Exception. + +0. Definitions. + +A file is an "Independent Module" if it either requires the Runtime +Library for execution after a Compilation Process, or makes use of an +interface provided by the Runtime Library, but is not otherwise based +on the Runtime Library. + +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of +the GNU General Public License (GPL) with the option of using any +subsequent versions published by the FSF. + +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with +the license of GCC. + +"Target Code" refers to output from any compiler for a real or virtual +target processor architecture, in executable form or suitable for +input to an assembler, loader, linker and/or execution +phase. Notwithstanding that, Target Code does not include data in any +format that is used as a compiler intermediate representation, or used +for producing a compiler intermediate representation. + +The "Compilation Process" transforms code entirely represented in +non-intermediate languages designed for human-written code, and/or in +Java Virtual Machine byte code, into Target Code. Thus, for example, +use of source code generators and preprocessors need not be considered +part of the Compilation Process, since the Compilation Process can be +understood as starting with the output of the generators or +preprocessors. + +A Compilation Process is "Eligible" if it is done using GCC, alone or +with other GPL-compatible software, or if it is done without using any +work based on GCC. For example, using non-GPL-compatible Software to +optimize any GCC intermediate representations would not qualify as an +Eligible Compilation Process. + +1. Grant of Additional Permission. + +You have permission to propagate a work of Target Code formed by +combining the Runtime Library with Independent Modules, even if such +propagation would otherwise violate the terms of GPLv3, provided that +all Target Code was generated by Eligible Compilation Processes. You +may then convey such a combination under terms of your choice, +consistent with the licensing of the Independent Modules. + +2. No Weakening of GCC Copyleft. + +The availability of this Exception does not imply any general +presumption that third-party software is unaffected by the copyleft +requirements of the license of GCC. + diff --git a/hadolint/licenses/LICENSE-lgpl-3.0 b/hadolint/licenses/LICENSE-lgpl-3.0 new file mode 100644 index 0000000..0a04128 --- /dev/null +++ b/hadolint/licenses/LICENSE-lgpl-3.0 @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/hadolint/licenses/LICENSE-libffi-ghc-9.10.2 b/hadolint/licenses/LICENSE-libffi-ghc-9.10.2 new file mode 100644 index 0000000..7282e79 --- /dev/null +++ b/hadolint/licenses/LICENSE-libffi-ghc-9.10.2 @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2024 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/hadolint/licenses/LICENSE-musl-1.2.6 b/hadolint/licenses/LICENSE-musl-1.2.6 new file mode 100644 index 0000000..2f15edc --- /dev/null +++ b/hadolint/licenses/LICENSE-musl-1.2.6 @@ -0,0 +1,193 @@ +musl as a whole is licensed under the following standard MIT license: + +---------------------------------------------------------------------- +Copyright © 2005-2020 Rich Felker, et al. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------------------------------------------------------------------- + +Authors/contributors include: + +A. Wilcox +Ada Worcester +Alex Dowad +Alex Suykov +Alexander Monakov +Andre McCurdy +Andrew Kelley +Anthony G. Basile +Aric Belsito +Arvid Picciani +Bartosz Brachaczek +Benjamin Peterson +Bobby Bingham +Boris Brezillon +Brent Cook +Chris Spiegel +Clément Vasseur +Daniel Micay +Daniel Sabogal +Daurnimator +David Carlier +David Edelsohn +Denys Vlasenko +Dmitry Ivanov +Dmitry V. Levin +Drew DeVault +Emil Renner Berthing +Fangrui Song +Felix Fietkau +Felix Janda +Gianluca Anzolin +Hauke Mehrtens +He X +Hiltjo Posthuma +Isaac Dunham +Jaydeep Patil +Jens Gustedt +Jeremy Huntwork +Jo-Philipp Wich +Joakim Sindholt +John Spencer +Julien Ramseier +Justin Cormack +Kaarle Ritvanen +Khem Raj +Kylie McClain +Leah Neukirchen +Luca Barbato +Luka Perkov +Lynn Ochs +M Farkas-Dyck (Strake) +Mahesh Bodapati +Markus Wichmann +Masanori Ogino +Michael Clark +Michael Forney +Mikhail Kremnyov +Natanael Copa +Nicholas J. Kain +orc +Pascal Cuoq +Patrick Oppenlander +Petr Hosek +Petr Skocik +Pierre Carrier +Reini Urban +Rich Felker +Richard Pennington +Ryan Fairfax +Samuel Holland +Segev Finer +Shiz +sin +Solar Designer +Stefan Kristiansson +Stefan O'Rear +Szabolcs Nagy +Timo Teräs +Trutz Behn +Will Dietz +William Haddon +William Pitcock + +Portions of this software are derived from third-party works licensed +under terms compatible with the above MIT license: + +The TRE regular expression implementation (src/regex/reg* and +src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed +under a 2-clause BSD license (license text in the source files). The +included version has been heavily modified by Rich Felker in 2012, in +the interests of size, simplicity, and namespace cleanliness. + +Much of the math library code (src/math/* and src/complex/*) is +Copyright © 1993,2004 Sun Microsystems or +Copyright © 2003-2011 David Schultz or +Copyright © 2003-2009 Steven G. Kargl or +Copyright © 2003-2009 Bruce D. Evans or +Copyright © 2008 Stephen L. Moshier or +Copyright © 2017-2018 Arm Limited +and labelled as such in comments in the individual source files. All +have been licensed under extremely permissive terms. + +The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 +The Android Open Source Project and is licensed under a two-clause BSD +license. It was taken from Bionic libc, used on Android. + +The AArch64 memcpy and memset code (src/string/aarch64/*) are +Copyright © 1999-2019, Arm Limited. + +The implementation of DES for crypt (src/crypt/crypt_des.c) is +Copyright © 1994 David Burren. It is licensed under a BSD license. + +The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was +originally written by Solar Designer and placed into the public +domain. The code also comes with a fallback permissive license for use +in jurisdictions that may not recognize the public domain. + +The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 +Lynn Ochs and is licensed under an MIT-style license. + +The x86_64 port was written by Nicholas J. Kain and is licensed under +the standard MIT terms. + +The mips and microblaze ports were originally written by Richard +Pennington for use in the ellcc project. The original code was adapted +by Rich Felker for build system and code conventions during upstream +integration. It is licensed under the standard MIT terms. + +The mips64 port was contributed by Imagination Technologies and is +licensed under the standard MIT terms. + +The powerpc port was also originally written by Richard Pennington, +and later supplemented and integrated by John Spencer. It is licensed +under the standard MIT terms. + +All other files which have no copyright comments are original works +produced specifically for use as part of this library, written either +by Rich Felker, the main author of the library, or by one or more +contibutors listed above. Details on authorship of individual files +can be found in the git version control history of the project. The +omission of copyright and license comments in each file is in the +interest of source tree size. + +In addition, permission is hereby granted for all public header files +(include/* and arch/*/bits/*) and crt files intended to be linked into +applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit +the copyright notice and permission notice otherwise required by the +license, and to use these files without any requirement of +attribution. These files include substantial contributions from: + +Bobby Bingham +John Spencer +Nicholas J. Kain +Rich Felker +Richard Pennington +Stefan Kristiansson +Szabolcs Nagy + +all of whom have explicitly granted such permission. + +This file previously contained text expressing a belief that most of +the files covered by the above exception were sufficiently trivial not +to be subject to copyright, resulting in confusion over whether it +negated the permissions granted in the license. In the spirit of +permissive licensing, and of not having licensing issues being an +obstacle to adoption, that text has been removed. diff --git a/hadolint/licenses/LICENSE-xxhash-in-ghc-9.10.2-and-hashable-1.5.1.0 b/hadolint/licenses/LICENSE-xxhash-in-ghc-9.10.2-and-hashable-1.5.1.0 new file mode 100644 index 0000000..e4c5da7 --- /dev/null +++ b/hadolint/licenses/LICENSE-xxhash-in-ghc-9.10.2-and-hashable-1.5.1.0 @@ -0,0 +1,26 @@ +xxHash Library +Copyright (c) 2012-2021 Yann Collet +All rights reserved. + +BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/hadolint/smoke.sh b/hadolint/smoke.sh new file mode 100755 index 0000000..c03f8ac --- /dev/null +++ b/hadolint/smoke.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Require hadolint to run, to name its version, and to report as JSON the one +# rule a fixed Dockerfile breaks. +# smoke.sh +set -euo pipefail + +bin=${1:?directory holding hadolint} +hadolint=$(cd "${bin}" && pwd)/hadolint + +"${hadolint}" --version + +work=$(mktemp -d "${TMPDIR:-/tmp}/hadolint-smoke.XXXXXX") +trap 'rm -rf "${work}"' EXIT +printf 'FROM debian\nRUN echo hello\n' > "${work}/Dockerfile" +# hadolint exits 1 when it has something to report. +"${hadolint}" --format json "${work}/Dockerfile" > "${work}/out.json" || true +cat "${work}/out.json" +grep -q '"code":"DL3006"' "${work}/out.json" || { echo "hadolint did not report DL3006 for an untagged image" >&2; exit 1; } + +# Beside the binary, in an archive and in the build's output alike: its +# licence, the notices of what is linked into it, and the offer of its source. +for file in NOTICES SOURCE COPYING.LESSER; do + [ -s "${bin}/${file}" ] || { echo "no ${file} beside hadolint" >&2; exit 1; } +done +grep -q '^GMP .*, the GNU Multiple Precision Arithmetic Library$' "${bin}/NOTICES" || { echo "NOTICES does not say GMP is linked in" >&2; exit 1; } +grep -q 'hackage.haskell.org/package/' "${bin}/SOURCE" || { echo "SOURCE names no Hackage package" >&2; exit 1; } +grep -q 'gitlab.alpinelinux.org/alpine/aports' "${bin}/SOURCE" || { echo "SOURCE does not say where the alpine packages' sources are" >&2; exit 1; } +# What only a package's Setup needs is not in the binary, and not in SOURCE: +# xml-conduit's asks for cabal-doctest, which nothing links. +if grep -q 'cabal-doctest' "${bin}/SOURCE" "${bin}/NOTICES"; then + echo "SOURCE or NOTICES names cabal-doctest, which only a Setup uses" >&2 + exit 1 +fi +grep -q '^xxHash, which GHC ' "${bin}/NOTICES" || { echo "NOTICES has no part for the xxHash compiled into the binary" >&2; exit 1; } + +# Static: nothing of the host's is loaded. +if command -v file > /dev/null; then + file -b "${hadolint}" | grep -q 'statically linked' || { echo "hadolint is not statically linked" >&2; exit 1; } +fi +echo "hadolint: runs, reports DL3006 as JSON" diff --git a/hadolint/versions.env b/hadolint/versions.env new file mode 100644 index 0000000..2979a74 --- /dev/null +++ b/hadolint/versions.env @@ -0,0 +1,3 @@ +# The image hadolint is built in: alpine, as upstream's own static build, +# pinned by digest (the tag is for a reader, the digest is the pin). +BUILD_IMAGE=mirror.gcr.io/library/alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf diff --git a/pins.yaml b/pins.yaml index ffba479..f68c5e8 100644 --- a/pins.yaml +++ b/pins.yaml @@ -187,3 +187,58 @@ pins: version: 11.0.100 source: 9fcae146169241cc3a189b61d4b03f71814db0d08906153686f4ef99ac026886 sha256: f9a271f91ea25a65f7eb742269b0881f657ff35b2b485016d27e2cc7b27c1969 + # hadolint, at the commit a consumer's differential names, a master commit + # and not a release: the archive is GitHub's tarball of it. Bumped by hand + # (version and digest.version together), as foxenflac is. + - name: hadolint + renovate: git-refs https://github.com/hadolint/hadolint + version: 1d901b9c0b0d0445d19b1a9128d89fa55bb4604e + url: https://github.com/hadolint/hadolint/archive/${version}.tar.gz + verify: download + digest: + version: 1d901b9c0b0d0445d19b1a9128d89fa55bb4604e + source: 7a4dfb1df7874032a8161ca8a508a1336b4b4eefbbd3c4810706701275a2f526 + sha256: a202e925d7fb5211ac23cc418d8d9a0509962fcedd04dc27e3ff05840d2ec0fc + # The compiler hadolint is built with, the release its own workflows + # install: GHC's build for musl, one entry an architecture, each tarball + # signed by the release's manager. Moved by hand with hadolint: the freeze + # file beside the recipe is of this compiler. + - name: ghc-linux-amd64 + renovate: manual + version: 9.10.2 + url: https://downloads.haskell.org/~ghc/${version}/ghc-${version}-x86_64-alpine3_18-linux.tar.xz + verify: pgp-detached https://downloads.haskell.org/~ghc/${version}/ghc-${version}-x86_64-alpine3_18-linux.tar.xz.sig https://keys.openpgp.org/vks/v1/by-fingerprint/88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 + digest: + version: 9.10.2 + source: 190c8a0b09cb28b6c545717038ec69f81995a7a4f5dea3902000e9d472465d33 + sha256: e54530aecb6bfbe8971a1344ba9e9193540efe7722b59146418007eeaf290c9c + - name: ghc-linux-arm64 + renovate: manual + version: 9.10.2 + url: https://downloads.haskell.org/~ghc/${version}/ghc-${version}-aarch64-alpine3_18-linux.tar.xz + verify: pgp-detached https://downloads.haskell.org/~ghc/${version}/ghc-${version}-aarch64-alpine3_18-linux.tar.xz.sig https://keys.openpgp.org/vks/v1/by-fingerprint/88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 88B57FCF7DB53B4DB3BFA4B1588764FBE22D19C4 + digest: + version: 9.10.2 + source: 70ae9e56ea34752d2939191c2571b9824b440db5ed814b9fc39076a614ebacac + sha256: 15fd860629276fb0119a6a0d9061e5af5d6d81230a2b88fc43498e937b5006e2 + # cabal-install, static binaries. Its release signs the SHA256SUMS file + # with a detached signature and no tarball, which no verify method reads: + # TLS is the guarantee. + - name: cabal-linux-amd64 + renovate: manual + version: 3.18.2.0 + url: https://downloads.haskell.org/~cabal/cabal-install-${version}/cabal-install-${version}-x86_64-linux-unknown.tar.xz + verify: download + digest: + version: 3.18.2.0 + source: 213bd0b4d91c38589cfa3286d298dfa9044a0fc4ac9f564240f1c22895ef0a28 + sha256: b4f4c83135da77cfc18ccd6056398ca714a2dad86d5f635621ffdda8f9afe587 + - name: cabal-linux-arm64 + renovate: manual + version: 3.18.2.0 + url: https://downloads.haskell.org/~cabal/cabal-install-${version}/cabal-install-${version}-aarch64-linux-unknown.tar.xz + verify: download + digest: + version: 3.18.2.0 + source: 356508e8ce1be0065b75c0bc76514dab3998f71ac65a4d81c414903c79323e9e + sha256: e4d940131ab0b78943a4b5ce64a9ef5acc452ea849df197787eaeecb1c3bf276