Skip to content

Commit

Permalink
[DO NOT MERGE] Make download dir read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Nov 21, 2024
1 parent fdca75c commit 07c55e4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build_system/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ use crate::path::{Dirs, RelPath};
use crate::utils::{copy_dir_recursively, ensure_empty_dir, spawn_and_wait};

pub(crate) fn prepare(dirs: &Dirs) {
if dirs.download_dir.exists() {
let mut make_readwrite_cmd = Command::new("chmod");
make_readwrite_cmd.arg("-R").arg("u+w").arg(".").current_dir(&dirs.download_dir);
spawn_and_wait(make_readwrite_cmd);
}
std::fs::create_dir_all(&dirs.download_dir).unwrap();
crate::tests::RAND_REPO.fetch(dirs);
crate::tests::REGEX_REPO.fetch(dirs);
Expand Down Expand Up @@ -140,6 +145,10 @@ impl GitRepo {
}

self.verify_checksum(dirs);

let mut make_readonly_cmd = Command::new("chmod");
make_readonly_cmd.arg("-R").arg("-w").arg(download_dir);
spawn_and_wait(make_readonly_cmd);
}

pub(crate) fn patch(&self, dirs: &Dirs) {
Expand All @@ -150,6 +159,10 @@ impl GitRepo {
&self.download_dir(dirs),
&self.source_dir().to_path(dirs),
);

let mut make_readonly_cmd = Command::new("chmod");
make_readonly_cmd.arg("-R").arg("-w").arg(self.source_dir().to_path(dirs));
spawn_and_wait(make_readonly_cmd);
}
}

Expand Down

0 comments on commit 07c55e4

Please sign in to comment.