This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

turn ECOS_REPOSITORY into a path


These patches turn the ECOS_REPOSITORY environment variable into a
path rather than a single directory, e.g. you can have:

  export ECOS_REPOSITORY=<private>:<anoncvs>:<last release>:...

Each repository must have its own ecos.db database and its own pkgconf
subdirectory. Effectively libcdl merges each repository into a single
one. The repositories are scanned in order. If there are duplicates,
e.g. version "current" of CYGPKG_KERNEL occurs in two separate
repositories, then the first entry found will be used and the latter
will be inaccessible. The repositories may contain completely separate
packages/targets/templates. For example you can have an entry in the
path for ports which are not in the public tree, with the appropriate
HAL packages and target entries in the corresponding ecos.db file.

With command-line ecosconfig --srcdir still overrides ECOS_REPOSITORY
completely. Arguably the --srcdir value should be prepended to
ECOS_REPOSITORY instead, but I think that could lead to more confusing
behaviour. There is a potential incompatibility: previously under
cygwin you could set ECOS_REPOSITORY to a windows-like directory
e.g. c:/ecos/packages. Now that will be interpreted as a path with
two entries, c and /ecos/packages. There is no easy way to cope with
this, so from now on ECOS_REPOSITORY has to use cygwin paths. The
generated /opt/ecos/ecosenv.sh already does this.

The changes have not been tested with the GUI tool yet. They'll
probably just work, as long as you don't then use the GUI to change
the repository. In theory the GUI needs to be updated to allow you to
add/remove/rearrange path entries, rather than define a single
directory. There may also be problems with a VC++ build of the Windows
configtool, but hopefully that will go away real soon.

These changes are for the trunk only. They are non-trivial and I don't
want to destabilize the 2.0 release.

Bart

----------------------------------------------------------------------------
The first step is to associate repositories with CdlLoadable objects
rather than CdlToplevel objects.

Index: cdlcore.hxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/cdlcore.hxx,v
retrieving revision 1.9
diff -u -u -r1.9 cdlcore.hxx
--- cdlcore.hxx	21 Sep 2002 22:05:09 -0000	1.9
+++ cdlcore.hxx	26 Mar 2003 17:32:17 -0000
@@ -3634,6 +3634,7 @@
     const std::vector<CdlNode>&         get_owned() const;
     bool                                owns(CdlConstNode) const;
     CdlInterpreter                      get_interpreter() const;
+    std::string                         get_repository() const;
     std::string                         get_directory() const;
 
     // Some properties such as doc and compile reference filenames.
@@ -3661,7 +3662,7 @@
 
   protected:
 
-    CdlLoadableBody(CdlToplevel, std::string /* directory */);
+    CdlLoadableBody(CdlToplevel, std::string /* repository */, std::string /* directory */);
 
     // Needed by derived classes, but not actually used.
     CdlLoadableBody();
@@ -3670,6 +3671,7 @@
     
     std::vector<CdlNode> owned;
     CdlInterpreter       interp;
+    std::string          repository;
     std::string          directory;
 
     // Used by add/remove_node_from_toplevel()
@@ -3792,11 +3794,6 @@
     // Each toplevel must have an associated master Tcl interpreter.
     CdlInterpreter      get_interpreter() const;
 
-    // Each toplevel should also have an associated directory for 
-    // the component repository. It is not required that all loadables
-    // are relative to this, but that is the default behaviour.
-    std::string         get_directory() const;
-
     // Each toplevel may have a single active main transaction.
     // For now there is no support for concurrent transactions
     // operating on a single toplevel (although nested transactions
@@ -3843,7 +3840,7 @@
     CYGDBG_DECLARE_MEMLEAK_COUNTER();
 
   protected:
-    CdlToplevelBody(CdlInterpreter, std::string);
+    CdlToplevelBody(CdlInterpreter);
 
   private:
 
@@ -3853,7 +3850,6 @@
     CdlInterpreter                      interp;
     CdlContainer                        orphans;
     std::string                         description;
