From e24aea0ee40be1745de3360bab9ee670e7fa32df Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 20:27:41 -0800 Subject: [PATCH 1/7] XXX check for cargo with "gmake setup" --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e6e158a..03de192 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +# +# Copyright 2024 Oxide Computer Company +# TOP = $(PWD) @@ -23,6 +26,13 @@ gmakecheck: exit 1; \ fi +.PHONY: cargocheck +cargocheck: + @if ! cargo --version >/dev/null 2>&1; then \ + printf ' You must install Rust before continuing.\n' >&2; \ + exit 1; \ + fi + # # Run a "quick" build of illumos for development: # @@ -47,7 +57,7 @@ setup: gmakecheck $(HELIOS_BUILD) @printf '\n' .PHONY: $(HELIOS_BUILD) -$(HELIOS_BUILD): +$(HELIOS_BUILD): cargocheck @if [[ $$(/usr/bin/uname -o) != illumos ]]; then \ printf 'ERROR: must be built on illumos\n' >&2; \ exit 1; \ From eb373ff1ebb095708ab0d3d6ef4f604ceb829dbd Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 17:39:48 -0800 Subject: [PATCH 2/7] XXX initial pass of licence/copyright and minor style cleanup --- LICENSE | 373 ++++++++++++++++++ README.md | 7 + image/mkcpio.sh | 3 + image/templates/files/bootparams.sh | 3 + image/templates/files/compliance-beacon.sh | 3 + image/templates/files/compliance-beacon.xml | 83 ++-- image/templates/files/compliance-dump.xml | 70 ++-- image/templates/files/compliance-hostname.sh | 3 + image/templates/files/compliance-hostname.xml | 4 +- image/templates/files/compliance-postboot.sh | 3 + image/templates/files/compliance-postboot.xml | 68 ++-- image/templates/files/compliance-time.xml | 83 ++-- image/templates/files/compliance-tofino.xml | 59 +-- image/templates/files/gimlet-postboot.sh | 3 + image/templates/files/gimlet-postboot.xml | 130 +++--- image/templates/files/mfg.sh | 3 + image/templates/files/mfg.xml | 42 +- image/templates/files/mfg_default_login | 2 +- image/templates/files/nvme-fio.sh | 6 + image/templates/files/recovery-hostname.sh | 9 +- image/templates/files/recovery-hostname.xml | 81 ++-- image/templates/files/rootisramdisk | 5 + image/templates/files/site-compliance.xml | 44 ++- image/templates/files/site-mfg.xml | 44 ++- image/templates/files/site.xml | 36 +- tools/helios-build/Cargo.toml | 4 +- tools/helios-build/rustfmt.toml | 3 + tools/helios-build/src/archive.rs | 4 + tools/helios-build/src/expand.rs | 4 + tools/helios-build/src/main.rs | 4 + tools/helios-build/src/zfs.rs | 4 + tools/packages/os-conflicts.mogrify | 4 + tools/packages/os-deps.mogrify | 4 + 33 files changed, 839 insertions(+), 359 deletions(-) create mode 100644 LICENSE create mode 100644 tools/helios-build/rustfmt.toml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a612ad9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index 6afb9f9..8fc1866 100644 --- a/README.md +++ b/README.md @@ -484,3 +484,10 @@ an array of extra ROM files with suffixes that represent different diagnostic capabilities. Additional files are not committed and may change at any time in the future. Software that interprets image archives should ignore any unrecognised files. + +## Licence + +Copyright 2024 Oxide Computer Company + +Unless otherwise noted, all components are licenced under the [Mozilla Public +License Version 2.0](./LICENSE). diff --git a/image/mkcpio.sh b/image/mkcpio.sh index 283d35f..265b041 100644 --- a/image/mkcpio.sh +++ b/image/mkcpio.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o errexit set -o pipefail diff --git a/image/templates/files/bootparams.sh b/image/templates/files/bootparams.sh index 6c7275e..a9a16d1 100644 --- a/image/templates/files/bootparams.sh +++ b/image/templates/files/bootparams.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# prtconf -v /devices | awk -v want="$1" " /name='/ && /type=string/ && /items=1/ { diff --git a/image/templates/files/compliance-beacon.sh b/image/templates/files/compliance-beacon.sh index f89edd2..c2b540d 100644 --- a/image/templates/files/compliance-beacon.sh +++ b/image/templates/files/compliance-beacon.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o errexit set -o pipefail diff --git a/image/templates/files/compliance-beacon.xml b/image/templates/files/compliance-beacon.xml index 2a7ed0b..de72f1c 100644 --- a/image/templates/files/compliance-beacon.xml +++ b/image/templates/files/compliance-beacon.xml @@ -1,49 +1,52 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/compliance-dump.xml b/image/templates/files/compliance-dump.xml index bdf549f..2cfacb3 100644 --- a/image/templates/files/compliance-dump.xml +++ b/image/templates/files/compliance-dump.xml @@ -1,43 +1,45 @@ + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/compliance-hostname.sh b/image/templates/files/compliance-hostname.sh index d902403..72752d2 100644 --- a/image/templates/files/compliance-hostname.sh +++ b/image/templates/files/compliance-hostname.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o errexit set -o pipefail diff --git a/image/templates/files/compliance-hostname.xml b/image/templates/files/compliance-hostname.xml index dd4a0e9..ddb86e4 100644 --- a/image/templates/files/compliance-hostname.xml +++ b/image/templates/files/compliance-hostname.xml @@ -1,5 +1,8 @@ + @@ -45,4 +48,3 @@ - diff --git a/image/templates/files/compliance-postboot.sh b/image/templates/files/compliance-postboot.sh index 90f27ed..f890bb7 100644 --- a/image/templates/files/compliance-postboot.sh +++ b/image/templates/files/compliance-postboot.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o errexit set -o pipefail diff --git a/image/templates/files/compliance-postboot.xml b/image/templates/files/compliance-postboot.xml index 88b50c6..491af1e 100644 --- a/image/templates/files/compliance-postboot.xml +++ b/image/templates/files/compliance-postboot.xml @@ -4,40 +4,40 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/compliance-time.xml b/image/templates/files/compliance-time.xml index 4a63e9d..1958ef0 100644 --- a/image/templates/files/compliance-time.xml +++ b/image/templates/files/compliance-time.xml @@ -1,49 +1,52 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/compliance-tofino.xml b/image/templates/files/compliance-tofino.xml index 2b70fbf..2966d25 100644 --- a/image/templates/files/compliance-tofino.xml +++ b/image/templates/files/compliance-tofino.xml @@ -1,37 +1,40 @@ + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/gimlet-postboot.sh b/image/templates/files/gimlet-postboot.sh index aecff68..f25ff24 100644 --- a/image/templates/files/gimlet-postboot.sh +++ b/image/templates/files/gimlet-postboot.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o errexit set -o pipefail diff --git a/image/templates/files/gimlet-postboot.xml b/image/templates/files/gimlet-postboot.xml index 75b8715..5553df8 100644 --- a/image/templates/files/gimlet-postboot.xml +++ b/image/templates/files/gimlet-postboot.xml @@ -1,84 +1,86 @@ + - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - + - + - - - + + + - + - + - diff --git a/image/templates/files/mfg.sh b/image/templates/files/mfg.sh index 6874f78..8f5185f 100755 --- a/image/templates/files/mfg.sh +++ b/image/templates/files/mfg.sh @@ -1,4 +1,7 @@ #!/bin/bash +# +# Copyright 2024 Oxide Computer Company +# set -o pipefail diff --git a/image/templates/files/mfg.xml b/image/templates/files/mfg.xml index 46e6f0c..bb299e3 100644 --- a/image/templates/files/mfg.xml +++ b/image/templates/files/mfg.xml @@ -1,27 +1,33 @@ + + - - + + - - - + + + - + - + - - - + + + - - + + diff --git a/image/templates/files/mfg_default_login b/image/templates/files/mfg_default_login index d9f617c..7ec995f 100644 --- a/image/templates/files/mfg_default_login +++ b/image/templates/files/mfg_default_login @@ -59,7 +59,7 @@ SUPATH=/usr/sbin:/sbin:/usr/bin # TIMEOUT sets the number of seconds (between 0 and 900) to wait before # abandoning a login session. -# +# #TIMEOUT=300 # UMASK sets the initial shell file creation mode mask. See umask(1). diff --git a/image/templates/files/nvme-fio.sh b/image/templates/files/nvme-fio.sh index c659bb6..ae2d459 100755 --- a/image/templates/files/nvme-fio.sh +++ b/image/templates/files/nvme-fio.sh @@ -12,7 +12,13 @@ # into a shell. # +# +# Copyright 2024 Oxide Computer Company +# + +# # The only required argument is the name of the config. +# if [[ "$#" != 1 ]]; then echo "Usage: nvme-fio.sh config" >&2 exit 1 diff --git a/image/templates/files/recovery-hostname.sh b/image/templates/files/recovery-hostname.sh index e2b8efc..c330af4 100644 --- a/image/templates/files/recovery-hostname.sh +++ b/image/templates/files/recovery-hostname.sh @@ -1,14 +1,19 @@ #!/bin/ksh +# +# Copyright 2024 Oxide Computer Company +# export PATH=/usr/bin:/usr/sbin:/sbin set -o errexit set -o pipefail -sn=$(prtconf -v /devices | \ +sn=$(prtconf -v /devices | awk -F"'" 'f { print $2; exit } /baseboard-identifier/ { f=1 }') -[[ -n "$sn" ]] || exit 1 +if [[ ! -n "$sn" ]]; then + exit 1 +fi echo "$sn" > /etc/nodename sed -i -e "s/unknown/$sn/g" /etc/inet/hosts diff --git a/image/templates/files/recovery-hostname.xml b/image/templates/files/recovery-hostname.xml index 805cf6f..588204d 100644 --- a/image/templates/files/recovery-hostname.xml +++ b/image/templates/files/recovery-hostname.xml @@ -1,48 +1,51 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/image/templates/files/rootisramdisk b/image/templates/files/rootisramdisk index 8db5255..39f022a 100644 --- a/image/templates/files/rootisramdisk +++ b/image/templates/files/rootisramdisk @@ -1,4 +1,9 @@ #!/sbin/sh + +# +# Copyright 2024 Oxide Computer Company +# + # # The real rootisramdisk needs to be able to look through ZFS, which presently # obfuscates the ramdisk reality somewhat. For now, we shall fake it until we diff --git a/image/templates/files/site-compliance.xml b/image/templates/files/site-compliance.xml index 56d8d37..676278d 100644 --- a/image/templates/files/site-compliance.xml +++ b/image/templates/files/site-compliance.xml @@ -1,26 +1,30 @@ + + - - - - + xmlns:xi='http://www.w3.org/2003/XInclude' > + + + + - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/image/templates/files/site-mfg.xml b/image/templates/files/site-mfg.xml index 387a6e7..fe3c021 100644 --- a/image/templates/files/site-mfg.xml +++ b/image/templates/files/site-mfg.xml @@ -1,26 +1,30 @@ + + - - - - + xmlns:xi='http://www.w3.org/2003/XInclude' > + + + + - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/image/templates/files/site.xml b/image/templates/files/site.xml index c596fcd..c8bfd8c 100644 --- a/image/templates/files/site.xml +++ b/image/templates/files/site.xml @@ -1,21 +1,25 @@ + + - - - - + xmlns:xi='http://www.w3.org/2003/XInclude' > + + + + - - - - - - - - - - - + + + + + + + + + + + diff --git a/tools/helios-build/Cargo.toml b/tools/helios-build/Cargo.toml index b7e4681..7506c7a 100644 --- a/tools/helios-build/Cargo.toml +++ b/tools/helios-build/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "helios-build" -version = "0.1.0" -authors = ["Oxide Computer Company"] +version = "0.0.0" edition = "2021" +license = "MPL-2.0" # # Report a specific error in the case that the toolchain is too old for # let-else: diff --git a/tools/helios-build/rustfmt.toml b/tools/helios-build/rustfmt.toml new file mode 100644 index 0000000..08bb75f --- /dev/null +++ b/tools/helios-build/rustfmt.toml @@ -0,0 +1,3 @@ +max_width = 80 +edition = "2021" +use_small_heuristics = "Max" diff --git a/tools/helios-build/src/archive.rs b/tools/helios-build/src/archive.rs index 9a7f716..e0f7443 100644 --- a/tools/helios-build/src/archive.rs +++ b/tools/helios-build/src/archive.rs @@ -1,4 +1,8 @@ use std::io::Write; +/* + * Copyright 2024 Oxide Computer Company + */ + use std::path::{Path, PathBuf}; use std::sync::mpsc; use std::thread::JoinHandle; diff --git a/tools/helios-build/src/expand.rs b/tools/helios-build/src/expand.rs index 0a2b34f..bdffa80 100644 --- a/tools/helios-build/src/expand.rs +++ b/tools/helios-build/src/expand.rs @@ -1,4 +1,8 @@ use std::collections::HashMap; +/* + * Copyright 2024 Oxide Computer Company + */ + use anyhow::{bail, Result}; diff --git a/tools/helios-build/src/main.rs b/tools/helios-build/src/main.rs index 18fd740..bdaf866 100644 --- a/tools/helios-build/src/main.rs +++ b/tools/helios-build/src/main.rs @@ -1,3 +1,7 @@ +/* + * Copyright 2024 Oxide Computer Company + */ + mod common; use common::*; diff --git a/tools/helios-build/src/zfs.rs b/tools/helios-build/src/zfs.rs index 5982fb3..1ebec5f 100644 --- a/tools/helios-build/src/zfs.rs +++ b/tools/helios-build/src/zfs.rs @@ -1,4 +1,8 @@ use std::process::Command; +/* + * Copyright 2024 Oxide Computer Company + */ + use anyhow::{Result, bail}; diff --git a/tools/packages/os-conflicts.mogrify b/tools/packages/os-conflicts.mogrify index 85fd131..91507e6 100644 --- a/tools/packages/os-conflicts.mogrify +++ b/tools/packages/os-conflicts.mogrify @@ -1,2 +1,6 @@ +# +# Copyright 2024 Oxide Computer Company +# + drop> drop> diff --git a/tools/packages/os-deps.mogrify b/tools/packages/os-deps.mogrify index 9e750f1..bbf0bb9 100644 --- a/tools/packages/os-deps.mogrify +++ b/tools/packages/os-deps.mogrify @@ -1,3 +1,7 @@ +# +# Copyright 2024 Oxide Computer Company +# + # # Each "transform" rule acts on a specific pkg(5) action, such as a "depend" # or a "file" entry. In this file, we wish to trim out a few specific From 603b825a8976afe1e2ecee738a94597cac471871 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 17:48:50 -0800 Subject: [PATCH 3/7] XXX remove some vestigial and/or misleading bits --- image/templates/gimlet/zfs-compliance.json | 96 ------------- tools/helios-build/src/main.rs | 149 +-------------------- 2 files changed, 4 insertions(+), 241 deletions(-) delete mode 100644 image/templates/gimlet/zfs-compliance.json diff --git a/image/templates/gimlet/zfs-compliance.json b/image/templates/gimlet/zfs-compliance.json deleted file mode 100644 index f3b47a1..0000000 --- a/image/templates/gimlet/zfs-compliance.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "pool": { - "name": "rpool", - "bename": "ramdisk", - "ashift": 9, - "uefi": false, - "size": 650, - "label": false, - "no_features": false, - "compression": "gzip-9", - "autoexpand": true, - "options": [ "failmode=panic" ], - "fsoptions": [ "primarycache=none" ] - }, - - "steps": [ - { "t": "create_be" }, - - { "t": "unpack_tar", "name": "gimlet-ramdisk.tar" }, - - { "t": "include", "name": "devfs" }, - - { "t": "include", "name": "common" }, - - { "t": "ensure_file", "file": "/etc/auto_master", - "src": "auto_master", - "owner": "root", "group": "root", "mode": "644" }, - - { "t": "ensure_file", "file": "/etc/ttydefs", - "src": "ttydefs.${baud}", - "owner": "root", "group": "sys", "mode": "644" }, - - { "t": "ensure_file", "file": "/etc/default/init", - "src": "default_init", - "owner": "root", "group": "root", "mode": "644" }, - - { "t": "ensure_file", "file": "/etc/inet/chrony.conf", - "src": "chrony.conf", - "owner": "root", "group": "root", "mode": "644" }, - - { "t": "ensure_file", "file": "/etc/ssh/sshd_config", - "src": "sshd_config", - "owner": "root", "group": "root", "mode": "644" }, - - { "t": "ensure_file", "file": "/usr/lib/bootparams", - "src": "bootparams.sh", - "owner": "root", "group": "bin", "mode": "0755" }, - - { "t": "include", "name": "t6-firmware" }, - - { "t": "include", "name": "compliance-common" }, - - { "t": "ensure_file", - "file": "/lib/svc/manifest/site/compliance-tofino.xml", - "src": "compliance-tofino.xml", - "owner": "root", "group": "bin", "mode": "0644" }, - - { "t": "ensure_file", - "file": "/var/svc/profile/site.xml", - "src": "site-compliance.xml", - "owner": "root", "group": "root", "mode": "644" }, - - { "t": "include", "with": "stress", "name": "stress" }, - - { "t": "include", "name": "root-noauth" }, - - { "t": "ensure_dir", - "dir": "/usr/share/compliance", - "owner": "root", "group": "sys", "mode": "0755" }, - { "t": "ensure_file", - "file": "/usr/share/compliance/dendrite-asic.tar.gz", - "extsrc": "dendrite/dendrite-asic.tar.gz", - "owner": "root", "group": "sys", "mode": "0644" }, - { "t": "ensure_file", - "file": "/usr/bin/pilot", - "extsrc": "pilot/pilot", - "owner": "root", "group": "bin", "mode": "0755" }, - { "t": "ensure_file", - "file": "/usr/share/compliance/pilot.toml", - "extsrc": "pilot/${pilot_profile}.toml", - "owner": "root", "group": "bin", "mode": "0644" }, - { "t": "ensure_file", - "file": "/usr/bin/xcvradm", - "extsrc": "xcvradm", - "owner": "root", "group": "bin", "mode": "0755" }, - { "t": "ensure_file", - "file": "/usr/bin/faux-mgs", - "extsrc": "faux-mgs", - "owner": "root", "group": "bin", "mode": "0755" }, - - { "t": "include", "with": "genproto", - "name": "genproto", "file": "${genproto}" }, - - { "t": "seed_smf", "apply_site": true } - ] -} diff --git a/tools/helios-build/src/main.rs b/tools/helios-build/src/main.rs index bdaf866..cc5ebed 100644 --- a/tools/helios-build/src/main.rs +++ b/tools/helios-build/src/main.rs @@ -18,8 +18,7 @@ use std::time::{Instant,SystemTime}; use slog::Logger; use std::path::Path; use time::{format_description, OffsetDateTime}; -use walkdir::{WalkDir, DirEntry}; -use regex::Regex; +use walkdir::WalkDir; use helios_build_utils::tree; pub mod illumos; @@ -413,7 +412,6 @@ fn ncpus() -> Result { /* * XXX Replace with kstat check. */ - /* "psrinfo -t" */ let out = Command::new("/usr/sbin/psrinfo") .env_clear() .arg("-t") @@ -1004,17 +1002,6 @@ fn cmd_illumos_bldenv(ca: &CommandArg) -> Result<()> { bail!("exec failure: {:?}", err); } -#[derive(Debug)] -enum BuildFile { - Script(PathBuf), - Manifest(PathBuf), -} - -struct BuildPackage { - name: String, - file: BuildFile, -} - fn read_string(path: &Path) -> Result { let f = File::open(path)?; let mut buf = String::new(); @@ -1023,110 +1010,6 @@ fn read_string(path: &Path) -> Result { Ok(buf) } -fn extract_pkgs(_log: &Logger, dir: &Path) -> Result> { - /* - * First, find all the build.sh scripts. - */ - fn is_build_sh(ent: &DirEntry) -> bool { - ent.file_type().is_file() && - ent.file_name().to_str() - .map(|s| s.starts_with("build") && s.ends_with(".sh")) - .unwrap_or(false) - } - - fn is_p5m(ent: &DirEntry) -> bool { - ent.file_type().is_file() && - ent.file_name().to_str() - .map(|s| s.ends_with(".p5m")) - .unwrap_or(false) - } - - let mut out = Vec::new(); - let re = Regex::new(r"\bPKG=([^[:space:]]+)[[:space:]]*(#.*)?$").unwrap(); - let re2 = Regex::new(r"^set name=pkg.fmri value=([^[:space:]]+).*") - .unwrap(); - let re3 = Regex::new("^(?:.*//[^/]*/)?(.+?)(?:@.*)$").unwrap(); - - for ent in WalkDir::new(&dir).into_iter() { - let ent = ent?; - - if is_p5m(&ent) { - for l in read_string(&ent.path())?.lines() { - if let Some(cap) = re2.captures(&l) { - let pkg = cap.get(1).unwrap().as_str(); - if let Some(cap) = re3.captures(&pkg) { - let pkg = cap.get(1).unwrap().as_str(); - out.push(BuildPackage { - name: pkg.to_string(), - file: BuildFile::Manifest(ent.path().to_path_buf()), - }); - } else { - bail!("weird package? {}", l); - } - } - } - continue; - } - - if !is_build_sh(&ent) { - continue; - } - - /* - * Inspect the contents of each build script and look for packages. - */ - for l in read_string(&ent.path())?.lines() { - if l.contains("##IGNORE##") { - continue; - } - - if let Some(cap) = re.captures(&l) { - if let Some(pkg) = cap.get(1) { - let pkg = pkg.as_str().trim(); - if !pkg.is_empty() { - out.push(BuildPackage { - name: pkg.to_string(), - file: BuildFile::Script(ent.path().to_path_buf()), - }); - } - } - } - } - } - - Ok(out) -} - -fn cmd_build_omnios(ca: &CommandArg) -> Result<()> { - let opts = baseopts(); - - let usage = || { - println!("{}", opts.usage("Usage: helios [OPTIONS] build-omnios \ - [OPTIONS]")); - }; - - let log = ca.log; - let res = opts.parse(ca.args)?; - - if res.opt_present("help") { - usage(); - return Ok(()); - } - - let dir = top_path(&["projects", "omnios-build", "build"])?; - - let mut pkgs = extract_pkgs(log, &dir)?; - - pkgs.sort_by(|a, b| a.name.cmp(&b.name)); - - for pkg in pkgs.iter() { - println!(" * {}", pkg.name); - println!(" {:?}", pkg.file); - } - - Ok(()) -} - fn cargo_target_cmd(project: &str, command: &str, debug: bool) -> Result { @@ -1246,7 +1129,6 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { opts.optopt("o", "", "output directory for image", "DIR"); opts.optmulti("F", "", "pass extra image builder features", "KEY[=VAL]"); opts.optflag("B", "", "include omicron1 brand"); - opts.optopt("C", "", "compliance dock location", "DOCK"); opts.optopt("N", "name", "image name", "NAME"); opts.optflag("R", "", "recovery image"); opts.optmulti("X", "", "skip this phase", "PHASE"); @@ -1264,8 +1146,7 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let log = ca.log; let res = opts.parse(ca.args.iter())?; - let cdock = res.opt_str("C"); - let brand = res.opt_present("B") || cdock.is_some(); + let brand = res.opt_present("B"); let (publisher, extrepo) = if let Some(arg) = res.opt_str("p") { if let Some((key, val)) = arg.split_once('=') { (key.to_string(), Some(val.to_string())) @@ -1371,7 +1252,7 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { "amd-host-image-builder", true)?; let baseline = "/usr/lib/brand/omicron1/baseline"; if brand && !PathBuf::from(baseline).is_file() { - bail!("pkg install /system/zones/brand/omicron1/tools"); + bail!("Please run: pkg install /system/zones/brand/omicron1/tools"); } /* @@ -1479,11 +1360,6 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { cmd.arg("-F").arg(&format!("genproto={}", genproto.to_str().unwrap())); } - if let Some(cdock) = &cdock { - cmd.arg("-F").arg("compliance"); - cmd.arg("-F").arg("stress"); - cmd.arg("-E").arg(&cdock); - } cmd.arg("-E").arg(&brand_extras); cmd.arg("-E").arg(&projects_extras); cmd.arg("-F").arg(format!("repo_publisher={}", publisher)); @@ -1545,7 +1421,6 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { } let tname = if recovery { "zfs-recovery" } - else if cdock.is_some() { "zfs-compliance" } else { "zfs" }; info!(log, "image builder template: {}...", tname); let mut cmd = basecmd(); @@ -1702,16 +1577,7 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { /* * Create the image and extract the checksum: */ - let target_size = if cdock.is_some() { - /* - * In the compliance rack we would like to avoid running out of space, - * and we have no customer workloads, so using more RAM for the ramdisk - * pool is OK. - */ - 16 * 1024 - } else { - 4 * 1024 - }; + let target_size = 4 * 1024; info!(log, "creating Oxide boot image..."); let mut cmd = Command::new(&mkimage); cmd.arg("-i").arg(&raw); @@ -2367,13 +2233,6 @@ fn main() -> Result<()> { hide: false, blank: false, }); - handlers.push(CommandInfo { - name: "build-omnios".into(), - desc: "build-omnios".into(), - func: cmd_build_omnios, - hide: true, - blank: false, - }); handlers.push(CommandInfo { name: "experiment-image".into(), desc: "experimental image construction for Gimlets".into(), From f8f6e98877e504d40b5aa3215971ed4fb693e492 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 17:49:18 -0800 Subject: [PATCH 4/7] XXX there is no external ip hack anymore --- image/templates/files/xde.conf | 11 ----------- image/templates/gimlet/zfs.json | 5 ----- 2 files changed, 16 deletions(-) delete mode 100644 image/templates/files/xde.conf diff --git a/image/templates/files/xde.conf b/image/templates/files/xde.conf deleted file mode 100644 index dfa2dfe..0000000 --- a/image/templates/files/xde.conf +++ /dev/null @@ -1,11 +0,0 @@ -# xde kernel module configuration file - -name="xde" parent="pseudo" instance=0; - -# -# Enable the "external IP hack". This disables encap and turns SNAT -# into plain NAT, along with performing proxy ARP for the NAT IP. This -# allows one to have network connectivty to their guests via the local -# IPv4 network that the sled is sitting on. -# -ext_ip_hack = 1; diff --git a/image/templates/gimlet/zfs.json b/image/templates/gimlet/zfs.json index 6e8b65c..dd61915 100644 --- a/image/templates/gimlet/zfs.json +++ b/image/templates/gimlet/zfs.json @@ -60,11 +60,6 @@ { "t": "include", "with": "stress", "name": "stress" }, - { "t": "ensure_file", "with": "opte", - "file": "/kernel/drv/xde.conf", - "src": "xde.conf", - "owner": "root", "group": "sys", "mode": "0644" }, - { "t": "include", "name": "root-noauth" }, { "t": "ensure_file", "with": "mfg", From 403dab508312e6c51adc82dc219cc41f9fd4f68b Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 17:51:25 -0800 Subject: [PATCH 5/7] XXX update/reduce deps --- tools/helios-build/Cargo.lock | 1180 +++++------------------------- tools/helios-build/Cargo.toml | 32 +- tools/helios-build/src/common.rs | 21 +- tools/helios-build/src/ensure.rs | 114 +-- 4 files changed, 202 insertions(+), 1145 deletions(-) diff --git a/tools/helios-build/Cargo.lock b/tools/helios-build/Cargo.lock index 9c92f2e..ad3f865 100644 --- a/tools/helios-build/Cargo.lock +++ b/tools/helios-build/Cargo.lock @@ -8,20 +8,11 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "atty" @@ -29,23 +20,11 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi", "libc", "winapi", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - [[package]] name = "bitflags" version = "1.3.2" @@ -53,16 +32,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "block-buffer" -version = "0.7.3" +name = "bitflags" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array 0.12.4", -] +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -70,75 +43,29 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array 0.14.6", + "generic-array", ] [[package]] -name = "block-padding" -version = "0.1.5" +name = "cc" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "byte-tools", + "libc", ] -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - [[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.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -158,26 +85,26 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array 0.14.6", + "generic-array", "typenum", ] [[package]] -name = "digest" -version = "0.8.1" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "generic-array 0.12.4", + "powerfmt", ] [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer 0.10.4", + "block-buffer", "crypto-common", ] @@ -203,165 +130,49 @@ dependencies = [ ] [[package]] -name = "encoding_rs" -version = "0.8.32" +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ - "cc", "libc", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", + "windows-sys", ] [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "libz-sys", "miniz_oxide", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-channel" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" -dependencies = [ - "futures-core", -] - -[[package]] -name = "futures-core" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" - -[[package]] -name = "futures-io" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d422fa3cbe3b40dca574ab087abb5bc98258ea57eea3fd6f1fa7162c778b91" - -[[package]] -name = "futures-sink" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" - -[[package]] -name = "futures-task" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" - -[[package]] -name = "futures-util" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" -dependencies = [ - "futures-core", - "futures-io", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -378,59 +189,33 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", "wasi", ] -[[package]] -name = "h2" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "helios-build" -version = "0.1.0" +version = "0.0.0" dependencies = [ "anyhow", - "atty", - "digest 0.8.1", "flate2", "getopts", "helios-build-utils", "json5", "libc", - "md-5", - "openssl", - "regex", - "reqwest", "serde", "serde_json", - "sha-1", "slog", "slog-term", "tar", @@ -442,7 +227,7 @@ dependencies = [ [[package]] name = "helios-build-utils" version = "0.0.0" -source = "git+ssh://git@github.com/oxidecomputer/helios-omicron-brand.git#967c00c7442ec1c025b96001793cc2738a0a2e93" +source = "git+https://github.com/oxidecomputer/helios-omicron-brand.git#87082932247209dc89ef31b627db2ce90792511a" dependencies = [ "anyhow", "serde", @@ -460,152 +245,21 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" -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-tls" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-native-tls", -] - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" dependencies = [ - "autocfg", + "equivalent", "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.45.0", -] - -[[package]] -name = "ipnet" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" - [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "json5" @@ -619,22 +273,27 @@ dependencies = [ ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "libc" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] -name = "libc" -version = "0.2.140" +name = "libredox" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.2", + "libc", + "redox_syscall", +] [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "pkg-config", @@ -643,91 +302,25 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "log" -version = "0.4.17" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "md-5" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "opaque-debug", -] +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "mime" -version = "0.3.17" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.45.0", -] - -[[package]] -name = "native-tls" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - [[package]] name = "num_threads" version = "0.1.6" @@ -739,92 +332,26 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "openssl" -version = "0.10.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-src" -version = "111.25.2+1.1.1t" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320708a054ad9b3bf314688b5db87cf4d6683d64cfc835e2337924ae62bf4431" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" -dependencies = [ - "autocfg", - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pest" -version = "2.5.6" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cbd939b234e95d72bc393d51788aec68aeeb5d51e748ca08ff3aad58cb722f7" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.5.6" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a81186863f3d0a27340815be8f2078dd8050b14cd71913db9fbda795e5f707d7" +checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" dependencies = [ "pest", "pest_generator", @@ -832,22 +359,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.6" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a1ef20bf3193c15ac345acb32e26b3dc3223aff4d77ae4fc5359567683796b" +checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "pest_meta" -version = "2.5.6" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3b284b1f13a20dc5ebc90aff59a51b8d7137c221131b52a7260c08cbc1cc80" +checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" dependencies = [ "once_cell", "pest", @@ -855,140 +382,79 @@ dependencies = [ ] [[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" +name = "pkg-config" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] -name = "pkg-config" -version = "0.3.26" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "proc-macro2" -version = "1.0.53" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall", + "libredox", "thiserror", ] -[[package]] -name = "regex" -version = "1.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "reqwest" -version = "0.11.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ba30cc2c0cd02af1222ed216ba659cdb2f879dfe3181852fe7c50b1d0005949" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-tls", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-native-tls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - [[package]] name = "rustix" -version = "0.36.11" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags", + "bitflags 2.4.2", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -999,63 +465,31 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - -[[package]] -name = "security-framework" -version = "2.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "serde" -version = "1.0.158" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771d4d9c4163ee138805e12c710dd365e4f44be8be0503cb1bb9eb989425d9c9" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.158" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e801c1712f48475582b7696ac71e0ca34ebb30e09338425384269d9717c62cad" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.10", + "syn", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1063,47 +497,23 @@ dependencies = [ ] [[package]] -name = "serde_urlencoded" -version = "0.7.1" +name = "serde_spanned" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ - "form_urlencoded", - "itoa", - "ryu", "serde", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug", -] - [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", + "digest", ] [[package]] @@ -1125,32 +535,11 @@ dependencies = [ "time", ] -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "syn" -version = "1.0.109" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aad1363ed6d37b84299588d62d3a7d95b5a5c2d9aad5c85609fda12afaa1f40" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1159,28 +548,15 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", "xattr", ] -[[package]] -name = "tempfile" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.42.0", -] - [[package]] name = "term" version = "0.7.0" @@ -1194,22 +570,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.10", + "syn", ] [[package]] @@ -1224,13 +600,15 @@ dependencies = [ [[package]] name = "time" -version = "0.3.20" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ + "deranged", "itoa", "libc", "num_threads", + "powerfmt", "serde", "time-core", "time-macros", @@ -1238,165 +616,76 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] -[[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.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "windows-sys 0.45.0", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - [[package]] name = "toml" -version = "0.5.11" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] [[package]] -name = "tower-service" -version = "0.3.2" +name = "toml_datetime" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", + "serde", ] [[package]] -name = "tracing-core" -version = "0.1.30" +name = "toml_edit" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "once_cell", + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", ] -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "vcpkg" @@ -1412,106 +701,20 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", ] -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "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.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "winapi" version = "0.3.9" @@ -1530,9 +733,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -1545,33 +748,18 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-sys" -version = "0.42.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -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-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1584,60 +772,62 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] -name = "winreg" -version = "0.10.1" +name = "winnow" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ - "winapi", + "memchr", ] [[package]] name = "xattr" -version = "0.2.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] diff --git a/tools/helios-build/Cargo.toml b/tools/helios-build/Cargo.toml index 7506c7a..ecb4335 100644 --- a/tools/helios-build/Cargo.toml +++ b/tools/helios-build/Cargo.toml @@ -9,34 +9,18 @@ license = "MPL-2.0" # rust-version = "1.65.0" -[features] -default = ["vendored-openssl"] -vendored-openssl = ['openssl/vendored'] - [dependencies] -getopts = "0.2" anyhow = "1" +flate2 = { version = "1", features = [ "zlib" ] } +getopts = "0.2" +helios-build-utils = { git = "https://github.com/oxidecomputer/helios-omicron-brand.git" } +json5 = "0.4.1" +libc = "0.2" serde = { version = "1", features = [ "derive" ] } serde_json = "1" slog = "2.5" slog-term = "2.5" -atty = "0.2" -libc = "0.2" -reqwest = { version = "0.11", features = [ "blocking" ] } -digest = "0.8" -md-5 = "0.8" -sha-1 = "0.8" -toml = "0.5" -walkdir = "2.3" -regex = "1.4" -# -# I believe it is necessary to pull this in here, so that we can demand the -# static linking of the vendored OpenSSL. We don't use it directly, but the -# same version will then be used by reqwest. -# -openssl = { version = "0.10", optional = true } -json5 = "0.4.1" -time = { version = "0.3" } -helios-build-utils = { git = "ssh://git@github.com/oxidecomputer/helios-omicron-brand.git" } -flate2 = { version = "1", features = [ "zlib" ] } tar = "0.4" +time = { version = "0.3" } +toml = "0.8" +walkdir = "2.3" diff --git a/tools/helios-build/src/common.rs b/tools/helios-build/src/common.rs index 19484a3..4b40e54 100644 --- a/tools/helios-build/src/common.rs +++ b/tools/helios-build/src/common.rs @@ -1,19 +1,15 @@ /* - * Copyright 2020 Oxide Computer Company + * Copyright 2024 Oxide Computer Company */ -#![allow(unused)] - -use atty::Stream; use slog::{Drain, Logger}; use std::sync::Mutex; use serde::Deserialize; -use std::fs::File; -use std::io::{Read, BufReader}; -use std::path::{Path, PathBuf}; +use std::io::IsTerminal; +use std::path::Path; use anyhow::{Result, bail}; -pub use slog::{info, warn, error, debug, trace, o}; +pub use slog::{info, o}; /** * Initialise a logger which writes to stdout, and which does the right thing on @@ -21,7 +17,7 @@ pub use slog::{info, warn, error, debug, trace, o}; */ pub fn init_log() -> Logger { let dec = slog_term::TermDecorator::new().stdout().build(); - if atty::is(Stream::Stdout) { + if std::io::stdout().is_terminal() { let dr = Mutex::new(slog_term::CompactFormat::new(dec) .build()).fuse(); slog::Logger::root(dr, o!()) @@ -78,11 +74,7 @@ pub fn read_toml(path: P) -> Result where P: AsRef, for<'de> O: Deserialize<'de> { - let f = File::open(path.as_ref())?; - let mut buf: Vec = Vec::new(); - let mut r = BufReader::new(f); - r.read_to_end(&mut buf)?; - Ok(toml::from_slice(&buf)?) + Ok(toml::from_str(&std::fs::read_to_string(path.as_ref())?)?) } fn exists>(path: P) -> Result> { @@ -94,6 +86,7 @@ fn exists>(path: P) -> Result> { } } +#[allow(unused)] pub fn exists_file>(path: P) -> Result { let p = path.as_ref(); diff --git a/tools/helios-build/src/ensure.rs b/tools/helios-build/src/ensure.rs index f0f120b..bb72000 100644 --- a/tools/helios-build/src/ensure.rs +++ b/tools/helios-build/src/ensure.rs @@ -1,26 +1,17 @@ /* - * Copyright 2020 Oxide Computer Company + * Copyright 2024 Oxide Computer Company */ use std::path::{Path, PathBuf}; use std::fs::{DirBuilder, File}; use std::os::unix::fs::DirBuilderExt; use std::ffi::CString; -use std::io::{Read, BufRead, Write, BufReader, BufWriter}; +use std::io::{Read, BufRead, Write, BufReader}; use std::process::{Command, Stdio}; use std::ffi::OsStr; -use digest::Digest; use slog::{Logger, info, warn, error}; use anyhow::{Result, bail, anyhow}; -#[allow(dead_code)] -#[derive(Debug, PartialEq)] -pub enum HashType { - SHA1, - MD5, - None, -} - #[derive(Debug, PartialEq)] pub enum FileType { Directory, @@ -459,107 +450,6 @@ pub fn symlink, P2: AsRef>(log: &Logger, dst: P1, Ok(did_work) } -pub fn hash_file>(p: P, hashtype: &HashType) -> Result { - let p = p.as_ref(); - - if let HashType::None = hashtype { - return Ok("".to_string()); - } - - let f = File::open(p)?; - let mut r = BufReader::new(f); - let mut buf = [0u8; 128 * 1024]; - - let mut digest: Box = match hashtype { - HashType::MD5 => Box::new(md5::Md5::new()), - HashType::SHA1 => Box::new(sha1::Sha1::new()), - HashType::None => panic!("None unexpected"), - }; - - loop { - let sz = r.read(&mut buf)?; - if sz == 0 { - break; - } - - digest.input(&buf[0..sz]); - } - - let mut out = String::new(); - let hash = digest.result(); - for byt in hash.iter() { - out.push_str(&format!("{:02x}", byt)); - } - - Ok(out) -} - -fn sleep(s: u64) { - std::thread::sleep(std::time::Duration::from_secs(s)); -} - -pub fn download_file>(log: &Logger, url: &str, p: P, hash: &str, - hashtype: HashType) -> Result<()> -{ - let p = p.as_ref(); - - loop { - /* - * Check to see if the file exists already. - */ - if let Some(fi) = check(p)? { - if fi.filetype != FileType::File { - warn!(log, "type {:?} unexpected; unlinking", fi.filetype); - std::fs::remove_file(p)?; - continue; - } - - info!(log, "file {} exists; checking hash...", p.display()); - - let actual_hash = hash_file(p, &hashtype)?; - info!(log, " got hash {}", actual_hash); - info!(log, "want hash {}", hash); - - if hash == actual_hash { - info!(log, "hash match! done"); - break; - } else { - warn!(log, "does not match; unlinking"); - std::fs::remove_file(p)?; - continue; - } - } - - info!(log, "file {} does not exist; downloading from {}", p.display(), - url); - let mut res = reqwest::blocking::get(url)?; - if !res.status().is_success() { - warn!(log, "HTTP {:?}; retrying...", res.status()); - sleep(5); - } - - let f = std::fs::OpenOptions::new() - .create_new(true) - .write(true) - .open(p)?; - let mut w = BufWriter::new(f); - - let sz = match std::io::copy(&mut res, &mut w) { - Ok(sz) => sz, - Err(e) => { - std::fs::remove_file(p)?; - warn!(log, "download error (retrying): {}", e); - sleep(5); - continue; - } - }; - - info!(log, "downloaded {} bytes", sz); - } - - Ok(()) -} - fn spawn_reader(log: &Logger, name: &str, stream: Option) -> Option> where From 18c506630a0c6eb219ef56584efdc70d60db2d7a Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Sun, 28 Jan 2024 20:00:41 -0800 Subject: [PATCH 6/7] XXX improved README, support for "gmake setup" without private repos --- README.md | 252 +++++++++++++++++++++++++++---------------- config/projects.toml | 54 +++++++--- 2 files changed, 198 insertions(+), 108 deletions(-) diff --git a/README.md b/README.md index 8fc1866..cb4b41e 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,86 @@ Helios is a distribution of illumos intended to power the Oxide Rack. The full distribution is built from several consolidations of software, driven from tools and documentation in this top-level repository. +| Consolidation | Public? | Description | +| ----------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------- | +| [boot-image-tools](https://github.com/oxidecomputer/boot-image-tools) | ✅ Yes | Tool for assembling boot images for Oxide hardware | +| [garbage-compactor](https://github.com/oxidecomputer/garbage-compactor) | ✅ Yes | Build scripts for packages beyond the core OS | +| [helios-omicron-brand](https://github.com/oxidecomputer/helios-omicron-brand) | ✅ Yes | Zone brand for [Omicron](https://github.com/oxidecomputer/omicron) components | +| [helios-omnios-build](https://github.com/oxidecomputer/helios-omnios-build) | ✅ Yes | Build scripts for packages beyond the core OS | +| [helios-omnios-extra](https://github.com/oxidecomputer/helios-omnios-extra) | ✅ Yes | Build scripts for packages beyond the core OS | +| [illumos-gate (stlouis branch)](https://github.com/oxidecomputer/illumos-gate/tree/stlouis/) | ✅ Yes | Core operating system (kernel, libc, etc) | +| [phbl](https://github.com/oxidecomputer/phbl) | ✅ Yes | Pico Host Boot Loader | +| [pinprick](https://github.com/oxidecomputer/pinprick) | ✅ Yes | ROM image compression utility | +| [illumos/image-builder](https://github.com/image-builder) | ✅ Yes | Tool for building bootable illumos disk images | +| [amd-firmware](https://github.com/oxidecomputer/amd-firmware) | ❌ No | AMD CPU firmware binary blobs (will be available in future) | +| [amd-host-image-builder](https://github.com/oxidecomputer/amd-host-image-builder) | ❌ No | ROM image construction tools for AMD CPUs (will be available in future) | +| [chelsio-t6-roms](https://github.com/oxidecomputer/chelsio-t6-roms) | ❌ No | Chelsio T6 network interface card firmware blobs (will be available in future) | +| [pilot](https://github.com/oxidecomputer/pilot) | ❌ No | A utility for low-level control of Oxide systems (will be available in future) | + +**NOTE:** Not all consolidations are presently available to the public. We're +working on this, but for now you can set `OXIDE_STAFF=no` in your environment +when you run `gmake setup` to skip cloning and building software that is not +yet available. + ## Getting started **NOTE: These instructions are for building your own operating system packages and installing them. If you're just trying to use Helios, you probably do not -need to do this.** +need to do this. See +[helios-engvm](https://github.com/oxidecomputer/helios-engvm) for +information about pre-built Helios software.** The best way to get started is to be using a physical or virtual build machine running an up-to-date installation of Helios. There are some details on getting a virtual machine installed in the -[helios-engvm](https://github.com/oxidecomputer/helios-engvm.git) repository. +[helios-engvm](https://github.com/oxidecomputer/helios-engvm) repository. +There are also some details there about install media that you can use on a +physical x86 system. + +### Prerequisites + +If you used the instructions from **helios-engvm** to create a virtual machine, +you should already have all of the packages needed. If you used one of the ISO +installers to set up a physical machine, or some other way of getting a Helios +environment, you may need to install the **pkg:/developer/illumos-tools** +package. You can check if you have this installed already with: + +``` +$ pkg list developer/illumos-tools +NAME (PUBLISHER) VERSION IFO +developer/illumos-tools 11-2.0 im-i +``` + +If missing from your system, it can be installed with `pkg install`. It's also +a good idea to be running the latest Helios packages if you can. You can +update your system with: + +``` +# pkg update +``` + +Pay careful attention to the instructions printed at the end of every update. +You may be told that a _boot environment_ was created and that you need to +reboot to activate it. You should do that with the `reboot` command before +moving on. + +### Install Rust and Cargo using Rustup + +Official Rust and Cargo binaries are available from the Rust project via the +same [rustup](https://rustup.rs/) tool that works on other systems. Use the +official instructions, but substitute `bash` anywhere you see `sh`; e.g., at +the time of writing, the (modified) official install instructions are: + +``` +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash +``` + +### Clone the repository and build the tools On your Helios machine, clone this repository and run the setup step: ``` -$ git clone git@github.com:oxidecomputer/helios.git +$ git clone https://github.com/oxidecomputer/helios.git Cloning into 'helios'... $ cd helios @@ -31,21 +96,34 @@ Cloning into '/home/user/helios/projects/illumos'... Setup complete! ./helios-build is now available. ``` +**NOTE:** If you do not have access to private repositories in the +**oxidecomputer** GitHub organisation, you can request that the setup step only +use the public repositories; e.g., + +``` +$ OXIDE_STAFF=no gmake setup +``` + The Rust-based `helios-build` tool will be built and several repositories will then be cloned under `projects/`. Note that, at least for now, the tool takes a little while to build the first time. -While the tool will initially clone the expected project repositories, no -subsequent manipulation (e.g., pulling updates) is presently performed. You -can (and must!) manage the local clones as you would any other git repository; -switching branches, pulling updates, etc. +While the tool will initially clone the expected project repositories, +subsequent manipulation (e.g., pulling updates, switching branches) is only +performed for some repositories. You can see which repositories the setup step +will update by looking at `auto_update` in the +[`config/projects.toml`](./config/projects.toml) file. You should otherwise +expect to manage local clones as you would any other git repository; switching +branches, pulling updates, etc. ## Building illumos -The operating system components at the core of Helios come from -[illumos-gate](https://github.com/illumos/illumos-gate). The packages that -ship on Helios systems are mostly stock illumos with a few minor packaging -transformations. +The operating system components at the core of Helios come from the +[**stlouis** branch of +illumos-gate](https://github.com/oxidecomputer/illumos-gate/tree/stlouis). The +packages that ship on Helios systems are mostly [stock +illumos](https://github.com/illumos/illumos-gate) with some additions for Oxide +hardware and a few minor packaging transformations. To make it easier to build illumos, `helios-build` provides several wrappers that manage build configuration and invoke the illumos build tools. The @@ -53,15 +131,6 @@ upstream illumos documentation has a guide, [Building illumos](https://illumos.org/docs/developers/build/), which covers most of what the Helios tools are doing on your behalf if you are curious. -### Prerequisites - -If you've installed the `helios-engvm` listed above, the prerequisites should -already be available. This is the `full` image from that repo. However, if -you're using the `base` image, you'll need to install the -`developer/illumos-tools` package. This includes the closed binaries and -assorted other machinery for `helios-build` to work its magic. You can determine -if you already have this installed with `pkg list developer/illumos-tools.` - ### Building during development While making changes to illumos, you can perform a "quick" build. This @@ -89,23 +158,25 @@ Once your build has completed successfully, there will be a package repository at `projects/illumos/packages/i386`. These packages can then be transformed and installed in various ways. -#### Installing locally +#### Installing: locally on your build machine To install your newly built packages on the build machine: ``` $ ./helios-build onu -t my-be-name -Dec 04 22:55:49.470 INFO creating temporary repository... +Jan 29 09:33:44.603 INFO creating temporary repository... ... -Dec 04 22:58:11.798 INFO O| beadm activate my-be-name -Dec 04 22:58:11.945 INFO O| Activated successfully -Dec 04 22:58:11.994 INFO onu complete! you must now reboot +Jan 29 09:35:53.050 INFO O| beadm activate my-be-name +Jan 29 09:35:53.911 INFO O| Activated successfully +Jan 29 09:35:53.921 INFO onu complete! you must now reboot ``` This will transform and install the illumos packages you just built and create a new _Boot Environment_ with the name you pass with `-t` (e.g., `my-be-name` above). The new boot environment can be seen with `beadm list`, and has been -activated by `onu` so that you can reboot into it. +activated by `onu` so that you can reboot into it. See +[beadm(8)](https://illumos.org/man/8/beadm) for more information about boot +environments. When rebooting, it is a good idea to be on the console so you can see any boot messages and interact with the boot loader. @@ -113,10 +184,9 @@ messages and interact with the boot loader. ``` helios console login: root Password: -Dec 4 22:58:11 helios login: ROOT LOGIN /dev/console -The illumos Project master-0-g7b4214534c December 2020 -# reboot -Dec 4 22:58:49 helios reboot: initiated by root on /dev/console +Last login: Mon Jan 29 09:34:20 on console +The illumos Project stlouis-0-g27e9202a98 January 2024 +root@genesis:~# reboot updating /platform/i86pc/amd64/boot_archive (CPIO) syncing file systems... done rebooting... @@ -125,14 +195,14 @@ rebooting... You can see that your updated packages are now running: ``` -$ pkg list -Hv SUNWcs -pkg://on-nightly/SUNWcs@0.5.11-1.0.999999:20201204T223805Z i-- +$ pkg list -Hv system/kernel +pkg://on-nightly/system/kernel@0.5.11-2.0.999999:20240129T090642Z i-- ``` -Critically, the `SUNWcs` package shown here comes from the `on-nightly` -publisher (your local files) and has a quick build version (`1.0.999999`). +Critically, the `system/kernel` package shown here comes from the `on-nightly` +publisher (your local files) and has a quick build version (`2.0.999999`). -#### Running a package repository server and installing somewhere else +#### Installing: on another machine, using a package repository server If you have a build machine and a separate set of test machine(s), you may wish to use the package repository server (`pkg.depotd`) on your build machine. You @@ -144,20 +214,20 @@ server: ``` $ ./helios-build onu -D -Sep 23 14:13:13.414 INFO creating temporary repository... -Sep 23 14:13:13.415 INFO repository /ws/helios/tmp/onu/repo.redist exists, removing first +Jan 29 09:39:46.885 INFO creating temporary repository... +Jan 29 09:39:46.886 INFO repository /home/user/helios/tmp/onu/repo.redist exists, removing first ... -Sep 23 14:14:31.315 INFO starting pkg.depotd on packages at: "/ws/helios/tmp/onu/repo.redist" -Sep 23 14:14:31.316 INFO access log file is "/ws/helios/tmp/depot/log/access" -Sep 23 14:14:31.316 INFO listening on port 7891 -Sep 23 14:14:31.316 INFO ^C to quit -[23/Sep/2021:14:14:31] INDEX Search Available -[23/Sep/2021:14:14:31] ENGINE Listening for SIGTERM. -[23/Sep/2021:14:14:31] ENGINE Listening for SIGHUP. -[23/Sep/2021:14:14:31] ENGINE Listening for SIGUSR1. -[23/Sep/2021:14:14:31] ENGINE Bus STARTING -[23/Sep/2021:14:14:31] ENGINE Serving on http://0.0.0.0:7891 -[23/Sep/2021:14:14:31] ENGINE Bus STARTED +Jan 29 09:41:00.428 INFO starting pkg.depotd on packages at: "/home/user/helios/tmp/onu/repo.redist" +Jan 29 09:41:00.428 INFO access log file is "/home/user/helios/tmp/depot/log/access" +Jan 29 09:41:00.428 INFO listening on port 7891 +Jan 29 09:41:00.428 INFO ^C to quit +[29/Jan/2024:09:41:01] INDEX Search Available +[29/Jan/2024:09:41:01] ENGINE Listening for SIGTERM. +[29/Jan/2024:09:41:01] ENGINE Listening for SIGHUP. +[29/Jan/2024:09:41:01] ENGINE Listening for SIGUSR1. +[29/Jan/2024:09:41:01] ENGINE Bus STARTING +[29/Jan/2024:09:41:01] ENGINE Serving on http://0.0.0.0:7891 +[29/Jan/2024:09:41:01] ENGINE Bus STARTED ``` The server is now running, and will remain running until you press Control-C or @@ -167,9 +237,9 @@ terminate it in some other way. You will need to know a DNS name or IP address Now, on the target machine, confirm that you can contact the build machine: ``` -# pkgrepo info -s http://vulcan:7891 +$ pkgrepo info -s http://genesis:7891 PUBLISHER PACKAGES STATUS UPDATED -on-nightly 532 online 2021-09-23T21:44:29.616498Z +on-nightly 549 online 2024-01-29T09:40:50.716102Z ``` Examine your existing package publisher configuration. On a stock Helios @@ -177,8 +247,8 @@ system, it should look like this: ``` # pkg publisher -PUBLISHER TYPE STATUS P LOCATION -helios-dev origin online F https://pkg.oxide.computer/helios-dev/ +PUBLISHER TYPE STATUS P LOCATION +helios-dev origin online F https://pkg.oxide.computer/helios/2/dev/ ``` Just one publisher is configured, using the central repository. We want to add @@ -187,12 +257,12 @@ to relax the "sticky" rule; i.e., that packages should only be updated from the publisher from which they were first installed. ``` -# pkg set-publisher -r -O http://vulcan:7891 --search-first on-nightly +# pkg set-publisher -r -O http://genesis:7891 --search-first on-nightly # pkg set-publisher -r --non-sticky helios-dev # pkg publisher -PUBLISHER TYPE STATUS P LOCATION -on-nightly origin online F http://vulcan:7891/ -helios-dev (non-sticky) origin online F https://pkg.oxide.computer/helios-dev/ +PUBLISHER TYPE STATUS P LOCATION +on-nightly origin online F http://genesis:7891/ +helios-dev (non-sticky) origin online F https://pkg.oxide.computer/helios/2/dev/ ``` For now, depending on what you're doing on the test system, it may be necessary @@ -216,14 +286,14 @@ Create backup boot environment: No Changed packages: helios-dev -> on-nightly SUNWcs - 0.5.11-1.0.20664 -> 0.5.11-1.0.999999 + 0.5.11-2.0.22430 -> 0.5.11-2.0.999999 SUNWcsd - 0.5.11-1.0.20664 -> 0.5.11-1.0.999999 + 0.5.11-2.0.22430 -> 0.5.11-2.0.999999 ... ``` Note that the version is changing from a stock Helios version (which is the -commit number on the master branch of illumos) to `1.0.999999`, the quick build +commit number on the master branch of illumos) to `2.0.999999`, the quick build version. A new boot environment will be created, and a reboot will be required. @@ -247,12 +317,12 @@ Reading search index Done Building new search index 582/582 Updating package cache 2/2 -A clone of 1203700f exists and has been updated and activated. -On the next boot the Boot Environment 1203700f-1 will be +A clone of helios exists and has been updated and activated. +On the next boot the Boot Environment helios-1 will be mounted on '/'. Reboot when ready to switch to this updated BE. *** Reboot required *** -New BE: 1203700f-1 +New BE: helios-1 Updating package cache 2/2 ``` @@ -272,39 +342,39 @@ Loading unix... Loading /platform/i86pc/amd64/boot_archive... Loading /platform/i86pc/amd64/boot_archive.hash... Booting... -Oxide Helios Version master-0-g0915aaef57 64-bit (onu) +Oxide Helios Version stlouis-0-g27e9202a98 64-bit (onu) Hostname: helios helios console login: root Password: -The illumos Project master-0-g0915aaef57 September 2021 +The illumos Project stlouis-0-g27e9202a98 January 2024 # uname -v -master-0-g0915aaef57 +stlouis-0-g27e9202a98 # pkg publisher -PUBLISHER TYPE STATUS P LOCATION -on-nightly origin online F http://vulcan:7891/ -helios-dev (non-sticky) origin online F https://pkg.oxide.computer/helios-dev/ +PUBLISHER TYPE STATUS P LOCATION +on-nightly origin online F http://genesis:7891/ +helios-dev (non-sticky) origin online F https://pkg.oxide.computer/helios/2/dev/ ``` In future, you should be able to do a new build, restart the package server, and then `pkg update -v` again on the test machine. -#### Producing packages without installing +#### Installing: producing packages without installing them If you just want to transform the packages from a quick build without installing them, you can do so with the `-P` flag: ``` $ ./helios-build onu -P -Sep 23 15:27:56.254 INFO creating temporary repository... -Sep 23 15:27:56.255 INFO repository /ws/helios/tmp/onu/repo.redist exists, removing first +Jan 29 09:45:36.040 INFO creating temporary repository... +Jan 29 09:45:36.040 INFO repository /home/user/helios/tmp/onu/repo.redist exists, removing first ... -Sep 23 15:28:35.964 INFO O| Republish: pkg:/text/locale@0.5.11,5.11-1.0.999999:20210914T044939Z ... Done -Sep 23 15:28:36.775 INFO exec: ["/usr/bin/pkgrepo", "refresh", "-s", "/ws/helios/tmp/onu/repo.redist"] -Sep 23 15:28:37.096 INFO O| Initiating repository refresh. -Sep 23 15:28:48.434 INFO transformed packages available for onu at: "/ws/helios/tmp/onu/repo.redist" +Jan 29 09:46:14.901 INFO O| Republish: pkg:/text/locale@0.5.11,5.11-2.0.999999:20240129T090648Z ... Done +Jan 29 09:46:15.602 INFO exec: ["/usr/bin/pkgrepo", "refresh", "-s", "/home/user/helios/tmp/onu/repo.redist"], pwd: None +Jan 29 09:46:15.907 INFO O| Initiating repository refresh. +Jan 29 09:46:24.978 INFO transformed packages available for onu at: "/home/user/helios/tmp/onu/repo.redist" ``` This may be useful if you just want to inspect the contents of the built @@ -313,14 +383,14 @@ repository; e.g., ``` $ pkgrepo info -s tmp/onu/repo.redist PUBLISHER PACKAGES STATUS UPDATED -on-nightly 532 online 2021-09-23T22:28:36.597380Z +on-nightly 549 online 2024-01-29T09:46:15.448096Z $ pkgrepo list -s tmp/onu/repo.redist PUBLISHER NAME O VERSION -on-nightly SUNWcs 0.5.11-1.0.999999:20210914T044859Z -on-nightly SUNWcsd 0.5.11-1.0.999999:20210914T044859Z -on-nightly audio/audio-utilities 0.5.11-1.0.999999:20210914T044901Z -on-nightly benchmark/filebench o 0.5.11-1.0.999999:20210914T044901Z +on-nightly SUNWcs 0.5.11-2.0.999999:20240129T090617Z +on-nightly SUNWcsd 0.5.11-2.0.999999:20240129T090618Z +on-nightly audio/audio-utilities 0.5.11-2.0.999999:20240129T090618Z +on-nightly benchmark/filebench o 0.5.11-2.0.999999:20240129T090618Z ... $ pkg contents -t file -s tmp/onu/repo.redist '*microcode*' @@ -333,7 +403,7 @@ platform/i86pc/ucode/AuthenticAMD/1062-00 platform/i86pc/ucode/AuthenticAMD/1080-00 platform/i86pc/ucode/AuthenticAMD/1081-00 platform/i86pc/ucode/AuthenticAMD/10A0-00 -platform/i86pc/ucode/AuthenticAMD/3010-00 +platform/i86pc/ucode/AuthenticAMD/2031-00 ... ``` @@ -355,18 +425,18 @@ environment: ``` $ ./helios-build bldenv -q -Sep 23 15:36:25.353 INFO file /ws/helios/projects/illumos/illumos-quick.sh exists, with correct contents -Sep 23 15:36:25.354 INFO ok! +Jan 29 09:50:22.895 INFO file /home/user/helios/projects/illumos/illumos-quick.sh exists, with correct contents +Jan 29 09:50:22.895 INFO ok! Build type is non-DEBUG RELEASE is -VERSION is master-0-g0915aaef57 -RELEASE_DATE is September 2021 +VERSION is stlouis-0-g27e9202a98 +RELEASE_DATE is January 2024 The top-level 'setup' target is available to build headers and tools. Using /bin/bash as shell. $ pwd -/ws/helios/projects/illumos/usr/src +/home/user/helios/projects/illumos/usr/src ``` A new interactive shell has been started, with `PATH` and other variables set @@ -374,7 +444,7 @@ correctly, and you can now change to a component directory and build it: ``` $ cd cmd/id -$ dmake -m serial install +$ dmake -S -m serial install ... ``` @@ -382,7 +452,7 @@ This will build and install the updated `id` command into the proto area: ``` $ ls -l $ROOT/usr/bin/id --r-xr-xr-x 1 jclulow staff 17688 Sep 23 15:38 /ws/helios/projects/illumos/proto/root_i386-nd/usr/bin/id +-r-xr-xr-x 1 user staff 17428 Jan 29 09:51 /home/user/helios/projects/illumos/proto/root_i386-nd/usr/bin/id ``` This kind of targetted incremental edit-and-recompile is a good way to make @@ -392,7 +462,7 @@ compile. Once you have changes you want to test, there are various things you can do next. -#### Most correct and slowest +#### Option 1: Most correct and slowest You can always do a new built of the entire OS. This is the only process that is (as much as anything can be) guaranteed to produce correct results. If, @@ -406,7 +476,7 @@ $ ./helios-build build-illumos -q This will rebuild all of illumos and produce packages you can then install in the usual way, as described in previous sections. -#### No guarantees but faster +#### Option 2: No guarantees but faster If you have updated some of the binaries in the proto area (e.g., by running `dmake install` in a kernel module or a command directory) you may @@ -427,7 +497,7 @@ Initiating repository refresh. Once you have updated packages you can use them to start a package repository server or install locally, as described in the previous sections. -#### It's your computer +#### Option 3: It's your computer At the end of the day, the operating system is just files in a file system. The packaging tools and other abstractions often create a kind of mystique diff --git a/config/projects.toml b/config/projects.toml index 9815ea8..ab4e377 100644 --- a/config/projects.toml +++ b/config/projects.toml @@ -1,3 +1,7 @@ +# +# Copyright 2024 Oxide Computer Company +# + [project.illumos] github = "oxidecomputer/illumos-gate" rev = "stlouis" @@ -5,14 +9,16 @@ unless_env = "BUILD_OS" [project.omnios-build] github = "oxidecomputer/helios-omnios-build" +rev = "helios2" unless_env = "BUILD_OS" -use_ssh = true +use_ssh = false site_sh = true [project.omnios-extra] github = "oxidecomputer/helios-omnios-extra" +rev = "helios2" unless_env = "BUILD_OS" -use_ssh = true +use_ssh = false site_sh = true [project.pinprick] @@ -22,7 +28,30 @@ cargo_build = true [project.phbl] github = "oxidecomputer/phbl" -use_ssh = true +use_ssh = false + +[project.image-builder] +github = "illumos/image-builder" +use_ssh = false +cargo_build = true +use_debug = true +auto_update = true + +[project.bootserver] +github = "oxidecomputer/boot-image-tools" +use_ssh = false +cargo_build = true +auto_update = true + +# +# ----------------------------------------------------------------------------- +# NOTE: Repositories below this comment are all still private. +# +# If you do not have access to private repositories in the "oxidecomputer" +# GitHub organisation, set "OXIDE_STAFF=no" in your environment to skip +# cloning them. +# ----------------------------------------------------------------------------- +# [project.amd-host-image-builder] github = "oxidecomputer/amd-host-image-builder" @@ -30,6 +59,7 @@ use_ssh = true cargo_build = true use_debug = true auto_update = true +unless_env = "OXIDE_STAFF" [[project.amd-host-image-builder.fixup]] # @@ -43,28 +73,18 @@ to_branch = "main" github = "oxidecomputer/amd-firmware" use_ssh = true auto_update = true - -[project.bootserver] -github = "oxidecomputer/boot-image-tools" -use_ssh = true -cargo_build = true -auto_update = true - -[project.image-builder] -github = "illumos/image-builder" -use_ssh = false -cargo_build = true -use_debug = true -auto_update = true +unless_env = "OXIDE_STAFF" [project.chelsio-t6-roms] github = "oxidecomputer/chelsio-t6-roms" use_ssh = true cargo_build = false auto_update = true +unless_env = "OXIDE_STAFF" [project.pilot] -github = "oxidecomputer/compliance-pilot" +github = "oxidecomputer/pilot" use_ssh = true cargo_build = true auto_update = true +unless_env = "OXIDE_STAFF" From ff8c8fafe9d82a98a006ac619a529604fd03fb38 Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Mon, 29 Jan 2024 02:59:43 -0800 Subject: [PATCH 7/7] XXX rustfmt --- tools/helios-build/src/common.rs | 21 +- tools/helios-build/src/ensure.rs | 215 +++++++----- tools/helios-build/src/expand.rs | 4 +- tools/helios-build/src/illumos.rs | 189 +++++------ tools/helios-build/src/main.rs | 540 +++++++++++++++++++----------- tools/helios-build/src/zfs.rs | 9 +- 6 files changed, 598 insertions(+), 380 deletions(-) diff --git a/tools/helios-build/src/common.rs b/tools/helios-build/src/common.rs index 4b40e54..b8b6ac8 100644 --- a/tools/helios-build/src/common.rs +++ b/tools/helios-build/src/common.rs @@ -2,12 +2,12 @@ * Copyright 2024 Oxide Computer Company */ -use slog::{Drain, Logger}; -use std::sync::Mutex; +use anyhow::{bail, Result}; use serde::Deserialize; +use slog::{Drain, Logger}; use std::io::IsTerminal; use std::path::Path; -use anyhow::{Result, bail}; +use std::sync::Mutex; pub use slog::{info, o}; @@ -18,13 +18,13 @@ pub use slog::{info, o}; pub fn init_log() -> Logger { let dec = slog_term::TermDecorator::new().stdout().build(); if std::io::stdout().is_terminal() { - let dr = Mutex::new(slog_term::CompactFormat::new(dec) - .build()).fuse(); + let dr = Mutex::new(slog_term::CompactFormat::new(dec).build()).fuse(); slog::Logger::root(dr, o!()) } else { - let dr = Mutex::new(slog_term::FullFormat::new(dec) - .use_original_order() - .build()).fuse(); + let dr = Mutex::new( + slog_term::FullFormat::new(dec).use_original_order().build(), + ) + .fuse(); slog::Logger::root(dr, o!()) } } @@ -71,8 +71,9 @@ impl OutputExt for std::process::Output { } pub fn read_toml(path: P) -> Result - where P: AsRef, - for<'de> O: Deserialize<'de> +where + P: AsRef, + for<'de> O: Deserialize<'de>, { Ok(toml::from_str(&std::fs::read_to_string(path.as_ref())?)?) } diff --git a/tools/helios-build/src/ensure.rs b/tools/helios-build/src/ensure.rs index bb72000..24855f9 100644 --- a/tools/helios-build/src/ensure.rs +++ b/tools/helios-build/src/ensure.rs @@ -2,15 +2,15 @@ * Copyright 2024 Oxide Computer Company */ -use std::path::{Path, PathBuf}; +use anyhow::{anyhow, bail, Result}; +use slog::{error, info, warn, Logger}; +use std::ffi::CString; +use std::ffi::OsStr; use std::fs::{DirBuilder, File}; +use std::io::{BufRead, BufReader, Read, Write}; use std::os::unix::fs::DirBuilderExt; -use std::ffi::CString; -use std::io::{Read, BufRead, Write, BufReader}; +use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; -use std::ffi::OsStr; -use slog::{Logger, info, warn, error}; -use anyhow::{Result, bail, anyhow}; #[derive(Debug, PartialEq)] pub enum FileType { @@ -41,9 +41,8 @@ impl FileInfo { pub fn check>(p: P) -> Result> { let name: &str = p.as_ref().to_str().unwrap(); let cname = CString::new(name.to_string())?; - let st = Box::into_raw(Box::new(unsafe { - std::mem::zeroed::() - })); + let st = + Box::into_raw(Box::new(unsafe { std::mem::zeroed::() })); let (r, e, st) = unsafe { let r = libc::lstat(cname.as_ptr(), st); let e = *libc::___errno(); @@ -77,11 +76,7 @@ pub fn check>(p: P) -> Result> { let perms = st.st_mode & 0o7777; /* as per mknod(2) */ - Ok(Some(FileInfo { - filetype, - perms, - target, - })) + Ok(Some(FileInfo { filetype, perms, target })) } pub fn perms>(log: &Logger, p: P, perms: u32) -> Result { @@ -119,9 +114,11 @@ pub fn perms>(log: &Logger, p: P, perms: u32) -> Result { Ok(did_work) } -pub fn directory>(log: &Logger, dir: P, mode: u32) - -> Result -{ +pub fn directory>( + log: &Logger, + dir: P, + mode: u32, +) -> Result { let dir = dir.as_ref(); let mut did_work = false; @@ -138,10 +135,7 @@ pub fn directory>(log: &Logger, dir: P, mode: u32) */ did_work = true; info!(log, "creating directory: {}", dir.display()); - DirBuilder::new() - .recursive(true) - .mode(mode) - .create(dir)?; + DirBuilder::new().recursive(true).mode(mode).create(dir)?; /* * Check the path again, to make sure we have up-to-date information: @@ -227,27 +221,41 @@ pub fn removed>(log: &Logger, dst: P) -> Result<()> { if let Some(fi) = check(dst)? { match fi.filetype { FileType::File | FileType::Link => { - info!(log, "file {} exists (as {:?}), removing", - dst.display(), fi.filetype); + info!( + log, + "file {} exists (as {:?}), removing", + dst.display(), + fi.filetype + ); std::fs::remove_file(dst)?; } t => { - bail!("file {} exists as {:?}, unexpected type", - dst.display(), t); + bail!( + "file {} exists as {:?}, unexpected type", + dst.display(), + t + ); } } } else { - info!(log, "file {} does not already exist, skipping removal", - dst.display()); + info!( + log, + "file {} does not already exist, skipping removal", + dst.display() + ); } Ok(()) } -pub fn file_str>(log: &Logger, contents: &str, dst: P, - mode: u32, create: Create) -> Result -{ +pub fn file_str>( + log: &Logger, + contents: &str, + dst: P, + mode: u32, + create: Create, +) -> Result { let dst = dst.as_ref(); let mut did_work = false; @@ -257,13 +265,19 @@ pub fn file_str>(log: &Logger, contents: &str, dst: P, */ match create { Create::IfMissing if fi.filetype == FileType::File => { - info!(log, "file {} exists, skipping population", - dst.display()); + info!( + log, + "file {} exists, skipping population", + dst.display() + ); false } Create::IfMissing if fi.filetype == FileType::Link => { - warn!(log, "symlink {} exists, skipping population", - dst.display()); + warn!( + log, + "symlink {} exists, skipping population", + dst.display() + ); false } Create::IfMissing => { @@ -271,8 +285,11 @@ pub fn file_str>(log: &Logger, contents: &str, dst: P, * Avoid clobbering an unexpected entry when we have been asked * to preserve in the face of modifications. */ - bail!("{} should be a file, but is a {:?}", - dst.display(), fi.filetype); + bail!( + "{} should be a file, but is a {:?}", + dst.display(), + fi.filetype + ); } Create::Always if fi.filetype == FileType::File => { /* @@ -280,12 +297,18 @@ pub fn file_str>(log: &Logger, contents: &str, dst: P, * what we expect. */ if comparestr(contents, dst)? { - info!(log, "file {} exists, with correct contents", - dst.display()); + info!( + log, + "file {} exists, with correct contents", + dst.display() + ); false } else { - warn!(log, "file {} exists, with wrong contents, unlinking", - dst.display()); + warn!( + log, + "file {} exists, with wrong contents, unlinking", + dst.display() + ); std::fs::remove_file(dst)?; true } @@ -295,8 +318,12 @@ pub fn file_str>(log: &Logger, contents: &str, dst: P, * We found a file type we don't expect. Try to unlink it * anyway. */ - warn!(log, "file {} exists, of type {:?}, unlinking", - dst.display(), fi.filetype); + warn!( + log, + "file {} exists, of type {:?}, unlinking", + dst.display(), + fi.filetype + ); std::fs::remove_file(dst)?; true } @@ -326,9 +353,13 @@ pub fn file_str>(log: &Logger, contents: &str, dst: P, Ok(did_work) } -pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, - mode: u32, create: Create) -> Result -{ +pub fn file, P2: AsRef>( + log: &Logger, + src: P1, + dst: P2, + mode: u32, + create: Create, +) -> Result { let src = src.as_ref(); let dst = dst.as_ref(); let mut did_work = false; @@ -339,13 +370,19 @@ pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, */ match create { Create::IfMissing if fi.filetype == FileType::File => { - info!(log, "file {} exists, skipping population", - dst.display()); + info!( + log, + "file {} exists, skipping population", + dst.display() + ); false } Create::IfMissing if fi.filetype == FileType::Link => { - warn!(log, "symlink {} exists, skipping population", - dst.display()); + warn!( + log, + "symlink {} exists, skipping population", + dst.display() + ); false } Create::IfMissing => { @@ -353,8 +390,11 @@ pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, * Avoid clobbering an unexpected entry when we have been asked * to preserve in the face of modifications. */ - bail!("{} should be a file, but is a {:?}", - dst.display(), fi.filetype); + bail!( + "{} should be a file, but is a {:?}", + dst.display(), + fi.filetype + ); } Create::Always if fi.filetype == FileType::File => { /* @@ -362,12 +402,18 @@ pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, * what we expect. */ if compare(src, dst)? { - info!(log, "file {} exists, with correct contents", - dst.display()); + info!( + log, + "file {} exists, with correct contents", + dst.display() + ); false } else { - warn!(log, "file {} exists, with wrong contents, unlinking", - dst.display()); + warn!( + log, + "file {} exists, with wrong contents, unlinking", + dst.display() + ); std::fs::remove_file(dst)?; true } @@ -377,8 +423,12 @@ pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, * We found a file type we don't expect. Try to unlink it * anyway. */ - warn!(log, "file {} exists, of type {:?}, unlinking", - dst.display(), fi.filetype); + warn!( + log, + "file {} exists, of type {:?}, unlinking", + dst.display(), + fi.filetype + ); std::fs::remove_file(dst)?; true } @@ -402,10 +452,11 @@ pub fn file, P2: AsRef>(log: &Logger, src: P1, dst: P2, Ok(did_work) } -pub fn symlink, P2: AsRef>(log: &Logger, dst: P1, - target: P2) - -> Result -{ +pub fn symlink, P2: AsRef>( + log: &Logger, + dst: P1, + target: P2, +) -> Result { let dst = dst.as_ref(); let target = target.as_ref(); let mut did_work = false; @@ -417,8 +468,12 @@ pub fn symlink, P2: AsRef>(log: &Logger, dst: P1, info!(log, "link target ok ({})", target.display()); false } else { - warn!(log, "link target wrong: want {}, got {}; unlinking", - target.display(), fitarget.display()); + warn!( + log, + "link target wrong: want {}, got {}; unlinking", + target.display(), + fitarget.display() + ); std::fs::remove_file(dst)?; true } @@ -426,8 +481,12 @@ pub fn symlink, P2: AsRef>(log: &Logger, dst: P1, /* * File type not correct. Unlink. */ - warn!(log, "file {} exists, of type {:?}, unlinking", - dst.display(), fi.filetype); + warn!( + log, + "file {} exists, of type {:?}, unlinking", + dst.display(), + fi.filetype + ); std::fs::remove_file(dst)?; true } @@ -450,8 +509,11 @@ pub fn symlink, P2: AsRef>(log: &Logger, dst: P1, Ok(did_work) } -fn spawn_reader(log: &Logger, name: &str, stream: Option) - -> Option> +fn spawn_reader( + log: &Logger, + name: &str, + stream: Option, +) -> Option> where T: Read + Send + 'static, { @@ -499,7 +561,7 @@ where } pub fn run2(log: &Logger, cmd: &mut Command) -> Result<()> { - let mut logargs = vec![ cmd.get_program().to_owned() ]; + let mut logargs = vec![cmd.get_program().to_owned()]; for arg in cmd.get_args() { logargs.push(arg.to_owned()); } @@ -579,9 +641,11 @@ pub fn scrub_env(cmd: &mut Command, utf8: bool) { cmd.env_remove("LC_ALL"); } -pub fn run_in, P: AsRef>(log: &Logger, pwd: P, - args: &[S]) -> Result<()> -{ +pub fn run_in, P: AsRef>( + log: &Logger, + pwd: P, + args: &[S], +) -> Result<()> { let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect(); let mut cmd = Command::new(&args[0]); @@ -625,10 +689,11 @@ pub fn run_utf8>(log: &Logger, args: &[S]) -> Result<()> { } pub fn run_env(log: &Logger, args: &[S], env: I) -> Result<()> - where S: AsRef, - I: IntoIterator, - K: AsRef, - V: AsRef, +where + S: AsRef, + I: IntoIterator, + K: AsRef, + V: AsRef, { let args: Vec<&OsStr> = args.iter().map(|s| s.as_ref()).collect(); diff --git a/tools/helios-build/src/expand.rs b/tools/helios-build/src/expand.rs index bdffa80..a8a243f 100644 --- a/tools/helios-build/src/expand.rs +++ b/tools/helios-build/src/expand.rs @@ -3,7 +3,6 @@ use std::collections::HashMap; * Copyright 2024 Oxide Computer Company */ - use anyhow::{bail, Result}; pub struct Expansion { @@ -126,7 +125,8 @@ impl Expansion { } pub fn evaluate( - &self, variables: &HashMap, + &self, + variables: &HashMap, ) -> Result { let mut out = String::new(); diff --git a/tools/helios-build/src/illumos.rs b/tools/helios-build/src/illumos.rs index 022a8f5..e8e6276 100644 --- a/tools/helios-build/src/illumos.rs +++ b/tools/helios-build/src/illumos.rs @@ -2,15 +2,15 @@ * Copyright 2020 Oxide Computer Company */ -use std::os::raw::{c_char, c_int}; -use std::process::{exit, Command}; -use std::ffi::{CString, CStr}; +use super::common::{sleep, OutputExt}; +use anyhow::{bail, Result}; +use slog::Logger; use std::collections::HashMap; -use std::path::{Path, PathBuf}; +use std::ffi::{CStr, CString}; use std::io::Write; -use anyhow::{Result, bail}; -use slog::Logger; -use super::common::{OutputExt, sleep}; +use std::os::raw::{c_char, c_int}; +use std::path::{Path, PathBuf}; +use std::process::{exit, Command}; const PFEXEC: &str = "/bin/pfexec"; const ZONEADM: &str = "/usr/sbin/zoneadm"; @@ -27,9 +27,7 @@ pub struct UserAttr { impl UserAttr { pub fn profiles(&self) -> Vec { if let Some(p) = self.attr.get("profiles") { - p.split(',') - .map(|s| s.trim().to_string()) - .collect::>() + p.split(',').map(|s| s.trim().to_string()).collect::>() } else { Vec::new() } @@ -74,16 +72,13 @@ struct UserAttrRaw { } #[link(name = "secdb")] -extern { +extern "C" { fn getusernam(buf: *const c_char) -> *mut UserAttrRaw; fn free_userattr(userattr: *mut UserAttrRaw); } pub fn get_user_attr_by_name(name: &str) -> Result> { - let mut out = UserAttr { - name: name.to_string(), - attr: HashMap::new(), - }; + let mut out = UserAttr { name: name.to_string(), attr: HashMap::new() }; let name = CString::new(name.to_owned())?; let ua = unsafe { getusernam(name.as_ptr()) }; @@ -112,11 +107,14 @@ pub fn nodename() -> String { exit(100); } std::ffi::CStr::from_ptr(un.nodename.as_mut_ptr()) - }.to_str().unwrap().to_string() + } + .to_str() + .unwrap() + .to_string() } #[link(name = "c")] -extern { +extern "C" { fn getzoneid() -> i32; fn getzonenamebyid(id: i32, buf: *mut u8, buflen: usize) -> isize; } @@ -138,7 +136,10 @@ pub fn zonename() -> String { Vec::from(&buf[0..sz as usize]) }; std::ffi::CStr::from_bytes_with_nul(&buf) - .unwrap().to_str().unwrap().to_string() + .unwrap() + .to_str() + .unwrap() + .to_string() } fn errno() -> i32 { @@ -223,7 +224,7 @@ impl Group { members.push(cs(unsafe { *mems })?.unwrap()); mems = unsafe { mems.offset(1) }; - } + } Some(members) } else { None @@ -334,10 +335,7 @@ impl Terms { } fn new() -> Terms { - Terms { - terms: Vec::new(), - buf: Some(String::new()), - } + Terms { terms: Vec::new(), buf: Some(String::new()) } } } @@ -425,17 +423,9 @@ pub fn zone_list() -> Result> { bail!("invalid zoneadm list line: {:?}", line); } - let id = if line[0] == "-" { - None - } else { - Some(line[0].parse()?) - }; + let id = if line[0] == "-" { None } else { Some(line[0].parse()?) }; - let uuid = if line[4] == "" { - None - } else { - Some(line[4].to_string()) - }; + let uuid = if line[4] == "" { None } else { Some(line[4].to_string()) }; zones.push(Zone { id, @@ -451,12 +441,11 @@ pub fn zone_list() -> Result> { Ok(zones) } -pub fn zone_create(name: S1, path: P, brand: S2) - -> Result<()> - where - P: AsRef, - S1: AsRef, - S2: AsRef, +pub fn zone_create(name: S1, path: P, brand: S2) -> Result<()> +where + P: AsRef, + S1: AsRef, + S2: AsRef, { let n = name.as_ref(); let p = path.as_ref(); @@ -474,7 +463,8 @@ pub fn zone_create(name: S1, path: P, brand: S2) let out = Command::new(PFEXEC) .env_clear() .arg(ZONECFG) - .arg("-z").arg(n) + .arg("-z") + .arg(n) .arg(script) .output()?; @@ -485,12 +475,11 @@ pub fn zone_create(name: S1, path: P, brand: S2) Ok(()) } -pub fn zone_add_lofs(name: S1, gz: P1, ngz: P2) - -> Result<()> - where - P1: AsRef, - P2: AsRef, - S1: AsRef, +pub fn zone_add_lofs(name: S1, gz: P1, ngz: P2) -> Result<()> +where + P1: AsRef, + P2: AsRef, + S1: AsRef, { let n = name.as_ref(); let gz = gz.as_ref(); @@ -510,7 +499,8 @@ pub fn zone_add_lofs(name: S1, gz: P1, ngz: P2) let out = Command::new(PFEXEC) .env_clear() .arg(ZONECFG) - .arg("-z").arg(n) + .arg("-z") + .arg(n) .arg(script) .output()?; @@ -521,10 +511,9 @@ pub fn zone_add_lofs(name: S1, gz: P1, ngz: P2) Ok(()) } -pub fn zone_install(name: S1, packages: &[&str]) - -> Result<()> - where - S1: AsRef, +pub fn zone_install(name: S1, packages: &[&str]) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -553,11 +542,10 @@ pub fn zone_install(name: S1, packages: &[&str]) Ok(()) } -pub fn zone_clone(name: S1, src: S2) - -> Result<()> - where - S1: AsRef, - S2: AsRef, +pub fn zone_clone(name: S1, src: S2) -> Result<()> +where + S1: AsRef, + S2: AsRef, { let n = name.as_ref(); let src = src.as_ref(); @@ -581,10 +569,9 @@ pub fn zone_clone(name: S1, src: S2) Ok(()) } -pub fn zone_halt(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_halt(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -603,10 +590,9 @@ pub fn zone_halt(name: S1) Ok(()) } -pub fn zone_boot(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_boot(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -625,11 +611,14 @@ pub fn zone_boot(name: S1) Ok(()) } -pub fn zone_milestone_wait(_log: &Logger, name: S1, fmri: S2) - -> Result<()> - where - S1: AsRef, - S2: AsRef, +pub fn zone_milestone_wait( + _log: &Logger, + name: S1, + fmri: S2, +) -> Result<()> +where + S1: AsRef, + S2: AsRef, { let name = name.as_ref(); let fmri = fmri.as_ref(); @@ -667,10 +656,9 @@ pub fn zone_milestone_wait(_log: &Logger, name: S1, fmri: S2) Ok(()) } -pub fn zone_mount(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_mount(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -689,10 +677,9 @@ pub fn zone_mount(name: S1) Ok(()) } -pub fn zone_unmount(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_unmount(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -711,10 +698,9 @@ pub fn zone_unmount(name: S1) Ok(()) } -pub fn zone_uninstall(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_uninstall(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -734,10 +720,9 @@ pub fn zone_uninstall(name: S1) Ok(()) } -pub fn zone_delete(name: S1) - -> Result<()> - where - S1: AsRef, +pub fn zone_delete(name: S1) -> Result<()> +where + S1: AsRef, { let n = name.as_ref(); @@ -757,11 +742,10 @@ pub fn zone_delete(name: S1) Ok(()) } -pub fn zone_deposit_script(name: S1, contents: S2) - -> Result - where - S1: AsRef, - S2: AsRef, +pub fn zone_deposit_script(name: S1, contents: S2) -> Result +where + S1: AsRef, + S2: AsRef, { let n = name.as_ref(); let c = contents.as_ref(); @@ -806,12 +790,11 @@ pub fn zone_deposit_script(name: S1, contents: S2) Ok(sp) } -pub fn zoneinstall_append(name: S1, path: P, line: S2) - -> Result<()> - where - P: AsRef, - S1: AsRef, - S2: AsRef, +pub fn zoneinstall_append(name: S1, path: P, line: S2) -> Result<()> +where + P: AsRef, + S1: AsRef, + S2: AsRef, { let n = name.as_ref(); let p = path.as_ref(); @@ -843,11 +826,15 @@ pub fn zoneinstall_append(name: S1, path: P, line: S2) Ok(()) } -pub fn zoneinstall_mkdir(name: S1, path: P, uid: u32, gid: u32) - -> Result<()> - where - P: AsRef, - S1: AsRef, +pub fn zoneinstall_mkdir( + name: S1, + path: P, + uid: u32, + gid: u32, +) -> Result<()> +where + P: AsRef, + S1: AsRef, { let n = name.as_ref(); let p = path.as_ref(); diff --git a/tools/helios-build/src/main.rs b/tools/helios-build/src/main.rs index cc5ebed..c59cf63 100644 --- a/tools/helios-build/src/main.rs +++ b/tools/helios-build/src/main.rs @@ -5,27 +5,27 @@ mod common; use common::*; -use anyhow::{Result, Context, bail}; -use helios_build_utils::metadata::{ArchiveType, self}; +use anyhow::{bail, Context, Result}; +use helios_build_utils::metadata::{self, ArchiveType}; +use helios_build_utils::tree; use serde::Deserialize; +use slog::Logger; use std::collections::HashMap; +use std::fs::File; +use std::io::{BufReader, Read, Write}; use std::os::unix::fs::PermissionsExt; -use std::process::Command; use std::os::unix::process::CommandExt; -use std::io::{BufReader, Read, Write}; -use std::fs::File; -use std::time::{Instant,SystemTime}; -use slog::Logger; use std::path::Path; +use std::process::Command; +use std::time::{Instant, SystemTime}; use time::{format_description, OffsetDateTime}; use walkdir::WalkDir; -use helios_build_utils::tree; -pub mod illumos; -pub mod ensure; -mod zfs; mod archive; +pub mod ensure; mod expand; +pub mod illumos; +mod zfs; use expand::Expansion; @@ -42,13 +42,18 @@ enum RelVer { } impl std::fmt::Display for RelVer { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) - -> std::result::Result<(), std::fmt::Error> - { - write!(f, "{}", match self { - RelVer::V1 => 1, - RelVer::V2 => 2, - }) + fn fmt( + &self, + f: &mut std::fmt::Formatter<'_>, + ) -> std::result::Result<(), std::fmt::Error> { + write!( + f, + "{}", + match self { + RelVer::V1 => 1, + RelVer::V2 => 2, + } + ) } } @@ -66,8 +71,8 @@ fn baseopts() -> getopts::Options { opts } -use std::path::{PathBuf, Component}; use std::ffi::OsStr; +use std::path::{Component, PathBuf}; const NO_PATH: Option = None; @@ -110,11 +115,8 @@ fn rel_path>( p: Option

