Package: vcheck
Severity: wishlist
Tags: patch
Version: 1.2.1-6

Hello,

I provide a little patch to permit the use of PLACEHOLDER in prog.dldir.

  * vcheck: use File::Path::mkpath.
    Remove validate on dldir.
    Substitute PLACEHOLDERS in prog.dldir.
    Create directory if it does not exist.


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (90, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30+hati.1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
Daniel Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x6A2540D1

=== modified file 'vcheck'
--- vcheck	2009-07-01 16:42:49 +0000
+++ vcheck	2009-07-03 09:25:37 +0000
@@ -120,6 +120,7 @@
 require HTTP::Request;
 use Fcntl ':flock';
 use File::Basename;
+use File::Path qw{mkpath};
 
 #-----8<--------------------------------------------------------------------
 
@@ -702,13 +703,6 @@
       },
       dldir => {
         type => 'string',
-        validate => sub {
-          if (m#^/#) {
-            return (-d && -w && -x) ? 0 : 'Directory not accessible/writable'
-          } else {
-            return 'Not an absolute path'
-          }
-        },
         help => "absolute path of a directory where to put d/l'ed files"
       },
       dlexec => {
@@ -819,13 +813,6 @@
       },
       dldir => {
         type => 'string',
-        validate => sub {
-          if (m#^/#) {
-            return (-d && -w && -x) ? 0 : 'Directory not accessible/writable'
-          } else {
-            return 0  # can't check presence lacking global $dldir value
-          }
-        },
         help => "d/l directory (absolute, or relative to global \$dldir)"
       },
       dlexec => {
@@ -1284,6 +1271,9 @@
       }
     }
   }
+  if (exists $data{$name}{'dldir'}) {
+      $data{$name}{'dldir'} = &substitute_vers($data{$name}{'dldir'}, \...@vers);
+  }
 }
 
 &save_data();
@@ -1297,6 +1287,9 @@
       "$data{$_[0]}{dldir}/" :
       ($config{dldir} ? "$config{dldir}/" . (exists $data{$_[0]}{dldir} ?
       "$data{$_[0]}{dldir}/" : '') : ''));
+    if (! -d $of) {
+        mkpath($of, {mode => 0750});
+    }
     if (length $of && !(-d $of && -w $of && -x $of)) {
       eprint "--> §YSkipping§N, since §Rspecified `dldir'  doesn't exist§N.\n";
       next

Attachment: pgpOvvtOkMLdt.pgp
Description: PGP signature

Reply via email to