-    std::string                         directory;
     std::list<CdlConflict>              conflicts;
     std::list<CdlConflict>              structural_conflicts;
 
@@ -5333,6 +5329,7 @@
 
   public:
     std::string         name;           /* CYGPKG_INFRA         */
+    std::string         repository;     /* arbitrary path       */
     std::string         directory;      /* infra/current        */
     std::vector<CdlBuildInfo_Header>            headers;
     std::vector<CdlBuildInfo_Compile>           compiles;

Index: base.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/base.cxx,v
retrieving revision 1.5
diff -u -u -r1.5 base.cxx
--- base.cxx	21 Sep 2002 22:05:08 -0000	1.5
+++ base.cxx	26 Mar 2003 17:32:55 -0000
`@@ -999,7 +999,7 @@
 // updates of the owned vector happen inside the CdlToplevel
 // add_node() and remove_node() family.
 
-CdlLoadableBody::CdlLoadableBody(CdlToplevel toplevel, std::string dir)
+CdlLoadableBody::CdlLoadableBody(CdlToplevel toplevel, std::string repo, std::string dir)
     : CdlContainerBody()
 {
     CYG_REPORT_FUNCNAME("CdlLoadable:: constructor");
@@ -1007,6 +1007,7 @@
     CYG_PRECONDITION_CLASSC(toplevel);
 
     // Initialize enough of the object to support check_this()
+    repository  = repo;
     directory   = dir;
     interp      = 0;
     remove_node_loadables_position = -1;
@@ -1092,6 +1093,7 @@
     CYG_ASSERTC(0 == owned.size());
     delete interp;
     interp      = 0;
+    repository  = "";
     directory   = "";
 
     CYGDBG_MEMLEAK_DESTRUCTOR();
@@ -1146,6 +1148,17 @@
 }
 
 std::string
+CdlLoadableBody::get_repository() const
+{
+    CYG_REPORT_FUNCNAME("CdlLoadable::get_repository");
+    CYG_REPORT_FUNCARG1XV(this);
+    CYG_PRECONDITION_THISC();
+
+    CYG_REPORT_RETURN();
+    return repository;
+}
+
+std::string
 CdlLoadableBody::get_directory() const
 {
     CYG_REPORT_FUNCNAME("CdlLoadable::get_directory");
@@ -1488,7 +1501,7 @@
     CYG_PRECONDITIONC("" != filename);
 
     // These variable names should be kept in step with CdlBuildable::update_all_build_info()
-    interp->set_variable("::cdl_topdir",  get_toplevel()->get_directory());
+    interp->set_variable("::cdl_topdir",  repository);
     interp->set_variable("::cdl_pkgdir",  directory);
     interp->set_variable("::cdl_prefdir", dirname);
     interp->set_variable("::cdl_target",  filename);
@@ -1536,7 +1549,7 @@
     CYG_PRECONDITIONC("" != filename);
 
     // These variable names should be kept in step with CdlBuildable::update_all_build_info()
-    interp->set_variable("::cdl_topdir",  get_toplevel()->get_directory());
+    interp->set_variable("::cdl_topdir",  repository);
     interp->set_variable("::cdl_pkgdir",  directory);
     interp->set_variable("::cdl_prefdir", dirname);
     interp->set_variable("::cdl_target",  filename);
@@ -1578,7 +1591,7 @@
 
     bool        result = false;
     
-    interp->set_variable("::cdl_topdir",  get_toplevel()->get_directory());
+    interp->set_variable("::cdl_topdir",  repository);
     interp->set_variable("::cdl_pkgdir",  directory);
     interp->set_variable("::cdl_target",  name);
 
@@ -1652,7 +1665,7 @@
 // an interpreter, so this should not happen until the world
 // is ready to deal with such errors.
 
-CdlToplevelBody::CdlToplevelBody(CdlInterpreter interp_arg, std::string directory_arg)
+CdlToplevelBody::CdlToplevelBody(CdlInterpreter interp_arg)
     : CdlContainerBody()
 {
     CYG_REPORT_FUNCNAME("CdlToplevel:: constructor");
@@ -1661,7 +1674,6 @@
 
     // The STL containers will take care of themselves.
     interp      = interp_arg;
-    directory   = directory_arg;
     transaction = 0;
 
     // A toplevel is always active, override the default setting for a node
@@ -2115,17 +2127,6 @@
     description = new_description;
 
     CYG_REPORT_RETURN();
-}
-
-std::string
-CdlToplevelBody::get_directory() const
-{
-    CYG_REPORT_FUNCNAME("CdlToplevel::get_directory");
-    CYG_REPORT_FUNCARG1XV(this);
-    CYG_PRECONDITION_THISC();
-
-    CYG_REPORT_RETURN();
-    return directory;
 }
 
 std::string
Index: build.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/build.cxx,v
retrieving revision 1.8
diff -u -u -r1.8 build.cxx
--- build.cxx	11 Feb 2003 22:38:20 -0000	1.8
+++ build.cxx	26 Mar 2003 17:34:51 -0000
@@ -544,14 +544,16 @@
     CdlLoadable loadable        = get_owner();
     CYG_ASSERT_CLASSC(loadable);
     std::string directory       = loadable->get_directory();
+    std::string repository      = loadable->get_repository();
     CYG_ASSERTC("" != directory);
+    CYG_ASSERTC("" != repository);
     CdlInterpreter interp       = loadable->get_interpreter();
     CYG_ASSERT_CLASSC(interp);
 
     // The interpreter needs some information about the locations
     // of various things. This code has to be kept in step with
     // CdlLoadable::find_relative_file()
-    interp->set_variable("::cdl_topdir", get_toplevel()->get_directory());
+    interp->set_variable("::cdl_topdir", repository);
     interp->set_variable("::cdl_pkgdir", directory);
 
     // For many packages the sources will reside in a src subdirectory.
@@ -964,7 +966,7 @@
 
     // It is necessary to search for the appropriate files.
     CdlInterpreter interp = loadable->get_interpreter();
-    std::string    path   = loadable->get_toplevel()->get_directory() + "/" + loadable->get_directory();
+    std::string    path   = loadable->get_repository() + "/" + loadable->get_directory();
     if (has_include_subdir) {
         std::vector<std::string> files;
         std::vector<std::string>::const_iterator file_i;
@@ -1051,8 +1053,9 @@
     CdlBuildInfo_Loadable tmp_info;
     build_info.entries.push_back(tmp_info);
     CdlBuildInfo_Loadable& this_info = *(build_info.entries.rbegin());
-    this_info.name      = get_name();
-    this_info.directory = get_directory();
+    this_info.name          = get_name();
+    this_info.repository    = get_repository();
+    this_info.directory     = get_directory();
 
     // Take care of the header files
     update_header_file_info(this, this_info);
@@ -1090,8 +1093,8 @@
     CdlBuildInfo_Loadable tmp_info;
     build_info.entries.push_back(tmp_info);
     CdlBuildInfo_Loadable& this_info = *(build_info.entries.rbegin());
-    this_info.name      = get_name();
-    this_info.directory = get_directory();
+    this_info.name       = get_name();
+    this_info.directory  = get_directory();
 
     std::string loadable_library = default_library_name;
     if (has_property(CdlPropertyId_Library)) {

----------------------------------------------------------------------------

Next, the derived CdlPackage and CdlConfig classes need to be updated.
There is also a fix to the config code where changing a template
version would cause libcdl to lose track of which packages belong to
the template.

----------------------------------------------------------------------------

Index: cdl.hxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/cdl.hxx,v
retrieving revision 1.5
diff -u -u -r1.5 cdl.hxx
--- cdl.hxx	21 Sep 2002 22:05:08 -0000	1.5
+++ cdl.hxx	26 Mar 2003 17:36:31 -0000
@@ -130,6 +130,7 @@
     const std::vector<std::string>&     get_package_aliases(std::string) const;
     const std::vector<std::string>&     get_package_versions(std::string) const;
     const std::string&                  get_package_directory(std::string) const;
+    const std::string&                  get_package_repository(std::string, std::string /* version */ = "") const;
     const std::string&                  get_package_script(std::string) const;
     bool                                is_hardware_package(std::string) const;
 
@@ -175,6 +176,7 @@
         std::string                     description;
         std::vector<std::string>        aliases;
         std::vector<std::string>        versions;
+        std::map<std::string, std::string> repositories;   /* one entry per version */
         std::string                     directory;
         std::string                     script;
         bool                            hardware;
@@ -202,6 +204,7 @@
     struct template_data {
       public:
         std::vector<std::string>        versions;
+        std::map<std::string, std::string>  files;
         std::map<std::string, struct template_version_data> version_details;
     };
     std::map<std::string, struct template_data>   templates;
@@ -482,7 +485,7 @@
   private:
 
     // The only valid constructor requires a number of fields
-    CdlPackageBody(std::string /* name */, CdlConfiguration, std::string /* directory */);
+    CdlPackageBody(std::string /* name */, CdlConfiguration, std::string /* repository */, std::string /* directory */);
 
     // Other constructors are illegal
     CdlPackageBody();


Index: package.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/package.cxx,v
retrieving revision 1.4
diff -u -u -r1.4 package.cxx
--- package.cxx	21 Sep 2002 22:05:09 -0000	1.4
+++ package.cxx	26 Mar 2003 17:37:21 -0000
@@ -72,7 +72,7 @@
 // ----------------------------------------------------------------------------
 // Constructor. The real work is actually done in the base classes
 // and the parser.
-CdlPackageBody::CdlPackageBody(std::string name_arg, CdlConfiguration toplevel, std::string dir)
+CdlPackageBody::CdlPackageBody(std::string name_arg, CdlConfiguration toplevel, std::string repo, std::string dir)
     : CdlNodeBody(name_arg),
       CdlContainerBody(),
       CdlUserVisibleBody(),
@@ -80,7 +80,7 @@
       CdlParentableBody(),
       CdlBuildableBody(),
       CdlDefinableBody(),
-      CdlLoadableBody(toplevel, dir),
+      CdlLoadableBody(toplevel, repo, dir),
       CdlBuildLoadableBody(),
       CdlDefineLoadableBody()
 {

Index: config.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/config.cxx,v
retrieving revision 1.6
diff -u -u -r1.6 config.cxx
--- config.cxx	21 Sep 2002 22:05:09 -0000	1.6
+++ config.cxx	26 Mar 2003 17:37:57 -0000
@@ -74,7 +74,7 @@
 
 CdlConfigurationBody::CdlConfigurationBody(std::string name, CdlPackagesDatabase db, CdlInterpreter interp)
     : CdlNodeBody(name),
-      CdlToplevelBody(interp, db->get_component_repository())
+      CdlToplevelBody(interp)
 {
     CYG_REPORT_FUNCNAME("CdlConfiguration:: constructor");
     CYG_REPORT_FUNCARG1XV(this);
@@ -747,6 +747,7 @@
             throw CdlInputOutputException("Package " + name + " does not have an installed version `" + version + "'.");
         }
     }
