chiark / gitweb /
packaging: Fix update-build-deps to handle features
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Dec 2022 22:02:58 +0000 (22:02 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 14 Dec 2022 22:06:52 +0000 (22:06 +0000)
It's not clear to me how one is supposed to know whether to put the
extra +default in the dependency.  Do it ad hoc.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/update-build-deps

index fbeea84ea6258418a65f82041ae435493075360f..9edd0294f3d0f37a90608b2adc961fe85d985dd5 100755 (executable)
@@ -4,9 +4,13 @@ use strict;
 open I, "debian/control" or die $!;
 open O, ">debian/control.new" or die $!;
 
+our %need_features = qw(
+    env-logger +default
+                     );
+
 while (<I>) {
   if (m{^\# debian/update-build-deps}i...m{^\S}) {
-    next if m{^ +librust[-a-z0-9]+,?\s*$};
+    next if m{^ +librust[-+a-z0-9]+ \<!cargo-upstream\>,?\s*$};
     if (m{^\S} && !m{^\#}i) {
       local ($_);
       open C, "Cargo.toml" or die $!;
@@ -16,7 +20,8 @@ while (<I>) {
        my $p = $1;
        next if m{path ?= ?\"};
        $p =~ y/_/-/;
-       print O "    librust-$p-dev <!cargo-upstream>,\n" or die $!;
+       my $f = $need_features{$p} // '';
+       print O "    librust-$p$f-dev <!cargo-upstream>,\n" or die $!;
       }
       C->error and die $!;
     }