@@ -559,155 +559,6 @@ function install_taplo_cli {
559559 " ${taplo_bin} /taplo" --version
560560}
561561
562- function install_cargo_machete {
563- local version=" $1 "
564-
565- echo " ==> installing cargo-machete..."
566- if cargo machete --version & > /dev/null; then
567- echo " cargo-machete is already installed"
568- return
569- fi
570- if [[ -z " $version " ]]; then
571- echo " Missing cargo-machete version"
572- return 1
573- fi
574-
575- local os arch triple asset url tmpdir extract_dir cargo_bin
576- os=" $( uname -s) "
577- case " $os " in
578- Darwin | Linux) ;;
579- * )
580- echo " Unsupported operating system for cargo-machete: $( uname -s) "
581- return 1
582- ;;
583- esac
584-
585- case " $( uname -m) " in
586- x86_64 | amd64)
587- arch=" x86_64"
588- ;;
589- aarch64 | arm64)
590- arch=" aarch64"
591- ;;
592- * )
593- echo " Unsupported architecture for cargo-machete: $( uname -m) "
594- return 1
595- ;;
596- esac
597-
598- if [[ " $os " == " Darwin" ]]; then
599- triple=" ${arch} -apple-darwin"
600- else
601- if [[ " $arch " == " x86_64" ]]; then
602- triple=" ${arch} -unknown-linux-musl"
603- else
604- triple=" ${arch} -unknown-linux-gnu"
605- fi
606- fi
607-
608- asset=" cargo-machete-${version} -${triple} .tar.gz"
609- url=" https://github.com/bnjbvr/cargo-machete/releases/download/${version} /${asset} "
610- tmpdir=$( mktemp -d)
611- if ! curl -fsSL " $url " -o " ${tmpdir} /${asset} " ; then
612- rm -rf " $tmpdir "
613- echo " Failed to download cargo-machete from ${url} "
614- return 1
615- fi
616-
617- if ! tar -xzf " ${tmpdir} /${asset} " -C " $tmpdir " ; then
618- rm -rf " $tmpdir "
619- echo " Failed to extract cargo-machete archive"
620- return 1
621- fi
622-
623- CARGO_HOME=" ${CARGO_HOME:- ${HOME} / .cargo} "
624- cargo_bin=" ${CARGO_HOME} /bin"
625- mkdir -p " $cargo_bin "
626- extract_dir=" ${tmpdir} /cargo-machete-${version} -${triple} "
627- if [[ ! -f " ${extract_dir} /cargo-machete" ]]; then
628- rm -rf " $tmpdir "
629- echo " cargo-machete binary not found in archive"
630- return 1
631- fi
632-
633- install -m 755 " ${extract_dir} /cargo-machete" " ${cargo_bin} /cargo-machete"
634- rm -rf " $tmpdir "
635- cargo machete --version
636- }
637- function install_cargo_audit {
638- local version=" $1 "
639-
640- echo " ==> installing cargo-audit..."
641- if cargo audit --version & > /dev/null; then
642- echo " cargo-audit is already installed"
643- return
644- fi
645-
646- local os
647- os=" $( uname -s) "
648- if [[ " $os " == " Darwin" ]]; then
649- brew install cargo-audit
650- cargo audit --version
651- return
652- fi
653-
654- if [[ " $os " != " Linux" ]]; then
655- echo " Unsupported operating system for cargo-audit: $( uname -s) "
656- return 1
657- fi
658-
659- if [[ -z " $version " ]]; then
660- echo " Missing cargo-audit version"
661- return 1
662- fi
663-
664- local arch triple asset url tmpdir extract_dir cargo_bin
665- case " $( uname -m) " in
666- x86_64 | amd64)
667- triple=" x86_64-unknown-linux-musl"
668- ;;
669- aarch64 | arm64)
670- triple=" aarch64-unknown-linux-gnu"
671- ;;
672- * )
673- echo " Unsupported architecture for cargo-audit: $( uname -m) "
674- return 1
675- ;;
676- esac
677-
678- local tag
679- tag=" cargo-audit%2F${version} "
680- asset=" cargo-audit-${triple} -${version} .tgz"
681- url=" https://github.com/rustsec/rustsec/releases/download/${tag} /${asset} "
682- tmpdir=$( mktemp -d)
683- if ! curl -fsSL " $url " -o " ${tmpdir} /${asset} " ; then
684- rm -rf " $tmpdir "
685- echo " Failed to download cargo-audit from ${url} "
686- return 1
687- fi
688-
689- if ! tar -xzf " ${tmpdir} /${asset} " -C " $tmpdir " ; then
690- rm -rf " $tmpdir "
691- echo " Failed to extract cargo-audit archive"
692- return 1
693- fi
694-
695- CARGO_HOME=" ${CARGO_HOME:- ${HOME} / .cargo} "
696- cargo_bin=" ${CARGO_HOME} /bin"
697- mkdir -p " $cargo_bin "
698- extract_dir=" ${tmpdir} /cargo-audit-${triple} -${version} "
699- if [[ ! -f " ${extract_dir} /cargo-audit" ]]; then
700- rm -rf " $tmpdir "
701- echo " cargo-audit binary not found in archive"
702- return 1
703- fi
704-
705- install -m 755 " ${extract_dir} /cargo-audit" " ${cargo_bin} /cargo-audit"
706- rm -rf " $tmpdir "
707-
708- cargo audit --version
709- }
710-
711562function install_typos_cli {
712563 echo " ==> installing typos CLI..."
713564 if typos --version & > /dev/null; then
818669 cat << EOF
819670Check tools (since -c was provided):
820671 * lcov
821- * cargo-audit, cargo-machete
822672 * taplo CLI
823673 * typos CLI
824674EOF
@@ -1009,8 +859,6 @@ if [[ "$INSTALL_CHECK_TOOLS" == "true" ]]; then
1009859 fi
1010860 install_pkg lcov " $PACKAGE_MANAGER "
1011861
1012- install_cargo_audit " v0.22.0"
1013- install_cargo_machete " v0.9.1"
1014862 install_taplo_cli
1015863 install_typos_cli
1016864fi
0 commit comments