Skip to content
Permalink
Browse files

Add more appropriate types and grades of verbosity.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@221 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Jordan K. Hubbard
Jordan K. Hubbard committed Aug 21, 2002
1 parent 3988d9e commit 9226c2f8ab0291b20a36b7a3396e48106d7f5337
@@ -14,8 +14,10 @@ register com.apple.build swdep build depends_build
# define options
options make.cmd make.type make.target.all make.target.install

set UI_PREFIX "---> "

proc build_main {args} {
global portname portpath workdir worksrcdir prefix make.type make.cmd make.worksrcdir make.target.all
global portname portpath workdir worksrcdir prefix make.type make.cmd make.worksrcdir make.target.all UI_PREFIX

default make.type bsd
default make.cmd make
@@ -31,6 +33,7 @@ proc build_main {args} {
set make.cmd bsdmake
}
default make.target.all all
ui_msg "$UI_PREFIX Building $portname with target ${make.target.all}"
system "${make.cmd} ${make.target.all}"
return 0
}
@@ -13,8 +13,10 @@ register com.apple.checksum requires main fetch
# define options
options checksums

set UI_PREFIX "---> "

proc md5 {file} {
global distpath
global distpath UI_PREFIX

set md5regex "^(MD5)\[ \]\\(($file)\\)\[ \]=\[ \](\[A-Za-z0-9\]+)\n$"
set pipe [open "|md5 ${file}" r]
@@ -23,8 +25,7 @@ proc md5 {file} {
return $sum
} else {
# XXX Handle this error beter
ui_puts $line
ui_puts "md5sum failed!"
ui_error "$UI_PREFIX $line - md5sum failed!"
return -1
}
}
@@ -41,29 +42,29 @@ proc dmd5 {file} {
}

