chiark / gitweb /
debian/update-build-deps: Add versions
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 Jun 2023 18:16:45 +0000 (19:16 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 15 Jun 2023 19:24:54 +0000 (20:24 +0100)
This ensures that we will migrate only after our actual build-deps do.

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

index 99e73c84a81463bc4349de23abc165fd92d4674a..8d5b849d139b39d7b2a185e6110b1ae35bf55bdb 100755 (executable)
@@ -20,6 +20,16 @@ our %replace = (
     clap => 'librust-clap-3+derive-dev',
               );
 
+sub convert_version ($) {
+  local ($_) = @_;
+  s{^\>= ?([^,]+)\, \<[^,]+$}{$1};
+  if (m{^\d+(?:\.\d+){0,2}$}) {
+    return "(>= $_~)";
+  } else {
+    warn "don't know how to convert Cargo version spec \`$_`";
+  }
+}
+
 while (<I>) {
   if (m{^\# debian/update-build-deps}i...m{^\S}) {
     next if m{^ +librust[-+a-z0-9.]+ (?:\(.*\) )?\<!upstream-cargo\>,?\s*$};
@@ -39,6 +49,11 @@ while (<I>) {
            }
            next if length $info->{path};
 
+
+           my $version = $info->{version} // die "$file $p ?";
+           $version = convert_version($version);
+           $version = " $version" if length $version;
+
            $p =~ y/_/-/;
            my $dep = $replace{$p};
            if (!defined $dep) {
@@ -46,7 +61,7 @@ while (<I>) {
              $dep = "librust-$p$f-dev";
            }
            if (length $dep) {
-             $outputs{"$dep <!upstream-cargo>"}++;
+             $outputs{"$dep$version <!upstream-cargo>"}++;
            }
          }
        }