On Tue, Mar 31, 2026 at 04:04:04PM +0800, Chow Loong Jin wrote:
> On Mon, Mar 30, 2026 at 01:05:34AM +0200, Agustin Martin wrote:
> > On Thu, Sep 18, 2025 at 11:58:56AM +0800, Chow Loong Jin wrote:
> > > Package: devscripts
> > > Version: 2.25.19ubuntu2
> > > Severity: normal
> > > When using the following debian/watch file:
> > > 
> > > --- debian/watch --
> > > Version: 5
> > > 
> > > Template: Github
> > > Owner: prusa3d
> > > Project: prusaslicer
> > > Release-Only: yes
> > > ---
> > ...
> > > This is wrong, because according to
> > > https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28, this
> > > actually means it's trying to search for git refs matching
> > > `refs/release/*`, which don't exist.
> > > 
> > > Instead, the URL to search should be
> > > https://api.github.com/repos/prusa3d/prusaslicer/releases, which
> > > actually lists the releases for the project, along with tarball links.
> > 
> > Hi all,
> > 
> > Seems that attached patch helps with the 'Release-Only' problem in rdma-core
> > and nextcloud-desktop, using pure template watch files.
> > 
> > It however does not help with slic3r-prusa because of the "version_" prefix.
> 
> I think downloadurlmangle should not be set when release-only is true.
> It might be better to separate the logic for releaseonly into completely
> different if-else branches instead of using a ternary.

Hello,

Agreed in the general case. Same for matchingpattern (See #1120369 uscan:
Github template w/ custom Matching-Pattern fails: Unknown compression).
While there may be some uses where this can be done safely, seems that this
is not true in the general case.

I have seen that Yadd has opened a merge request to use a new
'Version-Prefix' option,

https://salsa.debian.org/debian/devscripts/-/merge_requests/633

Did not test it yet. Will not be able to write comments to salsa for some
days, but hope to test that change soon.

In parallel I have thinking about a new 'Custom-Version' option for more of
less "special" versioning. See attached patch. With it and an entry like

Custom-Version: version_@ANY_VERSION@

in slic3r-prusa debian/watch, seems that things are working. 

Changes in Github.pm in this patch may be needed regardless of this
particular problem.

Note that it is a very first cut and is tested only with slic3r-prusa.
It should only be used with templates.

> Additionally, it would be nice to have a new setting to select only
> asset tarballs instead of snapshot tarballs. For example, in hyprland,
> with the following watch file, we would like to use [1] instead of [2],
> because the latter lacks hardcoded version info (see [3] for a diff) and
> leads to bugs like [4].

I like the https://github.com address and I would like to have a reference
to [2] in the releases page. Otherwise the possible problem is that if
github changes location template would need change.

> [1] 
> https://github.com/hyprwm/Hyprland/releases/download/v0.54.2/source-v0.54.2.tar.gz
> [2] https://api.github.com/repos/hyprwm/Hyprland/tarball/v0.54.2
> [3] 
> https://salsa.debian.org/hyprland-team/hyprland/-/compare/upstream%2F0.54.2+ds1..upstream%2F0.54.2+ds?from_project_id=106116#line_0abc253f1_A2
> [4] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1131628

Hope this helps,

-- 
Agustin
>From c64bb4a7eca717469562bd16275f5ac47a7b2ca0 Mon Sep 17 00:00:00 2001
From: Agustin Martin <[email protected]>
Date: Tue, 31 Mar 2026 11:24:49 +0200
Subject: [PATCH] lib/Devscripts/Uscan/*: First cut for a 'Custom-Version'
 option.

---
 lib/Devscripts/Uscan/Templates/Github.pm      |  8 ++++++--
 lib/Devscripts/Uscan/WatchSource.pm           |  2 +-
 lib/Devscripts/Uscan/WatchSource/Transform.pm | 14 +++++++++++++-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/lib/Devscripts/Uscan/Templates/Github.pm b/lib/Devscripts/Uscan/Templates/Github.pm
index 30f1c07c..e9de4a72 100644
--- a/lib/Devscripts/Uscan/Templates/Github.pm
+++ b/lib/Devscripts/Uscan/Templates/Github.pm
@@ -28,8 +28,12 @@ sub transform {
       ||= 's%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g';
     $watchSource->{filenamemangle} ||= (
         $watchSource->{component}
-        ? 's%.*/(?:[^/]+(?<=(?:\D|alpha|beta|rc))\-)?@ANY_VERSION@%@PACKAGE@-@COMPONENT@-$1.tar.gz%'
-        : 's%.*/(?:[^/]+(?<=(?:\D|alpha|beta|rc))\-)?@ANY_VERSION@%@PACKAGE@-$1.tar.gz%'
+        ? 's%.*/(?:[^/]+(?<=(?:\D|alpha|beta|rc))\-)?'
+          . $watchSource->{versiontype}
+          . '%@PACKAGE@-@COMPONENT@-$1.tar.gz%'
+        : 's%.*/(?:[^/]+(?<=(?:\D|alpha|beta|rc))\-)?'
+          . $watchSource->{versiontype}
+          . '%@PACKAGE@-$1.tar.gz%'
     );
     $watchSource->{searchmode} ||= 'plain';
     $watchSource->{pgpmode}    ||= 'none';
diff --git a/lib/Devscripts/Uscan/WatchSource.pm b/lib/Devscripts/Uscan/WatchSource.pm
index 2586e1ff..afc8b295 100644
--- a/lib/Devscripts/Uscan/WatchSource.pm
+++ b/lib/Devscripts/Uscan/WatchSource.pm
@@ -117,7 +117,7 @@ foreach (qw(
     component ctype hrefdecode repacksuffix unzipopt searchmode
     dirversionmangle downloadurlmangle dversionmangle filenamemangle pagemangle
     oversionmangle oversionmanglepagemangle pgpsigurlmangle uversionmangle
-    versionmangle versiontype
+    versionmangle versiontype customversion
     )
 ) {
     has $_ => (
diff --git a/lib/Devscripts/Uscan/WatchSource/Transform.pm b/lib/Devscripts/Uscan/WatchSource/Transform.pm
index 292510dd..49c52875 100644
--- a/lib/Devscripts/Uscan/WatchSource/Transform.pm
+++ b/lib/Devscripts/Uscan/WatchSource/Transform.pm
@@ -62,13 +62,25 @@ qq'Template "$watchSource->{template}" has no transform function';
             }
 
           # Templates can use Version-Type to define type of versions to accept
+            my $FORCED_VERSION_TYPE
+              = (defined $watchSource->{versiontype})
+              ? 1
+              : '';
             $watchSource->{versiontype} ||= 'ANY_VERSION';
             unless ($watchSource->{versiontype} =~ /^[A-Z_]+$/
                 and __PACKAGE__->can($watchSource->{versiontype})) {
                 uscan_die 'Bad Version-Type';
                 return;
             }
-            $watchSource->{versiontype} = "\@$watchSource->{versiontype}\@";
+            if (defined $watchSource->{customversion}) {
+                uscan_die
+"Explicit \"Version-Type\" and \"Custom-Version\" not allowed together in watch file.\n"
+                  if $FORCED_VERSION_TYPE;
+                $watchSource->{versiontype} = $watchSource->{customversion};
+            } else {
+                $watchSource->{versiontype}
+                  = "\@$watchSource->{versiontype}\@";
+            }
             my $tmp = eval { $transform->($watchSource) };
             if ($@) {
                 uscan_die "$pkg failed: $@";
-- 
2.53.0

Reply via email to