1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// Copyright (C) 2018-2025 Jelmer Vernooij <jelmer@debian.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//! Functions for working with watch files.
//!
//! This module provides utilities for manipulating and fixing Debian watch files.
//!
//! Note: The Python version has more extensive functionality for discovering
//! watch file candidates from various sources (PyPI, CRAN, GitHub, etc.).
//! This Rust version currently focuses on the core watch file manipulation
//! functions. The candidate discovery functionality can be added later as needed.
/// Value assigned when fixing watch files
pub const WATCH_FIX_VALUE: i32 = 60;
/// Common pgpsigurlmangle patterns for signature files
pub const COMMON_PGPSIGURL_MANGLES: & = &;
// TODO: Port the following functions from Python when needed:
// - probe_signature: Try to find and verify signature files for releases
// - candidates_from_setup_py: Extract watch candidates from PyPI/setup.py
// - candidates_from_upstream_metadata: Extract watch candidates from debian/upstream/metadata
// - candidates_from_hackage: Extract watch candidates from Hackage
// - guess_github_watch_entry: Generate watch entry for GitHub repos
// - guess_launchpad_watch_entry: Generate watch entry for Launchpad projects
// - guess_cran_watch_entry: Generate watch entry for CRAN packages
// - find_candidates: Find all possible watch file candidates
// - fix_old_github_patterns: Fix deprecated GitHub URL patterns
// - fix_github_releases: Convert GitHub /releases to /tags
// - fix_watch_issues: Apply all known fixes to watch entries
// - verify_watch_entry: Verify a watch entry can discover expected versions
// - watch_entries_certainty: Calculate certainty for watch entries
/// Verify that a watch file can discover the current upstream version.
///
/// After modifying a watch file, call this function to verify that the watch entry
/// still works by running `discover_blocking()` and checking if the expected upstream
/// version appears among the discovered releases.
///
/// # Arguments
///
/// * `watch_path` - Path to the debian/watch file
/// * `package` - Source package name
/// * `upstream_version` - The upstream version string to look for
///
/// # Returns
///
/// * `Some(true)` - The upstream version was found among discovered releases
/// * `Some(false)` - Discovery succeeded but the upstream version was not found
/// * `None` - Discovery failed (e.g. network error, parse error)