+    std::string repository      = database->get_package_repository(name, version);
     std::string directory       = database->get_package_directory(name);
     std::string script          = database->get_package_script(name);
     CYG_ASSERTC(("" != directory) && ("" != script));
@@ -763,7 +764,7 @@
     }
     directory = tcl_result;
     
-    tcl_cmd   = "file isdirectory [file join \"" + database->get_component_repository() + "\" " + directory + "]";
+    tcl_cmd   = "file isdirectory [file join \"" + repository + "\" " + directory + "]";
     if ((TCL_OK != interp->eval(tcl_cmd, tcl_result)) || ("1" != tcl_result)) {
         throw CdlInputOutputException("Cannot load package `" + name + "', there is no directory `" + directory + "'.");
     }
@@ -792,7 +793,7 @@
     CdlConfiguration_CommitCancelLoad* load_op  = 0;
     
     try {
-        package = new CdlPackageBody(name, this, directory);
+        package = new CdlPackageBody(name, this, repository, directory);
 
         // The package should be added to the hierarchy immediately.
         // All nodes will get added to the hierarchy as they are
@@ -1256,12 +1257,11 @@
     // Each new package needs to be registered as a template one.
     // NOTE: this may break if we start doing more interesting things
     // with savefiles.
-    const std::vector<CdlLoadable>& loadables = this->get_loadables();
-    unsigned int load_i = loadables.size();
     
     try {
         transaction->add_commit_cancel_op(rename_op);
         const std::vector<CdlLoadable>& loadables = this->get_loadables();
+        unsigned int load_i;
         for (i = (int) loadables.size() - 1; i >= 0; i--) {
             CdlPackage package = dynamic_cast<CdlPackage>(loadables[i]);
             if ((0 != package) && package->belongs_to_template()) {
@@ -1269,7 +1269,8 @@
             }
         }
         current_template = "";
-
+        load_i = loadables.size();
+        
         this->add(transaction, filename, error_fn, warn_fn);
         this->current_template = filename;
         this->set_name(saved_name);

----------------------------------------------------------------------------
The main work is in the database class, looping when scanning
ECOS_REPOSITORY etc.
----------------------------------------------------------------------------
Index: database.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/libcdl/database.cxx,v
retrieving revision 1.6
diff -u -u -r1.6 database.cxx
--- database.cxx	21 Sep 2002 22:05:09 -0000	1.6
+++ database.cxx	26 Mar 2003 17:40:55 -0000
@@ -152,13 +152,6 @@
         return TCL_OK;
     }
     std::string pkg_name        = argv[1];
-
-    // Better make sure that this is not a duplicate definition.
-    if (std::find(db->package_names.begin(), db->package_names.end(), pkg_name) != db->package_names.end()) {
-        CdlParse::report_warning(interp, diag_package + pkg_name, "Duplicate package entry, ignoring second occurence.");
-        CYG_REPORT_RETVAL(TCL_OK);
-        return TCL_OK;
-    }
     
     // The package data is constructed locally. It only gets added to
     // the database in the absence of errors.
@@ -227,8 +220,6 @@
                 std::vector<std::string> subdirs;
                 unsigned int i;
                 interp->locate_subdirs(pkgdir, subdirs);
-                std::sort(subdirs.begin(), subdirs.end(), Cdl::version_cmp());
-                
                 for (i = 0; i < subdirs.size(); i++) {
                     if (("CVS" == subdirs[i]) || ("cvs" == subdirs[i])) {
                         continue;
@@ -243,6 +234,7 @@
                         }
                     }
                     package.versions.push_back(subdirs[i]);
+                    package.repositories[subdirs[i]] = repo;
                 }
                 if (0 == package.versions.size()) {
                     CdlParse::report_warning(interp, diag_package + pkg_name,
@@ -254,9 +246,23 @@
     }
 
     // If the package is still ok, now is the time to add it to the database.
+    // It may be a new package, or there may already be an entry from a previous
+    // repository.
     if (package_ok && (old_error_count == CdlParse::get_error_count(interp))) {
-        db->package_names.push_back(pkg_name);
-        db->packages[pkg_name] = package;
+        if ( std::find(db->package_names.begin(), db->package_names.end(), pkg_name) == db->package_names.end()) {
+            db->package_names.push_back(pkg_name);
+            db->packages[pkg_name] = package;
+        } else {
+            // Only add versions which are not already present.
+            std::vector<std::string>::const_iterator version_i;
+            for (version_i = package.versions.begin(); version_i != package.versions.end(); version_i++) {
+                if (std::find(db->packages[pkg_name].versions.begin(), db->packages[pkg_name].versions.end(),
+                              *version_i) == db->packages[pkg_name].versions.end()) {
+                    db->packages[pkg_name].versions.push_back(*version_i);
+                    db->packages[pkg_name].repositories[*version_i] = package.repositories[*version_i];
+                }
+            }
+        }
     }
 
     CYG_REPORT_RETVAL(result);
@@ -441,10 +447,9 @@
     
     std::string target_name     = argv[1];
 
-    // Better make sure that this is not a duplicate definition.
+    // This may be a duplicate definition if the target was defined in an
+    // earlier repository
     if (std::find(db->target_names.begin(), db->target_names.end(), target_name) != db->target_names.end()) {
-        CdlParse::report_warning(interp, diag_target + target_name,
-                                 "Duplicate target entry, ignoring second occurence.");
         CYG_REPORT_RETVAL(TCL_OK);
         return TCL_OK;
     }
@@ -778,43 +783,80 @@
         CdlInterpreterBody::CommandSupport cmds(interp, commands);
         CdlInterpreterBody::DiagSupport diag(interp, error_fn, warn_fn);
         CdlInter
         return "";
     }
