Skip to content

Commit

Permalink
Upload source distribution directly using rsync
Browse files Browse the repository at this point in the history
  • Loading branch information
julianschuler committed Jan 25, 2025
1 parent 4e93229 commit 792933d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
7 changes: 6 additions & 1 deletion crates/nao/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,14 @@ impl Nao {
let mut command = self.rsync_with_nao()?;
command
.arg("--mkpath")
.arg("--keep-dirlinks")
.arg("--copy-dirlinks")
.arg("--copy-links")
.arg("--info=progress2")
.arg("--exclude=.git")
.arg("--exclude=webots")
.arg("--exclude=tools/machine-learning")
.arg("--exclude=tools/charging-box")
.arg("--filter=dir-merge,- .gitignore")
.arg(format!("{}/", local_directory.as_ref().display()))
.arg(format!(
"{}:{}/",
Expand Down
31 changes: 5 additions & 26 deletions crates/repository/src/upload.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
use std::{ffi::OsString, path::Path};
use std::path::Path;

use color_eyre::{
eyre::{bail, Context},
Result,
};
use tokio::{
fs::{create_dir_all, symlink},
process::Command,
};
use color_eyre::{eyre::Context, Result};
use tokio::fs::{create_dir_all, symlink};

use crate::Repository;

Expand Down Expand Up @@ -37,24 +31,9 @@ impl Repository {
.await
.wrap_err("failed to create directory for logs")?;

let source_file = upload_directory.join("logs/source.tar.gz");

let mut archive_command = OsString::from("cd ");
archive_command.push(&self.root);
archive_command.push(" && git ls-files --cached --others --exclude-standard | tar Tczf - ");
archive_command.push(source_file);

let mut command = Command::new("sh");
command.arg("-c").arg(archive_command);

let status = command
.status()
symlink(&self.root, upload_directory.join("logs/source"))
.await
.wrap_err("failed to run archive command")?;

if !status.success() {
bail!("archive command failed with {status}")
}
.wrap_err("failed to link source directory")?;

Ok(())
}
Expand Down

0 comments on commit 792933d

Please sign in to comment.