Przeglądaj źródła

import the VCS module so it can check if the VCS is available

Joey Hess 19 lat temu
rodzic
commit
f4429decbe
2 zmienionych plików z 11 dodań i 1 usunięć
  1. 10 0
      scripts/Dpkg/Source/VCS/git.pm
  2. 1 1
      scripts/dpkg-source.pl

+ 10 - 0
scripts/Dpkg/Source/VCS/git.pm

@@ -37,6 +37,15 @@ delete $ENV{GIT_OBJECT_DIRECTORY};
 delete $ENV{GIT_ALTERNATE_OBJECT_DIRECTORIES};
 delete $ENV{GIT_WORK_TREE};
 
+sub import {
+	foreach my $dir (split(/:/, $ENV{PATH})) {
+		if (-x "$dir/git") {
+			return 1;
+		}
+	}
+	main::error(sprintf(_g("This source package can only be unpacked using git, which is not in the PATH.")));
+}
+
 sub sanity_check {
 	my $srcdir=shift;
 
@@ -61,6 +70,7 @@ sub sanity_check {
 		}
 	}, "$srcdir/.git");
 
+	return 1;
 }
 
 # Called before a tarball is created, to prepare the tar directory.

+ 1 - 1
scripts/dpkg-source.pl

@@ -194,7 +194,7 @@ sub loadvcs {
 	my $vcs = shift;
 	my $mod = "Dpkg::Source::VCS::$vcs";
 	eval qq{require $mod};
-	return ! $@;
+	return $@ || import $mod;
 }