-    if ("" == version_name) {
+    if ("" == version) {
         CYG_ASSERTC(0 != template_i->second.versions.size());
-        version_name = template_i->second.versions[0];
+        version = template_i->second.versions[0];
     } else {
         std::vector<std::string>::const_iterator vsn_i = std::find(template_i->second.versions.begin(),
-                                                                   template_i->second.versions.end(), version_name);
+                                                                   template_i->second.versions.end(), version);
         if (vsn_i == template_i->second.versions.end()) {
             CYG_FAIL("Invalid template version passed to CdlPackagesDatabase::get_template_filename");
             CYG_REPORT_RETURN();
@@ -1347,7 +1426,8 @@
         }
     }
 
-    std::string result = component_repository + "/templates/" + template_name + "/" + version_name + ".ect";
+    std::map<std::string,std::string>::const_iterator file_i = template_i->second.files.find(version);
+    std::string result = file_i->second;
     CYG_REPORT_RETURN();
     return result;
 }


----------------------------------------------------------------------------
The makefile generator only needs a very small tweak, but note that
for each package the build will use the pkgconf subdirectory of its
repository. The toplevel makefile no longer defines REPOSITORY at all
because it is not needed.
----------------------------------------------------------------------------
Index: build.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/common/common/build.cxx,v
retrieving revision 1.15
diff -u -u -r1.15 build.cxx
--- build.cxx	21 Sep 2002 22:06:08 -0000	1.15
+++ build.cxx	26 Mar 2003 17:41:52 -0000
@@ -353,7 +354,6 @@
 	fprintf (stream, makefile_header.c_str ());
 
 	// generate the global variables
