mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-08-06 13:57:14 +02:00
testing/rustic: disable self-update feature
Patch backported from https://github.com/rustic-rs/rustic/pull/975
This commit is contained in:
parent
6bd113acff
commit
2504724f11
@ -18,9 +18,14 @@ subpackages="
|
|||||||
$pkgname-fish-completion
|
$pkgname-fish-completion
|
||||||
$pkgname-zsh-completion
|
$pkgname-zsh-completion
|
||||||
"
|
"
|
||||||
source="https://github.com/rustic-rs/rustic/archive/v$pkgver/rustic-$pkgver.tar.gz"
|
source="https://github.com/rustic-rs/rustic/archive/v$pkgver/rustic-$pkgver.tar.gz
|
||||||
|
make-self-update-optional.patch
|
||||||
|
"
|
||||||
options="net" # fetch dependencies
|
options="net" # fetch dependencies
|
||||||
|
|
||||||
|
# Disable self-update feature.
|
||||||
|
_cargo_opts="--no-default-features --frozen"
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
default_prepare
|
default_prepare
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ prepare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cargo auditable build --frozen --release
|
cargo auditable build $_cargo_opts --release
|
||||||
|
|
||||||
target/release/rustic completions bash > $pkgname.bash
|
target/release/rustic completions bash > $pkgname.bash
|
||||||
target/release/rustic completions fish > $pkgname.fish
|
target/release/rustic completions fish > $pkgname.fish
|
||||||
@ -46,7 +51,7 @@ build() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
cargo test --frozen
|
cargo test $_cargo_opts
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
@ -59,4 +64,5 @@ package() {
|
|||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
44b1e2be7336f74e832c33d06101b2ad1ba79123926bd00f3e4884cd49abd75e727e26636451bc393d154ec438fd9168ae9dce8bfa4ec9ffd371b89b6b426dcd rustic-0.6.1.tar.gz
|
44b1e2be7336f74e832c33d06101b2ad1ba79123926bd00f3e4884cd49abd75e727e26636451bc393d154ec438fd9168ae9dce8bfa4ec9ffd371b89b6b426dcd rustic-0.6.1.tar.gz
|
||||||
|
f63047855f5e01ea547b921af54e81dc63559e4dee15811e6cfdbf5e503543bb76b0d2612b660c7adff1751e5564186e386145f61f50d0188e5d8215c2586962 make-self-update-optional.patch
|
||||||
"
|
"
|
||||||
|
101
testing/rustic/make-self-update-optional.patch
Normal file
101
testing/rustic/make-self-update-optional.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
Patch-Source: https://github.com/rustic-rs/rustic/pull/975
|
||||||
|
--
|
||||||
|
From b32769f275adbd719453aefe68785c303664208a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jakub Jirutka <jakub@jirutka.cz>
|
||||||
|
Date: Mon, 1 Jan 2024 09:11:13 +0100
|
||||||
|
Subject: [PATCH 2/2] feat(cli): Allow building without self-update feature
|
||||||
|
(#975)
|
||||||
|
|
||||||
|
Co-authored-by: simonsan <14062932+simonsan@users.noreply.github.com>
|
||||||
|
---
|
||||||
|
Cargo.toml | 7 ++++---
|
||||||
|
src/commands.rs | 1 +
|
||||||
|
src/commands/self_update.rs | 13 +++++++++----
|
||||||
|
3 files changed, 14 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Cargo.toml b/Cargo.toml
|
||||||
|
index 24486f1..054a994 100644
|
||||||
|
--- a/Cargo.toml
|
||||||
|
+++ b/Cargo.toml
|
||||||
|
@@ -31,9 +31,10 @@ description = { workspace = true }
|
||||||
|
members = ["crates/rustic_testing", "xtask"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
-default = []
|
||||||
|
+default = ["self-update"]
|
||||||
|
mimalloc = ["dep:mimalloc"]
|
||||||
|
jemallocator = ["dep:jemallocator-global"]
|
||||||
|
+self-update = ["dep:self_update", "dep:semver"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rustic"
|
||||||
|
@@ -67,8 +68,8 @@ serde_with = { workspace = true }
|
||||||
|
|
||||||
|
# other dependencies
|
||||||
|
chrono = { workspace = true }
|
||||||
|
-self_update = { workspace = true }
|
||||||
|
-semver = { workspace = true }
|
||||||
|
+self_update = { workspace = true, optional = true }
|
||||||
|
+semver = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
# commands
|
||||||
|
clap = { workspace = true }
|
||||||
|
diff --git a/src/commands.rs b/src/commands.rs
|
||||||
|
index 07473d3..88432ab 100644
|
||||||
|
--- a/src/commands.rs
|
||||||
|
+++ b/src/commands.rs
|
||||||
|
@@ -101,6 +101,7 @@ enum RusticCmd {
|
||||||
|
ShowConfig(ShowConfigCmd),
|
||||||
|
|
||||||
|
/// Update to the latest rustic release
|
||||||
|
+ #[cfg_attr(not(feature = "self-update"), clap(hide = true))]
|
||||||
|
SelfUpdate(SelfUpdateCmd),
|
||||||
|
|
||||||
|
/// Remove unused data or repack repository pack files
|
||||||
|
diff --git a/src/commands/self_update.rs b/src/commands/self_update.rs
|
||||||
|
index dff8fb3..f9540e4 100644
|
||||||
|
--- a/src/commands/self_update.rs
|
||||||
|
+++ b/src/commands/self_update.rs
|
||||||
|
@@ -5,8 +5,6 @@ use crate::{Application, RUSTIC_APP};
|
||||||
|
use abscissa_core::{status_err, Command, Runnable, Shutdown};
|
||||||
|
|
||||||
|
use anyhow::Result;
|
||||||
|
-use self_update::cargo_crate_version;
|
||||||
|
-use semver::Version;
|
||||||
|
|
||||||
|
/// `self-update` subcommand
|
||||||
|
#[derive(clap::Parser, Command, Debug)]
|
||||||
|
@@ -26,8 +24,9 @@ impl Runnable for SelfUpdateCmd {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl SelfUpdateCmd {
|
||||||
|
+ #[cfg(feature = "self-update")]
|
||||||
|
fn inner_run(&self) -> Result<()> {
|
||||||
|
- let current_version = Version::parse(cargo_crate_version!())?;
|
||||||
|
+ let current_version = semver::Version::parse(self_update::cargo_crate_version!())?;
|
||||||
|
|
||||||
|
let release = self_update::backends::github::Update::configure()
|
||||||
|
.repo_owner("rustic-rs")
|
||||||
|
@@ -40,7 +39,7 @@ impl SelfUpdateCmd {
|
||||||
|
|
||||||
|
let latest_release = release.get_latest_release()?;
|
||||||
|
|
||||||
|
- let upstream_version = Version::parse(&latest_release.version)?;
|
||||||
|
+ let upstream_version = semver::Version::parse(&latest_release.version)?;
|
||||||
|
|
||||||
|
match current_version.cmp(&upstream_version) {
|
||||||
|
std::cmp::Ordering::Greater => {
|
||||||
|
@@ -62,4 +61,10 @@ impl SelfUpdateCmd {
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
+ #[cfg(not(feature = "self-update"))]
|
||||||
|
+ fn inner_run(&self) -> Result<()> {
|
||||||
|
+ anyhow::bail!(
|
||||||
|
+ "This version of rustic was built without the \"self-update\" feature. Please use your system package manager to update it."
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user