[devscripts] 01/02: debsnap: Make the destdir just before downloading
James McCoy
jamessan at debian.org
Mon Feb 29 02:09:53 UTC 2016
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit c5fe1bdfeb9fbd432d47b46f01ddd9383ec62aee
Author: James McCoy <jamessan at debian.org>
Date: Sun Feb 28 16:23:17 2016 -0500
debsnap: Make the destdir just before downloading
Closes: #816022
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 7 ++++++-
scripts/debsnap.pl | 12 +++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a68352c..ff4f351 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,7 +9,12 @@ devscripts (2.16.2) UNRELEASED; urgency=medium
[ Dominique Dumont ]
* licensecheck:
- - parse (c) owner with email like info at foo.com
+ + parse (c) owner with email like info at foo.com
+
+ [ James McCoy ]
+ * debsnap:
+ + Only make the destination directory if there is something to download.
+ (Closes: #816022)
-- Osamu Aoki <osamu at debian.org> Sat, 13 Feb 2016 22:10:05 +0900
diff --git a/scripts/debsnap.pl b/scripts/debsnap.pl
index bbad0c2..6ebd8b2 100755
--- a/scripts/debsnap.pl
+++ b/scripts/debsnap.pl
@@ -222,7 +222,15 @@ if (-d $opt{destdir}) {
fatal "Destination dir $opt{destdir} already exists.\nPlease (re)move it first, or use --force to overwrite.";
}
}
-make_path($opt{destdir});
+
+my $mkdir_done = 0;
+my $mkDestDir = sub {
+ unless ($mkdir_done)
+ {
+ make_path($opt{destdir});
+ $mkdir_done = 1;
+ }
+};
my $json_text = fetch_json_page($baseurl);
unless ($json_text && @{$json_text->{result}}) {
@@ -266,6 +274,7 @@ if ($opt{binary}) {
my $file_name = basename($fileinfo->{name});
if (!have_file("$opt{destdir}/$file_name", $hash)) {
verbose "Getting file $file_name: $file_url";
+ $mkDestDir->();
LWP::Simple::getstore($file_url, "$opt{destdir}/$file_name");
}
}
@@ -299,6 +308,7 @@ else {
$file_name = basename($file_name);
if (!have_file("$opt{destdir}/$file_name", $hash)) {
verbose "Getting file $file_name: $file_url";
+ $mkDestDir->();
LWP::Simple::getstore($file_url, "$opt{destdir}/$file_name");
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list