-	fprintf (stream, "export REPOSITORY := %s\n", cygpath (config->get_database ()->get_component_repository ()).c_str ());
 	fprintf (stream, "export PREFIX := %s\n", cygpath (install_tree).c_str ());
 	fprintf (stream, "export COMMAND_PREFIX := %s\n", command_prefix.c_str ());
 	fprintf (stream, "export CC := $(COMMAND_PREFIX)gcc\n");
@@ -366,6 +366,7 @@
 	fprintf (stream, "export AR := $(COMMAND_PREFIX)ar\n\n");
 
 	// generate the package variables
+	fprintf (stream, "export REPOSITORY := %s\n", cygpath (info.repository).c_str());
 	fprintf (stream, "PACKAGE := %s\n", info.directory.c_str ());
 	fprintf (stream, "OBJECT_PREFIX := %s\n", object_prefix.c_str ());
 	fprintf (stream, "CFLAGS := %s\n", get_flags (config, &info, "CFLAGS").c_str ());
@@ -516,7 +517,6 @@
 	fprintf (stream, makefile_header.c_str ());
 
 	// generate the variables
-	fprintf (stream, "export REPOSITORY := %s\n", cygpath (config->get_database ()->get_component_repository ()).c_str ());
 #if defined(_WIN32) || defined(__CYGWIN__)
     fprintf (stream, "export HOST := CYGWIN\n");
 #else


