[84055] contrib/mpab
jmr at macports.org
jmr at macports.org
Thu Sep 15 17:37:33 PDT 2011
Revision: 84055
http://trac.macports.org/changeset/84055
Author: jmr at macports.org
Date: 2011-09-15 17:37:33 -0700 (Thu, 15 Sep 2011)
Log Message:
-----------
mpab: add cleanup scripts
Added Paths:
-----------
contrib/mpab/cleanup_old.sh
contrib/mpab/oldports.tcl
Added: contrib/mpab/cleanup_old.sh
===================================================================
--- contrib/mpab/cleanup_old.sh (rev 0)
+++ contrib/mpab/cleanup_old.sh 2011-09-16 00:37:33 UTC (rev 84055)
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+if [[ -z "$PREFIX" ]]; then
+ PREFIX=/opt/local
+fi
+if [[ -z "$ULPATH" ]]; then
+ ULPATH=archive_staging
+fi
+if [[ -z "$TOPDIR" ]]; then
+ TOPDIR=.
+fi
+
+rm -vrf ${TOPDIR}/logs-*
+rm -vrf ${TOPDIR}/${ULPATH}
+rm -vrf ${PREFIX}/var/macports/distfiles/*
+
+oldports=`./oldports.tcl -t "${PREFIX}/share/macports/Tcl"`
+if [[ -n "$oldports" ]]; then
+ echo $oldports | xargs "${PREFIX}/bin/port" -f uninstall
+fi
Property changes on: contrib/mpab/cleanup_old.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: contrib/mpab/oldports.tcl
===================================================================
--- contrib/mpab/oldports.tcl (rev 0)
+++ contrib/mpab/oldports.tcl 2011-09-16 00:37:33 UTC (rev 84055)
@@ -0,0 +1,74 @@
+#!/usr/bin/tclsh
+
+proc printUsage {} {
+ puts "Usage: $::argv0 \[-hV\] \[-t macports-tcl-path\]"
+ puts " -h This help"
+ puts " -t Give a different location for the base MacPorts Tcl"
+ puts " file (defaults to /Library/Tcl)"
+ puts " -V show version and MacPorts version being used"
+}
+
+set MY_VERSION 0.1
+set macportsTclPath /Library/Tcl
+
+set showVersion 0
+
+while {[string index [lindex $::argv 0] 0] == "-" } {
+ switch [string range [lindex $::argv 0] 1 end] {
+ h {
+ printUsage
+ exit 0
+ }
+ t {
+ if {[llength $::argv] < 2} {
+ puts "-t needs a path"
+ printUsage
+ exit 2
+ }
+ set macportsTclPath [lindex $::argv 1]
+ set ::argv [lrange $::argv 1 end]
+ }
+ V {
+ set showVersion 1
+ }
+ default {
+ puts "Unknown option [lindex $::argv 0]"
+ printUsage
+ exit 2
+ }
+ }
+ set ::argv [lrange $::argv 1 end]
+}
+
+source "${macportsTclPath}/macports1.0/macports_fastload.tcl"
+package require macports
+mportinit
+
+if {$showVersion} {
+ puts "Version $MY_VERSION"
+ puts "MacPorts version [macports::version]"
+ exit 0
+}
+
+set ilist [registry::installed]
+foreach i $ilist {
+ set old 0
+ set iname [lindex $i 0]
+ set iversion [lindex $i 1]
+ set irevision [lindex $i 2]
+ set ivariants [lindex $i 3]
+ set res [mportlookup $iname]
+ if {[llength $res] < 2} {
+ # not found in index, classify as old
+ set old 1
+ } else {
+ array unset portinfo
+ array set portinfo [lindex $res 1]
+ if {$portinfo(version) != $iversion || $portinfo(revision) != $irevision} {
+ set old 1
+ }
+ }
+ if {$old} {
+ puts "$iname @${iversion}_${irevision}${ivariants}"
+ }
+}
Property changes on: contrib/mpab/oldports.tcl
___________________________________________________________________
Added: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110915/88c9a084/attachment.html>
More information about the macports-changes
mailing list