This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
[Patch] Selecting a release for ecos-install.tcl
- From: Peter Soetens <peter dot soetens at mech dot kuleuven dot ac dot be>
- To: ecos-discuss at sources dot redhat dot com
- Cc: Jonathan Larmour <jifl at eCosCentric dot com>
- Date: Fri, 23 Jan 2004 10:41:54 +0100
- Subject: [ECOS] [Patch] Selecting a release for ecos-install.tcl
- Organization: KU Leuven
- Reply-to: peter dot soetens at mech dot kuleuven dot ac dot be
Hi,
This patch enables selecting releases of ecos for downloading with the install
program.
It's basic, but it might come in handy. I'm using the eCos package management
system for the www.Orocos.org project.
Just as a reminder, I have written two scripts for ecos, one for
generating .epk files from packages,templates and targets and one for
building the ecos.db file from available .cdl files.
http://people.mech.kuleuven.ac.be/~psoetens/
Peter.
(I'm not on the ecos list)
--
------------------------------------------------------------------------
Peter Soetens http://www.orocos.org
Katholieke Universiteit Leuven
Division Production Engineering, tel. +32 16 322773
Machine Design and Automation fax. +32 16 322987
Celestijnenlaan 300B peter.soetens@mech.kuleuven.ac.be
B-3001 Leuven Belgium http://www.mech.kuleuven.ac.be/pma
------------------------------------------------------------------------
--- ecos-install.tcl~ 2004-01-23 10:22:51.000000000 +0100
+++ ecos-install.tcl 2004-01-23 10:31:09.000000000 +0100
@@ -140,6 +140,7 @@
array set ecosreleases { }
array set toolchains { }
variable ecosmirrors ""
+ variable chosenecos ""
}
# }}}
@@ -702,11 +703,9 @@
# obscurely later *after* downloading everything!
if { $ecos_install::force == 0 } {
if { !$ecos_install::tools_only } {
- # FIXME: when we support older versions this needs fixing too.
- set chosenecos [lindex $ecos_install::ecosreleases($ecos_install::os) 0]
- set ecospkgdir [file join $ecos_install::install_dir [ lindex $chosenecos 2 ]]
+ set ecospkgdir [file join $ecos_install::install_dir [ lindex $ecos_install::chosenecos 2 ]]
if { [ file exists $ecospkgdir ] } {
- fatal_error "eCos [lindex $chosenecos 0] already appears to be\ninstalled at $ecospkgdir.\nPlease either remove it or choose to overwrite it\nby invoking this installer with the -f option."
+ fatal_error "eCos [lindex $ecos_install::chosenecos 0] already appears to be\ninstalled at $ecospkgdir.\nPlease either remove it or choose to overwrite it\nby invoking this installer with the -f option."
}
}
foreach prefix $ecos_install::tool_prefixes {
@@ -833,23 +832,52 @@
# }}}
# {{{
# ----------------------------------------------------------------------------
+# determine_release
+
+proc ecos_install::determine_release { } {
+ if { $ecos_install::chosenecos != "" } {
+ # Already set. Nothing to do.
+ return
+ }
+ ecos_install::report "---------------------------------------------------------"
+ ecos_install::report "Available Releases :\n"
+ for { set i 0 } { $i < [llength $ecos_install::ecosreleases($ecos_install::os)] } { incr i } {
+ ecos_install::report "\[[expr ($i+1)]\]\t[ lindex [lindex $ecos_install::ecosreleases($ecos_install::os) $i] 0]"
+ }
+ set status -1
+ set mnum 0
+
+ while { $status <= 0 } {
+ puts -nonewline "\nPlease select a release : "
+ set status [gets stdin mnum]
+ if { $status > 0 } {
+ if { ($mnum < 1) || ($mnum > [llength $ecos_install::ecosreleases($ecos_install::os)]) } {
+ set status -1
+ ecos_install::report "Invalid selection!"
+ }
+ }
+ }
+ set ecos_install::chosenecos [lindex $ecos_install::ecosreleases($ecos_install::os) [expr ($mnum-1)]]
+}
+
+# }}}
+# {{{
+# ----------------------------------------------------------------------------
# get_ecos
proc ecos_install::get_ecos { } {
- # FIXME: support downloading older versions
- set chosenecos [lindex $ecos_install::ecosreleases($ecos_install::os) 0]
- report "Retrieving eCos version [lindex $chosenecos 0]"
+ report "Retrieving eCos version [lindex $ecos_install::chosenecos 0]"
if { $ecos_install::mirror == "" } {
fatal_error "Distribution site or mirror unset!"
}
set url $ecos_install::mirror
- set url [ ecos_install::file_or_url_join $url [lindex $chosenecos 1]]
+ set url [ ecos_install::file_or_url_join $url [lindex $ecos_install::chosenecos 1]]
ecos_install::retrieve_url $url 1 ""
lappend ecos_install::tarballs_to_unpack [ecos_install::file_or_url_basename $url]
- set ecos_install::ecos_repo_suffix [lindex $chosenecos 2]
- set ecos_install::ecos_path_suffixes [lindex $chosenecos 3]
+ set ecos_install::ecos_repo_suffix [lindex $ecos_install::chosenecos 2]
+ set ecos_install::ecos_path_suffixes [lindex $ecos_install::chosenecos 3]
}
@@ -1176,6 +1204,7 @@
ecos_install::report "Written and maintained by Jonathan Larmour <jifl@eCosCentric.com>\n"
ecos_install::get_ecos_install_data
ecos_install::determine_mirror
+ ecos_install::determine_release
ecos_install::mk_install_dir
ecos_install::get_tools
if { !$ecos_install::tools_only } {
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss