about summary refs log tree commit diff
path: root/tools/tvlc
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-26T09·49+0300
committertazjin <tazjin@tvl.su>2022-12-26T11·16+0000
commitc6cb13856549907729e76035c818303f3c1fd244 (patch)
treed0d2711e41bf6649543587a92004b7b56056a6ac /tools/tvlc
parent1e439fb5ad042d5b55355dff260ff8241bc3e44a (diff)
chore(tools): remove depot-scanner & tvlc r/5490
These are both unused things from a long time ago, which we don't need
to keep around anymore.

Their design doc has been marked as archived.

Change-Id: Icd2744e511e78ec95ec8f39e5f79ed1fe98e9e4a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7639
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tools/tvlc')
-rw-r--r--tools/tvlc/OWNERS1
-rw-r--r--tools/tvlc/common.sh33
-rw-r--r--tools/tvlc/default.nix51
-rwxr-xr-xtools/tvlc/tvlc-new103
4 files changed, 0 insertions, 188 deletions
diff --git a/tools/tvlc/OWNERS b/tools/tvlc/OWNERS
deleted file mode 100644
index 34c668e2fbf5..000000000000
--- a/tools/tvlc/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-riking
diff --git a/tools/tvlc/common.sh b/tools/tvlc/common.sh
deleted file mode 100644
index fe7605857fd3..000000000000
--- a/tools/tvlc/common.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-set -eu
-set -o pipefail
-
-source path-scripts
-
-XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
-tvlc_root="$XDG_DATA_HOME/tvlc"
-
-nice_checkout_root=
-if [ -f "$tvlc_root"/nice_checkout_root ]; then
-  nice_checkout_root="$(cat "$tvlc_root"/nice_checkout_root)"
-fi
-nice_checkout_root="${nice_checkout_root:-$HOME/tvlc}"
-
-depot_root=
-if [ -f "$tvlc_root/depot_root" ]; then
-  depot_root="$(cat "$tvlc_root/depot_root")"
-fi
-if [ -d /depot ]; then
-  # don't require config on tvl nixos servers
-  depot_root="${depot_root:-/depot}"
-fi
-if [ -n "$depot_root" ]; then
-  export DEPOT_ROOT="$depot_root"
-fi
-
-if [ ! -d "$tvlc_root" ]; then
-  echo "tvlc: setup required"
-  echo "please run 'tvlc setup' from the depot root"
-  exit 1
-fi
diff --git a/tools/tvlc/default.nix b/tools/tvlc/default.nix
deleted file mode 100644
index a6f201485ff2..000000000000
--- a/tools/tvlc/default.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ pkgs, depot, ... }:
-
-let
-  pathScripts = pkgs.writeShellScript "imports" ''
-    export tvix_instantiate="${depot.third_party.nix}/bin/nix-instantiate"
-    export depot_scanner="${depot.tools.depot-scanner}/bin/depot-scanner"
-  '';
-
-  # setup: git rev-parse --show-toplevel > $tvlc_root/depot_root
-  # setup: mkdir $tvlc_root/clients
-  # setup: echo 1 > $tvlc_root/next_clientid
-
-  commonsh = pkgs.stdenv.mkDerivation {
-    name = "common.sh";
-    src = ./common.sh;
-    doCheck = true;
-    unpackPhase = "true";
-    buildPhase = ''
-      substitute ${./common.sh} $out --replace path-scripts ${pathScripts}
-    '';
-    checkPhase = ''
-      ${pkgs.shellcheck}/bin/shellcheck $out ${pathScripts} && echo "SHELLCHECK OK"
-    '';
-    installPhase = ''
-      chmod +x $out
-    '';
-  };
-
-  tvlcNew = pkgs.stdenv.mkDerivation {
-    name = "tvlc-new";
-    src = ./tvlc-new;
-    doCheck = true;
-
-    unpackPhase = "true";
-    buildPhase = ''
-      substitute ${./tvlc-new} $out --replace common.sh ${commonsh}
-    '';
-    checkPhase = ''
-      ${pkgs.shellcheck}/bin/shellcheck $out ${commonsh} ${pathScripts} && echo "SHELLCHECK OK"
-    '';
-    installPhase = ''
-      chmod +x $out
-    '';
-  };
-
-in
-{
-  inherit pathScripts;
-  inherit commonsh;
-  inherit tvlcNew;
-}
diff --git a/tools/tvlc/tvlc-new b/tools/tvlc/tvlc-new
deleted file mode 100755
index 4ef0df5d33b2..000000000000
--- a/tools/tvlc/tvlc-new
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/bash
-
-source common.sh
-
-set -eu
-set -o pipefail
-
-function usage() {
-  echo "tvlc new [-n|--name CLIENTNAME] [derivation...]"
-  echo ""
-  cat <<EOF
-  The 'new' command creates a new git sparse checkout with the given name, and
-  contents needed to build the Nix derivation(s) specified on the command line.
-
-  Options:
-    -n/--name client-name: Sets the git branch and nice checkout name for the
-	workspace. If the option is not provided, the name will be based on the
-	first non-option command-line argument.
-    --branch branch-name: Sets the git branch name only.
-EOF
-}
-
-checkout_name=
-branch_name=
-
-options=$(getopt -o 'n:' --long debug --long name: -- "$@")
-eval set -- "$options"
-while true; do
-  case "$1" in
-  -h)
-    usage
-    exit 0
-    ;;
-  -v)
-    version
-    exit 0
-    ;;
-  -n|--name)
-    shift
-    checkout_name="$1"
-    if [ -z "$branch_name" ]; then
-      branch_name=tvlc-"$1"
-    fi
-    ;;
-  --branch)
-    shift
-    branch_name="$1"
-    ;;
-  --)
-    shift
-    break
-    ;;
-  esac
-  shift
-done
-
-if [ $# -eq 0 ]; then
-  echo "error: workspace name, target derivations required"
-  exit 1
-fi
-
-if [ -z "$checkout_name" ]; then
-  # TODO(riking): deduce
-  echo "error: workspace name (-n) required"
-  exit 1
-fi
-
-if [ -d "$nice_checkout_root/$checkout_name" ]; then
-  echo "error: checkout $checkout_name already exists"
-  # nb: shellescape checkout_name because we expect the user to copy-paste it
-  # shellcheck disable=SC1003
-  echo "consider deleting it with tvlc remove '${checkout_name/'/\'}'"
-  exit 1
-fi
-if [ -f "$DEPOT_ROOT/.git/refs/heads/$branch_name" ]; then
-  echo "error: branch $branch_name already exists in git"
-  # shellcheck disable=SC1003
-  echo "consider deleting it with cd $DEPOT_ROOT; git branch -d '${checkout_name/'/\'}'"
-  exit 1
-fi
-
-# The big one: call into Nix to figure out what paths the desired derivations depend on.
-readarray -t includedPaths < <("$depot_scanner" --mode 'print' --only 'DEPOT' --relpath --depot "$DEPOT_ROOT" --nix-bin "$tvix_instantiate" "$@")
-
-# bash math
-checkout_id=$(("$(cat "$tvlc_root/next_clientid")"))
-next_checkout_id=$(("$checkout_id"+1))
-echo "$next_checkout_id" > "$tvlc_root/next_clientid"
-
-checkout_dir="$tvlc_root/clients/$checkout_id"
-mkdir "$checkout_dir"
-cd "$DEPOT_ROOT"
-git worktree add --no-checkout -b "$branch_name" "$checkout_dir"
-# BUG: git not creating the /info/ subdir
-mkdir "$DEPOT_ROOT/.git/worktrees/$checkout_id/info"
-
-cd "$checkout_dir"
-git sparse-checkout init --cone
-git sparse-checkout set "${includedPaths[@]}"
-
-ln -s "$checkout_dir" "$nice_checkout_root"/"$checkout_name"
-
-echo "$nice_checkout_root/$checkout_name"