Subject: Re: warn about watch files that use github and include full refs

From: Gordon Ball <[email-masked]>
Date: Sun, 21 Mar 2021 08:34:58 +0000

I started a branch for lintian-brush here:
https://salsa.debian.org/chronitis/lintian-brush/-/tree/github-archive-url

(using a nonexistant lintian tag, so having a real one would definitely
be a first step).

However, it turned out to be a bit more complex than I first thought (or
hoped):

* Lots of unrelated test cases get broken (since it rewrites their watch
  files)
* Lots of different ways of spelling the match pattern - amongst my
  there were at least three (and subvariants of each)

    - .*/archive/v([0-9.]+)    # now matches nothing
    - .*/archive/(.+)          # now matches refs/tags/x.y.z
    - .*/archive/@ANY_VERSION@ # now matches nothing

  and the discussion on IRC suggested other cases too (adding a wildcard
  for the new /refs/tags/ part, just matching @ANY_VERSION@.tar.gz, etc.
* Unpreservable formatting in several of the test cases I was using
  (continuation lines in comments?)
* What new pattern to actually write? The initial idea was just to
  literally replace /archive/ with /archive/refs/tags/, which _should_
  meet the idea of being conservative about what to fix (but might still
  collide with hand-written fixes for this issue like ./archive/.*/v...

I _think_ a good indicator for lintian (and a fixer) would be if the
matching expression contains "archive" followed by no wildcard pattern
before the capturing group for the version.

Let me know if this makes sense to develop further.

Gordon