aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe/src/advisory/partial_security_advisory.rs2
-rw-r--r--crates/shirabe/src/command/fund_command.rs2
-rw-r--r--crates/shirabe/src/downloader/zip_downloader.rs6
-rw-r--r--crates/shirabe/src/io/base_io.rs2
-rw-r--r--crates/shirabe/src/platform/version.rs6
-rw-r--r--crates/shirabe/src/repository/package_repository.rs2
-rw-r--r--crates/shirabe/src/self_update/versions.rs2
-rw-r--r--crates/shirabe/src/util/composer_mirror.rs8
-rw-r--r--crates/shirabe/tests/platform/version_test.rs3
9 files changed, 17 insertions, 16 deletions
diff --git a/crates/shirabe/src/advisory/partial_security_advisory.rs b/crates/shirabe/src/advisory/partial_security_advisory.rs
index 148bef4..d5ff999 100644
--- a/crates/shirabe/src/advisory/partial_security_advisory.rs
+++ b/crates/shirabe/src/advisory/partial_security_advisory.rs
@@ -38,7 +38,7 @@ impl PartialSecurityAdvisory {
Ok(c) => c,
Err(_) => {
let affected_version =
- Preg::replace(r"(^[>=<^~]*[\d.]+).*", "$1", affected_versions_str);
+ Preg::replace(r"{(^[>=<^~]*[\d.]+).*}", "$1", affected_versions_str);
match parser.parse_constraints(&affected_version) {
Ok(c) => c,
Err(_) => SimpleConstraint::new(
diff --git a/crates/shirabe/src/command/fund_command.rs b/crates/shirabe/src/command/fund_command.rs
index 5d1dfea..5c98031 100644
--- a/crates/shirabe/src/command/fund_command.rs
+++ b/crates/shirabe/src/command/fund_command.rs
@@ -63,7 +63,7 @@ impl FundCommand {
.unwrap_or("");
if r#type == "github"
&& let Some(matches) =
- Preg::is_match_with_indexed_captures(r"^https://github.com/([^/]+)$", &url)
+ Preg::is_match_with_indexed_captures(r"{^https://github.com/([^/]+)$}", &url)
&& let Some(sponsor) = matches.into_iter().nth(1)
{
url = format!("https://github.com/sponsors/{}", sponsor);
diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs
index 428ca2a..bc0c9e4 100644
--- a/crates/shirabe/src/downloader/zip_downloader.rs
+++ b/crates/shirabe/src/downloader/zip_downloader.rs
@@ -112,7 +112,11 @@ impl ZipDownloader {
== 0
{
let mut m: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::is_match3(r"^\s*7-Zip(?:\s\[64\])?\s([0-9.]+)", &output, Some(&mut m)) {
+ if Preg::is_match3(
+ r"{^\s*7-Zip(?:\s\[64\])?\s([0-9.]+)}",
+ &output,
+ Some(&mut m),
+ ) {
let m1 = m.get(&CaptureKey::ByIndex(1)).cloned().unwrap_or_default();
if version_compare(&m1, "21.01", "<") {
self.inner.io.write_error(&format!(
diff --git a/crates/shirabe/src/io/base_io.rs b/crates/shirabe/src/io/base_io.rs
index 79fd7b7..9cd0d33 100644
--- a/crates/shirabe/src/io/base_io.rs
+++ b/crates/shirabe/src/io/base_io.rs
@@ -141,7 +141,7 @@ pub trait BaseIO: IOInterface {
config.merge(&config_outer, "implicit-due-to-auth");
}
- if !Preg::is_match(r"^[.A-Za-z0-9_]+$", &token_str) {
+ if !Preg::is_match(r"{^[.A-Za-z0-9_]+$}", &token_str) {
return Err(anyhow::anyhow!(UnexpectedValueException {
message: format!(
"Your github oauth token for {} contains invalid characters: \"{}\"",
diff --git a/crates/shirabe/src/platform/version.rs b/crates/shirabe/src/platform/version.rs
index b78baad..cbbbe44 100644
--- a/crates/shirabe/src/platform/version.rs
+++ b/crates/shirabe/src/platform/version.rs
@@ -12,7 +12,7 @@ impl Version {
let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::match3(
- r"^(?P<version>[0-9.]+)(?P<patch>[a-z]{0,2})(?P<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)(?:-\w+)?(?: \(.+?\))?$",
+ r"/^(?P<version>[0-9.]+)(?P<patch>[a-z]{0,2})(?P<suffix>(?:-?(?:dev|pre|alpha|beta|rc|fips)[\d]*)*)(?:-\w+)?(?: \(.+?\))?$/",
openssl_version,
Some(&mut matches),
) {
@@ -56,7 +56,7 @@ impl Version {
pub fn parse_libjpeg(libjpeg_version: &str) -> Option<String> {
let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::match3(
- r"^(?P<major>\d+)(?P<minor>[a-z]*)$",
+ r"/^(?P<major>\d+)(?P<minor>[a-z]*)$/",
libjpeg_version,
Some(&mut matches),
) {
@@ -81,7 +81,7 @@ impl Version {
pub fn parse_zoneinfo_version(zoneinfo_version: &str) -> Option<String> {
let mut matches: IndexMap<CaptureKey, String> = IndexMap::new();
if !Preg::match3(
- r"^(?P<year>\d{4})(?P<revision>[a-z]*)$",
+ r"/^(?P<year>\d{4})(?P<revision>[a-z]*)$/",
zoneinfo_version,
Some(&mut matches),
) {
diff --git a/crates/shirabe/src/repository/package_repository.rs b/crates/shirabe/src/repository/package_repository.rs
index 024f191..1a5ccc8 100644
--- a/crates/shirabe/src/repository/package_repository.rs
+++ b/crates/shirabe/src/repository/package_repository.rs
@@ -82,7 +82,7 @@ impl PackageRepository {
pub fn get_repo_name(&self) -> String {
use crate::repository::RepositoryInterface;
- Preg::replace(r"^array ", "package ", &self.inner.get_repo_name())
+ Preg::replace(r"{^array }", "package ", &self.inner.get_repo_name())
}
// In PHP the inherited ArrayRepository methods lazily call the overridden initialize() to load
diff --git a/crates/shirabe/src/self_update/versions.rs b/crates/shirabe/src/self_update/versions.rs
index 9d7dfa2..856d16f 100644
--- a/crates/shirabe/src/self_update/versions.rs
+++ b/crates/shirabe/src/self_update/versions.rs
@@ -94,7 +94,7 @@ impl Versions {
self.channel = Some(channel.clone());
// rewrite '2' and '1' channels to stable for future self-updates, but LTS ones like '2.2' remain pinned
- let stored_channel = if Preg::is_match(r"^\d+$", &channel) {
+ let stored_channel = if Preg::is_match(r"{^\d+$}D", &channel) {
"stable".to_string()
} else {
channel.clone()
diff --git a/crates/shirabe/src/util/composer_mirror.rs b/crates/shirabe/src/util/composer_mirror.rs
index c0ff8d8..31f7127 100644
--- a/crates/shirabe/src/util/composer_mirror.rs
+++ b/crates/shirabe/src/util/composer_mirror.rs
@@ -15,7 +15,7 @@ impl ComposerMirror {
pretty_version: Option<&str>,
) -> String {
let reference = reference.map(|r| {
- if Preg::is_match(r"^([a-f0-9]*|%reference%)$", r) {
+ if Preg::is_match(r"{^([a-f0-9]*|%reference%)$}", r) {
r.to_string()
} else {
hash("md5", r)
@@ -56,7 +56,7 @@ impl ComposerMirror {
let mut gh_matches: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new();
let mut bb_matches: indexmap::IndexMap<CaptureKey, String> = indexmap::IndexMap::new();
let normalized_url = if Preg::match3(
- r"^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$",
+ r"#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#",
url,
Some(&mut gh_matches),
) {
@@ -72,7 +72,7 @@ impl ComposerMirror {
.unwrap_or_default(),
)
} else if Preg::match3(
- r"^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$",
+ r"#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#",
url,
Some(&mut bb_matches),
) {
@@ -88,7 +88,7 @@ impl ComposerMirror {
.unwrap_or_default(),
)
} else {
- Preg::replace(r"[^a-z0-9_.-]", "-", url.trim_matches('/'))
+ Preg::replace(r"{[^a-z0-9_.-]}i", "-", url.trim_matches('/'))
};
["%package%", "%normalizedUrl%", "%type%"]
diff --git a/crates/shirabe/tests/platform/version_test.rs b/crates/shirabe/tests/platform/version_test.rs
index 009b0a7..49fc34a 100644
--- a/crates/shirabe/tests/platform/version_test.rs
+++ b/crates/shirabe/tests/platform/version_test.rs
@@ -57,7 +57,6 @@ fn provide_openssl_versions() -> Vec<(&'static str, &'static str, bool, Option<&
}
#[test]
-#[ignore]
fn test_parse_openssl_versions() {
for (input, parsed_version, fips_expected, normalized_version) in provide_openssl_versions() {
let mut is_fips = false;
@@ -76,7 +75,6 @@ fn test_parse_openssl_versions() {
}
#[test]
-#[ignore]
fn test_parse_libjpeg_version() {
let cases = [
("9", "9.0"),
@@ -95,7 +93,6 @@ fn test_parse_libjpeg_version() {
}
#[test]
-#[ignore]
fn test_parse_zoneinfo_version() {
let cases = [
("2019c", "2019.3"),