comparison packages/ecosadmin.tcl @ 1482:111c2191e6f5

* ecos.db: Add 'hardware' attribute to CYGPKG_DEVS_ETH_ARM_KS32C5000. * ecosadmin.tcl: Delete empty directories in the repository following eCos package removal. Read the hardware attribute from package records in ecos.db.
author jld
date Fri, 30 Jan 2004 10:26:17 +0000
parents 4d9dfbffc2d1
children
comparison
equal deleted inserted replaced
1481:ba7fea8efa2f 1482:111c2191e6f5
17 #####ECOSGPLCOPYRIGHTBEGIN#### 17 #####ECOSGPLCOPYRIGHTBEGIN####
18 ## ------------------------------------------- 18 ## -------------------------------------------
19 ## This file is part of eCos, the Embedded Configurable Operating System. 19 ## This file is part of eCos, the Embedded Configurable Operating System.
20 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. 20 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
21 ## Copyright (C) 2003 John Dallaway 21 ## Copyright (C) 2003 John Dallaway
22 ## Copyright (C) 2004 eCosCentric Limited
22 ## 23 ##
23 ## eCos is free software; you can redistribute it and/or modify it under 24 ## eCos is free software; you can redistribute it and/or modify it under
24 ## the terms of the GNU General Public License as published by the Free 25 ## the terms of the GNU General Public License as published by the Free
25 ## Software Foundation; either version 2 or (at your option) any later version. 26 ## Software Foundation; either version 2 or (at your option) any later version.
26 ## 27 ##
553 proc package { name body } { 554 proc package { name body } {
554 add_known_package $name 555 add_known_package $name
555 set_package_data "$name,alias" "" 556 set_package_data "$name,alias" ""
556 set_package_data "$name,versions" "" 557 set_package_data "$name,versions" ""
557 set_package_data "$name,dir" "" 558 set_package_data "$name,dir" ""
559 set_package_data "$name,hardware" 0
558 set ::current_package $name 560 set ::current_package $name
559 eval $body 561 eval $body
560 set ::current_package "" 562 set ::current_package ""
561 } 563 }
562 564
597 if { $::current_package != "" } { 599 if { $::current_package != "" } {
598 set_package_data "$::current_package,alias" $str 600 set_package_data "$::current_package,alias" $str
599 } 601 }
600 } 602 }
601 603
604 proc hardware { } {
605 set_package_data "$::current_package,hardware" 1
606 }
607
602 proc description { str } { } 608 proc description { str } { }
603 proc disable { str } { } 609 proc disable { str } { }
604 proc enable { str } { } 610 proc enable { str } { }
605 proc hardware { } { }
606 proc script { str } { } 611 proc script { str } { }
607 proc set_value { str1 str2 } { } 612 proc set_value { str1 str2 } { }
608 } 613 }
609 614
610 # The parser is ready to evaluate the script. To avoid having to give the 615 # The parser is ready to evaluate the script. To avoid having to give the
1034 ecosadmin::report "removing package $name" 1039 ecosadmin::report "removing package $name"
1035 } 1040 }
1036 if { [ catch { file delete -force -- $package_dir } message ] != 0 } { 1041 if { [ catch { file delete -force -- $package_dir } message ] != 0 } {
1037 # issue a warning if package deletion failed - this is not fatal 1042 # issue a warning if package deletion failed - this is not fatal
1038 ecosadmin::warning $message 1043 ecosadmin::warning $message
1039 } 1044 }
1045 set dir [ file dirname $package_dir ]
1046 while { [ llength [ glob -nocomplain -- [ file join $dir "*" ] ] ] == 0 } {
1047 # the parent of the deleted directory is now empty so delete it
1048 if { [ catch { file delete -- $dir } message ] != 0 } {
1049 # issue a warning if empty directory deletion failed - this is not fatal
1050 ecosadmin::warning $message
1051 }
1052 set dir [ file dirname $dir ]
1053 }
1040 } 1054 }
1041 } 1055 }
1042 1056
1043 # Create the parser, add the aliased commands, and then define 1057 # Create the parser, add the aliased commands, and then define
1044 # the routines that do the real work. 1058 # the routines that do the real work.