From 6ed08f293421691a294b4bcdb76864752bb3d57d Mon Sep 17 00:00:00 2001 From: Ben Cressey Date: Fri, 31 May 2024 18:38:31 +0000 Subject: [PATCH] remove license-tool This is no longer used in the main Bottlerocket repo, and no longer supported by Twoliter. Signed-off-by: Ben Cressey --- Dockerfile | 39 +- license-tool/Cargo.lock | 1253 ----------------- license-tool/Cargo.toml | 20 - license-tool/README.md | 43 - license-tool/clarify.toml | 81 -- license-tool/deny.toml | 48 - license-tool/src/main.rs | 315 ----- .../tests/data/test-packages-licenses.toml | 7 - 8 files changed, 1 insertion(+), 1805 deletions(-) delete mode 100644 license-tool/Cargo.lock delete mode 100644 license-tool/Cargo.toml delete mode 100644 license-tool/README.md delete mode 100644 license-tool/clarify.toml delete mode 100644 license-tool/deny.toml delete mode 100644 license-tool/src/main.rs delete mode 100644 license-tool/tests/data/test-packages-licenses.toml diff --git a/Dockerfile b/Dockerfile index 76ef5af7..40c047e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -683,10 +683,9 @@ FROM sdk-rust as rust-sources # Copy the sources without clarify.toml or deny.toml, so that validation failures # don't require a full rebuild from source every time those files are modified. COPY license-scan /license-scan -COPY license-tool /license-tool USER root -RUN rm /license-{scan,tool}/{clarify,deny}.toml +RUN rm /license-scan/{clarify,deny}.toml # =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= @@ -708,15 +707,6 @@ RUN cargo build --release --locked # =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= -FROM sdk-cargo as sdk-license-tool - -USER builder -WORKDIR /home/builder/license-tool -COPY --from=rust-sources license-tool . -RUN cargo build --release --locked - -# =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= - FROM sdk-cargo as sdk-cargo-deny ENV DENYVER="0.14.20" @@ -765,10 +755,6 @@ COPY --from=sdk-cargo-make \ /home/builder/cargo-make \ /home/builder/cargo-make -COPY --from=sdk-license-tool \ - /home/builder/license-tool \ - /home/builder/license-tool - COPY --from=sdk-license-scan \ /home/builder/license-scan \ /home/builder/license-scan @@ -781,10 +767,6 @@ COPY --chown=0:0 --from=sdk-cargo-make \ /home/builder/cargo-make/target/release/cargo-make \ /usr/libexec/tools/ -COPY --chown=0:0 --from=sdk-license-tool \ - /home/builder/license-tool/target/release/bottlerocket-license-tool \ - /usr/libexec/tools/ - COPY --chown=0:0 --from=sdk-license-scan \ /home/builder/license-scan/target/release/bottlerocket-license-scan \ /usr/libexec/tools/ @@ -801,10 +783,6 @@ COPY --chown=1000:1000 --from=sdk-cargo-make \ /home/builder/cargo-make/LICENSE \ /usr/share/licenses/cargo-make/ -COPY --chown=1000:1000 \ - COPYRIGHT LICENSE-APACHE LICENSE-MIT \ - /usr/share/licenses/bottlerocket-license-tool/ - COPY --chown=1000:1000 \ COPYRIGHT LICENSE-APACHE LICENSE-MIT \ /usr/share/licenses/bottlerocket-license-scan/ @@ -837,20 +815,6 @@ RUN \ /usr/libexec/tools/cargo-deny \ --all-features check --disable-fetch licenses bans sources -WORKDIR /home/builder/license-tool -COPY license-tool/clarify.toml . -RUN \ - /usr/libexec/tools/bottlerocket-license-scan \ - --clarify clarify.toml \ - --spdx-data /usr/libexec/tools/spdx-data \ - --out-dir /usr/share/licenses/bottlerocket-license-tool/vendor \ - cargo --locked Cargo.toml - -COPY license-tool/deny.toml . -RUN \ - /usr/libexec/tools/cargo-deny \ - --all-features check --disable-fetch licenses bans sources - WORKDIR /home/builder/license-scan COPY license-scan/clarify.toml . RUN \ @@ -1280,7 +1244,6 @@ COPY --chown=0:0 --from=sdk-go-1.22 \ # "sdk-rust-tools" has our attribution generation and license scan tools. COPY --chown=0:0 --from=sdk-rust-tools /usr/libexec/tools/ /usr/libexec/tools/ COPY --chown=0:0 --from=sdk-rust-tools /usr/share/licenses/bottlerocket-license-scan/ /usr/share/licenses/bottlerocket-license-scan/ -COPY --chown=0:0 --from=sdk-rust-tools /usr/share/licenses/bottlerocket-license-tool/ /usr/share/licenses/bottlerocket-license-tool/ COPY --chown=0:0 --from=sdk-rust-tools /usr/share/licenses/cargo-deny/ /usr/share/licenses/cargo-deny/ COPY --chown=0:0 --from=sdk-rust-tools /usr/share/licenses/cargo-make/ /usr/share/licenses/cargo-make/ diff --git a/license-tool/Cargo.lock b/license-tool/Cargo.lock deleted file mode 100644 index 4f5e62aa..00000000 --- a/license-tool/Cargo.lock +++ /dev/null @@ -1,1253 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "anyhow" -version = "1.0.81" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" - -[[package]] -name = "argh" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" -dependencies = [ - "argh_derive", - "argh_shared", -] - -[[package]] -name = "argh_derive" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" -dependencies = [ - "argh_shared", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "argh_shared" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" -dependencies = [ - "serde", -] - -[[package]] -name = "autocfg" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" - -[[package]] -name = "backtrace" -version = "0.3.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" - -[[package]] -name = "bottlerocket-license-tool" -version = "0.1.0" -dependencies = [ - "anyhow", - "argh", - "httptest", - "reqwest", - "serde", - "tempfile", - "tokio", - "toml", - "url", -] - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata 0.1.10", -] - -[[package]] -name = "bumpalo" -version = "3.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" - -[[package]] -name = "bytes" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" - -[[package]] -name = "cc" -version = "1.0.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "crossbeam-channel" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "encoding_rs" -version = "0.8.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "fastrand" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "httptest" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b44a11846bda8c9fe9194f9924db7132c34635c7ce020f180f6c5d46d2308f" -dependencies = [ - "bstr", - "bytes", - "crossbeam-channel", - "form_urlencoded", - "futures", - "http", - "hyper", - "log", - "once_cell", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", -] - -[[package]] -name = "hyper" -version = "0.14.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "2.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" -dependencies = [ - "equivalent", - "hashbrown", -] - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "js-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "linux-raw-sys" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" - -[[package]] -name = "log" -version = "0.4.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" - -[[package]] -name = "memchr" -version = "2.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "wasi", - "windows-sys", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "proc-macro2" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.6", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "regex-automata" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" - -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "ring" -version = "0.17.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" -dependencies = [ - "cc", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustix" -version = "0.38.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" -dependencies = [ - "bitflags 2.5.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "rustls" -version = "0.21.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4" -dependencies = [ - "log", - "ring", - "rustls-webpki", - "sct", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "ryu" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "serde" -version = "1.0.197" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.197" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "syn" -version = "2.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "url" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" - -[[package]] -name = "web-sys" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "winnow" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys", -] diff --git a/license-tool/Cargo.toml b/license-tool/Cargo.toml deleted file mode 100644 index 99126a98..00000000 --- a/license-tool/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "bottlerocket-license-tool" -version = "0.1.0" -license = "Apache-2.0 OR MIT" -authors = ["Arnaldo Garcia Rincon "] -edition = "2018" -publish = false - -[dependencies] -anyhow = "1" -argh = "0.1" -reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"] } -serde = { version = "1", features = ["derive"] } -tokio = { version = "1", default-features = false, features = ["macros", "rt-multi-thread"] } -toml = "0.8" -url = { version = "2", features = ["serde"] } - -[dev-dependencies] -httptest = "0.15" -tempfile = "3" diff --git a/license-tool/README.md b/license-tool/README.md deleted file mode 100644 index 6a62ce07..00000000 --- a/license-tool/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Bottlerocket's license-tool helper -There are cases where multiple licenses could apply to a package in the main bottlerocket repo, depending on who will distribute the software. -For such packages, the users should have the ability to choose what license they want to use for a package with multiple distribution licenses, without hardcoding this information in the RPM recipes. - -The **license-tool** helper can be used to select the licenses that will apply to a set of packages. -The tool provides commands to retrieve the licenses' SPDX id and file paths, which are used in the RPM spec recipes. - -The Bottlerocket build system uses this helper to let users select the license that best applies to them, for some of the third-party packages distributed in the base image. - -## Use in the Bottlerocket build system -The Bottlerocket build system calls `bottlerocket-license-tool fetch` to create a local copy of the licenses files, before the packages builds begin. -In the spec file of a package with multiple distribution licenses, `bottlerocket-license-tool` is called with the `spdx-id` and `path` commands to fetch the license's SDPX id and file path. -For example, a RPM spec recipe could have: - -```rpm-spec -%global spdx_id %(bottlerocket-license-tool spdx-id package-name) -%global license_file %(bottlerocket-license-tool path package-name -p ./licenses) - -# ... - -%package my-package -License: %{spdx_id} - -# ... - -%files my-package -%license %{license_file} -``` - -## Licenses file example - -```toml -[my-package] -spdx-id = "SPDX-ID AND SPDX-ID-2 AND SPDX-ID-3" # Package with multiple licenses -licenses = [ - # This file is copied from a file system, and will be saved as `path` - { license-url = "file:///path/to/spdx-id-license.txt", path = "spdx-id-license.txt" }, - # This file is fetched from a https endpoint, and will be saved as `path` - { license-url = "https://localhost/spdx-id-license-v2.txt", path = "spdx-id-license-2.txt" } - # This file is expected to be in the directory specified in `--prefix` - { path = "spdx-id-license-3.txt" } -] -``` diff --git a/license-tool/clarify.toml b/license-tool/clarify.toml deleted file mode 100644 index fc3de1a6..00000000 --- a/license-tool/clarify.toml +++ /dev/null @@ -1,81 +0,0 @@ -[clarify.backtrace-sys] -# backtrace-sys is MIT/Apache-2.0, libbacktrace is BSD-3-Clause -expression = "(MIT OR Apache-2.0) AND BSD-3-Clause" -license-files = [ - { path = "src/libbacktrace/LICENSE", hash = 0x0ce09262 }, -] - -[clarify.bstr] -expression = "(MIT OR Apache-2.0) AND Unicode-DFS-2016" -license-files = [ - { path = "COPYING", hash = 0x28398560 }, - { path = "LICENSE-APACHE", hash = 0x24b54f4b }, - { path = "LICENSE-MIT", hash = 0x462dee44 }, - { path = "src/unicode/data/LICENSE-UNICODE", hash = 0x70f7339 }, -] - -[clarify.crossbeam-channel] -expression = "MIT OR Apache-2.0" -license-files = [ - { path = "LICENSE-APACHE", hash = 0x24b54f4b }, - { path = "LICENSE-MIT", hash = 0xbc436f08 }, - { path = "LICENSE-THIRD-PARTY", hash = 0x847bf39 }, -] - -[clarify.regex] -expression = "MIT OR Apache-2.0" -license-files = [ - { path = "LICENSE-APACHE", hash = 0x24b54f4b }, - { path = "LICENSE-MIT", hash = 0xb755395b }, -] -skip-files = [ - "src/testdata/LICENSE", # we aren't using the test data -] - -[clarify.regex-syntax] -expression = "(MIT OR Apache-2.0) AND Unicode-DFS-2016" -license-files = [ - { path = "LICENSE-APACHE", hash = 0x24b54f4b }, - { path = "LICENSE-MIT", hash = 0xb755395b }, - { path = "src/unicode_tables/LICENSE-UNICODE", hash = 0xa7f28b93 }, -] - -[clarify.encoding_rs] -expression = "(MIT OR Apache-2.0) AND BSD-3-Clause" -license-files = [ - { path = "LICENSE-APACHE", hash = 0x18785531 }, - { path = "LICENSE-MIT", hash = 0xafaec4cb }, - { path = "LICENSE-WHATWG", hash = 0xbcb87a0c }, -] -skip-files = [ "COPYRIGHT"] # this file describes what licenses apply to the sources, and when they apply - -[[clarify.regex-automata]] -version = "^0.1" -expression = "Unlicense OR MIT" -license-files = [ - { path = "LICENSE-MIT", hash = 0x616d8a83 }, - { path = "UNLICENSE", hash = 0x87b84020 }, -] -skip-files = [ - # these licenses apply to the test data, which we don't distribute, - "data/tests/fowler/LICENSE", - "data/fowler-tests/LICENSE", - # this file describes what licenses apply to the sources, and when they apply - "COPYING" -] - -[[clarify.regex-automata]] -version = "^0.3" -expression = "MIT OR Apache-2.0" -license-files = [ - { path = "LICENSE-MIT", hash = 0xb755395b }, - { path = "LICENSE-APACHE", hash = 0x24b54f4b }, -] - -[clarify.unicode-ident] -expression = "(MIT OR Apache-2.0) AND Unicode-DFS-2016" -license-files = [ - { path = "LICENSE-APACHE", hash = 0xb5518783 }, - { path = "LICENSE-MIT", hash = 0x386ca1bc }, - { path = "LICENSE-UNICODE", hash = 0x9698cbbe }, -] diff --git a/license-tool/deny.toml b/license-tool/deny.toml deleted file mode 100644 index 9759d107..00000000 --- a/license-tool/deny.toml +++ /dev/null @@ -1,48 +0,0 @@ -[licenses] - -# We want really high confidence when inferring licenses from text -confidence-threshold = 0.93 - -allow = [ - "Apache-2.0", - "BSD-3-Clause", - "BSL-1.0", - "ISC", - "MIT", - "OpenSSL", - "Unlicense", - "Zlib", -] - -exceptions = [ - { name = "webpki-roots", allow = ["MPL-2.0"], version = "*" }, - { name = "unicode-ident", allow = ["MIT", "Apache-2.0", "Unicode-DFS-2016"] }, -] - -[[licenses.clarify]] -name = "ring" -expression = "MIT AND ISC AND OpenSSL" -license-files = [ - { path = "LICENSE", hash = 0xbd0eed23 }, -] - -[[licenses.clarify]] -name = "webpki" -expression = "ISC" -license-files = [ - { path = "LICENSE", hash = 0x001c7e6c }, -] - -[bans] -# Deny multiple versions or wildcard dependencies. -multiple-versions = "deny" -wildcards = "deny" -skip = [ - # redox_syscall uses an older version of bitflags - { name = "bitflags", version = "=1.3" }, -] - -[sources] -# Deny crates from unknown registries or git repositories. -unknown-registry = "deny" -unknown-git = "deny" diff --git a/license-tool/src/main.rs b/license-tool/src/main.rs deleted file mode 100644 index 1d11dd91..00000000 --- a/license-tool/src/main.rs +++ /dev/null @@ -1,315 +0,0 @@ -#![deny(rust_2018_idioms)] -#![warn(clippy::pedantic)] -#![allow(clippy::redundant_closure_for_method_calls)] - -use anyhow::{bail, Context, Result}; -use argh::FromArgs; -use serde::Deserialize; -use std::collections::HashMap; -use std::fs::{self, File}; -use std::io; -use std::path::{Path, PathBuf}; -use url::Url; - -const DEFAULT_LICENSES_CONF: &str = "Licenses.toml"; - -/// Stores arguments -#[derive(FromArgs, PartialEq, Debug)] -struct Args { - /// configuration file with the licenses to be used - #[argh(option, short = 'l', default = "DEFAULT_LICENSES_CONF.to_string()")] - licenses_file: String, - - #[argh(subcommand)] - subcommand: Subcommand, -} - -/// Stores the subcommand to be executed -#[derive(FromArgs, Debug, PartialEq)] -#[argh(subcommand)] -enum Subcommand { - SpdxId(SpdxIdArgs), - Path(PathArgs), - Fetch(FetchArgs), -} - -/// Returns the spdx-id for the package -#[derive(FromArgs, Debug, PartialEq)] -#[argh(subcommand, name = "spdx-id")] -struct SpdxIdArgs { - /// the package name used to look up for the licenses - #[argh(positional)] - package_name: String, -} - -/// Creates a copy of the licenses files in the dest directory -#[derive(FromArgs, Debug, PartialEq)] -#[argh(subcommand, name = "fetch")] -struct FetchArgs { - /// the destination folder for the licenses - #[argh(positional)] - destination: PathBuf, -} - -/// Prints out a space-separated list of the paths to the licenses files -#[derive(FromArgs, Debug, PartialEq)] -#[argh(subcommand, name = "path")] -struct PathArgs { - /// the package name used to look up for the licenses - #[argh(positional)] - package_name: String, - /// the source folder where the licenses are - #[argh(option, short = 'p')] - prefix: Option, -} - -/// Holds the configurations for package's licenses -#[derive(Deserialize, Debug)] -struct PackageLicense { - // The SPDX identifier for the package - #[serde(rename(deserialize = "spdx-id"))] - spdx_id: String, - // The licenses that apply to the package - licenses: Vec, -} - -/// Holds the configurations for a license -#[derive(Deserialize, Debug, Clone)] -struct License { - // The path to the license to fetch - #[serde(rename(deserialize = "license-url"))] - license_url: Option, - // The file name used to store the license - path: String, -} - -/// Prints the spdx id for the package -fn print_spdx_id(packages_licenses: &HashMap, package: S) -> Result<()> -where - S: AsRef, -{ - let package = package.as_ref(); - let package_license = packages_licenses.get(package).context(format!( - "Couldn't find configuration for package '{package}'" - ))?; - println!("{}", package_license.spdx_id); - Ok(()) -} - -/// Prints a space separated list of paths -fn print_paths( - packages_licenses: &HashMap, - package_name: S, - prefix: Option, -) -> Result<()> -where - S: AsRef, -{ - let package_name = package_name.as_ref(); - let package_license = packages_licenses.get(package_name).context(format!( - "Couldn't find configuration for package '{package_name}'" - ))?; - println!( - "{}", - get_license_destinations(package_license, prefix).join(" ") - ); - Ok(()) -} - -/// Fetches all the licenses for the passed map of package licenses -async fn fetch_all_licenses

