[Pkg-javascript-devel] Bug#1026974: Bug#1026974: Cannot exclude a component from consideration using !

Julian Gilbey jdg at debian.org
Sun Dec 25 20:00:20 GMT 2022


Hi Israel,

That is exactly the behaviour I would expect from both a reading of
that manpage and the code in /usr/share/perl5/Debian/PkgJs/Utils.pm,
lines 153-217, excerpted here:

sub component_list {
    my $lerna = $OPTS->{lerna};
    my ( @components, %packages, @toDelete );
    [...]
    if ( -e 'debian/watch' ) {
        map { push @components, $1 if (/^[^#]*component=([\w\-\.]+)/) }
          open_file('debian/watch');
    }
    [...]
    if ( -e 'debian/nodejs/additional_components' ) {
        debug "Found debian/nodejs/additional_components";
        map {
            if (s/^!//) {
                push @toDelete, $_;
            }
            else {
                debug 'Adding component(s): ' . join( ', ', glob($_) );
                push @components, glob($_);
            }
        } open_file('debian/nodejs/additional_components');
    }
    [...]
    foreach (@toDelete) {
        my $ref = $_;
        @components = grep { $_ ne $ref } @components;
        delete $packages{$ref};
    }
    return \%packages;
}

So if I understand this function correctly, the intended behaviour is
exactly as I described in the bug report: writing "!brotli" in
additional_components should cause the dh-nodejs scripts to ignore
this component.  But it's possible that some of the bits I commented
out cause the function to do something else that I don't understand.

Best wishes,

   Julian


On Sun, Dec 25, 2022 at 08:36:27PM +0100, Israel Galadima wrote:
> Hi Julian,
> These are some excerpts from pkg-js-tools manpage:
> debian/nodejs/additional_components is used to set some subdirectories that
> should be considered as components even if they are not listed in debian/watch.
> Starting from pkg-js-tools version 0.12.0 and 0.12.7, the packages field in
> lerna.conf and workspaces field in package.json are used to automatically detect
> additional components. If a component should not be considered i.e, not
> automatically detected, insert its name preceded by a "!" in
> debian/nodejs/additional_components.
> From the above, I don't think "!" in debian/nodejs/additional_components is used
> to exclude a component listed in debian/watch.
> On Sun, 25 Dec 2022 at 13:09, Julian Gilbey <jdg at debian.org> wrote:
> 
>   Package: pkg-js-tools
>   Version: 0.15.12
>   Severity: normal
> 
>   I am working on a package (node-webfont) which requires a non-node
>   component.  The dh-nodejs tools keeps complaining, for example
>   debclean reports:
> 
>   Found debian/nodejs/additional_components
>   /!\ woff2/package.json not found
>   Unable to load woff2
>   /!\ brotli/package.json not found
>   Unable to load brotli
> 
>   My additional_components reads:
>   ---
>   !brotli
>   !woff2
>   ---
>   following the guidance in pkg-js-tools(7), if I've understood it
>   correctly.  But it seems that this syntax doesn't help;
>   list-node-components reports:
> 
>   [...]
>   varstream
>   woff2
>   brotli
>   !brotli
>   !woff2
> 
>   with the first occurrence being picked up from debian/watch and the !
>   occurrences being those in additional_components.  But
>   component_list in /usr/share/perl5/Debian/PkgJs/Utils.pm has a
>   different behaviour, and it would seem that that should work.
>   Unfortunately, though, it doesn't appear to do so, and I don't
>   understand why not.
> 
>   Best wishes,
> 
>      Julian



More information about the Pkg-javascript-devel mailing list