, components: &[&str], ) -> Result { - let mut top = if let Some(p) = p { - p.as_ref().to_path_buf() - } else { - top()? - }; + let mut top = + if let Some(p) = p { p.as_ref().to_path_buf() } else { top()? }; for c in components { top.push(c); } @@ -256,11 +258,15 @@ fn ensure_dir(components: &[&str]) -> Result { Ok(dir) } - -fn create_ips_repo(log: &Logger, path: P, publ: S, torch: bool) - -> Result<()> - where P: AsRef, - S: AsRef, +fn create_ips_repo( + log: &Logger, + path: P, + publ: S, + torch: bool, +) -> Result<()> +where + P: AsRef, + S: AsRef, { let publ: &str = publ.as_ref(); let path: &Path = path.as_ref(); @@ -298,8 +304,10 @@ fn cmd_merge_illumos(ca: &CommandArg) -> Result<()> { opts.optopt("p", "", "output publisher name", "PUBLISHER"); let usage = || { - println!("{}", - opts.usage("Usage: helios [OPTIONS] merge-illumos [OPTIONS]")); + println!( + "{}", + opts.usage("Usage: helios [OPTIONS] merge-illumos [OPTIONS]") + ); }; let log = ca.log; @@ -351,10 +359,12 @@ fn cmd_merge_illumos(ca: &CommandArg) -> Result<()> { ensure_dir(&["tmp", &tillumos])?; let repo_merge = top_path(&["tmp", &tillumos, "nightly-merged"])?; - let repo_d = rel_path(Some(&gate), - &["packages", "i386", "nightly", "repo.redist"])?; - let repo_nd = rel_path(Some(&gate), - &["packages", "i386", "nightly-nd", "repo.redist"])?; + let repo_d = + rel_path(Some(&gate), &["packages", "i386", "nightly", "repo.redist"])?; + let repo_nd = rel_path( + Some(&gate), + &["packages", "i386", "nightly-nd", "repo.redist"], + )?; /* * Merge the packages from the DEBUG and non-DEBUG builds into a single @@ -363,9 +373,18 @@ fn cmd_merge_illumos(ca: &CommandArg) -> Result<()> { info!(log, "recreating merging repository at {:?}", &repo_merge); create_ips_repo(log, &repo_merge, &input_publisher, true)?; - ensure::run(log, &["/usr/bin/pkgmerge", "-d", &repo_merge.to_str().unwrap(), - "-s", &format!("debug.illumos=false,{}/", repo_nd.to_str().unwrap()), - "-s", &format!("debug.illumos=true,{}/", repo_d.to_str().unwrap())])?; + ensure::run( + log, + &[ + "/usr/bin/pkgmerge", + "-d", + &repo_merge.to_str().unwrap(), + "-s", + &format!("debug.illumos=false,{}/", repo_nd.to_str().unwrap()), + "-s", + &format!("debug.illumos=true,{}/", repo_d.to_str().unwrap()), + ], + )?; info!(log, "transforming packages for publishing..."); @@ -387,14 +406,25 @@ fn cmd_merge_illumos(ca: &CommandArg) -> Result<()> { top_path(&["packages", "os"])? }; - ensure::run(log, &[PKGRECV, - "-s", &repo_merge.to_str().unwrap(), - "-d", &repo.to_str().unwrap(), - "--mog-file", &mog_publisher.to_str().unwrap(), - "--mog-file", &mog_conflicts.to_str().unwrap(), - "--mog-file", &mog_deps.to_str().unwrap(), - "-m", "latest", - "*"])?; + ensure::run( + log, + &[ + PKGRECV, + "-s", + &repo_merge.to_str().unwrap(), + "-d", + &repo.to_str().unwrap(), + "--mog-file", + &mog_publisher.to_str().unwrap(), + "--mog-file", + &mog_conflicts.to_str().unwrap(), + "--mog-file", + &mog_deps.to_str().unwrap(), + "-m", + "latest", + "*", + ], + )?; ensure::run(log, &[PKGREPO, "refresh", "-s", &repo.to_str().unwrap()])?; /* @@ -412,10 +442,8 @@ fn ncpus() -> Result { /* * XXX Replace with kstat check. */ - let out = Command::new("/usr/sbin/psrinfo") - .env_clear() - .arg("-t") - .output()?; + let out = + Command::new("/usr/sbin/psrinfo").env_clear().arg("-t").output()?; if !out.status.success() { bail!("could not count CPUs: {}", out.info()); @@ -450,16 +478,21 @@ impl BuildType { } } -fn regen_publisher_mog>(log: &Logger, mogfile: Option

, - publisher: &str) -> Result<()> -{ +fn regen_publisher_mog>( + log: &Logger, + mogfile: Option

, + publisher: &str, +) -> Result<()> { /* * Create the pkgmogrify template that we need to replace the pkg(5) * publisher name when promoting packages from a build repository to the * central repository. */ - let mog = format!(" \ - edit value pkg://[^/]+/ pkg://{}/>\n", publisher); + let mog = format!( + " \ + edit value pkg://[^/]+/ pkg://{}/>\n", + publisher + ); let mogpath = if let Some(mogfile) = mogfile { mogfile.as_ref().to_path_buf() } else { @@ -472,9 +505,8 @@ fn regen_publisher_mog>(log: &Logger, mogfile: Option

, fn determine_release_version() -> Result { let relpath = "/etc/os-release"; let relfile = std::fs::read_to_string(relpath)?; - let map: HashMap<_, _> = relfile.lines().filter_map(|l| { - l.split_once('=') - }).collect(); + let map: HashMap<_, _> = + relfile.lines().filter_map(|l| l.split_once('=')).collect(); let Some(id) = map.get("ID") else { bail!("ID missing from {relpath:?}"); @@ -493,9 +525,12 @@ fn determine_release_version() -> Result { }) } -fn regen_illumos_sh>(log: &Logger, gate: P, bt: BuildType, - relver: RelVer) -> Result -{ +fn regen_illumos_sh>( + log: &Logger, + gate: P, + bt: BuildType, + relver: RelVer, +) -> Result { let gate = gate.as_ref(); let path_env = rel_path(Some(gate), &[bt.script_name()])?; @@ -637,8 +672,10 @@ fn cmd_build_illumos(ca: &CommandArg) -> Result<()> { opts.optflag("i", "incremental", "perform an incremental build"); let usage = || { - println!("{}", - opts.usage("Usage: helios [OPTIONS] build-illumos [OPTIONS]")); + println!( + "{}", + opts.usage("Usage: helios [OPTIONS] build-illumos [OPTIONS]") + ); }; let log = ca.log; @@ -686,20 +723,25 @@ fn cmd_build_illumos(ca: &CommandArg) -> Result<()> { }; let env_sh = regen_illumos_sh(log, &gate, bt, relver)?; - let script = format!("cd {} && ./usr/src/tools/scripts/nightly{} {}", + let script = format!( + "cd {} && ./usr/src/tools/scripts/nightly{} {}", gate.to_str().unwrap(), if res.opt_present("i") { " -i" } else { "" }, - env_sh.to_str().unwrap()); + env_sh.to_str().unwrap() + ); ensure::run(log, &["/sbin/sh", "-c", &script])?; Ok(()) } -fn create_transformed_repo(log: &Logger, gate: &Path, tmpdir: &Path, - debug: bool, refresh: bool) - -> Result -{ +fn create_transformed_repo( + log: &Logger, + gate: &Path, + tmpdir: &Path, + debug: bool, + refresh: bool, +) -> Result { let repo = rel_path(Some(tmpdir), &["repo.redist"])?; create_ips_repo(log, &repo, "on-nightly", true)?; @@ -711,15 +753,25 @@ fn create_transformed_repo(log: &Logger, gate: &Path, tmpdir: &Path, info!(log, "transforming packages for installation..."); let which = if debug { "nightly" } else { "nightly-nd" }; - let repo_nd = rel_path(Some(gate), - &["packages", "i386", which, "repo.redist"])?; - ensure::run(log, &[PKGRECV, - "-s", &repo_nd.to_str().unwrap(), - "-d", &repo.to_str().unwrap(), - "--mog-file", &mog_conflicts.to_str().unwrap(), - "--mog-file", &mog_deps.to_str().unwrap(), - "-m", "latest", - "*"])?; + let repo_nd = + rel_path(Some(gate), &["packages", "i386", which, "repo.redist"])?; + ensure::run( + log, + &[ + PKGRECV, + "-s", + &repo_nd.to_str().unwrap(), + "-d", + &repo.to_str().unwrap(), + "--mog-file", + &mog_conflicts.to_str().unwrap(), + "--mog-file", + &mog_deps.to_str().unwrap(), + "-m", + "latest", + "*", + ], + )?; if refresh { ensure::run(log, &[PKGREPO, "refresh", "-s", &repo.to_str().unwrap()])?; } @@ -801,8 +853,13 @@ fn cmd_illumos_onu(ca: &CommandArg) -> Result<()> { * consolidations. To do this, we create an onu-specific repository: */ info!(log, "creating temporary repository..."); - let repo = create_transformed_repo(log, &gate, - &ensure_dir(&["tmp", &tonu])?, res.opt_present("d"), true)?; + let repo = create_transformed_repo( + log, + &gate, + &ensure_dir(&["tmp", &tonu])?, + res.opt_present("d"), + true, + )?; if res.opt_present("P") { info!(log, "transformed packages available for onu at: {:?}", &repo); @@ -884,13 +941,34 @@ fn cmd_illumos_onu(ca: &CommandArg) -> Result<()> { * privileges as it modifies the system. */ info!(log, "installing packages..."); - let onu = rel_path(Some(&gate), &["usr", "src", "tools", "proto", - "root_i386-nd", "opt", "onbld", "bin", "onu"])?; + let onu = rel_path( + Some(&gate), + &[ + "usr", + "src", + "tools", + "proto", + "root_i386-nd", + "opt", + "onbld", + "bin", + "onu", + ], + )?; let onu_dir = top_path(&["tmp", &tonu])?; - ensure::run(log, &["pfexec", &onu.to_str().unwrap(), "-v", - "-d", &onu_dir.to_str().unwrap(), - "-t", &bename])?; + ensure::run( + log, + &[ + "pfexec", + &onu.to_str().unwrap(), + "-v", + "-d", + &onu_dir.to_str().unwrap(), + "-t", + &bename, + ], + )?; info!(log, "onu complete! you must now reboot"); Ok(()) @@ -984,8 +1062,8 @@ fn cmd_illumos_bldenv(ca: &CommandArg) -> Result<()> { let env = rel_path(Some(&gate), &[t.script_name()])?; let src = rel_path(Some(&gate), &["usr", "src"])?; - let bldenv = rel_path(Some(&gate), &["usr", "src", - "tools", "scripts", "bldenv"])?; + let bldenv = + rel_path(Some(&gate), &["usr", "src", "tools", "scripts", "bldenv"])?; /* * bldenv(1) starts an interactive build shell with the correct environment @@ -1010,11 +1088,18 @@ fn read_string(path: &Path) -> Result { Ok(buf) } -fn cargo_target_cmd(project: &str, command: &str, debug: bool) - -> Result -{ - let bin = top_path(&["projects", project, "target", - if debug { "debug" } else { "release" }, command])?; +fn cargo_target_cmd( + project: &str, + command: &str, + debug: bool, +) -> Result { + let bin = top_path(&[ + "projects", + project, + "target", + if debug { "debug" } else { "release" }, + command, + ])?; if !bin.is_file() { bail!("binary {:?} does not exist. run \"gmake setup\"?", bin); } @@ -1046,8 +1131,10 @@ fn genproto(proto: &Path, output_template: &Path) -> Result<()> { /* * On illumos, /bin is always a symbolic link to /usr/bin. */ - bail!("proto {:?} contains a /bin directory; should use /usr/bin", - proto); + bail!( + "proto {:?} contains a /bin directory; should use /usr/bin", + proto + ); } /* @@ -1085,9 +1172,7 @@ fn genproto(proto: &Path, output_template: &Path) -> Result<()> { || relpath == PathBuf::from("opt") { "sys" - } else if relpath.starts_with("lib") - || relpath.starts_with("usr") - { + } else if relpath.starts_with("lib") || relpath.starts_with("usr") { "bin" } else { "root" @@ -1135,13 +1220,20 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { opts.optflag("", "ddr-testing", "build ROMs for other DDR frequencies"); opts.optopt("p", "", "use an external package repository", "PUBLISHER=URL"); opts.optopt("P", "", "include all files from extra proto area", "DIR"); - opts.optmulti("Y", "", "AMD firmware blob directories override \ - (e.g., \"GN/1.0.0.1\")", "DIR"); + opts.optmulti( + "Y", + "", + "AMD firmware blob directories override \ + (e.g., \"GN/1.0.0.1\")", + "DIR", + ); opts.optopt("Z", "", "AMD firmware configuration file override", "FILE"); let usage = || { - println!("{}", - opts.usage("Usage: helios [OPTIONS] experiment-image [OPTIONS]")); + println!( + "{}", + opts.usage("Usage: helios [OPTIONS] experiment-image [OPTIONS]") + ); }; let log = ca.log; @@ -1170,10 +1262,9 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { None }; - let image_template = res.opt_str("N") - .unwrap_or_else( - || r"${user}@${host}: ${os_short_commit}; ${date} ${time}" - .to_string()); + let image_template = res.opt_str("N").unwrap_or_else(|| { + r"${user}@${host}: ${os_short_commit}; ${date} ${time}".to_string() + }); if res.opt_present("help") { usage(); @@ -1214,22 +1305,25 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { info!(log, "using AMD firmware configuration file {amdconf:?}"); let amdblobs = if res.opt_present("Y") { - res.opt_strs("Y").into_iter().map(|y| { - /* - * If the override is an absolute path, just pass it through. - * Otherwise look in the place where we usually store the - * firmware blobs: - */ - let d = if y.starts_with("/") { - let p = PathBuf::from(y); - assert!(p.is_absolute()); - p - } else { - top_path(&["projects", "amd-firmware", &y])? - }; + res.opt_strs("Y") + .into_iter() + .map(|y| { + /* + * If the override is an absolute path, just pass it through. + * Otherwise look in the place where we usually store the + * firmware blobs: + */ + let d = if y.starts_with("/") { + let p = PathBuf::from(y); + assert!(p.is_absolute()); + p + } else { + top_path(&["projects", "amd-firmware", &y])? + }; - Ok(d) - }).collect::>>()? + Ok(d) + }) + .collect::>>()? } else { /* * If there is no override, use the default: @@ -1248,8 +1342,11 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let builder = cargo_target_cmd("image-builder", "image-builder", true)?; let mkimage = cargo_target_cmd("bootserver", "mkimage", false)?; let pinprick = cargo_target_cmd("pinprick", "pinprick", false)?; - let ahib = cargo_target_cmd("amd-host-image-builder", - "amd-host-image-builder", true)?; + let ahib = cargo_target_cmd( + "amd-host-image-builder", + "amd-host-image-builder", + true, + )?; let baseline = "/usr/lib/brand/omicron1/baseline"; if brand && !PathBuf::from(baseline).is_file() { bail!("Please run: pkg install /system/zones/brand/omicron1/tools"); @@ -1266,8 +1363,10 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { bail!("neither LOGNAME nor IMAGE_DATASET present in environment?"); }; if !zfs::dataset_exists(&imgds)? { - bail!("ZFS dataset {:?} does not exist; we need it to create images", - imgds); + bail!( + "ZFS dataset {:?} does not exist; we need it to create images", + imgds + ); } let mp = zfs::zfs_get(&imgds, "mountpoint")?; @@ -1334,8 +1433,13 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { * consolidations. To do this, we create an onu-specific repository: */ info!(log, "creating temporary repository..."); - Some(create_transformed_repo(log, &gate, &tempdir, - res.opt_present("d"), false)?) + Some(create_transformed_repo( + log, + &gate, + &tempdir, + res.opt_present("d"), + false, + )?) }; /* @@ -1357,8 +1461,8 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { cmd.arg("-F").arg(&format!("relver={}", relver)); if let Some(genproto) = &genproto { cmd.arg("-E").arg(extra_proto.as_deref().unwrap()); - cmd.arg("-F").arg(&format!("genproto={}", - genproto.to_str().unwrap())); + cmd.arg("-F") + .arg(&format!("genproto={}", genproto.to_str().unwrap())); } cmd.arg("-E").arg(&brand_extras); cmd.arg("-E").arg(&projects_extras); @@ -1369,8 +1473,8 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { cmd.arg("-F").arg("debug_variant"); } } else if let Some(repo) = &repo { - cmd.arg("-F").arg(format!("repo_redist={}", - repo.to_str().unwrap())); + cmd.arg("-F") + .arg(format!("repo_redist={}", repo.to_str().unwrap())); } cmd.arg("-F").arg("baud=3000000"); if brand { @@ -1399,10 +1503,10 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { */ info!(log, "omicron1 baseline generation..."); - ensure::run(log, &[baseline, - "-R", &root, - &brand_extras.to_str().unwrap() - ])?; + ensure::run( + log, + &[baseline, "-R", &root, &brand_extras.to_str().unwrap()], + )?; } info!(log, "image builder template: ramdisk-02-trim..."); @@ -1420,8 +1524,7 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { info!(log, "skipping installation phase, using existing archive"); } - let tname = if recovery { "zfs-recovery" } - else { "zfs" }; + let tname = if recovery { "zfs-recovery" } else { "zfs" }; info!(log, "image builder template: {}...", tname); let mut cmd = basecmd(); cmd.arg("-n").arg(tname); @@ -1433,8 +1536,10 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let mut tokens = HashMap::new(); let now: OffsetDateTime = SystemTime::now().into(); - tokens.insert("user".to_string(), - illumos::get_username()?.unwrap_or_else(|| "unknown".to_string())); + tokens.insert( + "user".to_string(), + illumos::get_username()?.unwrap_or_else(|| "unknown".to_string()), + ); tokens.insert("host".to_string(), illumos::nodename()); let dt_fmt = format_description::parse(DATE_FORMAT_STR).unwrap(); tokens.insert("date".to_string(), now.format(&dt_fmt).unwrap()); @@ -1482,12 +1587,10 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { /* * Assemble a set of extra metadata to include in the archive. */ - let mut infos = vec![ - ( - "image-args.txt".to_string(), - format!("image arguments: {:#?}\n", ca.args).as_bytes().to_vec(), - ), - ]; + let mut infos = vec![( + "image-args.txt".to_string(), + format!("image arguments: {:#?}\n", ca.args).as_bytes().to_vec(), + )]; /* * Include some basic git metadata from the set of project directories we @@ -1609,9 +1712,9 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let tar = archive::Archive::new( &tarpath, metadata::MetadataBuilder::new(ArchiveType::Os) - .info("name", &image_name)? - .info("checksum", &csum)? - .build()?, + .info("name", &image_name)? + .info("checksum", &csum)? + .build()?, )?; for (name, data) in infos { @@ -1628,8 +1731,16 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let mkcpio = top_path(&["image", "mkcpio.sh"])?; let cpio = rel_path(Some(&outdir), &["cpio"])?; info!(log, "creating boot archive (CPIO)..."); - ensure::run(log, &["bash", mkcpio.to_str().unwrap(), - &root, cpio.to_str().unwrap(), tempdir.to_str().unwrap()])?; + ensure::run( + log, + &[ + "bash", + mkcpio.to_str().unwrap(), + &root, + cpio.to_str().unwrap(), + tempdir.to_str().unwrap(), + ], + )?; /* * Create a compressed CPIO and kernel to be passed to nanobl-rs via XMODEM. @@ -1640,31 +1751,64 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { let unix = format!("{}/platform/oxide/kernel/amd64/unix", root); let unixz = rel_path(Some(&outdir), &["unix.z"])?; info!(log, "creating compressed cpio/unix for nanobl-rs..."); - ensure::run(log, &["bash", "-c", - &format!("'{}' '{}' >'{}'", pinprick, unix, - unixz.to_str().unwrap())])?; + ensure::run( + log, + &[ + "bash", + "-c", + &format!( + "'{}' '{}' >'{}'", + pinprick, + unix, + unixz.to_str().unwrap() + ), + ], + )?; tar.add_file(&unixz, "unix.z")?; - ensure::run(log, &["bash", "-c", - &format!("'{}' '{}' >'{}'", pinprick, cpio.to_str().unwrap(), - cpioz.to_str().unwrap())])?; + ensure::run( + log, + &[ + "bash", + "-c", + &format!( + "'{}' '{}' >'{}'", + pinprick, + cpio.to_str().unwrap(), + cpioz.to_str().unwrap() + ), + ], + )?; tar.add_file(&cpioz, "cpio.z")?; /* * Create the reset image for the Gimlet SPI ROM: */ info!(log, "creating reset image..."); - ensure::run_in(log, &top_path(&["projects", "phbl"])?, - &["cargo", "xtask", "build", "--release", - "--cpioz", cpioz.to_str().unwrap()])?; + ensure::run_in( + log, + &top_path(&["projects", "phbl"])?, + &[ + "cargo", + "xtask", + "build", + "--release", + "--cpioz", + cpioz.to_str().unwrap(), + ], + )?; info!(log, "building host image..."); let rom = rel_path(Some(&outdir), &["rom"])?; - let reset = top_path(&["projects", "phbl", "target", - "x86_64-oxide-none-elf", "release", "phbl"])?; + let reset = top_path(&[ + "projects", + "phbl", + "target", + "x86_64-oxide-none-elf", + "release", + "phbl", + ])?; let ahibdir = top_path(&["projects", "amd-host-image-builder"])?; let ahibargs_base = { - let mut t: Vec = vec![ - ahib.as_str().into(), - ]; + let mut t: Vec = vec![ahib.as_str().into()]; for blob in amdblobs { t.push("-B".into()); t.push(blob.to_str().unwrap().into()); @@ -1685,8 +1829,11 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { t }; - ensure::run_in(log, &ahibdir, - &ahibargs.iter().map(String::as_str).collect::>())?; + ensure::run_in( + log, + &ahibdir, + &ahibargs.iter().map(String::as_str).collect::>(), + )?; tar.add_file(&rom, "rom")?; if ddr_testing { @@ -1705,8 +1852,10 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { * Produce a new configuration file with the specified * MemBusFrequencyLimit: */ - let tmpcfg = rel_path(Some(&tempdir), - &[&format!("milan-gimlet-b.ddr{}.efs.json", limit)])?; + let tmpcfg = rel_path( + Some(&tempdir), + &[&format!("milan-gimlet-b.ddr{}.efs.json", limit)], + )?; maybe_unlink(&tmpcfg)?; mk_rom_config(inputcfg.clone(), &tmpcfg, limit)?; @@ -1727,8 +1876,11 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { t }; - ensure::run_in(log, &ahibdir, - &ahibargs.iter().map(String::as_str).collect::>())?; + ensure::run_in( + log, + &ahibdir, + &ahibargs.iter().map(String::as_str).collect::>(), + )?; tar.add_file(&rom, &romname)?; } } @@ -1741,10 +1893,11 @@ fn cmd_image(ca: &CommandArg) -> Result<()> { Ok(()) } -fn mk_rom_config(mut input: serde_json::Value, output: &Path, ddr_speed: u32) - -> Result<()> -{ - +fn mk_rom_config( + mut input: serde_json::Value, + output: &Path, + ddr_speed: u32, +) -> Result<()> { let Some(bhd) = input.get_mut("bhd") else { bail!("could not find bhd"); }; @@ -1770,7 +1923,7 @@ fn mk_rom_config(mut input: serde_json::Value, output: &Path, ddr_speed: u32) target: EntryTarget, } - let ee: Entry= serde_json::from_value(e.clone())?; + let ee: Entry = serde_json::from_value(e.clone())?; if ee.target.type_ != "ApcbBackup" { continue; } @@ -1801,8 +1954,9 @@ fn mk_rom_config(mut input: serde_json::Value, output: &Path, ddr_speed: u32) }; let h: Header = serde_json::from_value(h.clone())?; - if h.group_id != 0x3000 || h.entry_id != 0x0004 || - h.instance_id != 0 + if h.group_id != 0x3000 + || h.entry_id != 0x0004 + || h.instance_id != 0 { continue; } @@ -1830,8 +1984,10 @@ fn mk_rom_config(mut input: serde_json::Value, output: &Path, ddr_speed: u32) continue; } } - dword.insert("MemBusFrequencyLimit".to_string(), - serde_json::Value::String(format!("Ddr{}", ddr_speed))); + dword.insert( + "MemBusFrequencyLimit".to_string(), + serde_json::Value::String(format!("Ddr{}", ddr_speed)), + ); } } } @@ -1991,8 +2147,11 @@ fn cmd_setup(ca: &CommandArg) -> Result<()> { let bs = git_branch_status(&path)?; if &bs.head == "(detached)" && bs.oid == fixup.from_commit { - info!(log, "applying fixup: moving to branch {}...", - fixup.to_branch); + info!( + log, + "applying fixup: moving to branch {}...", + fixup.to_branch + ); let mut child = Command::new("git") .current_dir(&path) .arg("checkout") @@ -2120,8 +2279,13 @@ fn cmd_setup(ca: &CommandArg) -> Result<()> { site_sh += &format!("TMPDIR={}\n", &tmp.to_str().unwrap()); site_sh += "DTMPDIR=$TMPDIR\n"; - ensure::file_str(&log, &site_sh, &ssp, 0o644, - ensure::Create::Always)?; + ensure::file_str( + &log, + &site_sh, + &ssp, + 0o644, + ensure::Create::Always, + )?; } if name == "illumos" { @@ -2146,8 +2310,11 @@ fn cmd_setup(ca: &CommandArg) -> Result<()> { regen_publisher_mog(log, NO_PATH, publisher)?; for mog in &["os-conflicts", "os-deps"] { let mogpath = top_path(&["packages", &format!("{}.mogrify", mog)])?; - ensure::symlink(log, &mogpath, - &format!("../tools/packages/{}.mogrify", mog))?; + ensure::symlink( + log, + &mogpath, + &format!("../tools/packages/{}.mogrify", mog), + )?; } /* @@ -2285,10 +2452,7 @@ fn main() -> Result<()> { continue; } - let ca = CommandArg { - log: &log, - args: args.as_slice(), - }; + let ca = CommandArg { log: &log, args: args.as_slice() }; return (ci.func)(&ca); } diff --git a/tools/helios-build/src/zfs.rs b/tools/helios-build/src/zfs.rs index 1ebec5f..0a6d652 100644 --- a/tools/helios-build/src/zfs.rs +++ b/tools/helios-build/src/zfs.rs @@ -3,8 +3,7 @@ use std::process::Command; * Copyright 2024 Oxide Computer Company */ - -use anyhow::{Result, bail}; +use anyhow::{bail, Result}; pub fn dataset_exists(dataset: &str) -> Result { if dataset.contains('@') { @@ -14,7 +13,8 @@ pub fn dataset_exists(dataset: &str) -> Result { let zfs = Command::new("/sbin/zfs") .env_clear() .arg("list") - .arg("-Ho").arg("name") + .arg("-Ho") + .arg("name") .arg(dataset) .output()?; @@ -34,7 +34,8 @@ pub fn zfs_get(dataset: &str, n: &str) -> Result { .env_clear() .arg("get") .arg("-H") - .arg("-o").arg("value") + .arg("-o") + .arg("value") .arg(n) .arg(dataset) .output()?;