Ensure we have a bare clone of aur.git locally. Update if already present.
(&self)
| 46 | |
| 47 | /// Ensure we have a bare clone of aur.git locally. Update if already present. |
| 48 | fn update_or_clone(&self) -> Result<(), Error> { |
| 49 | if self.repo_dir().exists() { |
| 50 | info!("Updating aur.git mirror..."); |
| 51 | let output = Command::new("git") |
| 52 | .arg("-C") |
| 53 | .arg(self.repo_dir()) |
| 54 | .args(["fetch", "--depth=1", "--prune"]) |
| 55 | .output() |
| 56 | .map_err(|source| Error::Io { |
| 57 | context: "fetching latest AUR git sources".to_string(), |
| 58 | source, |
| 59 | })?; |
| 60 | ensure_success(&output, "Fetching latest AUR git sources".to_string())?; |
| 61 | } else { |
| 62 | create_dir_all(self.download_dir()).map_err(|source| Error::IoPath { |
| 63 | path: self.download_dir(), |
| 64 | context: "recursively creating the directory".to_string(), |
| 65 | source, |
| 66 | })?; |
| 67 | info!("Cloning aur.git mirror..."); |
| 68 | let output = Command::new("git") |
| 69 | .args([ |
| 70 | // We want all remote branches locally, |
| 71 | // using a mirror clone is the simplest solution. |
| 72 | "clone", |
| 73 | "--mirror", |
| 74 | "--depth=1", |
| 75 | "--no-single-branch", |
| 76 | AUR_GIT_MIRROR_URL, |
| 77 | ]) |
| 78 | .arg(self.repo_dir()) |
| 79 | .output() |
| 80 | .map_err(|source| Error::Io { |
| 81 | context: "cloning AUR git sources".to_string(), |
| 82 | source, |
| 83 | })?; |
| 84 | ensure_success(&output, "Cloning AUR git sources".to_string())?; |
| 85 | } |
| 86 | Ok(()) |
| 87 | } |
| 88 | |
| 89 | /// Extract .SRCINFO and PKGBUILD files from aur.git branches. |
| 90 | fn parallel_extract_files(&self) -> Result<(), Error> { |
no test coverage detected