----------------------------------------------------------------------------
That leaves some changes to ecosconfig. The TRANSLATE_PATH() calls are
not needed with current cygwin, and cause problems because you end up
with colons in the repository variable. Also there were two bugs
related to template versions. 
----------------------------------------------------------------------------
Index: ecosconfig.cxx
===================================================================
RCS file: /cvs/ecos/ecos/host/tools/configtool/standalone/common/ecosconfig.cxx,v
retrieving revision 1.10
diff -u -u -r1.10 ecosconfig.cxx
--- ecosconfig.cxx	11 Feb 2003 22:50:15 -0000	1.10
+++ ecosconfig.cxx	26 Mar 2003 17:44:18 -0000
@@ -55,30 +55,6 @@
 #define DEFAULT_SAVE_FILE "ecos.ecc"
 static char* tool = "ecosconfig";
 
-// When running under cygwin there may be confusion between cygwin and
-// Windows paths. Some paths will be passed on to the Tcl library,
-// which sometimes will accept a cygwin path and sometimes not. This
-// does not affect the VC++ build which only accepts Windows paths,
-// and obviously it does not affect any Unix platfom.
-#ifdef __CYGWIN__
-static std::string
-translate_path(std::string& path)
-{
-    std::string result;
-    char buffer [MAXPATHLEN + 1];
-    if ("" == path) {
-        result = path;
-    } else {
-        cygwin_conv_to_win32_path (path.c_str (), buffer);
-        result = std::string(buffer);
-    }
-    return result;
-}
-# define TRANSLATE_PATH(a) translate_path(a)
-#else
-# define TRANSLATE_PATH(a) (a)
-#endif
-
 int main (int argc, char * argv []) {
 
     // process command qualifiers
@@ -280,10 +256,6 @@
         }
     }
 
