aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/git_downloader.rs4
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs8
-rw-r--r--crates/shirabe/src/downloader/zip_downloader.rs10
3 files changed, 13 insertions, 9 deletions
diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs
index 5e57de52..275050fd 100644
--- a/crates/shirabe/src/downloader/git_downloader.rs
+++ b/crates/shirabe/src/downloader/git_downloader.rs
@@ -19,7 +19,7 @@ use crate::util::Url;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- PhpMixed, RuntimeException, array_map, basename, dirname, impl_php_class, implode,
+ CmpOp, PhpMixed, RuntimeException, array_map, basename, dirname, impl_php_class, implode,
in_array_strict, is_dir, php_regex, preg_quote, realpath, rtrim, strlen, strpos, substr, trim,
version_compare,
};
@@ -814,7 +814,7 @@ impl VcsDownloader for GitDownloader {
// --dissociate option is only available since git 2.3.0-rc0
if git_version.is_some()
- && version_compare(git_version.as_deref().unwrap_or(""), "2.3.0-rc0", ">=")
+ && version_compare(git_version.as_deref().unwrap_or(""), "2.3.0-rc0", CmpOp::Ge)
&& Cache::is_usable(&cache_path)
{
self.inner.io.write_error3(
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 99a5bfe6..6a8bdf0e 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -17,7 +17,7 @@ use crate::util::Svn as SvnUtil;
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_php_shim::{
- PhpMixed, RuntimeException, impl_php_class, is_dir, php_regex, version_compare,
+ CmpOp, PhpMixed, RuntimeException, impl_php_class, is_dir, php_regex, version_compare,
};
#[derive(Debug)]
@@ -223,7 +223,11 @@ impl VcsDownloader for SvnDownloader {
Some(self.inner.process.clone()),
);
let mut flags: Vec<String> = vec![];
- if version_compare(&util.binary_version().unwrap_or_default(), "1.7.0", ">=") {
+ if version_compare(
+ &util.binary_version().unwrap_or_default(),
+ "1.7.0",
+ CmpOp::Ge,
+ ) {
flags.push("--ignore-ancestry".to_string());
}
diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs
index 350ea738..8870194c 100644
--- a/crates/shirabe/src/downloader/zip_downloader.rs
+++ b/crates/shirabe/src/downloader/zip_downloader.rs
@@ -11,10 +11,10 @@ use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::symfony::process::ExecutableFinder;
use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, ErrorException, PhpMixed, RuntimeException, UnexpectedValueException,
- ZipArchive, bin2hex, class_exists, file_exists, file_get_contents, filesize, function_exists,
- hash_file, impl_php_class, is_file, json_encode, php_regex, random_int, str_contains,
- str_replace, strlen, substr, version_compare,
+ CmpOp, DIRECTORY_SEPARATOR, ErrorException, PhpMixed, RuntimeException,
+ UnexpectedValueException, ZipArchive, bin2hex, class_exists, file_exists, file_get_contents,
+ filesize, function_exists, hash_file, impl_php_class, is_file, json_encode, php_regex,
+ random_int, str_contains, str_replace, strlen, substr, version_compare,
};
use std::sync::Mutex;
@@ -120,7 +120,7 @@ impl ZipDownloader {
Some(&mut m),
) {
let m1 = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default();
- if version_compare(&m1, "21.01", "<") {
+ if version_compare(&m1, "21.01", CmpOp::Lt) {
self.inner.io.borrow().write_error(&format!(
" <warning>Unzipping using {} {} may result in incorrect file permissions. Install {} 21.01+ or unzip to ensure you get correct permissions.</warning>",
executable, m1, executable,