Hey folks,

> (...)
> and then goes on to detail how this directory name checking works
> exactly. AFAICS, this directory name checking should protect against
> these stray watch files in most of the cases, but apparently it is not
> working.
> (...)
> AFAIU, "subdir" should have matched /^test(-+.)?/, which does not seem
> to be the case, so this check seems broken in uscan?

Turns out there was a bug with the directory checking. I submitted a fix
here:

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

That MR also has a small change to the manpage that makes it a bit more
explicit that uscan works recursively by default.

>  - There currently seems to be no way to disable this behaviour at all,
>    if it turns out to be problematic?

I've found that the `--watchfile` option disables recursive processing
and just processes the given file instead. So to just process the
package in the current directory, you can run `uscan --watchfile
debian/watch`.

>  - The most common usecase seems to be scanning for new versions of a
>    single package, where this recursive scanning is not needed at all.
>    Would it not make sense to just scan the current directory by
>    default, and add an option to enable recursive scanning for usecases
>    that need it?
I still think that the current default might not be ideal. However, I do
see the usecase of running uscan over a collection of debian package at
the same time.

Maybe the default could be changed to only scan the current directory
*if* it is a debian source tree, and default to recursive scanning if
not? That would support both the "Run on a single package" and "Run on a
collection of packages" usecases neatly?

More specifically, I would suggest:
 - Adding a `--no-recursive` option, which will always check only the
   current dir (and probably produce an error if no valid package and
   watchfile can be found). This might be implemented as an alias for
   `--watchfile debian/watch` maybe.
 - Adding a `--recursive` option, which ensures that recursive operation
   happens, even when the current directory is a valid source tree. This
   is what is the current default operation.
 - Specifying more than one of `--recursive`, `--no-recursive` and
   `--watchfile` is an error.
 - When none of `--recursive`, `--no-recursive` and `--watchfile` is
   specified, the default is to use `--no-recursive` when the current
   directory is a source tree, and `--recursive` otherwise.

One open question is what constitutes a "source tree" exactly for the
purpose of the default operation. The simplest (and most conservative)
is "Whenever a debian/ subdirectory exists", the most extensive is
probably "When a debian/changelog exists and can be parsed and
debian/watch exists".

I would tend to simplest rather than complex, since that is easier to
check and harder to break (e.g. a typo in the changelog causing uscan to
behave differently).

I *can* imagine that someone would have a debian directory in their
package collection they want to run uscan on (e.g. a debian and ubuntu
directory for splitting packages between those), so maybe "When
debian/changelog exists" is a good compromise here.

How does that sound?

Gr.

Matthijs

Attachment: signature.asc
Description: PGP signature

Reply via email to