( - packages_licenses: &HashMap, - dest: P, -) -> Result<()> -where - P: AsRef, -{ - for package_license in packages_licenses.values() { - fetch_licenses(package_license, &dest).await?; - } - - Ok(()) -} - -/// Fetches the licenses in the `PackageLicense` object, and creates a copy of them in `dest` -async fn fetch_licenses

(package_license: &PackageLicense, dest: P) -> Result<()> -where - P: AsRef, -{ - let dest = dest.as_ref(); - for license in &package_license.licenses { - let path: PathBuf = dest.join(&license.path); - - if path.exists() { - // Skip if the file already exists - continue; - } - - if let Some(license_url) = &license.license_url { - match license_url.scheme() { - "file" => { - fs::copy(license_url.path(), &path) - .context(format!("Failed to copy file from '{}'", license_url.path()))?; - } - "http" | "https" => { - let content = reqwest::get(license_url.clone()) - .await - .context(format!("Failed to download file from '{license_url}'"))? - .text() - .await?; - let mut dest = File::create(&path).context(format!( - "Failed to create file '{}'", - path.display() - ))?; - io::copy(&mut content.as_bytes(), &mut dest).context(format!( - "Failed to copy content to '{}'", - path.display() - ))?; - } - _ => bail!( - "Invalid scheme for '{}', valid options are: ['file://', 'http://', 'https://']", - license_url - ), - }; - } - } - Ok(()) -} - -/// Returns a list of paths to the destination files for the licenses -fn get_license_destinations( - package_license: &PackageLicense, - dest: Option, -) -> Vec { - let mut all_paths = Vec::new(); - let dest = match dest { - None => Path::new("").into(), - Some(dest) => dest, - }; - - for license in &package_license.licenses { - all_paths.push(dest.join(&license.path).display().to_string()); - } - - all_paths -} - -/// Parses a map of `PackageLicense` objects from an array of bytes -fn parse_licenses_file

(licenses_file: P) -> Result> -where - P: AsRef, -{ - let licenses_file = licenses_file.as_ref(); - Ok(toml::from_str( - &fs::read_to_string(licenses_file) - .context(format!("Failed to read file '{}'", licenses_file.display()))?, - )?) -} - -#[tokio::main] -async fn main() -> Result<()> { - let args: Args = argh::from_env(); - let packages_licenses = parse_licenses_file(&args.licenses_file)?; - - match args.subcommand { - Subcommand::SpdxId(spdxid_args) => { - print_spdx_id(&packages_licenses, spdxid_args.package_name)?; - } - Subcommand::Path(path_args) => { - print_paths(&packages_licenses, path_args.package_name, path_args.prefix)?; - } - Subcommand::Fetch(fetch_args) => { - fetch_all_licenses(&packages_licenses, fetch_args.destination).await?; - } - } - - Ok(()) -} - -#[cfg(test)] -mod test_packages_licenses { - use super::{get_license_destinations, parse_licenses_file}; - use anyhow::Result; - use std::io; - static TEST_PACKAGES_LICENSES: &str = include_str!("../tests/data/test-packages-licenses.toml"); - - #[test] - fn test_parse_toml_file() -> Result<()> { - let mut tmplicense = tempfile::NamedTempFile::new()?; - io::copy(&mut TEST_PACKAGES_LICENSES.as_bytes(), &mut tmplicense)?; - assert!(parse_licenses_file(tmplicense).is_ok()); - Ok(()) - } - - #[test] - fn test_use_path() -> Result<()> { - let mut tmplicense = tempfile::NamedTempFile::new()?; - io::copy(&mut TEST_PACKAGES_LICENSES.as_bytes(), &mut tmplicense)?; - let packages_licences = parse_licenses_file(tmplicense)?; - let package_license = packages_licences.get("the-package").unwrap(); - // Original file name is `license.txt` - assert!( - get_license_destinations(package_license, Some("./dest".into())) - == vec!["./dest/license-path.txt"] - ); - Ok(()) - } -} - -#[cfg(test)] -mod test_fetch_license { - use super::{fetch_licenses, License, PackageLicense}; - use anyhow::Result; - use httptest::{matchers::request, responders::status_code, Expectation, Server}; - use std::fs; - use url::Url; - - #[tokio::test] - async fn test_fetch_license_from_file() -> Result<()> { - let tmpdir = tempfile::tempdir()?; - let tmplicense = tempfile::NamedTempFile::new()?; - let package_license = PackageLicense { - spdx_id: "spdx-id".to_string(), - licenses: vec![License { - license_url: Some(Url::parse(&format!( - "file://{}", - tmplicense.path().display() - ))?), - path: String::from("license-file.txt"), - }], - }; - fetch_licenses(&package_license, &tmpdir).await?; - assert!(tmpdir - .path() - .join(String::from("license-file.txt")) - .exists()); - Ok(()) - } - - #[tokio::test] - async fn test_fetch_license_from_http() -> Result<()> { - let tmpdir = tempfile::tempdir()?; - let server = Server::run(); - let license_body = "A cool body for the license"; - - server.expect( - Expectation::matching(request::method_path("GET", "/license.txt")) - .respond_with(status_code(200).body(license_body)), - ); - - let url = server.url("/license.txt"); - let package_license = PackageLicense { - spdx_id: "spdx-id".to_string(), - licenses: vec![License { - license_url: Some(Url::parse(&url.to_string())?), - path: String::from("license-file.txt"), - }], - }; - let path = tmpdir.path().join(String::from("license-file.txt")); - fetch_licenses(&package_license, &tmpdir).await?; - assert!(path.exists()); - let content = fs::read(path)?; - assert!(content == license_body.as_bytes()); - Ok(()) - } -} diff --git a/license-tool/tests/data/test-packages-licenses.toml b/license-tool/tests/data/test-packages-licenses.toml deleted file mode 100644 index 7e28372c..00000000 --- a/license-tool/tests/data/test-packages-licenses.toml +++ /dev/null @@ -1,7 +0,0 @@ -[the-package] -spdx-id = "text-id" -licenses = [ { license-url = "file://license.txt", path = "license-path.txt"} ] - -[the-other-package] -spdx-id = "text-id" -licenses = [ { path = "license-path-2.txt" } ]