[pve-devel] [PATCH proxmox-apt 3/3] standard repos: drop product acronym from repo name

Fabian Ebner f.ebner at proxmox.com
Wed Jun 30 12:20:18 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 src/repositories/mod.rs      | 14 +++++++-------
 src/repositories/standard.rs | 21 +++++++++------------
 tests/repositories.rs        | 21 +++++++--------------
 3 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/src/repositories/mod.rs b/src/repositories/mod.rs
index eba65f4..e2b0b6b 100644
--- a/src/repositories/mod.rs
+++ b/src/repositories/mod.rs
@@ -83,17 +83,17 @@ pub fn standard_repositories(
         APTStandardRepository {
             handle: APTRepositoryHandle::Enterprise,
             status: None,
-            name: APTRepositoryHandle::Enterprise.name(product),
+            name: APTRepositoryHandle::Enterprise.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::NoSubscription,
             status: None,
-            name: APTRepositoryHandle::NoSubscription.name(product),
+            name: APTRepositoryHandle::NoSubscription.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::Test,
             status: None,
-            name: APTRepositoryHandle::Test.name(product),
+            name: APTRepositoryHandle::Test.name(),
         },
     ];
 
@@ -102,22 +102,22 @@ pub fn standard_repositories(
             APTStandardRepository {
                 handle: APTRepositoryHandle::CephPacific,
                 status: None,
-                name: APTRepositoryHandle::CephPacific.name(product),
+                name: APTRepositoryHandle::CephPacific.name(),
             },
             APTStandardRepository {
                 handle: APTRepositoryHandle::CephPacificTest,
                 status: None,
-                name: APTRepositoryHandle::CephPacificTest.name(product),
+                name: APTRepositoryHandle::CephPacificTest.name(),
             },
             APTStandardRepository {
                 handle: APTRepositoryHandle::CephOctopus,
                 status: None,
-                name: APTRepositoryHandle::CephOctopus.name(product),
+                name: APTRepositoryHandle::CephOctopus.name(),
             },
             APTStandardRepository {
                 handle: APTRepositoryHandle::CephOctopusTest,
                 status: None,
-                name: APTRepositoryHandle::CephOctopusTest.name(product),
+                name: APTRepositoryHandle::CephOctopusTest.name(),
             },
         ]);
     }
diff --git a/src/repositories/standard.rs b/src/repositories/standard.rs
index 2a29852..dcfe85b 100644
--- a/src/repositories/standard.rs
+++ b/src/repositories/standard.rs
@@ -87,20 +87,17 @@ impl Display for APTRepositoryHandle {
 
 impl APTRepositoryHandle {
     /// Get the full name of the repository.
-    pub fn name(self, product: &str) -> String {
+    pub fn name(self) -> String {
         match self {
-            APTRepositoryHandle::Enterprise => {
-                format!("{} Enterprise Repository", product.to_uppercase())
-            }
-            APTRepositoryHandle::NoSubscription => {
-                format!("{} No-Subscription Repository", product.to_uppercase())
-            }
-            APTRepositoryHandle::Test => format!("{} Test Repository", product.to_uppercase()),
-            APTRepositoryHandle::CephPacific => "PVE Ceph Pacific Repository".to_string(),
-            APTRepositoryHandle::CephPacificTest => "PVE Ceph Pacific Test Repository".to_string(),
-            APTRepositoryHandle::CephOctopus => "PVE Ceph Octopus Repository".to_string(),
-            APTRepositoryHandle::CephOctopusTest => "PVE Ceph Octopus Test Repository".to_string(),
+            APTRepositoryHandle::Enterprise => "Enterprise Repository",
+            APTRepositoryHandle::NoSubscription => "No-Subscription Repository",
+            APTRepositoryHandle::Test => "Test Repository",
+            APTRepositoryHandle::CephPacific => "Ceph Pacific Repository",
+            APTRepositoryHandle::CephPacificTest => "Ceph Pacific Test Repository",
+            APTRepositoryHandle::CephOctopus => "Ceph Octopus Repository",
+            APTRepositoryHandle::CephOctopusTest => "Ceph Octopus Test Repository",
         }
+        .to_string()
     }
 
     /// Get the standard file path for the repository referenced by the handle.
diff --git a/tests/repositories.rs b/tests/repositories.rs
index 3265bce..fefc608 100644
--- a/tests/repositories.rs
+++ b/tests/repositories.rs
@@ -320,37 +320,37 @@ fn test_standard_repositories() -> Result<(), Error> {
         APTStandardRepository {
             handle: APTRepositoryHandle::Enterprise,
             status: None,
-            name: APTRepositoryHandle::Enterprise.name("pve"),
+            name: APTRepositoryHandle::Enterprise.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::NoSubscription,
             status: None,
-            name: APTRepositoryHandle::NoSubscription.name("pve"),
+            name: APTRepositoryHandle::NoSubscription.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::Test,
             status: None,
-            name: APTRepositoryHandle::Test.name("pve"),
+            name: APTRepositoryHandle::Test.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::CephPacific,
             status: None,
-            name: APTRepositoryHandle::CephPacific.name("pve"),
+            name: APTRepositoryHandle::CephPacific.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::CephPacificTest,
             status: None,
-            name: APTRepositoryHandle::CephPacificTest.name("pve"),
+            name: APTRepositoryHandle::CephPacificTest.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::CephOctopus,
             status: None,
-            name: APTRepositoryHandle::CephOctopus.name("pve"),
+            name: APTRepositoryHandle::CephOctopus.name(),
         },
         APTStandardRepository {
             handle: APTRepositoryHandle::CephOctopusTest,
             status: None,
-            name: APTRepositoryHandle::CephOctopusTest.name("pve"),
+            name: APTRepositoryHandle::CephOctopusTest.name(),
         },
     ];
 
@@ -370,17 +370,10 @@ fn test_standard_repositories() -> Result<(), Error> {
 
     let std_repos = standard_repositories("pbs", &file_vec);
 
-    expected[0].name = APTRepositoryHandle::Enterprise.name("pbs");
-    expected[1].name = APTRepositoryHandle::NoSubscription.name("pbs");
-    expected[2].name = APTRepositoryHandle::Test.name("pbs");
-
     assert_eq!(&std_repos, &expected[0..=2]);
 
     expected[0].status = Some(false);
     expected[1].status = Some(true);
-    expected[0].name = APTRepositoryHandle::Enterprise.name("pve");
-    expected[1].name = APTRepositoryHandle::NoSubscription.name("pve");
-    expected[2].name = APTRepositoryHandle::Test.name("pve");
 
     let std_repos = standard_repositories("pve", &file_vec);
 
-- 
2.30.2






More information about the pve-devel mailing list