proc checksum_main {args} {
global checksums distpath portpath all_dist_files
global checksums distpath portpath all_dist_files UI_PREFIX

# If no files have been downloaded there is nothing to checksum
if ![info exists all_dist_files] {
return 0
}

if ![info exists checksums] {
ui_puts "No MD5 checksums."
ui_error "$UI_PREFIX No MD5 checksums."
return -1
}

foreach distfile $all_dist_files {
set checksum [md5 $distpath/$distfile]
set dchecksum [dmd5 $distfile]
if {$dchecksum == -1} {
ui_puts "No checksum recorded for $distfile"
ui_error "$UI_PREFIX No checksum recorded for $distfile"
return -1
}
if {$checksum == $dchecksum} {
ui_puts "Checksum OK for $distfile"
ui_msg "$UI_PREFIX Checksum OK for $distfile"
} else {
ui_puts "Checksum mismatch for $distfile"
ui_error "$UI_PREFIX Checksum mismatch for $distfile"
return -1
}
}
@@ -14,8 +14,10 @@ register com.apple.configure swdep build depends_build
# define options
options configure.type configure.args configure.worksrcdir automake automake.env automake.args autoconf autoconf.env autoconf.args xmkmf libtool

set UI_PREFIX "---> "

proc configure_main {args} {
global configure configure.type configure.args configure.worksrcdir automake automake.env automake.args autoconf autoconf.env autoconf.args xmkmf libtool portname portpath workdir worksrcdir prefix
global configure configure.type configure.args configure.worksrcdir automake automake.env automake.args autoconf autoconf.env autoconf.args xmkmf libtool portname portpath workdir worksrcdir prefix UI_PREFIX

if [info exists configure.worksrcdir] {
set configpath ${portpath}/${workdir}/${worksrcdir}/${configure.worksrcdir}
@@ -28,6 +30,7 @@ proc configure_main {args} {
# XXX depend on automake
}

ui_msg "$UI_PREFIX Running configure script"
if [info exists configure.args] {
system "./configure --prefix=${prefix} ${configure.args}"
} else {
@@ -16,8 +16,10 @@ global extract_opts
# define options
options extract_opts extract.only extract.cmd extract.before_args extract.after_args

set UI_PREFIX "---> "

proc extract_main {args} {
global portname portpath portpath workdir distname distpath distfiles use_bzip2 extract.only extract.cmd extract.before_args extract.after_args
global portname portpath portpath workdir distname distpath distfiles use_bzip2 extract.only extract.cmd extract.before_args extract.after_args UI_PREFIX

if {![info exists distfiles] && ![info exists extract.only]} {
# nothing to do
@@ -38,18 +40,17 @@ proc extract_main {args} {
set extract.after_args "-d $portpath/$workdir"
}

ui_puts "Extracting for $distname"
ui_msg "$UI_PREFIX Extracting for $distname"

cd $portpath/$workdir
foreach distfile ${extract.only} {
ui_puts "$distfile: " -nonewline
flush stdout
ui_info "$UI_PREFIX Extracting $distfile ... " -nonewline
set cmd "${extract.cmd} [join ${extract.before_args}] $distpath/$distfile [join ${extract.after_args}]"
if [catch {system $cmd} result] {
ui_puts $result
ui_error "$UI_PREFIX $result"
return -1
}
ui_puts "done"
ui_info "Done"
}
return 0
}
@@ -17,6 +17,8 @@ options master_sites patch_sites extract_sufx distfiles extract_only patchfiles
# Defaults
default extract_sufx tar.gz

set UI_PREFIX "---> "

proc suffix {distname} {
global extract_sufx use_bzip2 use_zip
if {[info exists extract_sufx]} {
@@ -46,17 +48,17 @@ proc checkfiles {args} {
}

proc fetchfiles {args} {
global distpath all_dist_files master_sites
global distpath all_dist_files master_sites UI_PREFIX

if {![file isdirectory $distpath]} {
file mkdir $distpath
}

foreach distfile $all_dist_files {
if {![file isfile $distpath/$distfile]} {
ui_puts "$distfile doesn't seem to exist in $distpath"
ui_info "$UI_PREFIX $distfile doesn't seem to exist in $distpath"
foreach site $master_sites {
ui_puts "Attempting to fetch from $site"
ui_msg "$UI_PREFIX Attempting to fetch $distfile from $site"
if ![catch {exec curl -o ${distpath}/${distfile} ${site}${distfile} >&@ stdout} result] {
set fetched 1
break
@@ -11,8 +11,10 @@ register com.apple.patch provides patch
register com.apple.patch requires main fetch checksum extract
register com.apple.patch swdep build depends_build

set UI_PREFIX "---> "

proc patch_main {args} {
global portname patchfiles distpath filedir workdir portpath
global portname patchfiles distpath filedir workdir portpath UI_PREFIX

if ![info exists patchfiles] {
return 0
@@ -29,6 +31,7 @@ proc patch_main {args} {
}
cd $portpath/$workdir
foreach patch $patchlist {
ui_info "$UI_PREFIX Applying $patch"
switch -glob -- [file tail $patch] {
*.Z -
*.gz {system "gzcat $patch | patch -p0"}
@@ -15,6 +15,9 @@ options ports_debug
# If set, output informational messages (ui_info)
options ports_verbose

# If set, don't output "standard messages"
options ports_quiet

# do whatever interesting things need to be done to initialize the UI
# environment. Always called by convention though it does nothing
# much in the "minimal UI" implementation (though it should always
@@ -69,15 +72,28 @@ proc ui_debug {str} {
}

# Output message if ports_verbose is set.
# Output debugging messages if the ports_debug variable is set.
proc ui_info {str} {
proc ui_info {str {nonl ""}} {
global ports_verbose

if [tbool ports_verbose] {
ui_puts $str
ui_puts $str $nonl
}
}

# Output message unless ports_quiet is set.
proc ui_msg {str {nonl ""}} {
global ports_quiet

if ![tbool ports_quiet] {
ui_puts $str $nonl
}
}

# Output message unconditionally as an error message.
proc ui_error {str} {
ui_puts Error: $str
}

# Get a line of input from the user and store in str, returning the
# number of bytes input.
proc ui_gets {str} {
@@ -139,7 +139,7 @@ proc register {name mode args} {
set chain [lindex $args 0]
set procedure [lindex $args 1]
if {[dlist_has_key targets $name procedure,$chain]} {
ui_puts "Warning: target '$name' re-registered for chain $chain (new procedure: '$procedure')"
ui_info "Warning: target '$name' re-registered for chain $chain (new procedure: '$procedure')"
}
dlist_set_key targets $name procedure,$chain $procedure

@@ -160,7 +160,7 @@ proc register {name mode args} {
if {[dlist_has_item targets $name]} {
dlist_append_key targets $name $mode $args
} else {
ui_puts "Warning: target '$name' not-registered in register $mode"
ui_info "Warning: target '$name' not-registered in register $mode"
}

if {[string equal provides $mode]} {
@@ -406,11 +406,11 @@ proc dlist_evaluate {dlist downstatusdict action} {
set names [array names uplist name,*]
if { [llength $names] > 0} {
# somebody broke!
ui_puts "Warning: the following items did not execute: "
ui_info "Warning: the following items did not execute: "
foreach name $names {
ui_puts "$uplist($name) " -nonewline
ui_info "$uplist($name) " -nonewline
}
ui_puts ""
ui_info ""
}
}

@@ -428,11 +428,11 @@ proc exec_target {fd chain dlist name} {
flush $fd
}
} else {
ui_puts "$chain error: $name returned $result"
ui_error "$chain error: $name returned $result"
set result failure
}
} else {
ui_puts "Warning: $name does not support chain $chain"
ui_info "Warning: $name does not support chain $chain"
set result failure
}
return $result
@@ -451,7 +451,7 @@ proc eval_targets {dlist chain target} {
array set uplist [array get dependents]
# Special-case 'all'
} elseif {![string equal $target all]} {
ui_puts "Warning: unknown target: $target"
ui_info "Warning: unknown target: $target"
return
}
}

0 comments on commit 9226c2f

Please sign in to comment.
You can’t perform that action at this time.