Ignore:
Timestamp:
Jan 27, 2014, 3:39:11 PM (7 years ago)
Author:
cal@…
Message:

portmgr/packaging: whitespace only, unify whitespace, reindent

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/portmgr/packaging/mpkgall.tcl

    r116517 r116518  
    1111# are met:
    1212# 1. Redistributions of source code must retain the above copyright
    13 #    notice, this list of conditions and the following disclaimer.
     13#        notice, this list of conditions and the following disclaimer.
    1414# 2. Redistributions in binary form must reproduce the above copyright
    15 #    notice, this list of conditions and the following disclaimer in the
    16 #    documentation and/or other materials provided with the distribution.
     15#        notice, this list of conditions and the following disclaimer in the
     16#        documentation and/or other materials provided with the distribution.
    1717# 3. Neither the name of Apple Inc. nor the names of its contributors
    18 #    may be used to endorse or promote products derived from this software
    19 #    without specific prior written permission.
    20 # 
     18#        may be used to endorse or promote products derived from this software
     19#        without specific prior written permission.
     20#
    2121# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    2222# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     
    5454        # XXX: probably should exclude KDE here too
    5555        if {$portname == "XFree86"} { return {} }
    56        
     56
    5757        if {[catch {set res [mportsearch "^$portname\$"]} error]} {
    5858                puts stderr "Internal error: port search failed: $error"
     
    6464                if {![info exists portinfo(version)]} { return -1 }
    6565                if {![info exists portinfo(categories)]} { return -1 }
    66                
     66
    6767                set portname $portinfo(name)
    6868                set portversion $portinfo(version)
    6969                set category [lindex $portinfo(categories) 0]
    70                
     70
    7171                set depends {}
    7272                if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
     
    7676                        set dep [lindex [split $depspec :] end]
    7777                        set result [copy_package_if_available $dep $basepath $destpath]
    78                         if {$result == -1} { 
     78                        if {$result == -1} {
    7979                                return -1
    8080                        } else {
     
    8282                        }
    8383                }
    84                
     84
    8585                set pkgname "${portname}-${portversion}.pkg"
    8686                lappend dependencies $pkgname
     
    9696                }
    9797        }
    98        
     98
    9999        return $dependencies
    100100}
     
    121121
    122122proc write_welcome_html {filename portname portversion long_description description homepage} {
    123     set fd [open ${filename} w+]
    124     if {$long_description eq ""} {
    125         set long_description $description
    126     }
     123        set fd [open ${filename} w+]
     124        if {$long_description eq ""} {
     125                set long_description $description
     126        }
    127127
    128128puts $fd "
     
    138138<p>"
    139139
    140     if {$homepage ne ""} {
    141         puts $fd "<font face=\"Helvetica\">${homepage}</font><p>"
    142     }
    143 
    144     puts $fd "<font face=\"Helvetica\">This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.</font>
     140        if {$homepage ne ""} {
     141                puts $fd "<font face=\"Helvetica\">${homepage}</font><p>"
     142        }
     143
     144        puts $fd "<font face=\"Helvetica\">This installer guides you through the steps necessary to install ${portname} ${portversion} for Mac OS X. To get started, click Continue.</font>
    145145</body>
    146146</html>"
    147147
    148     close $fd
     148        close $fd
    149149}
    150150
     
    157157proc mpkg_write_info_plist {infofile portname portversion portrevision destination dependencies} {
    158158        set vers [split $portversion "."]
    159        
     159
    160160        if {[string index $destination end] ne "/"} {
    161161                append destination /
    162162        }
    163        
     163
    164164        set depxml ""
    165165        foreach dep $dependencies {
     
    207207
    208208proc fatal args {
    209     global argv0
    210     puts stderr "$argv0: $args"
    211     exit
     209        global argv0
     210        puts stderr "$argv0: $args"
     211        exit
    212212}
    213213
     
    218218
    219219if {[catch {mportinit ui_options options variations} result]} {
    220     puts "Failed to initialize ports system, $result"
    221     exit 1
     220        puts "Failed to initialize ports system, $result"
     221        exit 1
    222222}
    223223
     
    226226# If no arguments were given, default to all ports.
    227227if {[llength $argv] == 0} {
    228         lappend argv ".*"
     228        lappend argv ".*"
    229229}
    230230
    231231foreach pname $argv {
    232 
    233 if {[catch {set res [mportsearch "^${pname}\$"]} result]} {
    234         puts "port search failed: $result"
    235         exit 1
    236 }
    237 
    238 foreach {name array} $res {
    239         global prefix
    240         array unset portinfo
    241         array set portinfo $array
    242 
    243         if {![info exists portinfo(porturl)]} {
    244                 puts stderr "Internal error: no porturl for $name"
    245                 continue
    246         }
    247        
    248         set pkgbase "/darwinports/pkgs/"
    249         set mpkgbase "/darwinports/mpkgs/"
    250         set porturl $portinfo(porturl)
    251         set prefix "/opt/local"
    252 
    253         # Skip up-to-date packages
    254         if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
    255                 if {[info exists portinfo(name)] &&
    256                         [info exists portinfo(version)] &&
    257                         [info exists portinfo(categories)]} {
    258                         set portname $portinfo(name)
    259                         set portversion $portinfo(version)
    260                         set category [lindex $portinfo(categories) 0]
    261                         set mpkgfile ${mpkgbase}/${category}/${portname}-${portversion}.mpkg/Contents/Info.plist
    262                         if {[file readable $mpkgfile] && ([file mtime ${mpkgfile}] > [file mtime ${portpath}/Portfile])} {
    263                                 puts stderr "Skipping ${portname}-${portversion}; meta-package is up to date."
    264                                 continue
    265                         }
    266                 }
    267         }
    268        
    269         # Skipt packages which previously failed
    270                
    271         # Building the mpkg:
    272         # - create an mpkg skeleton
    273         # - copy dependent pkgs into Contents/Resources directory
    274 
    275         set portname ""
    276         set portversion ""
    277         set description ""
    278         set long_description ""
    279         set homepage ""
    280         set category ""
    281 
    282         if {[info exists portinfo(name)]} {     set portname $portinfo(name) }
    283         if {[info exists portinfo(version)]} { set portversion $portinfo(version) }
    284         if {[info exists portinfo(description)]} { set description $portinfo(description) }
    285         if {[info exists portinfo(long_description)]} { set long_description $portinfo(long_description) }
    286         if {[info exists portinfo(homepage)]} { set homepage $portinfo(homepage) }
    287         if {[info exists portinfo(categories)]} { set category [lindex $portinfo(categories) 0] }
    288         if {[info exists portinfo(maintainers)]} { set maintainers $portinfo(maintainers) }
    289        
    290         puts "meta-packaging ${category}/${portname}-${portversion}"
    291 
    292         set mpkgpath "${mpkgbase}/${category}/${portname}-${portversion}.mpkg"
    293 
    294         if {[catch {system "mkdir -p -m 0755 ${mpkgpath}/Contents/Resources"} error]} {
    295                 puts stderr "Internal error: $error"
    296         }
    297        
    298         # list of .pkg names for dependencies,
    299         # built up by copy_package_if_available, and used in the Info.plist
    300         set dependencies {}
    301         set result [copy_package_if_available ${portname} $pkgbase "${mpkgpath}/Contents/Resources/"]
    302         if {$result == -1} {
    303                 puts stderr "aborting; one or more dependencies was missing."
    304                 if {[catch {system "rm -R ${mpkgpath}"} error]} {
     232        if {[catch {set res [mportsearch "^${pname}\$"]} result]} {
     233                puts "port search failed: $result"
     234                exit 1
     235        }
     236
     237        foreach {name array} $res {
     238                global prefix
     239                array unset portinfo
     240                array set portinfo $array
     241
     242                if {![info exists portinfo(porturl)]} {
     243                        puts stderr "Internal error: no porturl for $name"
     244                        continue
     245                }
     246
     247                set pkgbase "/darwinports/pkgs/"
     248                set mpkgbase "/darwinports/mpkgs/"
     249                set porturl $portinfo(porturl)
     250                set prefix "/opt/local"
     251
     252                # Skip up-to-date packages
     253                if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
     254                        if {[info exists portinfo(name)] &&
     255                                [info exists portinfo(version)] &&
     256                                [info exists portinfo(categories)]} {
     257                                set portname $portinfo(name)
     258                                set portversion $portinfo(version)
     259                                set category [lindex $portinfo(categories) 0]
     260                                set mpkgfile ${mpkgbase}/${category}/${portname}-${portversion}.mpkg/Contents/Info.plist
     261                                if {[file readable $mpkgfile] && ([file mtime ${mpkgfile}] > [file mtime ${portpath}/Portfile])} {
     262                                        puts stderr "Skipping ${portname}-${portversion}; meta-package is up to date."
     263                                        continue
     264                                }
     265                        }
     266                }
     267
     268                # Skipt packages which previously failed
     269
     270                # Building the mpkg:
     271                # - create an mpkg skeleton
     272                # - copy dependent pkgs into Contents/Resources directory
     273
     274                set portname ""
     275                set portversion ""
     276                set description ""
     277                set long_description ""
     278                set homepage ""
     279                set category ""
     280
     281                if {[info exists portinfo(name)]} {     set portname $portinfo(name) }
     282                if {[info exists portinfo(version)]} { set portversion $portinfo(version) }
     283                if {[info exists portinfo(description)]} { set description $portinfo(description) }
     284                if {[info exists portinfo(long_description)]} { set long_description $portinfo(long_description) }
     285                if {[info exists portinfo(homepage)]} { set homepage $portinfo(homepage) }
     286                if {[info exists portinfo(categories)]} { set category [lindex $portinfo(categories) 0] }
     287                if {[info exists portinfo(maintainers)]} { set maintainers $portinfo(maintainers) }
     288
     289                puts "meta-packaging ${category}/${portname}-${portversion}"
     290
     291                set mpkgpath "${mpkgbase}/${category}/${portname}-${portversion}.mpkg"
     292
     293                if {[catch {system "mkdir -p -m 0755 ${mpkgpath}/Contents/Resources"} error]} {
    305294                        puts stderr "Internal error: $error"
    306295                }
    307                 continue
    308         } else {
    309                 set result [lsort -uniq $result]
    310                 eval "lappend dependencies $result"
    311         }
    312        
    313         #
    314         # Begin quote from portmpkg.tcl
    315         #
    316     write_PkgInfo ${mpkgpath}/Contents/PkgInfo
    317     mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $prefix $dependencies
    318     write_description_plist ${mpkgpath}/Contents/Resources/Description.plist $portname $portversion $description
    319     # long_description, description, or homepage may not exist
    320     foreach variable {long_description description homepage} {
    321         if {![info exists $variable]} {
    322             set pkg_$variable ""
    323         } else {
    324             set pkg_$variable [set $variable]
    325         }
    326     }
    327     write_welcome_html ${mpkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
    328     file copy -force -- /opt/local/share/darwinports/resources/port1.0/package/background.tiff \
     296
     297                # list of .pkg names for dependencies,
     298                # built up by copy_package_if_available, and used in the Info.plist
     299                set dependencies {}
     300                set result [copy_package_if_available ${portname} $pkgbase "${mpkgpath}/Contents/Resources/"]
     301                if {$result == -1} {
     302                        puts stderr "aborting; one or more dependencies was missing."
     303                        if {[catch {system "rm -R ${mpkgpath}"} error]} {
     304                                puts stderr "Internal error: $error"
     305                        }
     306                        continue
     307                } else {
     308                        set result [lsort -uniq $result]
     309                        eval "lappend dependencies $result"
     310                }
     311
     312                #
     313                # Begin quote from portmpkg.tcl
     314                #
     315                write_PkgInfo ${mpkgpath}/Contents/PkgInfo
     316                mpkg_write_info_plist ${mpkgpath}/Contents/Info.plist $portname $portversion $prefix $dependencies
     317                write_description_plist ${mpkgpath}/Contents/Resources/Description.plist $portname $portversion $description
     318                # long_description, description, or homepage may not exist
     319                foreach variable {long_description description homepage} {
     320                        if {![info exists $variable]} {
     321                                set pkg_$variable ""
     322                        } else {
     323                                set pkg_$variable [set $variable]
     324                        }
     325                }
     326                write_welcome_html ${mpkgpath}/Contents/Resources/Welcome.html $portname $portversion $pkg_long_description $pkg_description $pkg_homepage
     327                file copy -force -- /opt/local/share/darwinports/resources/port1.0/package/background.tiff \
    329328                        ${mpkgpath}/Contents/Resources/background.tiff
    330         #
    331         # End quote from portmpkg.tcl
    332         #
    333 }
    334 
     329                #
     330                # End quote from portmpkg.tcl
     331                #
     332        }
    335333}
    336334# end foreach pname
Note: See TracChangeset for help on using the changeset viewer.