Ticket #29592: image_to_archive.diff
File image_to_archive.diff, 2.8 KB (added by yaseppochi (Stephen J. Turnbull), 13 years ago) |
---|
-
src/images_to_archives.tcl
33 33 set archived_list {} 34 34 35 35 foreach installed $ilist { 36 puts $installed 36 37 set iname [lindex $installed 0] 37 38 set iversion [lindex $installed 1] 38 39 set irevision [lindex $installed 2] … … 49 50 set location "" 50 51 } 51 52 53 puts $location 54 52 55 if {$location == "" || ![file isfile $location]} { 53 56 # no image archive present, so make one 54 57 set archs [registry::property_retrieve $iref archs] … … 56 59 set archs ${macports::os_arch} 57 60 } 58 61 # look for any existing archive in the old location 59 set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}. [join $archs -]"62 set oldarchiverootname "${iname}-${iversion}_${irevision}${ivariants}.${macports::os_platform}_${macports::os_major}.[join $archs -]" 60 63 set archivetype tbz2 61 64 set oldarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}_${macports::os_major}] 62 65 set olderarchivedir [file join ${macports::portdbpath} packages ${macports::os_platform}] … … 68 71 set olderarchivedir [file join $olderarchivedir universal] 69 72 } 70 73 set found 0 71 foreach adir [list $oldarchivedir $olderarchivedir] { 74 foreach adir [list [file dirname $location] $oldarchivedir $olderarchivedir] { 75 puts $adir 72 76 foreach type {tbz2 tbz tgz tar txz tlz xar xpkg zip cpgz cpio} { 73 77 set oldarchivefullpath "[file join $adir $oldarchiverootname].${type}" 74 78 if {[file isfile $oldarchivefullpath]} { … … 92 96 set newlocation [file join $targetdir $archivename] 93 97 94 98 if {$found} { 95 file rename $oldarchivefullpath $newlocation 99 if {[catch {file rename $oldarchivefullpath $newlocation}]} { 100 puts "Found $archivename (renaming failed)." 101 } 96 102 } elseif {$installtype == "image"} { 97 # create archive from image dir 98 system "cd $location && $tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1" 99 file delete -force ${targetdir}/error.log 103 if {! [file isfile $newlocation]} { 104 # create archive from image dir 105 system "cd $location && $tarcmd -cjf $newlocation * > ${targetdir}/error.log 2>&1" 106 file delete -force ${targetdir}/error.log 107 } 100 108 } else { 101 109 # direct mode, create archive from installed files 102 110 # we tell tar to read filenames from a file so as not to run afoul of command line length limits