diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..2538503284 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +.git/ +target/ +.vscode/ +docs/ +examples/ +packages/ +.github/ +__pycache__/ +*.so +*.egg-info/ diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000000..465f524389 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,20 @@ +name: Python + +on: push + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - run: sudo pip3 install pipenv + - run: pipenv sync --dev + - name: Lint Formatting with Black + run: pipenv run -- black --check + - name: Lint Typing with MyPy + run: pipenv run -- mypy spk + # TODO: find a way to run the unit test suite... it needs an installation + # of spfs and we currently only produce a centos rpm that's not easy to use here diff --git a/.github/workflows/rpm.yml b/.github/workflows/rpm.yml new file mode 100644 index 0000000000..2a07c37291 --- /dev/null +++ b/.github/workflows/rpm.yml @@ -0,0 +1,23 @@ +name: RPM Build + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: echo RPM_NAME=$(rpmspec -q spk.spec | head -n1) >> $GITHUB_ENV + - run: echo Building ${{ env.RPM_NAME }}.rpm + - name: build RPM package + env: + SPFS_PULL_USERNAME: ${{ secrets.SPFS_PULL_USERNAME }} + SPFS_PULL_PASSWORD: ${{ secrets.SPFS_PULL_PASSWORD }} + run: make rpm + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: Binary RPM + path: dist/rpm/RPMS/x86_64/${{ env.RPM_NAME }}.rpm + # TODO: find a way to run the unit test suite... it needs an installation + # of spfs and we currently only produce a centos rpm that's not easy to use here diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000000..72cb2af403 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,29 @@ +name: Rust + +on: push + +env: + CARGO_TERM_COLOR: always + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: cargo fmt -- --check + build: + runs-on: ubuntu-18.04 + env: + SPFS_PULL_USERNAME: ${{ secrets.SPFS_PULL_USERNAME }} + SPFS_PULL_PASSWORD: ${{ secrets.SPFS_PULL_PASSWORD }} + steps: + - uses: actions/checkout@v2 + - run: sudo apt-get install -y libcap-dev + - run: sudo pip3 install pipenv + - name: Patch spfs Pull Auth + run: sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" Cargo.toml + - run: pipenv sync --dev + - name: Build + run: pipenv run -- cargo build --verbose + - name: Run tests + run: pipenv run -- cargo test --verbose --no-default-features diff --git a/.gitignore b/.gitignore index 7447f61935..4e9479d5b0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ dist/ .idea/ .vscode/ .nfs* +.env # GENERATED FOR spdev:Shell # END spdev:Shell @@ -32,4 +33,4 @@ dist/ # END spdev:Pipenv # GENERATED FOR spdev:Rust target/ -# END spdev:Rust \ No newline at end of file +# END spdev:Rust diff --git a/Cargo.lock b/Cargo.lock index 737a13af38..8480fb354e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2119,7 +2119,7 @@ dependencies = [ [[package]] name = "spfs" version = "0.27.0" -source = "git+https://gitlab.spimageworks.com/spi/dev/dev-ops/spfs?tag=v0.27.0#92fdc13bba103be7297dfd4cf4bd75c4b3a5b6be" +source = "git+https://github.com/imageworks/spfs?tag=v0.27.0#92fdc13bba103be7297dfd4cf4bd75c4b3a5b6be" dependencies = [ "capabilities", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 2649123573..2b33ba49df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,6 @@ extension-module = ["pyo3/extension-module"] [dependencies] pyo3 = {version = "0.13.2"} relative-path = "1.3.2" -spfs = {git = 'https://gitlab.spimageworks.com/spi/dev/dev-ops/spfs', tag = 'v0.27.0'} +spfs = {git = 'https://github.com/imageworks/spfs', tag = 'v0.27.0'} tracing = "0.1.25" tracing-subscriber = "0.2.16" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..d5b4ede821 --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +VERSION = $(shell cat spk.spec | grep Version | cut -d ' ' -f 2) +SOURCE_ROOT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) + +.PHONY: rpm devel test +default: devel + +devel: + cd $(SOURCE_ROOT) + pipenv run -- python setup.py develop + +test: + cd $(SOURCE_ROOT) + pipenv run -- spfs run - -- pytest + +rpm: SPFS_PULL_USERNAME ?= $(shell read -p "Github Username: " user; echo $$user) +rpm: SPFS_PULL_PASSWORD ?= $(shell read -s -p "Github Password/Access Token: " pass; echo $$pass) +rpm: + cd $(SOURCE_ROOT) + docker build . \ + -f rpmbuild.Dockerfile \ + --build-arg VERSION=$(VERSION) \ + --build-arg SPFS_PULL_USERNAME=$(SPFS_PULL_USERNAME) \ + --build-arg SPFS_PULL_PASSWORD=$(SPFS_PULL_PASSWORD) \ + --tag spk-rpm-builder + mkdir -p dist/rpm + CONTAINER=$$(docker create spk-rpm-builder) \ + && docker cp $$CONTAINER:/root/rpmbuild/RPMS dist/rpm/ \ + && docker rm --force $$CONTAINER diff --git a/Pipfile b/Pipfile index 6d2a3bcbbf..1d45ac81be 100644 --- a/Pipfile +++ b/Pipfile @@ -1,6 +1,6 @@ [[source]] name = "pypi" -url = "https://artifactory.spimageworks.com/api/pypi/pypi/simple" +url = "https://pypi.org/simple" verify_ssl = true [dev-packages] @@ -19,15 +19,15 @@ colorama = "~=0.4.3" typing-extensions = "~=3.7" simplejson = "~=3.17" semver = "~=2.9" +sentry-sdk = "~=1.0" structlog = "~=19.2" -spops = "~=0.1.13" sortedcontainers = "~=2.1" pytz = ">=2020" cerberus = "~=1.3" distro = "~=1.5" [requires] -python_version = "3.7" +python_version = "3.6" [pipenv] allow_prereleases = true diff --git a/Pipfile.lock b/Pipfile.lock index 688fb1b4f1..45b5f21c7d 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,16 +1,16 @@ { "_meta": { "hash": { - "sha256": "eaeca6e0915e1ec36b7a212a7243d6e58acab0753ee2da9e859d70887180b3cc" + "sha256": "92dee8474f6803aae66a798680a6af1d831cb7915ee4e4a22fffd53d180f0bea" }, "pipfile-spec": 6, "requires": { - "python_version": "3.7" + "python_version": "3.6" }, "sources": [ { "name": "pypi", - "url": "https://artifactory.spimageworks.com/api/pypi/pypi/simple", + "url": "https://pypi.org/simple", "verify_ssl": true } ] @@ -18,10 +18,11 @@ "default": { "cerberus": { "hashes": [ - "sha256:302e6694f206dd85cb63f13fd5025b31ab6d38c99c50c6d769f8fa0b0f299589" + "sha256:7aff49bc793e58a88ac14bffc3eca0f67e077881d3c62c621679a621294dd174", + "sha256:eec10585c33044fb7c69650bc5b68018dac0443753337e2b07684ee0f3c83329" ], "index": "pypi", - "version": "==1.3.2" + "version": "==1.3.3" }, "certifi": { "hashes": [ @@ -54,41 +55,6 @@ "index": "pypi", "version": "==2021.1" }, - "pyyaml": { - "hashes": [ - "sha256:08682f6b72c722394747bddaf0aa62277e02557c0fd1c42cb853016a38f8dedf", - "sha256:0f5f5786c0e09baddcd8b4b45f20a7b5d61a7e7e99846e3c799b05c7c53fa696", - "sha256:129def1b7c1bf22faffd67b8f3724645203b79d8f4cc81f674654d9902cb4393", - "sha256:294db365efa064d00b8d1ef65d8ea2c3426ac366c0c4368d930bf1c5fb497f77", - "sha256:3b2b1824fe7112845700f815ff6a489360226a5609b96ec2190a45e62a9fc922", - "sha256:3bd0e463264cf257d1ffd2e40223b197271046d09dadf73a0fe82b9c1fc385a5", - "sha256:4465124ef1b18d9ace298060f4eccc64b0850899ac4ac53294547536533800c8", - "sha256:49d4cdd9065b9b6e206d0595fee27a96b5dd22618e7520c33204a4a3239d5b10", - "sha256:4e0583d24c881e14342eaf4ec5fbc97f934b999a6828693a99157fde912540cc", - "sha256:5accb17103e43963b80e6f837831f38d314a0495500067cb25afab2e8d7a4018", - "sha256:607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e", - "sha256:6c78645d400265a062508ae399b60b8c167bf003db364ecb26dcab2bda048253", - "sha256:72a01f726a9c7851ca9bfad6fd09ca4e090a023c00945ea05ba1638c09dc3347", - "sha256:74c1485f7707cf707a7aef42ef6322b8f97921bd89be2ab6317fd782c2d53183", - "sha256:895f61ef02e8fed38159bb70f7e100e00f471eae2bc838cd0f4ebb21e28f8541", - "sha256:8c1be557ee92a20f184922c7b6424e8ab6691788e6d86137c5d93c1a6ec1b8fb", - "sha256:bb4191dfc9306777bc594117aee052446b3fa88737cd13b7188d0e7aa8162185", - "sha256:bfb51918d4ff3d77c1c856a9699f8492c612cde32fd3bcd344af9be34999bfdc", - "sha256:c20cfa2d49991c8b4147af39859b167664f2ad4561704ee74c1de03318e898db", - "sha256:cb333c16912324fd5f769fff6bc5de372e9e7a202247b48870bc251ed40239aa", - "sha256:d2d9808ea7b4af864f35ea216be506ecec180628aced0704e34aca0b040ffe46", - "sha256:d483ad4e639292c90170eb6f7783ad19490e7a8defb3e46f97dfe4bacae89122", - "sha256:dd5de0646207f053eb0d6c74ae45ba98c3395a571a2891858e87df7c9b9bd51b", - "sha256:e1d4970ea66be07ae37a3c2e48b5ec63f7ba6804bdddfdbd3cfd954d25a82e63", - "sha256:e4fac90784481d221a8e4b1162afa7c47ed953be40d31ab4629ae917510051df", - "sha256:fa5ae20527d8e831e8230cbffd9f8fe952815b2b7dae6ffec25318803a7528fc", - "sha256:fd7f6999a8070df521b6384004ef42833b9bd62cfee11a09bda1079b4b704247", - "sha256:fdc842473cd33f45ff6bce46aea678a54e3d21f1b61a7750ce3c498eedfe25d6", - "sha256:fe69978f3f768926cfa37b867e3843918e012cf83f680806599ddce33c2c68b0" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==5.4.1" - }, "ruamel.yaml": { "hashes": [ "sha256:64b06e7873eb8e1125525ecef7345447d786368cadca92a7cd9b59eae62e95a3", @@ -131,7 +97,7 @@ "sha256:e9f7d1d8c26a6a12c23421061f9022bb62704e38211fe375c645485f38df34a2", "sha256:f6061a31880c1ed6b6ce341215336e2f3d0c1deccd84957b6fa8ca474b41e89f" ], - "markers": "python_version < '3.10' and platform_python_implementation == 'CPython'", + "markers": "platform_python_implementation == 'CPython' and python_version < '3.10'", "version": "==0.2.2" }, "semver": { @@ -144,10 +110,11 @@ }, "sentry-sdk": { "hashes": [ - "sha256:0e5e947d0f7a969314aa23669a94a9712be5a688ff069ff7b9fc36c66adc160c", - "sha256:799a8bf76b012e3030a881be00e97bc0b922ce35dde699c6537122b751d80e2c" + "sha256:71de00c9711926816f750bc0f57ef2abbcb1bfbdf5378c601df7ec978f44857a", + "sha256:9221e985f425913204989d0e0e1cbb719e8b7fa10540f1bc509f660c06a34e66" ], - "version": "==0.14.4" + "index": "pypi", + "version": "==1.0.0" }, "simplejson": { "hashes": [ @@ -205,7 +172,6 @@ "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.15.0" }, "sortedcontainers": { @@ -216,22 +182,6 @@ "index": "pypi", "version": "==2.3.0" }, - "spops": { - "hashes": [ - "sha256:882c85f005ec7ab4e3e38a0b7c024938e965763dede54e2afdf75c485eda4c7c", - "sha256:c1d2cb4e33a413a3a599ea1d1fe44ad83fa27df97a849803532fae4a2bc413a1", - "sha256:efa0145c67142d8dd9f235cbf94c430171f3c390a01bf54e1c84c1adf43bf6ed" - ], - "index": "pypi", - "version": "==0.1.14" - }, - "statsd": { - "hashes": [ - "sha256:c610fb80347fca0ef62666d241bce64184bd7cc1efe582f9690e045c25535eaa", - "sha256:e3e6db4c246f7c59003e51c9720a51a7f39a396541cb9b147ff4b14d15b5dd1f" - ], - "version": "==3.3.0" - }, "structlog": { "hashes": [ "sha256:4287058cf4ce1a59bc5dea290d6386d37f29a37529c9a51cdf7387e51710152b", @@ -254,7 +204,6 @@ "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df", "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", "version": "==1.26.4" } }, @@ -271,7 +220,6 @@ "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6", "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==20.3.0" }, "black": { @@ -286,7 +234,6 @@ "sha256:6123ddc1052673e52bab52cdc955bcb57a015264a1c57d37bea2f6b817af0125", "sha256:98b3170739e5e83dd9dc19633f074727ad848cbedb6026708c8ac2d3b697a433" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==3.3.0" }, "certifi": { @@ -343,16 +290,14 @@ "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa", "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==4.0.0" }, "click": { "hashes": [ - "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a", - "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc" + "sha256:06b3a46da3b40f4bbe19b8ea5ba9a34e7925913a9b51608ff0c1d78ef0b814b4", + "sha256:7340a8666a3e2eff5f2ee778c2d06b606ce9891a61b2ee315e0a3994ffd2226a" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==7.1.2" + "version": "==8.0.0rc1" }, "colorama": { "hashes": [ @@ -364,61 +309,60 @@ }, "coverage": { "hashes": [ - "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c", - "sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6", - "sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45", - "sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a", - "sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03", - "sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529", - "sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a", - "sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a", - "sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2", - "sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6", - "sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759", - "sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53", - "sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a", - "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4", - "sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff", - "sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502", - "sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793", - "sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb", - "sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905", - "sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821", - "sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b", - "sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81", - "sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0", - "sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b", - "sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3", - "sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184", - "sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701", - "sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a", - "sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82", - "sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638", - "sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5", - "sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083", - "sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6", - "sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90", - "sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465", - "sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a", - "sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3", - "sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e", - "sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066", - "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf", - "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b", - "sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae", - "sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669", - "sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873", - "sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b", - "sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6", - "sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb", - "sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160", - "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c", - "sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079", - "sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d", - "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==5.5" + "sha256:00368e6328ebff76197fff5f4d5704b44098f89d8d99a67a349ad6674ec0b157", + "sha256:0389690e0a1c94e9a246dc3130355d70805e51ca509db1bf07fbde27efb33aa4", + "sha256:065d2181f44392893d37d0a4f9ff60b485d705f733356d0a2fb292a58c6f2e0f", + "sha256:082febdba717c769da92d5e19e14a659ebef6daab19b67fced304b7b8d2475e2", + "sha256:0a35ae0d590effb7cc96e7d6935ae2ab8a51526a111fbe0f12d1671aa9fdc377", + "sha256:142493f0400a0bd5acf03c52971229e937323c3e24c372800ae1c44a503e0921", + "sha256:186f53367a08e8d24cc534c7cbfa43a82d1618a48dec2e0c56e80577ec1888fe", + "sha256:2163a00bcd613e95e118c01ea2811f705fbbacf1904d657b24d306879e2303d3", + "sha256:24ecf342b1e23de259d81b3adc83578935babeb54f6950c9bd9534b12443a49c", + "sha256:2c24d3e09f433817ddd0cb2e8f82f8b42cd09a8ac558462fedf99be479ed4851", + "sha256:2d741575de4a13869c9d4a685235bacc897c94afd3703e2ad4fdc362f37e87da", + "sha256:305ca73c09dd84054a3a8f53d5b70e0325b5b303245d0b96ed505698dc7e8ea7", + "sha256:4bf1d0a390de707f8bfd49efdcdac9366ce77ed64cb35b344f58b1ec62517317", + "sha256:50d90d6b753debb7568621125aad4e5fb418e7bdcb0dba3fa6f4ee82994b35d4", + "sha256:5a2079bca21fa959608223b90cf2f95ce686a6497fb12bfaaa7bb24c3e298199", + "sha256:60c6d433f0357db7ed2a2a698fb75b8ce919ce547d6d6bc79c576e090f509768", + "sha256:66cfae29bccea703f02d8997f60d71e236c5a321588f5aa5a318bd88ca23dc0a", + "sha256:6d6fc990962559de1f3685eb3e365ca60f2e3257bfd145bf675c566b8ebb1944", + "sha256:703b126f3ad20c463b545e199c4da460695630da5fdfd949de6a6269b45eabab", + "sha256:730cee22c41852b90948343cdfd183db1e96a9de69fd4dabec3532c582afea68", + "sha256:7e4a16bde8a3b7424b2955130f5a6c29e741e7138fe05c5d9d72efc356076a80", + "sha256:801e8277958bc2e6cc1f2443a20a2a97f79583aa64524b130e1c0de44c287ca9", + "sha256:80baa69a78d5696c60b72dee44ac3d5ccf75ee82e84d018938ddf642d036a6a8", + "sha256:80c00ce9cef80afbf18d16cb3052f5601ba8d087501d829169eecb33c153346a", + "sha256:89db5a374d793344087732207ee15869549486b2148e3e2e6effe22146351fcd", + "sha256:917b98cc5725ea2e0b88c74d34182589a9be07092cb35b861ea9e74189174f71", + "sha256:9398f8fd89f6f260e94e57559df1885b8200b18312824b617a8789e0f5e7dc74", + "sha256:95b6f212bb0c7379f1f2f6e47c722fbdc7355d8b7488a68649e83dfa29522704", + "sha256:9f23313f3e494475581d46de3b8b6bdcf618ee1df412490e779a9aa0a6c72162", + "sha256:9f6f26e5b129bb0218aab30d368d6ead750517a457986f8854b1df4b4c318098", + "sha256:a502693c83a2c6558bc45b4c2dc01a00c9b99cb3cf846913438933a44af174fc", + "sha256:aa4999130a8e892fa9051edc18bf4daa0a2839d3f3de2dcfcbf0ae4619ee3b5e", + "sha256:b10be0b80784c1beb8061e5ce938d8511a182125de5fc695a60f0561b984d361", + "sha256:b1f7b23a606aaf2464eb81c23b5b20623e2ba44b4aaca6ea9bfe00e84a1a5264", + "sha256:b78c8d232d97dbc8ad3a3d94cc15fccabe9a331685d76d2e5cb5284acc4a5feb", + "sha256:b88fa862817035ad7921f2641c27a85dab12cc685ad3ef29c0caaf5b3d10a868", + "sha256:b93fb9137070899b5f10d6487724f4427b5945983a785e1e2f1102c5e175c516", + "sha256:b9639e16c1bc4eb8a78b3b30df4146bb78df5d52ba1b7454b634abd89aede6cc", + "sha256:baa3b6be365c97f80d92a397cb8963dcd9bc22d101b39784e77a9cad093812f8", + "sha256:c06c5758bae454a49dc3e7917804b46c31bb4a72cedfc8e7b4f17a318b3de9d6", + "sha256:c544153709e93ea7e9edcefee72f5afcf484a9cb526067065f9419419f4a3694", + "sha256:c6c74260ba130f7c20a340e8f9e544b0941621641f53edcf69e4602e12c9f29e", + "sha256:d040615ff5c02ffd97ba9f0f73b9db34c09b8142fbfdd363b2a79fa6a554242c", + "sha256:d85774b1ac09ec1d958e63baa436cc4c90e2e910294847ba51dcc3ca3ca04a63", + "sha256:e508bb216eee8350e77b436f9f99c4f2d8335ecb51483f5ffd8bf5e84aaa56d1", + "sha256:ea1cb38b1a52392ebb4e93eaf4a44b3cfdec35cca3f78a9a599f27b7f27031e2", + "sha256:ec310e0029d530d1043f638b7a326b349884421572626bc2909408da7b0d03e5", + "sha256:ed04b79f53fa975660f1a598120c504a0f4529170eeaf0d823fcc1f06f4d2e0f", + "sha256:f4909ee1ddabed351f0fa55063a7dbe498001e2245a9602d9fb0fd74afecdca9", + "sha256:f49ae9e19737493911e7f8e551310f719f463e442ea1ec92fe0804c62066a7e8", + "sha256:f4c93e6102087dda4931fcd50fa4ad44e8e43e09419290c5f05cc2c690961ebf", + "sha256:fa1b639d85af4794cb20d7cfd4c5ae38e94a418b17a2318a1992b470fb68260d" + ], + "version": "==5.6b1" }, "cryptography": { "hashes": [ @@ -435,16 +379,21 @@ "sha256:eb8cc2afe8b05acbd84a43905832ec78e7b3873fb124ca190f574dca7389a87d", "sha256:ee77aa129f481be46f8d92a1a7db57269a2f23052d5f2433b4621bb457081cc9" ], - "markers": "python_version >= '3.6'", "version": "==3.4.7" }, + "dataclasses": { + "hashes": [ + "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf", + "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97" + ], + "version": "==0.8" + }, "docutils": { "hashes": [ - "sha256:a71042bb7207c03d5647f280427f14bfbd1a65c9eb84f4b341d85fafb6bb4bdf", - "sha256:e2ffeea817964356ba4470efba7c2f42b6b0de0b04e66378507e3e2504bbff4c" + "sha256:6c6dd09c7c6c0928f39796433fba87ab56da0cf44385a4b35a496596c343101e", + "sha256:cc7828ebbce3ed8972076bf1607dac0d70717cba075b0816d46ae7e0dc64188b" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==0.17" + "version": "==0.17.1b1.dev0" }, "filelock": { "hashes": [ @@ -458,16 +407,15 @@ "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6", "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.10" }, "importlib-metadata": { "hashes": [ - "sha256:c9db46394197244adf2f0b08ec5bc3cf16757e9590b02af1fca085c16c0d600a", - "sha256:d2d46ef77ffc85cbf7dac7e81dd663fde71c45326131bea8033b9bad42268ebe" + "sha256:2ec0faae539743ae6aaa84b49a169670a465f7f5d64e6add98388cc29fd1f2f6", + "sha256:c9356b657de65c53744046fa8f7358afe0714a1af7d570c00c3835c2d724a7c1" ], "markers": "python_version < '3.8'", - "version": "==3.10.0" + "version": "==3.10.1" }, "iniconfig": { "hashes": [ @@ -489,7 +437,6 @@ "sha256:045703609dd3fccfcdb27da201684278823b72af515aedec1a8515719a038cb8", "sha256:8f607d7d1cc502c43a932a275a56fe47db50271904513a379d39df1af277ac48" ], - "markers": "python_version >= '3.6'", "version": "==23.0.1" }, "mypy": { @@ -539,7 +486,6 @@ "sha256:5b327ac1320dc863dca72f4514ecc086f31186744b84a230374cc1fd776feae5", "sha256:67714da7f7bc052e064859c05c595155bd1ee9f69f76557e21f051443c20947a" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==20.9" }, "pathspec": { @@ -558,18 +504,16 @@ }, "pluggy": { "hashes": [ - "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0", - "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d" + "sha256:265a94bf44ca13662f12fcd1b074c14d4b269a712f051b6f644ef7e705d6735f", + "sha256:467f0219e89bb5061a8429c6fc5cf055fa3983a0e68e84a1d205046306b37d9e" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==0.13.1" + "version": "==1.0.0.dev0" }, "py": { "hashes": [ "sha256:21b81bda15b66ef5e1a777a21c4dcd9c20ad3efd0b3f817e7a809035269e1bd3", "sha256:3b80836aa6d1feeaa108e046da6423ab8f6ceda6468545ae8d02d9d58d18818a" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.10.0" }, "pycparser": { @@ -577,7 +521,6 @@ "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0", "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.20" }, "pygments": { @@ -585,16 +528,14 @@ "sha256:2656e1a6edcdabf4275f9a3640db59fd5de107d88e8663c5d4e9a0fa62f77f94", "sha256:534ef71d539ae97d4c3a4cf7d6f110f214b0e687e92f9cb9d2a3b0d3101289c8" ], - "markers": "python_version >= '3.5'", "version": "==2.8.1" }, "pyparsing": { "hashes": [ - "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1", - "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b" + "sha256:1c6409312ce2ce2997896af5756753778d5f1603666dba5587804f09ad82ed27", + "sha256:f4896b4cc085a1f8f8ae53a1a90db5a86b3825ff73eb974dffee3d9e701007f4" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", - "version": "==2.4.7" + "version": "==3.0.0b2" }, "pytest": { "hashes": [ @@ -678,7 +619,6 @@ "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804", "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", "version": "==2.25.1" }, "requests-toolbelt": { @@ -708,7 +648,6 @@ "sha256:45e4b32ee9d6d70ba5f440ec8cc5221074c7f4b0e8918bdab748cc37912440a9", "sha256:d2cb2de0558762934679b9a104e82eca7af448c9f4974d1f3eeccff651df8a54" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.8.5" }, "setuptools-rust": { @@ -724,7 +663,6 @@ "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259", "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.15.0" }, "toml": { @@ -732,7 +670,6 @@ "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b", "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f" ], - "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==0.10.2" }, "tqdm": { @@ -740,7 +677,6 @@ "sha256:daec693491c52e9498632dfbe9ccfc4882a557f5fa08982db1b4d3adbe0887c3", "sha256:ebdebdb95e3477ceea267decfc0784859aa3df3e27e22d23b83e9b272bf157ae" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==4.60.0" }, "twine": { @@ -753,38 +689,38 @@ }, "typed-ast": { "hashes": [ - "sha256:07d49388d5bf7e863f7fa2f124b1b1d89d8aa0e2f7812faff0a5658c01c59aa1", - "sha256:14bf1522cdee369e8f5581238edac09150c765ec1cb33615855889cf33dcb92d", - "sha256:240296b27397e4e37874abb1df2a608a92df85cf3e2a04d0d4d61055c8305ba6", - "sha256:36d829b31ab67d6fcb30e185ec996e1f72b892255a745d3a82138c97d21ed1cd", - "sha256:37f48d46d733d57cc70fd5f30572d11ab8ed92da6e6b28e024e4a3edfb456e37", - "sha256:4c790331247081ea7c632a76d5b2a265e6d325ecd3179d06e9cf8d46d90dd151", - "sha256:5dcfc2e264bd8a1db8b11a892bd1647154ce03eeba94b461effe68790d8b8e07", - "sha256:7147e2a76c75f0f64c4319886e7639e490fee87c9d25cb1d4faef1d8cf83a440", - "sha256:7703620125e4fb79b64aa52427ec192822e9f45d37d4b6625ab37ef403e1df70", - "sha256:8368f83e93c7156ccd40e49a783a6a6850ca25b556c0fa0240ed0f659d2fe496", - "sha256:84aa6223d71012c68d577c83f4e7db50d11d6b1399a9c779046d75e24bed74ea", - "sha256:85f95aa97a35bdb2f2f7d10ec5bbdac0aeb9dafdaf88e17492da0504de2e6400", - "sha256:8db0e856712f79c45956da0c9a40ca4246abc3485ae0d7ecc86a20f5e4c09abc", - "sha256:9044ef2df88d7f33692ae3f18d3be63dec69c4fb1b5a4a9ac950f9b4ba571606", - "sha256:963c80b583b0661918718b095e02303d8078950b26cc00b5e5ea9ababe0de1fc", - "sha256:987f15737aba2ab5f3928c617ccf1ce412e2e321c77ab16ca5a293e7bbffd581", - "sha256:9ec45db0c766f196ae629e509f059ff05fc3148f9ffd28f3cfe75d4afb485412", - "sha256:9fc0b3cb5d1720e7141d103cf4819aea239f7d136acf9ee4a69b047b7986175a", - "sha256:a2c927c49f2029291fbabd673d51a2180038f8cd5a5b2f290f78c4516be48be2", - "sha256:a38878a223bdd37c9709d07cd357bb79f4c760b29210e14ad0fb395294583787", - "sha256:b4fcdcfa302538f70929eb7b392f536a237cbe2ed9cba88e3bf5027b39f5f77f", - "sha256:c0c74e5579af4b977c8b932f40a5464764b2f86681327410aa028a22d2f54937", - "sha256:c1c876fd795b36126f773db9cbb393f19808edd2637e00fd6caba0e25f2c7b64", - "sha256:c9aadc4924d4b5799112837b226160428524a9a45f830e0d0f184b19e4090487", - "sha256:cc7b98bf58167b7f2db91a4327da24fb93368838eb84a44c472283778fc2446b", - "sha256:cf54cfa843f297991b7388c281cb3855d911137223c6b6d2dd82a47ae5125a41", - "sha256:d003156bb6a59cda9050e983441b7fa2487f7800d76bdc065566b7d728b4581a", - "sha256:d175297e9533d8d37437abc14e8a83cbc68af93cc9c1c59c2c292ec59a0697a3", - "sha256:d746a437cdbca200622385305aedd9aef68e8a645e385cc483bdc5e488f07166", - "sha256:e683e409e5c45d5c9082dc1daf13f6374300806240719f95dc783d1fc942af10" - ], - "version": "==1.4.2" + "sha256:01ae5f73431d21eead5015997ab41afa53aa1fbe252f9da060be5dad2c730ace", + "sha256:067a74454df670dcaa4e59349a2e5c81e567d8d65458d480a5b3dfecec08c5ff", + "sha256:0fb71b8c643187d7492c1f8352f2c15b4c4af3f6338f21681d3681b3dc31a266", + "sha256:1b3ead4a96c9101bef08f9f7d1217c096f31667617b58de957f690c92378b528", + "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6", + "sha256:209596a4ec71d990d71d5e0d312ac935d86930e6eecff6ccc7007fe54d703808", + "sha256:2c726c276d09fc5c414693a2de063f521052d9ea7c240ce553316f70656c84d4", + "sha256:398e44cd480f4d2b7ee8d98385ca104e35c81525dd98c519acff1b79bdaac363", + "sha256:52b1eb8c83f178ab787f3a4283f68258525f8d70f778a2f6dd54d3b5e5fb4341", + "sha256:5feca99c17af94057417d744607b82dd0a664fd5e4ca98061480fd8b14b18d04", + "sha256:7538e495704e2ccda9b234b82423a4038f324f3a10c43bc088a1636180f11a41", + "sha256:760ad187b1041a154f0e4d0f6aae3e40fdb51d6de16e5c99aedadd9246450e9e", + "sha256:777a26c84bea6cd934422ac2e3b78863a37017618b6e5c08f92ef69853e765d3", + "sha256:95431a26309a21874005845c21118c83991c63ea800dd44843e42a916aec5899", + "sha256:9ad2c92ec681e02baf81fdfa056fe0d818645efa9af1f1cd5fd6f1bd2bdfd805", + "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c", + "sha256:aee0c1256be6c07bd3e1263ff920c325b59849dc95392a05f258bb9b259cf39c", + "sha256:af3d4a73793725138d6b334d9d247ce7e5f084d96284ed23f22ee626a7b88e39", + "sha256:b36b4f3920103a25e1d5d024d155c504080959582b928e91cb608a65c3a49e1a", + "sha256:b9574c6f03f685070d859e75c7f9eeca02d6933273b5e69572e5ff9d5e3931c3", + "sha256:bff6ad71c81b3bba8fa35f0f1921fb24ff4476235a6e94a26ada2e54370e6da7", + "sha256:c190f0899e9f9f8b6b7863debfb739abcb21a5c054f911ca3596d12b8a4c4c7f", + "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075", + "sha256:cae53c389825d3b46fb37538441f75d6aecc4174f615d048321b716df2757fb0", + "sha256:dd4a21253f42b8d2b48410cb31fe501d32f8b9fbeb1f55063ad102fe9c425e40", + "sha256:dde816ca9dac1d9c01dd504ea5967821606f02e510438120091b84e852367428", + "sha256:f2362f3cb0f3172c42938946dbc5b7843c2a28aec307c49100c8b38764eb6927", + "sha256:f328adcfebed9f11301eaedfa48e15bdece9b519fb27e6a8c01aa52a17ec31b3", + "sha256:f8afcf15cc511ada719a88e013cec87c11aff7b91f019295eb4530f96fe5ef2f", + "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65" + ], + "version": "==1.4.3" }, "typing-extensions": { "hashes": [ @@ -800,7 +736,6 @@ "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df", "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", "version": "==1.26.4" }, "webencodings": { @@ -815,7 +750,6 @@ "sha256:3607921face881ba3e026887d8150cca609d517579abe052ac81fc5aeffdbd76", "sha256:51cb66cc54621609dd593d1787f286ee42a5c0adbb4b29abea5a63edc3e03098" ], - "markers": "python_version >= '3.6'", "version": "==3.4.1" } } diff --git a/README.md b/README.md index 791cd1fa6c..c5101c16fd 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,9 @@ Package Manager for SPFS. SpFS provides a powerful set of tools for capturing and isolating process filesystems at runtime, but not a lot of great workflows for managing and organizing the environments and layers. SPK is the solution to this problem, adding the concept of software packages and the process of environment and dependency resolution for a better workflow. +## Usage + +See the main [docs](docs/) for details on using spk, starting with the [index](docs/_index.md). ## License @@ -17,15 +20,50 @@ SPK/SPFS/spawn are distributed using the [Apache-2.0 license](LICENSE.txt). ## Development -As an spdev project, you can build and validate your local clone of spk by entering the development environment and running the whole workflow: +SPK is mostly written in python, with a Rust extension that integrates with the spfs API. + +For details on architecture and design of the codebase, see the [developer docs](docs/develop). + +Python dependencies are tracked with [Pipenv](https://github.com/pypa/pipenv#installation), which will need to be installed. You will also need access to the rust toolchain, which can be installed with [rustup](https://rustup.sh). + +Once you have access to the pipenv command, jump into a development environment using: ```sh -spdev env -spdev flow +pipenv sync --dev +pipenv shell ``` -When making changes to the rust portion of the codebase, it may need to be rebuilt in order to test locally: +The easiest way to work with spk is to install a local development version into the pipenv virtaul environment. Once in a pipenv shell, this can be achieved by running the commands below. ```sh python setup.py develop +which spk # now points to local dev version +spk --help +``` + +**NOTE** In order to run spk you will need [spfs](https://github.com/imageworks/spfs) to already be installed on the local system. + +### RPM Package + +The spk codebase is setup to produce a centos7-compatible rpm package by building spfs in a docker container. To create the rpm package, you will need docker installed. These packages are also built and made available in this repository's CI. + +In order to properly build the rpm, you will need to provide your github username and an access token so that the container can pull the spfs sources to build against. The Makefile is setup to prompt you for and fill in these values automatically. If you don't wish to fill these in each time, you can also set the `SPFS_PULL_USERNAME` and `SPFS_PULL_PASSWORD` environment variables before calling make. + +```sh +# build the rpm package via docker and copy into ./dist/rpm +make rpm +``` + +### Testing + +Spfs has a number of unit and integration tests as well as testable examples that can all be executed with `pytest`. The tests themselves need to be executed under an spfs runtime in order to properly execute. + +```sh +spfs run - -- pytest +``` + +Additionally, there are some rust unit tests that can be executed using `cargo`. + +```sh +cargo test ``` diff --git a/rpmbuild.Dockerfile b/rpmbuild.Dockerfile new file mode 100644 index 0000000000..cecf7ffee4 --- /dev/null +++ b/rpmbuild.Dockerfile @@ -0,0 +1,32 @@ +FROM centos:7 +ARG VERSION +ARG SPFS_PULL_USERNAME +ARG SPFS_PULL_PASSWORD + +RUN yum install -y \ + curl \ + rpm-build \ + && yum clean all + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh /dev/stdin -y +ENV PATH $PATH:/root/.cargo/bin + +RUN mkdir -p /root/rpmbuild/{SOURCES,SPECS,RPMS,SRPMS} + +COPY spk.spec /root/rpmbuild/SPECS/ +ENV VERSION ${VERSION} +RUN echo "Building for $VERSION" + +# ensure the current build version matches the one in the rpm +# spec file, or things can go awry +RUN test "$VERSION" == "$(cat /root/rpmbuild/SPECS/spk.spec | grep Version | cut -d ' ' -f 2)" + +RUN yum-builddep -y /root/rpmbuild/SPECS/spk.spec && yum clean all + +COPY . /source/spk-$VERSION +ENV SPFS_PULL_USERNAME ${SPFS_PULL_USERNAME} +ENV SPFS_PULL_PASSWORD ${SPFS_PULL_PASSWORD} +RUN sed -i "s|github.com|$SPFS_PULL_USERNAME:$SPFS_PULL_PASSWORD@github.com|" /source/spk-$VERSION/Cargo.toml +RUN tar -C /source -czvf /root/rpmbuild/SOURCES/v$VERSION.tar.gz . + +RUN rpmbuild -ba /root/rpmbuild/SPECS/spk.spec diff --git a/spk.spec b/spk.spec index 9a1346706f..b8285ee5f8 100644 --- a/spk.spec +++ b/spk.spec @@ -3,17 +3,18 @@ Version: 0.28.1 Release: 1 Summary: Package manager for SPFS. License: NONE -URL: https://gitlab.spimageworks.com/spi/dev/dev-ops/spk -Source0: https://gitlab.spimageworks.com/spi/dev/dev-ops/spk/-/archive/v%{version}/%{name}-v%{version}.tar.gz +URL: https://github.com/imageworks/spk +Source0: https://github.com/imageworks/spk/archive/refs/tags/v%{version}.tar.gz BuildRequires: gcc +BuildRequires: git +BuildRequires: which BuildRequires: gcc-c++ BuildRequires: chrpath -BuildRequires: python-pip BuildRequires: libcap-devel -BuildRequires: python37-devel BuildRequires: openssl-devel -BuildRequires: spdev +BuildRequires: python3-devel +BuildRequires: python3-pip Requires: rsync Requires: spfs >= 0.27.0 @@ -23,14 +24,14 @@ Requires: spfs >= 0.27.0 Package manager for SPFS %prep -%setup -q -n %{name}-v%{version} +%setup -q -n %{name}-%{version} %build +pip3 install pipenv +export LANG=en_US.UTF-8 mkdir -p ./build -dev toolchain install Rust -source ~/.bashrc pipenv sync --dev -source "$(pipenv --venv)/bin/activate" +source $(pipenv --venv)/bin/activate python setup.py install python -m nuitka \ --standalone \ @@ -50,7 +51,7 @@ python -m nuitka \ %install mkdir -p %{buildroot}/usr/local/bin mkdir -p %{buildroot}/opt/spk.dist -rsync -rvapog --chmod 755 %{_builddir}/%{name}-v%{version}/build/spk.dist/* %{buildroot}/opt/spk.dist/ +rsync -rvapog --chmod 755 %{_builddir}/%{name}-%{version}/build/spk.dist/* %{buildroot}/opt/spk.dist/ %files /opt/spk.dist/ diff --git a/spk/cli/_args.py b/spk/cli/_args.py index 5da24abcdf..ebe996e087 100644 --- a/spk/cli/_args.py +++ b/spk/cli/_args.py @@ -9,11 +9,15 @@ import logging import argparse -import spops import sentry_sdk import structlog import colorama +try: + import spops +except ImportError: + spops = None + import spk import spkrs from . import ( @@ -101,6 +105,8 @@ def configure_sentry() -> None: def configure_spops() -> None: + if spops is None: + return try: spops.configure( {"statsd": {"host": "statsd.k8s.spimageworks.com", "port": 30111}} diff --git a/spk/cli/_cmd_convert.py b/spk/cli/_cmd_convert.py index 6807558c1b..cf214bc15d 100644 --- a/spk/cli/_cmd_convert.py +++ b/spk/cli/_cmd_convert.py @@ -24,7 +24,7 @@ def register( "convert", help=_convert.__doc__, **parser_args ) - sub_parsers = convert_cmd.add_subparsers(dest="converter", required=True) + sub_parsers = convert_cmd.add_subparsers(dest="converter") spcomp2_cmd = sub_parsers.add_parser( "spcomp2", help="Convert and convert spComp2s as packages", **parser_args ) @@ -128,6 +128,11 @@ def _convert(args: argparse.Namespace) -> None: elif args.converter == "pip": _convert_pip_packages(args) + elif args.converter is None: + raise ValueError( + f"Converter required and not given: use 'spk convert --help' for more info" + ) + else: raise NotImplementedError( f"Internal Error: no logic for converter: {args.converter}" diff --git a/spk/cli/_run.py b/spk/cli/_run.py index 4d659378a2..03b902d0ad 100644 --- a/spk/cli/_run.py +++ b/spk/cli/_run.py @@ -6,13 +6,12 @@ import sys import traceback -import spops import sentry_sdk from colorama import Fore import spk -from ._args import parse_args, configure_logging, configure_sentry, configure_spops +from ._args import parse_args, configure_logging, configure_sentry, configure_spops, spops def main() -> None: @@ -37,7 +36,8 @@ def run(argv: Sequence[str]) -> int: configure_logging(args) configure_spops() - spops.count("spk.run_count", command=args.command) + if spops is not None: + spops.count("spk.run_count", command=args.command) with sentry_sdk.configure_scope() as scope: scope.set_extra("command", args.command) @@ -51,7 +51,10 @@ def run(argv: Sequence[str]) -> int: try: - with spops.timer("spk.run_time", command=args.command): + if spops is not None: + with spops.timer("spk.run_time", command=args.command): + args.func(args) + else: args.func(args) except KeyboardInterrupt: @@ -62,7 +65,8 @@ def run(argv: Sequence[str]) -> int: except Exception as e: _capture_if_relevant(e) - spops.count("spk.error_count", command=args.command) + if spops is not None: + spops.count("spk.error_count", command=args.command) print(f"{spk.io.format_error(e)}", file=sys.stderr) if args.verbose > 2: print(f"{Fore.RED}{traceback.format_exc()}{Fore.RESET}", file=sys.stderr) diff --git a/spk/external/_spcomp2.py b/spk/external/_spcomp2.py index ea7c3522da..ea8637d7f8 100644 --- a/spk/external/_spcomp2.py +++ b/spk/external/_spcomp2.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # https://github.com/imageworks/spk -from typing import Iterable, List, Iterable, Optional, Tuple +from typing import Iterable, List, Iterable, Optional, Tuple, TYPE_CHECKING import os import re from pathlib import Path @@ -13,6 +13,11 @@ from .. import api, storage, build +if TYPE_CHECKING: + Pattern = re.Pattern +else: + Pattern = None + _LOGGER = structlog.get_logger("spk.external.spcomp2") SPCOMP2_ROOT = "/shots/spi/home/lib/SpComp2" @@ -184,7 +189,7 @@ def _to_spk_name(name: str) -> str: return name.lower().replace("_", "-") -KNOWN_OPTIONS: List[Tuple[re.Pattern, str, str, List[api.Option]]] = [ +KNOWN_OPTIONS: List[Tuple[Pattern, str, str, List[api.Option]]] = [ ( re.compile(r"rhel(7)"), "var",