diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-07 12:35:33 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-02-08 09:37:04 +0100 |
commit | d319579fc89b5ac09f10abf4bfc77c21b0fc65ce (patch) | |
tree | e4fb352f3c1cd98383955d08c20fc0d311db51b7 /src/job | |
parent | 31fb8c89fefd3167b8b928cd75ddc008da60b434 (diff) |
Remove `Artifact` type
This patch follows-up on the shrinking of the `Artifact` type and removes it
entirely.
The type is not needed. Only the `ArtifactPath` type is needed, which is a thin
wrapper around `PathBuf`, ensuring that the path is relative to the store root.
The `Artifact` type used `pom` to parse the name and version of the package from
the `ArtifactPath` object it contained, which resulted in the restriction that
the path must always be
<name>-<version>...
Which should not be a requirement and actually caused issues with a package
named "foo-bar" (as an example).
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/job')
-rw-r--r-- | src/job/resource.rs | 10 | ||||
-rw-r--r-- | src/job/runnable.rs | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/job/resource.rs b/src/job/resource.rs index d4fa654..d657599 100644 --- a/src/job/resource.rs +++ b/src/job/resource.rs @@ -8,13 +8,13 @@ // SPDX-License-Identifier: EPL-2.0 // -use crate::filestore::Artifact; +use crate::filestore::ArtifactPath; use crate::util::EnvironmentVariableName; #[derive(Clone, Debug)] pub enum JobResource { Environment(EnvironmentVariableName, String), - Artifact(Artifact), + Artifact(ArtifactPath), } impl From<(EnvironmentVariableName, String)> for JobResource { @@ -23,8 +23,8 @@ impl From<(EnvironmentVariableName, String)> for JobResource { } } -impl From<Artifact> for JobResource { - fn from(a: Artifact) -> Self { +impl From<ArtifactPath> for JobResource { + fn from(a: ArtifactPath) -> Self { JobResource::Artifact(a) } } @@ -36,7 +36,7 @@ impl JobResource { _ => None, } } - pub fn artifact(&self) -> Option<&Artifact> { + pub fn artifact(&self) -> Option<&ArtifactPath> { match self { JobResource::Artifact(a) => Some(a), _ => None, diff --git a/src/job/runnable.rs b/src/job/runnable.rs index 9806939..6361a49 100644 --- a/src/job/runnable.rs +++ b/src/job/runnable.rs @@ -19,7 +19,7 @@ use log::trace; use uuid::Uuid; use crate::config::Configuration; -use crate::filestore::Artifact; +use crate::filestore::ArtifactPath; use crate::job::Job; use crate::job::JobResource; use crate::package::Package; @@ -57,7 +57,7 @@ impl RunnableJob { job: &Job, source_cache: &SourceCache, config: &Configuration, - dependencies: Vec<Artifact>, + dependencies: Vec<ArtifactPath>, ) -> Result<Self> { // Add the environment from the original Job object to the resources let resources = dependencies |