Menu

[r3]: / cmp / PkgLib / Del.tcl  Maximize  Restore  History

Download this file

119 lines (89 with data), 2.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
##
## Compiler2 - PkgLib - Del
##
## (C) IPN - Ingenieurbuero fuer Praezisionsnumerik
##
## Dipl.-Ing. Andreas Otto
## Ulmenstrasse 3
## D-34289 Zierenberg
## mailto:aotto@t-online.de
## http://tclcompiler.sourceforge.net
##
## Alle Rechte vorbehalten
##
package require StdLib
package require FileLib
namespace eval ::PkgLib::Del {
variable PKG {NOT SET}
namespace import ::PkgLib::Db::*
}
proc ::PkgLib::Del::Msg { Str } {
puts stdout "\nPKG DEL MSG: $Str"
}
proc ::PkgLib::Del::ErrorN { args } {
lappend args {please check your environment}
variable PKG
::StdLib::ErrorN [ list PKG DEL $PKG ] $args
}
##
##-------------------------------------------------------------
## Pfade
##
proc ::PkgLib::Del::Item { HOME List } {
foreach { Typ Tgt } $List break
if {![ info exists Typ ]} return
if {[ string equal [ file pathtype $Tgt ] {relative} ]} {
set Tgt [ file join $HOME $Tgt ]
}
switch -exact $Typ {
l -
f {
file delete -force $Tgt
}
d {
set L [ glob -directory $Tgt -nocomplain .* * ]
if {[ llength $L ] <= 2} { file delete -force -- $Tgt }
}
}
}
proc ::PkgLib::Del::Remove { INSTDIR } {
##
Msg "read file database"
##
set Data [ ::PkgLib::Db::Read-FILE_LIST $INSTDIR ]
set HOME [ ::PkgLib::COMPILER_HOME ]
##
Msg "scan file database"
##
foreach List $Data { Item $HOME $List }
}
##
##-------------------------------------------------------------
## Main
##
proc ::PkgLib::Del::Main { pKG { FORCE no } } {
variable PKG [ ResolvDbName $pKG ]
if {!$FORCE && [ DbTOK $PKG Force ]} {
ErrorN "can't \"--del\" package \"$PKG\" because it have to be available" \
"please use \"--upd\" to upgrade to a new release"
}
set BUILDDIR [ ::PkgLib::BUILDDIR $PKG ]
set INSTDIR [ ::PkgLib::INSTDIR $PKG ]
Remove $INSTDIR
if {!$FORCE && ![::Question::YesNo "should package \"$PKG\" be deleted ?"]} return
##
Msg "delete directory"
##
DelIfExist $BUILDDIR
DelIfExist $INSTDIR
DelIfExist [ file join [ file dirname $INSTDIR ] .$PKG ]
## get the DB
::PkgLib::External $PKG D
::PkgLib::Index $PKG
::PkgLib::SysIndex $PKG
::PkgLib::CctCfg $PKG
::PkgLib::CgiCfg $PKG
::PkgLib::Db::Del $PKG
package require IView
::IView::DocDel $PKG [::Env::Get DIR]
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.