Changes between Version 10 and Version 11 of Scripts/testport_script
- Timestamp:
- Apr 26, 2012, 6:27:18 PM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Scripts/testport_script
v10 v11 24 24 # testport -c -r -e -v clang-3.1 25 25 # testport -s clang-3.1 26 # testport -c -r openal configure.cc='/opt/macports-test/bin/clang-mp-3.1' configure.cxx='/opt/macports-test/bin/clang++-mp-3.1' 26 27 27 28 … … 40 41 -r: remove / uninstall specified port before reinstalling it 41 42 -s: build and install from source only 42 -u: update MacPorts system and upgrade outdated ports 43 -u: update MacPorts system and upgrade outdated ports (cleans work directories) 43 44 -v: enable verbose mode 44 45 -l dir: specify dir as location of MacPorts system (otherwise defaults to /opt/macports-test) … … 71 72 } 72 73 74 75 do_clean_all() { 76 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --all installed 77 [[ $(port list inactive | wc -l) -gt 0 ]] && port -f uninstall inactive 78 find -x "${MP_PREFIX}/var/macports/build" -maxdepth 3 -type d -name work -print0 | while IFS="" read -r -d "" dirpath; do 79 portname="$( basename "$(dirname "${dirpath}")" )" 80 echo port -f -v clean --all "${portname}" 81 port -f -v clean --all "${portname}" 82 done 83 return 0 84 } 85 86 do_clean_work() { 87 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --work installed 88 find -x "${MP_PREFIX}/var/macports/build" -maxdepth 3 -type d -name work -print0 | while IFS="" read -r -d "" dirpath; do 89 portname="$( basename "$(dirname "${dirpath}")" )" 90 echo port -f -v clean --work "${portname}" 91 port -f -v clean --work "${portname}" 92 done 93 return 0 94 } 95 96 97 do_update() { 98 do_clean_work 99 port selfupdate 100 port outdated 101 [[ $(port outdated | wc -l) -gt 1 ]] && port upgrade -R -u outdated 102 return 0 103 } 104 105 106 73 107 unset CDPATH PATH IFS LC_ALL MP_PREFIX all_new 74 108 IFS=$' \t\n' … … 178 212 export PATH 179 213 214 215 if [[ $(id -u) -ne 0 ]] || [[ "${HOME}" != '/var/root' ]]; then 216 echo 'This script must be run in a root shell to prevent sudo timeout!' 1>&2 217 echo 'Use: sudo -H -i' 1>&2 218 exit 1 219 fi 220 221 180 222 if [[ $printpath -eq 1 ]]; then 181 223 printf '\n\n%s\n\n\n' "export PATH=\"${MP_PREFIX}/bin:${MP_PREFIX}/sbin:/usr/bin:/bin:/usr/sbin:/sbin\"" … … 190 232 191 233 if [[ $# -eq 0 ]]; then 192 if [[ $clean_all -eq 1 ]]; then 193 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --all installed 234 if [[ $clean_all -eq 1 ]] && [[ $update -eq 1 ]]; then 235 do_clean_all 236 do_update 237 exit 238 elif [[ $clean_all -eq 1 ]]; then 239 do_clean_all 194 240 exit 195 241 elif [[ $update -eq 1 ]]; then 196 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --all installed 197 port selfupdate 198 port outdated 199 [[ $(port outdated | wc -l) -gt 1 ]] && port upgrade -R -u outdated 242 do_update 200 243 exit 201 244 else … … 208 251 209 252 210 if [[ $(id -u) -ne 0 ]] || [[ "${HOME}" != '/var/root' ]]; then211 echo 'This script must be run in a root shell to prevent sudo timeout!' 1>&2212 echo 'Use: sudo -H -i' 1>&2213 exit 1214 fi215 216 217 dsclHome="$(dscl . -read /Users/macports NFSHomeDirectory | sed 's/^NFSHomeDirectory: *//')"218 dscl . -change /Users/macports NFSHomeDirectory "${dsclHome}" "${MP_PREFIX}/var/macports/home"219 220 221 253 # make sure the current working directory exists 222 254 pwd -P 1>/dev/null || exit 1 223 224 255 225 256 # prevent idle sleep … … 238 269 trap on_exit EXIT TERM HUP INT QUIT 239 270 271 dsclHome="$(dscl . -read /Users/macports NFSHomeDirectory | sed 's/^NFSHomeDirectory: *//')" 272 dscl . -change /Users/macports NFSHomeDirectory "${dsclHome}" "${MP_PREFIX}/var/macports/home" 273 240 274 echo 241 275 … … 247 281 248 282 echo 249 250 # clean up previous "${MP_PREFIX}" directory251 if [[ -x "${MP_PREFIX}/bin/port" ]]; then252 if [[ $clean_all -eq 1 ]]; then253 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --all installed254 else255 [[ $(port installed "$@" | wc -l) -gt 1 ]] && port -f clean --work "$@"256 fi257 fi258 283 259 284 … … 279 304 tar -xjf MacPorts-2.0.4.tar.bz2 280 305 cd MacPorts-2.0.4 || exit 1 281 # --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms"306 # --enable-werror --with-install-user=$owner --with-install-group=$group --with-directory-mode=$perms" 282 307 ./configure --prefix="${MP_PREFIX}" --with-tclpackage="${MP_PREFIX}/tcl" --with-applications-dir="${MP_PREFIX}/Applications" 283 308 … … 297 322 export PATH 298 323 324 echo 325 326 # clean up previous "${MP_PREFIX}" directory 327 if [[ $all_new -eq 0 ]] && [[ -x "${MP_PREFIX}/bin/port" ]]; then 328 if [[ $clean_all -eq 1 ]]; then 329 do_clean_all 330 else 331 do_clean_work 332 fi 333 fi 334 335 299 336 if [[ $update -eq 1 ]]; then 300 [[ $(port installed | wc -l) -gt 1 ]] && port -f clean --all installed 301 port selfupdate 302 port outdated 303 [[ $(port outdated | wc -l) -gt 1 ]] && port upgrade -R -u outdated 337 do_update 304 338 fi 305 339