-    repository          = TRANSLATE_PATH(repository);
-    savefile            = TRANSLATE_PATH(savefile);
-    install_prefix      = TRANSLATE_PATH(install_prefix);
-
     // Initialize the cdl_exec code (not quite sure why this needs a
     // separate object rather than just a bunch of statics). 
     cdl_exec exec (trim_path (repository), savefile, trim_path (install_prefix), no_resolve);
@@ -302,7 +274,7 @@
 
     if ("new" == command) {
         // Usage: ecosconfig new <target> [template [version]]
-        if ((command_index == argc) || ((command_index + 3) <= argc)) {
+        if ((command_index == argc) || ((command_index + 3) < argc)) {
             usage_message();
         } else {
             // The default values for template and template_version
@@ -392,7 +364,7 @@
         if (command_index + 1 == argc) {
             status = exec.cmd_template (argv [command_index]);
         } else if (command_index + 2 == argc) {
-            status = exec.cmd_template (argv [command_index], argv [command_index]);
+            status = exec.cmd_template (argv [command_index], argv [command_index + 1]);
         } else {
             usage_message ();
         }
@@ -401,7 +373,6 @@
         // Usage: ecosconfige export <filename>
         if (command_index + 1 == argc) {
             std::string filename = std::string(argv[command_index]);
-            filename = TRANSLATE_PATH(filename);
             status = exec.cmd_export(filename);
         } else {
             usage_message ();
@@ -411,7 +382,6 @@
         // Usage: ecosconfig import <filename>
         if (command_index + 1 == argc) {
             std::string filename = std::string(argv[command_index]);
-            filename = TRANSLATE_PATH(filename);
             status = exec.cmd_import(filename);
         } else {
             usage_message ();



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]