]> git.sur5r.net Git - bacula/bacula/commitdiff
- Apply Nicolas' dvd-freespace.in patch.
authorKern Sibbald <kern@sibbald.com>
Thu, 15 Sep 2005 16:28:21 +0000 (16:28 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 15 Sep 2005 16:28:21 +0000 (16:28 +0000)
- Make sure SQL table names are not translated.
- Eliminate incorrect message saying barcodes not
  found in label barcodes -- fixes bug report.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2391 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kes-1.37
bacula/scripts/dvd-freespace.in
bacula/src/cats/sql_create.c
bacula/src/dird/ua_label.c
bacula/src/version.h

index 4b13ae4e589c8c69158be9bb702babb88c07cc3b..be0100f6e428625dff71420a576100a8eafa5cad 100644 (file)
@@ -3,6 +3,12 @@
 
 General:
 
+Changes to 1.37.39:
+15Sep05
+- Apply Nicolas' dvd-freespace.in patch.
+- Make sure SQL table names are not translated.
+- Eliminate incorrect message saying barcodes not
+  found in "label barcodes" -- fixes bug report.
 Changes to 1.37.38:
 07Sep05
 - Add ability to have passwords on backup of catalog as
index d8cc05b0ff09b7e079a97a055edbbf6c24fc6f25..2551f54613faa1ad4f1d145269026f786d1b2ad5 100755 (executable)
@@ -74,48 +74,47 @@ def gettotalsize():
         print "Cannot get media lead-out index from " + dvdrwmediainfo
         sys.exit(0)
 
-cmd=df + " " + device
-process = popen2.Popen4(cmd)
-status = process.wait()
-if not os.WIFEXITED(status):
-   print -errno.EPIPE
-   print df + " process did not not exit correctly."
-   sys.exit(0)
-
-exitstat = os.WEXITSTATUS(status) & ~0x80
-if exitstat == errno.ENOSPC:
-   print "0"
-   print os.strerror(exitstat)
-   sys.exit(0)
-if exitstat != 0:
-   print -exitstat
-   print os.strerror(exitstat)
-   sys.exit(0)
-size = 0
-while 1:
-   result = process.fromchild.readline()
-   if not result:
+def getcurrentsize():
+   cmd=df + " " + device
+   process = popen2.Popen4(cmd)
+   status = process.wait()
+   if not os.WIFEXITED(status):
       print -errno.EPIPE
-      print "Cannot get output from " + df
+      print df + " process did not not exit correctly."
       sys.exit(0)
-   index = result.find(device)
-   if index > -1: 
-      while result[index] != ' ':
-        index += 1
-      while result[index] == ' ':
-        index += 1
-      eindex = index;
-      while result[eindex] != ' ':
-        eindex += 1
-      res = result[index:eindex] 
-      if not res.isdigit():
-        print -errno.EPIPE;
-        print "Could not find size in df output"
-        sys.exit(0)
-      size = long(res)*1024
-      break
 
-size = gettotalsize()-(size+margin)
+   exitstat = os.WEXITSTATUS(status) & ~0x80
+   if exitstat == errno.ENOSPC:
+      print "0"
+      print os.strerror(exitstat)
+      sys.exit(0)
+   if exitstat != 0:
+      print -exitstat
+      print os.strerror(exitstat)
+      sys.exit(0)
+   size = 0
+   while 1:
+      result = process.fromchild.readline()
+      if not result:
+         return 0
+      index = result.find(device)
+      if index > -1: 
+         while result[index] != ' ':
+            index += 1
+         while result[index] == ' ':
+           index += 1
+         eindex = index;
+         while result[eindex] != ' ':
+           eindex += 1
+         res = result[index:eindex] 
+         if not res.isdigit():
+           print -errno.EPIPE;
+           print "Could not find size in df output"
+           sys.exit(0)
+         return long(res)*1024
+         break
+
+size = gettotalsize()-(getcurrentsize()+margin)
 if size < 0:
    size = 0
 print size
index df042726ce633455a9820172ebea084694289a3e..fb46704122f6135f0d67e384cd026149d537130d 100644 (file)
@@ -88,7 +88,7 @@ db_create_job_record(JCR *jcr, B_DB *mdb, JOB_DBR *jr)
       jr->JobId = 0;
       stat = 0;
    } else {
-      jr->JobId = sql_insert_id(mdb, _("Job"));
+      jr->JobId = sql_insert_id(mdb, N_("Job"));
       stat = 1;
    }
    db_unlock(mdb);
@@ -199,7 +199,7 @@ db_create_pool_record(JCR *jcr, B_DB *mdb, POOL_DBR *pr)
       pr->PoolId = 0;
       stat = false;
    } else {
-      pr->PoolId = sql_insert_id(mdb, _("Pool"));
+      pr->PoolId = sql_insert_id(mdb, N_("Pool"));
       stat = true;
    }
    db_unlock(mdb);
@@ -246,7 +246,7 @@ db_create_device_record(JCR *jcr, B_DB *mdb, DEVICE_DBR *dr)
       dr->DeviceId = 0;
       ok = false;
    } else {
-      dr->DeviceId = sql_insert_id(mdb, _("Device"));
+      dr->DeviceId = sql_insert_id(mdb, N_("Device"));
       ok = true;
    }
    db_unlock(mdb);
