Removed existing LFS check

This commit is contained in:
Joshua Barretto 2023-01-18 22:31:33 +00:00
parent 44f4dcc6f7
commit 63d0c937f0
2 changed files with 1 additions and 42 deletions

View File

@ -1,10 +1,4 @@
use std::{ use std::{env, fs::File, io::Write, path::Path, process::Command};
env,
fs::File,
io::{Read, Write},
path::{Path, PathBuf},
process::Command,
};
fn main() { fn main() {
// If these env variables exist then we are building on nix, use them as hash // If these env variables exist then we are building on nix, use them as hash
@ -52,38 +46,6 @@ fn main() {
Err(e) => panic!("failed to retrieve current git commit hash: {}", e), Err(e) => panic!("failed to retrieve current git commit hash: {}", e),
} }
} }
// Check if git-lfs is working
if env::var("DISABLE_GIT_LFS_CHECK").is_err() && cfg!(not(feature = "no-assets")) {
let asset_path: PathBuf = ["..", "assets", "voxygen", "background", "bg_main.jpg"]
.iter()
.collect();
let asset_file = match File::open(&asset_path) {
Ok(file) => file,
Err(e) => panic!(
"failed to open asset file {}: {}",
asset_path.to_str().unwrap(),
e
),
};
const LFS_MARKER: &[u8] = b"version https://git-lfs.github.com/spec/";
let mut buffer = Vec::new();
let bytes_read = asset_file
.take(LFS_MARKER.len() as u64)
.read_to_end(&mut buffer)
.expect("failed to read asset file");
if bytes_read == LFS_MARKER.len() && buffer == LFS_MARKER {
panic!(
"\n\nGit Large File Storage (git-lfs) has not been set up correctly.\n\
Most common reasons:\n\
\t- git-lfs was not installed before cloning this repository\n\
\t- this repository was not cloned from the primary gitlab mirror.\n\
\t The github mirror does not support lfs.\n\
See the book at https://book.veloren.net/ for details.\n\n"
);
}
}
} }
fn create_hash_file(hash: &str) { fn create_hash_file(hash: &str) {

View File

@ -86,9 +86,6 @@
pkgConfig = common: let pkgConfig = common: let
inherit (common) pkgs; inherit (common) pkgs;
veloren-common-ov = { veloren-common-ov = {
# Disable `git-lfs` check here since we check it ourselves
# We have to include the command output here, otherwise Nix won't run it
DISABLE_GIT_LFS_CHECK = true;
# We don't add in any information here because otherwise anything # We don't add in any information here because otherwise anything
# that depends on common will be recompiled. We will set these in # that depends on common will be recompiled. We will set these in
# our wrapper instead. # our wrapper instead.