From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 587F871D0D for ; Wed, 30 Jun 2021 12:20:25 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4D46D1861F for ; Wed, 30 Jun 2021 12:20:25 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E520318616 for ; Wed, 30 Jun 2021 12:20:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id BC286430C7 for ; Wed, 30 Jun 2021 12:20:23 +0200 (CEST) From: Fabian Ebner To: pve-devel@lists.proxmox.com Date: Wed, 30 Jun 2021 12:20:18 +0200 Message-Id: <20210630102019.39057-4-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210630102019.39057-1-f.ebner@proxmox.com> References: <20210630102019.39057-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.632 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [standard.rs, repositories.rs, mod.rs] Subject: [pve-devel] [PATCH proxmox-apt 3/3] standard repos: drop product acronym from repo name X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2021 10:20:25 -0000 Signed-off-by: Fabian Ebner --- 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