changeset 7:c4e6fc065b6d

fixed problem with dsmc because of new filespace. uses excplicit destination directory now.
author casties
date Thu, 23 Sep 2004 21:55:44 +0200
parents a3feffd94021
children 65895eec9e30
files unarchiver.pl
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/unarchiver.pl	Tue Jul 13 20:32:49 2004 +0200
+++ b/unarchiver.pl	Thu Sep 23 21:55:44 2004 +0200
@@ -3,6 +3,7 @@
 use strict;
 
 use XML::LibXML;
+use FileHandle;
 
 # MPIWG libraries
 use lib '/usr/local/mpiwg/archive';
@@ -17,7 +18,7 @@
 #
 
 # program version
-my $version = "0.1 (24.9.2003)";
+my $version = "0.2 (23.9.2004)";
 
 # read command line parameters
 my $args = parseargs;
@@ -55,6 +56,7 @@
     logger("ABORT", "unable to write log file '$log_file'!!");
     exit 1;
 }
+LOG->autoflush(1);
 
 #######################################################
 # check parameters that were passed to the program
@@ -77,6 +79,9 @@
     exit 1;
 }
 
+# construct document's parent dir
+my $docparent = $docdir;
+$docparent =~ s!/[^/]+$!!;
 
 #######################################################
 # internal variables
@@ -172,15 +177,16 @@
 # runs the retriever program on $docdir and returns a list of archived files
 #
 # Sample output:
-# Retrieving          17,234 /mpiwg/archive/data/test/auto_titit_123/pageimg/essen-wind1.jpg [Done]
-#
+# (old!) Retrieving          17,234 /mpiwg/archive/data/test/auto_titit_123/pageimg/essen-wind1.jpg [Done]
+# Retrieving      42,406,326 /mpiwg/archive/data/library/B980G582/raw/00015.tif --> /mpiwg/archive/data/library/B980G582/raw/00015.tif [Done]
 sub run_retrieve {
     my %files;
-    print LOG "START unarchive $version ", scalar localtime, "\n";
+    print LOG "START unarchive $version on ", scalar localtime, "\n";
     my $archcmd = $archprog;
     $archcmd .= " retrieve -subdir=yes -replace=all";
     $archcmd .= " -description='$archname'";
-    $archcmd .= " '$docdir/'";
+    $archcmd .= " '$docdir/'"; # archive name
+    $archcmd .= " '$docparent/'"; # destination dir name
 
     my $archcnt = 0;
     print LOG "CMD: $archcmd\n";
@@ -192,6 +198,8 @@
 		Retrieving
 		\s+([\d,]+)    # size
 		\s+(\S+)       # file name
+		\s+-->
+		\s+(\S+)       # destination file name
 		\s+\[Done\]
 		/x) {
 		my $size = $1;
@@ -271,7 +279,7 @@
 
 # make shure the right user is running this program
 my $user = getlogin;
-if (($user ne "archive")&&($user ne "root")) {
+if (($user)&&($user ne "archive")&&($user ne "root")) {
     logger("ABORT", "you must be archive or root user to run this program!");
     exit 1;
 }