Skip to content

Commit 990e60c

Browse files
authored
Merge pull request #257 from nix-community/deprecate-24_05
search: deprecate 24.05
2 parents 418c662 + c79f19d commit 990e60c

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nh"
3-
version = "4.0.0"
3+
version = "4.0.1"
44
edition = "2021"
55
license = "EUPL-1.2"
66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/search.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ use elasticsearch_dsl::*;
66
use interface::SearchArgs;
77
use regex::Regex;
88
use serde::Deserialize;
9-
use tracing::{debug, trace};
9+
use tracing::{debug, trace, warn};
1010

1111
use crate::*;
1212

13+
// List of deprecated NixOS versions
14+
// Add new versions as they become deprecated.
15+
const DEPRECATED_VERSIONS: &[&str] = &["nixos-24.05"];
16+
1317
#[derive(Debug, Deserialize)]
1418
#[allow(non_snake_case, dead_code)]
1519
struct SearchResult {
@@ -211,6 +215,12 @@ fn supported_branch<S: AsRef<str>>(branch: S) -> bool {
211215
return true;
212216
}
213217

218+
if DEPRECATED_VERSIONS.contains(&branch) {
219+
warn!("Channel {} is deprecated and not supported", branch);
220+
return false;
221+
}
222+
223+
// Support for current version pattern
214224
let re = Regex::new(r"nixos-[0-9]+\.[0-9]+").unwrap();
215225
re.is_match(branch)
216226
}
@@ -219,7 +229,8 @@ fn supported_branch<S: AsRef<str>>(branch: S) -> bool {
219229
fn test_supported_branch() {
220230
assert!(supported_branch("nixos-unstable"));
221231
assert!(!supported_branch("nixos-unstable-small"));
222-
assert!(supported_branch("nixos-24.05"));
232+
assert!(!supported_branch("nixos-24.05"));
233+
assert!(supported_branch("nixos-24.11"));
223234
assert!(!supported_branch("24.05"));
224235
assert!(!supported_branch("nixpkgs-darwin"));
225236
assert!(!supported_branch("nixpks-21.11-darwin"));

0 commit comments

Comments
 (0)