[116443] trunk/base/src/images_to_archives.tcl

cal at macports.org cal at macports.org
Sat Jan 25 08:43:11 PST 2014


Revision: 116443
          https://trac.macports.org/changeset/116443
Author:   cal at macports.org
Date:     2014-01-25 08:43:11 -0800 (Sat, 25 Jan 2014)
Log Message:
-----------
images_to_archives.tcl: use string comparisons where strings are compared, part of a patch from Gustaf Neumann

See this thread https://lists.macosforge.org/pipermail/macports-dev/2013-July/023224.html

Modified Paths:
--------------
    trunk/base/src/images_to_archives.tcl

Modified: trunk/base/src/images_to_archives.tcl
===================================================================
--- trunk/base/src/images_to_archives.tcl	2014-01-25 15:30:31 UTC (rev 116442)
+++ trunk/base/src/images_to_archives.tcl	2014-01-25 16:43:11 UTC (rev 116443)
@@ -45,19 +45,19 @@
     set iepoch [lindex $installed 5]
     set iref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
     set installtype [registry::property_retrieve $iref installtype]
-    if {$installtype == "image"} {
+    if {$installtype eq "image"} {
         set location [registry::property_retrieve $iref location]
-        if {$location == "0"} {
+        if {$location == 0} {
             set location [registry::property_retrieve $iref imagedir]
         }
     } else {
         set location ""
     }
 
-    if {$location == "" || ![file isfile $location]} {
+    if {$location eq "" || ![file isfile $location]} {
         # no image archive present, so make one
         set archs [registry::property_retrieve $iref archs]
-        if {$archs == "" || $archs == "0"} {
+        if {$archs eq "" || $archs == 0} {
             set archs ${macports::os_arch}
         }
         # look for any existing archive in the old location
@@ -88,12 +88,12 @@
         # compute new name and location of archive
         set archivename "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -].${archivetype}"
         ui_msg "Processing ${counter} of ${installed_len}: ${archivename}"
-        if {$installtype == "image"} {
+        if {$installtype eq "image"} {
             set targetdir [file dirname $location]
         } else {
             set targetdir [file join ${macports::registry.path} software ${iname}]
         }
-        if {$location == "" || ![file isdirectory $location]} {
+        if {$location eq "" || ![file isdirectory $location]} {
             set contents [$iref imagefiles]
         }
         file mkdir $targetdir
@@ -101,7 +101,7 @@
 
         if {$found} {
             file rename $oldarchivefullpath $newlocation
-        } elseif {$installtype == "image" && [file isdirectory $location]} {
+        } elseif {$installtype eq "image" && [file isdirectory $location]} {
             # create archive from image dir
             system -W $location "$tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1"
             file delete -force ${targetdir}/error.log
@@ -132,7 +132,7 @@
         set iref [lindex $archived 1]
         set newlocation [lindex $archived 3]
     
-        if {$installtype == "direct"} {
+        if {$installtype eq "direct"} {
             # change receipt to image
             $iref installtype image
             $iref state imaged
@@ -150,7 +150,7 @@
     incr counter
     set location [lindex $archived 2]
     ui_msg "Deleting ${counter} of ${archived_len}: ${location}"
-    if {$location != "" && [file isdirectory $location]} {
+    if {$location ne "" && [file isdirectory $location]} {
         if {[catch {file delete -force $location} result]} {
             ui_warn "Failed to delete ${location}: $result"
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140125/26dec843/attachment.html>


More information about the macports-changes mailing list