@@ -304,7 +304,7 @@ bool db_create_storage_record(JCR *jcr, B_DB *mdb, STORAGE_DBR *sr)
       Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg);
       ok = false;
    } else {
-      sr->StorageId = sql_insert_id(mdb, _("Storage"));
+      sr->StorageId = sql_insert_id(mdb, N_("Storage"));
       sr->created = true;
       ok = true;
    }
@@ -352,7 +352,7 @@ db_create_mediatype_record(JCR *jcr, B_DB *mdb, MEDIATYPE_DBR *mr)
       mr->MediaTypeId = 0;
       stat = false;
    } else {
-      mr->MediaTypeId = sql_insert_id(mdb, _("MediaType"));
+      mr->MediaTypeId = sql_insert_id(mdb, N_("MediaType"));
       stat = true;
    }
    db_unlock(mdb);
@@ -423,7 +423,7 @@ db_create_media_record(JCR *jcr, B_DB *mdb, MEDIA_DBR *mr)
             mdb->cmd, sql_strerror(mdb));
       stat = 0;
    } else {
-      mr->MediaId = sql_insert_id(mdb, _("Media"));
+      mr->MediaId = sql_insert_id(mdb, N_("Media"));
       stat = 1;
       if (mr->set_label_date) {
          char dt[MAX_TIME_LENGTH];
@@ -505,7 +505,7 @@ int db_create_client_record(JCR *jcr, B_DB *mdb, CLIENT_DBR *cr)
       cr->ClientId = 0;
       stat = 0;
    } else {
-      cr->ClientId = sql_insert_id(mdb, _("Client"));
+      cr->ClientId = sql_insert_id(mdb, N_("Client"));
       stat = 1;
    }
    db_unlock(mdb);
@@ -616,7 +616,7 @@ bool db_create_fileset_record(JCR *jcr, B_DB *mdb, FILESET_DBR *fsr)
       fsr->FileSetId = 0;
       stat = false;
    } else {
-      fsr->FileSetId = sql_insert_id(mdb, _("FileSet"));
+      fsr->FileSetId = sql_insert_id(mdb, N_("FileSet"));
       fsr->created = true;
       stat = true;
    }
@@ -736,7 +736,7 @@ static int db_create_file_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
       ar->FileId = 0;
       stat = 0;
    } else {
-      ar->FileId = sql_insert_id(mdb, _("File"));
+      ar->FileId = sql_insert_id(mdb, N_("File"));
       stat = 1;
    }
    return stat;
@@ -800,7 +800,7 @@ static int db_create_path_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
       ar->PathId = 0;
       stat = 0;
    } else {
-      ar->PathId = sql_insert_id(mdb, _("Path"));
+      ar->PathId = sql_insert_id(mdb, N_("Path"));
       stat = 1;
    }
 
@@ -854,7 +854,7 @@ static int db_create_filename_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar)
       Jmsg(jcr, M_FATAL, 0, "%s", mdb->errmsg);
       ar->FilenameId = 0;
    } else {
-      ar->FilenameId = sql_insert_id(mdb, _("Filename"));
+      ar->FilenameId = sql_insert_id(mdb, N_("Filename"));
    }
    return ar->FilenameId > 0;
 }
index 60040cdee8d46435c7b97aa7350e13d6421e595b..5d35016ee6bfc21d8d45a5c87861223217ff34bb 100644 (file)
@@ -283,6 +283,7 @@ static int do_label(UAContext *ua, const char *cmd, int relabel)
    MEDIA_DBR mr, omr;
    POOL_DBR pr;
    bool print_reminder = true;
+   bool label_barcodes = false;
    int ok = FALSE;
    int i;
    int drive;
@@ -297,6 +298,12 @@ static int do_label(UAContext *ua, const char *cmd, int relabel)
    if (!open_db(ua)) {
       return 1;
    }
+
+   if (!relabel && (i=find_arg_keyword(ua, barcode_keyword)) >= 0) {
+      *ua->argk[i] = 0;      /* zap barcode keyword */
+      label_barcodes = true;
+   }
+
    store = get_storage_resource(ua, true/*use default*/);
    if (!store) {
       return 1;
@@ -304,7 +311,7 @@ static int do_label(UAContext *ua, const char *cmd, int relabel)
    drive = get_storage_drive(ua, store);
    set_storage(ua->jcr, store);
 
-   if (!relabel && find_arg_keyword(ua, barcode_keyword) >= 0) {
+   if (label_barcodes) {
       label_from_barcodes(ua, drive);
       return 1;
    }
index ed37245d0287b8b6748d4fb34562cc3743486126..dadaa2609299b0de7929471a96de0587b8934fda 100644 (file)
@@ -3,9 +3,9 @@
  */
 
 #undef  VERSION
-#define VERSION "1.37.38"
-#define BDATE   "07 September 2005"
-#define LSMDATE "07Sep05"
+#define VERSION "1.37.39"
+#define BDATE   "15 September 2005"
+#define LSMDATE "15Sep05"
 
 /* Debug flags */
 #undef  DEBUG