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 12, 2025
1 parent c517077 commit c8b843a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
5 changes: 4 additions & 1 deletion crates/nao/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,12 @@ impl Nao {
) -> Result<()> {
let mut command = self.rsync_with_nao(true)?;
command
.arg("--keep-dirlinks")
.arg("--copy-dirlinks")
.arg("--copy-links")
.arg("--info=progress2")
.arg("--exclude=.git")
.arg("--exclude=webots")
.arg("--filter=dir-merge,- .gitignore")
.arg(format!("{}/", local_directory.as_ref().display()))
.arg(format!(
"{}:{}/",
Expand Down
35 changes: 5 additions & 30 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};

pub async fn populate_upload_directory(
upload_directory: impl AsRef<Path>,
Expand All @@ -31,28 +25,9 @@ pub async fn populate_upload_directory(
.await
.wrap_err("failed to link executable")?;

create_dir_all(upload_directory.join("logs"))
symlink(repository_root, upload_directory.join("source"))
.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(repository_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()
.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
2 changes: 1 addition & 1 deletion tools/pepsi/src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async fn upload_with_progress(
.get_os_version()
.await
.wrap_err_with(|| format!("failed to get OS version of {nao_address}"))?;
let expected_os_version = read_os_version(repository_root)
let expected_os_version = read_os_version(&repository_root)
.await
.wrap_err("failed to get configured OS version")?;
if nao_os_version != expected_os_version {
Expand Down

0 comments on commit c8b843a

Please sign in to comment.