From 5e40d45fedc7181810d837a77a8a1ca97b5f8665 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 24 Nov 2020 13:58:40 +0300 Subject: Adapt to converting local repo canonical name path part to lower case on Windows --- bdep/deinit.cxx | 2 +- bdep/fetch.cxx | 2 +- bdep/status.cxx | 2 +- bdep/sync.cxx | 2 +- bdep/utility.cxx | 14 ++++++++++++++ bdep/utility.hxx | 5 +++++ tests/fetch.testscript | 6 +++--- tests/status.testscript | 4 ++-- tests/sync.testscript | 16 ++++++++-------- tests/test.testscript | 16 ++++++++-------- 10 files changed, 44 insertions(+), 25 deletions(-) diff --git a/bdep/deinit.cxx b/bdep/deinit.cxx index b4a3350..598efd5 100644 --- a/bdep/deinit.cxx +++ b/bdep/deinit.cxx @@ -214,7 +214,7 @@ namespace bdep o, "remove", "-d", c->path, - "dir:" + prj.string ()); + repository_name (prj)); } return 0; diff --git a/bdep/fetch.cxx b/bdep/fetch.cxx index dcc98b6..93a727f 100644 --- a/bdep/fetch.cxx +++ b/bdep/fetch.cxx @@ -23,7 +23,7 @@ namespace bdep o, "fetch", "-d", c->path, - (full ? nullptr : ("dir:" + prj.string ()).c_str ())); + (full ? nullptr : repository_name (prj).c_str ())); } int diff --git a/bdep/status.cxx b/bdep/status.cxx index a4cdb28..2e60b29 100644 --- a/bdep/status.cxx +++ b/bdep/status.cxx @@ -33,7 +33,7 @@ namespace bdep "fetch", "-d", cfg, "--shallow", - "dir:" + prj.string ()); + repository_name (prj)); // Don't show the hold status since the only packages that will normally // be held are the project's. But do show dependency constraints. diff --git a/bdep/sync.cxx b/bdep/sync.cxx index 63486cd..471e190 100644 --- a/bdep/sync.cxx +++ b/bdep/sync.cxx @@ -256,7 +256,7 @@ namespace bdep for (const project& prj: prjs) { if (prj.fetch) - reps.push_back ("dir:" + prj.path.string ()); + reps.push_back (repository_name (prj.path)); for (const package_state& pkg: prj.config->packages) { diff --git a/bdep/utility.cxx b/bdep/utility.cxx index 0e19691..703520e 100644 --- a/bdep/utility.cxx +++ b/bdep/utility.cxx @@ -310,4 +310,18 @@ namespace bdep dr << info << "consider using " << opt << " to override"; } } + + string + repository_name (const dir_path& d) + { + // We could probably obtain the canonical name by creating the repository + // URL and then the repository location, but let's keep it simple and + // produce it directly. + // + #ifdef _WIN32 + return "dir:" + lcase (d.string ()); + #else + return "dir:" + d.string (); + #endif + } } diff --git a/bdep/utility.hxx b/bdep/utility.hxx index 22be4ee..d5e98c8 100644 --- a/bdep/utility.hxx +++ b/bdep/utility.hxx @@ -311,6 +311,11 @@ namespace bdep validate_utf8_graphic (const string&, const char* what, const char* opt = nullptr); + + // Return the canonical name of a directory repository location. + // + string + repository_name (const dir_path&); } #include diff --git a/tests/fetch.testscript b/tests/fetch.testscript index 9ffd7aa..08ede11 100644 --- a/tests/fetch.testscript +++ b/tests/fetch.testscript @@ -35,9 +35,9 @@ deinit += -d prj depends: libbar EOI - $* 2>>/"EOE"; - fetching dir:$~/libbar \(complements dir:$~/prj\) - fetching dir:$~/libfoo \(prerequisite of dir:$~/prj\) + $* 2>>/~%EOE%; + %fetching dir:.+/libbar \(complements dir:.+/prj\)% + %fetching dir:.+/libfoo \(prerequisite of dir:.+/prj\)% EOE $status libfoo libbar >>~%EOO%; diff --git a/tests/status.testscript b/tests/status.testscript index 49b5412..bf4339b 100644 --- a/tests/status.testscript +++ b/tests/status.testscript @@ -82,10 +82,10 @@ deinit += -d prj depends: libprj EOI - $* --recursive >>EOO 2>>/"EOE"; # Note: implicitly fetches in cfg. + $* --recursive >>EOO 2>>/~%EOE%; # Note: implicitly fetches in cfg. prj configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1 EOO - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% EOE $sync; diff --git a/tests/sync.testscript b/tests/sync.testscript index 68a4c70..c03abbb 100644 --- a/tests/sync.testscript +++ b/tests/sync.testscript @@ -50,10 +50,10 @@ deinit += -d prj } EOI - $* -d prj 2>>/~"%EOE%"; - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + $* -d prj 2>>/~%EOE%; + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% synchronizing: - % new libprj.+ \\\(required by prj\\\)% + % new libprj.+ \(required by prj\)% % upgrade prj.+19700101000000#1% EOE @@ -130,15 +130,15 @@ deinit += -d prj # Sync the default (cfg1) configuration (via the package directory). # - $* -d prj/pkg2 2>>/~"%EOE%"; - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + $* -d prj/pkg2 2>>/~%EOE%; + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% synchronizing: - % new libprj.+ \\\(required by pkg1\\\)% + % new libprj.+ \(required by pkg1\)% % upgrade pkg1.+19700101000000#1% % upgrade pkg2.+19700101000000#1% EOE - $status >>~%EOO% 2>>/~"%EOE%"; # Note: implicitly fetches into cfg2. + $status >>~%EOO% 2>>/~%EOE%; # Note: implicitly fetches into cfg2. in configuration @cfg1: pkg1 configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% @@ -148,7 +148,7 @@ deinit += -d prj pkg1 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1 pkg2 configured 0.1.0-a.0.19700101000000 available 0.1.0-a.0.19700101000000#1 EOO - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% EOE # Sync all configurations (via the project directory). diff --git a/tests/test.testscript b/tests/test.testscript index 88dadaf..1079ccf 100644 --- a/tests/test.testscript +++ b/tests/test.testscript @@ -77,22 +77,22 @@ deinit += -d prj tags: c++ EOI - $* -d prj/pkg2 2>>/~"%EOE%"; # Default (cfg1). - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + $* -d prj/pkg2 2>>/~%EOE%; # Default (cfg1). + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% synchronizing: - % new libprj.+ \\\(required by pkg1\\\)% + % new libprj.+ \(required by pkg1\)% % upgrade pkg1.+19700101000000#1% % upgrade pkg2.+19700101000000#1% - %\(mkdir|c\\+\\+|ld|test\) .+%{4} + %(mkdir|c\+\+|ld|test) .+%{4} EOE - $* @cfg2 -d prj/pkg2 2>>/~"%EOE%"; # By name (cfg2). - fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) + $* @cfg2 -d prj/pkg2 2>>/~%EOE%; # By name (cfg2). + %fetching dir:.+/libprj \(prerequisite of dir:.+/prj\)% synchronizing: - % new libprj.+ \\\(required by pkg1\\\)% + % new libprj.+ \(required by pkg1\)% % upgrade pkg1.+19700101000000#1% % upgrade pkg2.+19700101000000#1% - %\(mkdir|c\\+\\+|ld|test\) .+%{4} + %(mkdir|c\+\+|ld|test) .+%{4} EOE $* -a --recursive -d prj/pkg1 2>>~%EOE% # All configs recursive. -- cgit v1.1