RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port1.0/portactivate.tcl,v
retrieving revision 1.3
diff -u -u -r1.3 portactivate.tcl
|
|
|
41 | 41 | target_requires ${com.apple.activate} main fetch extract checksum patch configure build destroot install |
42 | 42 | target_prerun ${com.apple.activate} activate_start |
43 | 43 | |
| 44 | # define options |
| 45 | options activate.copy_defaults |
| 46 | default activate.copy_defaults "" |
| 47 | |
44 | 48 | set_ui_prefix |
45 | 49 | |
| 50 | proc copy_default_file { src dst } { |
| 51 | # Only copy file if it doesn't already exist |
| 52 | if { [file exists $dst] } { |
| 53 | ui_debug [format "Default file %s already exists" $dst] |
| 54 | } else { |
| 55 | # Make sure the src file is readable |
| 56 | if { ![file readable $src] } { |
| 57 | return -code error [msgcat::mc [format "Default file %s does not exist or is not readable" $src]] |
| 58 | } |
| 59 | |
| 60 | ui_debug [format "Installing default file %s" $dst] |
| 61 | file copy $src $dst |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | proc copy_default_files {files} { |
| 66 | # args is a list of pairs of file paths. Number of args must be even |
| 67 | if { [llength $files] % 2 != 0 } { |
| 68 | return -code error [msgcat::mc "activate.copy_defaults must have an even number of parameters"] |
| 69 | } |
| 70 | |
| 71 | # copy each src/dst pair of files. src is copied to dst iff dst doesn't exist. |
| 72 | foreach { src dst } $files { |
| 73 | copy_default_file $src $dst |
| 74 | } |
| 75 | } |
| 76 | |
46 | 77 | proc activate_start {args} { |
47 | 78 | global UI_PREFIX portname portversion portrevision variations portvariants |
48 | 79 | |
… |
… |
|
62 | 93 | |
63 | 94 | proc activate_main {args} { |
64 | 95 | global portname portversion portrevision portvariants |
| 96 | |
| 97 | # activate the port |
65 | 98 | registry_activate $portname ${portversion}_${portrevision}${portvariants} |
| 99 | |
| 100 | # copy any default files that don't yet exist |
| 101 | copy_default_files [option activate.copy_defaults] |
| 102 | |
66 | 103 | return 0 |
67 | 104 | } |