comparison packages/ecosadmin.tcl @ 2930:d3f9f7616d6b

* ecosadmin.tcl: Keep target records containing removed packages by default. Add "--remove_targets" switch to force removal. * io/usb/serial/slave/current/cdl/usbs_serial.cdl, net/autotest/current/cdl/net_autotest.cdl: Specify test executable names for compatibility with the eCos Configuration Tool.
author jld
date Fri, 13 Nov 2009 11:32:31 +0000
parents 74dbf4c3f2e1
children
comparison
equal deleted inserted replaced
2929:accd0f2fef35 2930:d3f9f7616d6b
10 # 10 #
11 #=============================================================================== 11 #===============================================================================
12 ## ####ECOSGPLCOPYRIGHTBEGIN#### 12 ## ####ECOSGPLCOPYRIGHTBEGIN####
13 ## ------------------------------------------- 13 ## -------------------------------------------
14 ## This file is part of eCos, the Embedded Configurable Operating System. 14 ## This file is part of eCos, the Embedded Configurable Operating System.
15 ## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. 15 ## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
16 ## 16 ##
17 ## eCos is free software; you can redistribute it and/or modify it under 17 ## eCos is free software; you can redistribute it and/or modify it under
18 ## the terms of the GNU General Public License as published by the Free 18 ## the terms of the GNU General Public License as published by the Free
19 ## Software Foundation; either version 2 or (at your option) any later 19 ## Software Foundation; either version 2 or (at your option) any later
20 ## version. 20 ## version.
116 variable check_database_arg 0; # check 116 variable check_database_arg 0; # check
117 variable accept_license_arg 0; # --accept_license 117 variable accept_license_arg 0; # --accept_license
118 variable extract_license_arg 0; # --extract_license 118 variable extract_license_arg 0; # --extract_license
119 variable add_package ""; # add FILE 119 variable add_package ""; # add FILE
120 variable remove_package ""; # remove PACKAGE 120 variable remove_package ""; # remove PACKAGE
121 variable keep_targets_arg ""; # --keep_targets 121 variable keep_targets_arg 1; # --keep_targets, --remove_targets
122 variable merge_repository ""; # merge REPOSITORY 122 variable merge_repository ""; # merge REPOSITORY
123 variable version_arg ""; # --version VER 123 variable version_arg ""; # --version VER
124 124
125 # Details of all known packages, targets and templates 125 # Details of all known packages, targets and templates
126 # read from the ecos.db file 126 # read from the ecos.db file
431 if { [regexp -- {^-?-keep_targets$} $args($i)] == 1 } { 431 if { [regexp -- {^-?-keep_targets$} $args($i)] == 1 } {
432 set ecosadmin::keep_targets_arg 1 432 set ecosadmin::keep_targets_arg 1
433 continue 433 continue
434 } 434 }
435 435
436 # check for --remove_targets
437 if { [regexp -- {^-?-remove_targets$} $args($i)] == 1 } {
438 set ecosadmin::keep_targets_arg 0
439 continue
440 }
441
436 # check for the add command 442 # check for the add command
437 if { [regexp -- {^-?-?add=?(.*)$} $args($i) dummy match1] == 1 } { 443 if { [regexp -- {^-?-?add=?(.*)$} $args($i) dummy match1] == 1 } {
438 if { $match1 != "" } { 444 if { $match1 != "" } {
439 set ecosadmin::add_package $match1 445 set ecosadmin::add_package $match1
440 } else { 446 } else {
507 513
508 proc ecosadmin::argument_help { } { 514 proc ecosadmin::argument_help { } {
509 515
510 puts "Usage: ecosadmin \[ command \]" 516 puts "Usage: ecosadmin \[ command \]"
511 puts " commands are:" 517 puts " commands are:"
512 puts " list : list packages" 518 puts " list : list packages"
513 puts " check : check database" 519 puts " check : check database"
514 puts " add FILE : add packages" 520 puts " add FILE : add packages"
515 puts " remove PACKAGE \[ --version VER \] : remove a package" 521 puts " remove PACKAGE \[ --version VER \] \[ --remove_targets \] : remove a package"
516 } 522 }
517 523
518 # }}} 524 # }}}
519 # {{{ Packages file 525 # {{{ Packages file
520 526
1186 # this procedure is called when the interpreter encounters a command in the datafile on the second pass 1192 # this procedure is called when the interpreter encounters a command in the datafile on the second pass
1187 proc filter { command name body } { 1193 proc filter { command name body } {
1188 if { ( $command == "target" ) && ( ( [ target_requires_any_package $name $ecosadmin::removed_packages ] != 0 ) || ( [ target_requires_missing_package $name ] != 0 ) ) } { 1194 if { ( $command == "target" ) && ( ( [ target_requires_any_package $name $ecosadmin::removed_packages ] != 0 ) || ( [ target_requires_missing_package $name ] != 0 ) ) } {
1189 # the target requires a package which has been removed 1195 # the target requires a package which has been removed
1190 if { $ecosadmin::keep_targets_arg != 1 } { 1196 if { $ecosadmin::keep_targets_arg != 1 } {
1191 # "--keep_targets" not specified so remove targets with missing packages 1197 # "--remove_targets" specified so remove the target
1192 ecosadmin::report "removing target $name" 1198 ecosadmin::report "removing target $name"
1193 } else { 1199 } else {
1194 # "--keep_targets" specified so remove missing packages from the target definition 1200 # remove missing packages from the target definition
1195 puts $ecosadmin::outfile "$command $name \{\n$ecosadmin::target_attributes \tpackages \{" 1201 puts $ecosadmin::outfile "$command $name \{\n$ecosadmin::target_attributes \tpackages \{"
1196 foreach pkg $ecosadmin::target_packages { 1202 foreach pkg $ecosadmin::target_packages {
1197 if { ([ lsearch $ecosadmin::removed_packages $pkg ] == -1) && ([ lsearch $ecosadmin::known_packages $pkg ] != -1) } { 1203 if { ([ lsearch $ecosadmin::removed_packages $pkg ] == -1) && ([ lsearch $ecosadmin::known_packages $pkg ] != -1) } {
1198 # package exists and has not been listed for removal so keep it in the target definition 1204 # package exists and has not been listed for removal so keep it in the target definition
1199 puts $ecosadmin::outfile "\t\t$pkg" 1205 puts $ecosadmin::outfile "\t\t$pkg"