diff options
-rw-r--r-- | bdep/git.cxx | 24 | ||||
-rw-r--r-- | bdep/git.hxx | 10 | ||||
-rw-r--r-- | bdep/git.ixx | 4 | ||||
-rw-r--r-- | bdep/git.txx | 8 | ||||
-rw-r--r-- | bdep/project-email.cxx | 4 | ||||
-rw-r--r-- | bdep/publish.cxx | 3 | ||||
-rw-r--r-- | bdep/types.hxx | 6 | ||||
-rw-r--r-- | tests/common.test | 13 | ||||
-rw-r--r-- | tests/config.test | 30 | ||||
-rw-r--r-- | tests/init.test | 29 | ||||
-rw-r--r-- | tests/new.test | 10 | ||||
-rw-r--r-- | tests/publish.test | 15 | ||||
-rw-r--r-- | tests/status.test | 16 | ||||
-rw-r--r-- | tests/sync.test | 30 | ||||
-rw-r--r-- | tests/test.test | 8 |
15 files changed, 104 insertions, 106 deletions
diff --git a/bdep/git.cxx b/bdep/git.cxx index 79e6255..a5e2be4 100644 --- a/bdep/git.cxx +++ b/bdep/git.cxx @@ -12,32 +12,36 @@ using namespace butl; namespace bdep { - static optional<standard_version> git_ver; + static optional<semantic_version> git_ver; - // On the first call check that git is at least of the specified minimum - // supported version. + // Check that git is at least of the specified minimum supported version. // void - git_check_version (const standard_version& min_ver) + git_check_version (const semantic_version& min_ver) { + // Query and cache git version on the first call. + // if (!git_ver) { // Make sure that the getline() function call doesn't end up with an // infinite recursion. // - git_ver = standard_version (); + git_ver = semantic_version (); - optional<string> s (git_line (min_ver, + optional<string> s (git_line (*git_ver, false /* ignore_error */, "--version")); if (!s || !(git_ver = git_version (*s))) fail << "unable to obtain git version"; - - if (*git_ver < min_ver) - fail << "unsupported git version " << *git_ver << - info << "minimum supported version is " << min_ver << endf; } + + // Note that we don't expect the min_ver to contain the build component, + // that doesn't matter functionality-wise for git. + // + if (*git_ver < min_ver) + fail << "unsupported git version " << *git_ver << + info << "minimum supported version is " << min_ver << endf; } optional<string> diff --git a/bdep/git.hxx b/bdep/git.hxx index 6b112c8..fcc9513 100644 --- a/bdep/git.hxx +++ b/bdep/git.hxx @@ -21,11 +21,11 @@ namespace bdep // template <typename I, typename O, typename E, typename... A> process - start_git (const standard_version&, I&& in, O&& out, E&& err, A&&... args); + start_git (const semantic_version&, I&& in, O&& out, E&& err, A&&... args); template <typename I, typename O, typename E, typename... A> process - start_git (const standard_version&, + start_git (const semantic_version&, const dir_path& repo, I&& in, O&& out, E&& err, A&&... args); @@ -39,18 +39,18 @@ namespace bdep // template <typename... A> void - run_git (const standard_version&, const dir_path& repo, A&&... args); + run_git (const semantic_version&, const dir_path& repo, A&&... args); // Return the first line of the git output. If ignore_error is true, then // suppress stderr, ignore (normal) error exit status, and return nullopt. // template <typename... A> optional<string> - git_line (const standard_version&, bool ignore_error, A&&... args); + git_line (const semantic_version&, bool ignore_error, A&&... args); template <typename... A> optional<string> - git_line (const standard_version&, + git_line (const semantic_version&, const dir_path& repo, bool ignore_error, A&&... args); diff --git a/bdep/git.ixx b/bdep/git.ixx index 0e3ee9f..379f392 100644 --- a/bdep/git.ixx +++ b/bdep/git.ixx @@ -6,7 +6,7 @@ namespace bdep { template <typename I, typename O, typename E, typename... A> inline process - start_git (const standard_version& min_ver, + start_git (const semantic_version& min_ver, const dir_path& repo, I&& in, O&& out, E&& err, A&&... args) @@ -25,7 +25,7 @@ namespace bdep template <typename... A> inline optional<string> - git_line (const standard_version& min_ver, + git_line (const semantic_version& min_ver, const dir_path& repo, bool ie, A&&... args) diff --git a/bdep/git.txx b/bdep/git.txx index 19a9d42..4abae3c 100644 --- a/bdep/git.txx +++ b/bdep/git.txx @@ -6,7 +6,7 @@ namespace bdep { template <typename... A> void - run_git (const standard_version& min_ver, const dir_path& repo, A&&... args) + run_git (const semantic_version& min_ver, const dir_path& repo, A&&... args) { process pr (start_git (min_ver, repo, @@ -17,11 +17,11 @@ namespace bdep } void - git_check_version (const standard_version& min_ver); + git_check_version (const semantic_version& min_ver); template <typename I, typename O, typename E, typename... A> process - start_git (const standard_version& min_ver, + start_git (const semantic_version& min_ver, I&& in, O&& out, E&& err, A&&... args) { @@ -34,7 +34,7 @@ namespace bdep template <typename... A> optional<string> - git_line (const standard_version& min_ver, bool ie, A&&... args) + git_line (const semantic_version& min_ver, bool ie, A&&... args) { fdpipe pipe (fdopen_pipe ()); auto_fd null (ie ? fdnull () : auto_fd ()); diff --git a/bdep/project-email.cxx b/bdep/project-email.cxx index 9e8bbc9..fe43b18 100644 --- a/bdep/project-email.cxx +++ b/bdep/project-email.cxx @@ -11,8 +11,6 @@ using namespace butl; namespace bdep { - static const standard_version git_ver ("2.1.0"); - optional<string> project_email (const dir_path& prj) { @@ -37,7 +35,7 @@ namespace bdep // resolved value can be queried with the GIT_AUTHOR_IDENT logical // variable. // - if (optional<string> l = git_line (git_ver, + if (optional<string> l = git_line (semantic_version {2, 1, 0}, prj, true /* ignore_error */, "var", "GIT_AUTHOR_IDENT")) diff --git a/bdep/publish.cxx b/bdep/publish.cxx index 1afdd36..c498361 100644 --- a/bdep/publish.cxx +++ b/bdep/publish.cxx @@ -8,6 +8,7 @@ #include <libbutl/fdstream.mxx> // fdterm() #include <libbutl/manifest-parser.mxx> +#include <libbutl/standard-version.mxx> #include <libbutl/manifest-serializer.mxx> #include <libbpkg/manifest.hxx> @@ -29,7 +30,7 @@ namespace bdep // worktree command used. We also use bpkg that caps the git version at // 2.12, so let's use is as the lowest common denominator. // - static const standard_version git_ver ("2.12.0"); + static const semantic_version git_ver {2, 12, 0}; static inline url parse_url (const string& s, const char* what) diff --git a/bdep/types.hxx b/bdep/types.hxx index 0c13639..7cf5c41 100644 --- a/bdep/types.hxx +++ b/bdep/types.hxx @@ -28,7 +28,7 @@ #include <libbutl/optional.mxx> #include <libbutl/fdstream.mxx> #include <libbutl/small-vector.mxx> -#include <libbutl/standard-version.mxx> +#include <libbutl/semantic-version.mxx> namespace bdep { @@ -111,9 +111,9 @@ namespace bdep using butl::fdopen_mode; using butl::fdstream_mode; - // <libbutl/standard-version.mxx> + // <libbutl/semantic-version.mxx> // - using butl::standard_version; + using butl::semantic_version; } // In order to be found (via ADL) these have to be either in std:: or in diff --git a/tests/common.test b/tests/common.test index f532d76..80d37d3 100644 --- a/tests/common.test +++ b/tests/common.test @@ -30,13 +30,10 @@ end +echo "$git_version" | sed -e 's/(\d+).*/\1/' | set git_version_major +echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor -# This flag must be used by testscripts to decide if they should skip git -# repository-related tests or adjust bdep commands. Note that specific command -# tests may still adjust this flag to express the higher requirements for the -# minimum supported git version. -# -git_supported = ($git_version_major > 2 || \ - $git_version_major == 2 && $git_version_minor >= 1) ++if! ($git_version_major > 2 || \ + $git_version_major == 2 && $git_version_minor >= 1) + exit "minimum supported git version is 2.1" +end # Helper commands that can be used by tests to prepare the testing environment # or validate an outcome of the command being tested. They are likely to get @@ -50,7 +47,7 @@ clean = $* clean deinit = $* deinit init = $* init fetch = $* fetch -new = $* new --no-checks --vcs ($git_supported ? git : none) +new = $* new --no-checks status = $* status sync = $* sync update = $* update diff --git a/tests/config.test b/tests/config.test index 7c03286..5beabcf 100644 --- a/tests/config.test +++ b/tests/config.test @@ -31,10 +31,10 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $* list @cfg >>/"EOO"; @cfg $~/cfg-dir/ 1 default,forwarded,auto-synchronized @@ -65,10 +65,10 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $* list >>/"EOO"; @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized @@ -99,10 +99,10 @@ deinit += -d prj $init -c cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $* list >>/"EOO"; $~/cfg/ 1 default,forwarded,auto-synchronized @@ -162,19 +162,19 @@ deinit += -d prj initializing in project $~/prj/ in configuration @cfg1: synchronizing: - % new prj.+% + % new prj.+19700101000000% in configuration @cfg2: synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status --all >>~%EOO%; + $status --all >>EOO; in configuration @cfg1: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 in configuration @cfg2: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 EOO $* list >>/"EOO"; @@ -218,7 +218,7 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE mv prj-cfg prj-cfg2; @@ -252,7 +252,7 @@ deinit += -d prj $init @cfg 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE $* rename @cfg cfg2 2>>/"EOE"; @@ -300,8 +300,8 @@ deinit += -d prj removed configuration @cfg1 $~/prj-cfg1/ 1 EOE - $status --all >>~%EOO%; - %prj configured 0\.1\.0-a\.0\..+% + $status --all >>EOO; + prj configured 0.1.0-a.0.19700101000000 EOO $* list >>/"EOO"; diff --git a/tests/init.test b/tests/init.test index 2fb3945..8915189 100644 --- a/tests/init.test +++ b/tests/init.test @@ -24,13 +24,13 @@ deinit += -d prj initializing in project $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE sed -n -e 's/^config.cc.poptions = (.+)$/\1/p' prj-cfg/build/config.build \ >'-DTEST'; - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $build prj/ 2>>/EOE; mkdir prj-cfg/prj/fsdir{prj/} @@ -72,22 +72,22 @@ deinit += -d prj initializing in project $~/prj/ added configuration @cfg1 $~/prj-cfg1/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE $* -A prj-cfg2 @cfg2 2>>/~"%EOE%"; initializing in project $~/prj/ added configuration @cfg2 $~/prj-cfg2/ 2 auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status --all >>~%EOO%; + $status --all >>EOO; in configuration @cfg1: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 in configuration @cfg2: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 EOO $build prj-cfg1/ 2>>/~%EOE%; @@ -134,10 +134,10 @@ deinit += -d prj initializing in project $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $build prj/ 2>>/EOE; mkdir prj-cfg/prj/fsdir{prj/} @@ -150,10 +150,7 @@ deinit += -d prj # mkdir --no-cleanup prj/prj.pkg; - mv prj/prj prj/build prj/buildfile prj/manifest prj/prj.pkg/; - if ($git_supported) - mv prj/.gitignore prj/prj.pkg/ - end; + mv prj/prj prj/build prj/buildfile prj/manifest prj/.gitignore prj/prj.pkg/; mv prj/prj.pkg prj/prj; cat <<EOI >=prj/packages.manifest; @@ -170,8 +167,8 @@ deinit += -d prj $init --all -d prj/libprj 2>>/~"%EOE%"; initializing in project $~/prj/ synchronizing: - % upgrade prj.+#1% - % new libprj.+% + % upgrade prj.+19700101000000#1% + % new libprj.+19700101000000% EOE # Factor out some of the executable package functionality into the library. @@ -204,7 +201,7 @@ deinit += -d prj $build prj-cfg/prj/ 2>>/~"%EOE%"; synchronizing $~/prj-cfg/: - % upgrade prj.+#2% + % upgrade prj.+19700101000000#2% %mkdir prj-cfg/.+%{2} %.{3} %ld prj-cfg/.+%{2} diff --git a/tests/new.test b/tests/new.test index 089be60..3a62df3 100644 --- a/tests/new.test +++ b/tests/new.test @@ -6,7 +6,7 @@ # Disable nesting checks in the created projects. # -test.arguments += --no-checks --vcs ($git_supported ? git : none) +test.arguments += --no-checks cxx = "config.cxx=$config.cxx" @@ -104,10 +104,10 @@ status += -d prj created new executable project prj in $~/prj/ created configuration @cfg $~/prj-config/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $build prj/ 2>>/EOE mkdir prj-config/prj/fsdir{prj/} @@ -129,10 +129,10 @@ status += -d prj created new executable project prj in $~/prj/ created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized synchronizing: - % new prj.+% + % new prj.+19700101000000% EOE - $status >~'%prj configured 0\.1\.0-a\.0\..+%'; + $status >'prj configured 0.1.0-a.0.19700101000000'; $build prj/ 2>>/EOE mkdir prj-cfg/prj/fsdir{prj/} diff --git a/tests/publish.test b/tests/publish.test index 8541d9c..d8d86d8 100644 --- a/tests/publish.test +++ b/tests/publish.test @@ -4,6 +4,14 @@ .include common.test project.test +# bdep-publish requirements for the minimum supported git version are higher +# then the default 2.1 (see bdep/publish.cxx for details). +# ++if! ($git_version_major > 2 || \ + $git_version_major == 2 && $git_version_minor >= 12) + exit +end + # Repository to use for the package submissions simulation. # # Note: could use empty config.bdep.test.repository value to suppress @@ -24,12 +32,6 @@ init += $cxx -d prj 2>! &prj/**/bootstrap/*** windows = ($cxx.target.class == 'windows') -# bdep-publish requirements for the minimum supported git version are higher -# then the default 2.1 (see bdep/publish.cxx for details). -# -git_supported = ($git_version_major > 2 || \ - $git_version_major == 2 && $git_version_minor >= 12) - # Note that using the same package name and version for tests may result in # duplicate submissions. We will use unique version for each test, # incrementing the patch version for 1.0.X. @@ -230,7 +232,6 @@ git_supported = ($git_version_major > 2 || \ : control : -if ($git_supported) { # The control repository URL doesn't really matter for the submission # simulation. We specify it to enable the control branch-related diff --git a/tests/status.test b/tests/status.test index 12ccc34..676dac0 100644 --- a/tests/status.test +++ b/tests/status.test @@ -29,7 +29,7 @@ deinit += -d prj $init -C @cfg &prj-cfg/***; - $* >~'%prj configured 0\.1\.0-a\.0\..+%'; + $* >'prj configured 0.1.0-a.0.19700101000000'; $deinit 2>>/"EOE" deinitializing in project $~/prj/ @@ -46,14 +46,14 @@ deinit += -d prj $init -C @cfg1 &prj-cfg1/***; $init -C @cfg2 &prj-cfg2/***; - $* @cfg2 >~'%prj configured 0\.1\.0-a\.0\..+%'; + $* @cfg2 >'prj configured 0.1.0-a.0.19700101000000'; - $* --all >>~%EOO%; + $* --all >>EOO; in configuration @cfg1: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 in configuration @cfg2: - %prj configured 0\.1\.0-a\.0\..+% + prj configured 0.1.0-a.0.19700101000000 EOO $deinit 2>>/"EOE" @@ -83,8 +83,8 @@ deinit += -d prj depends: libprj EOI - $* --recursive >>~%EOO% 2>>/"EOE"; # Note: implicitly fetches in cfg. - %prj configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% + $* --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\) EOE @@ -92,7 +92,7 @@ deinit += -d prj $sync; $* --recursive >>~%EOO%; - %prj configured 0\.1\.0-a\.0\..+#1% + prj configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% EOO diff --git a/tests/sync.test b/tests/sync.test index 842c2e1..c086a02 100644 --- a/tests/sync.test +++ b/tests/sync.test @@ -55,11 +55,11 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by prj\\\)% - % upgrade prj.+#1% + % upgrade prj.+19700101000000#1% EOE - $status >>~"%EOO%"; - %prj configured 0\.1\.0-a\.0\..+#1% + $status >>~%EOO%; + prj configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% EOO @@ -140,19 +140,19 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+#1% - % upgrade pkg2.+#1% + % upgrade pkg1.+19700101000000#1% + % upgrade pkg2.+19700101000000#1% EOE $status >>~%EOO% 2>>/~"%EOE%"; # Note: implicitly fetches into cfg2. in configuration @cfg1: - %pkg1 configured 0\.1\.0-a\.0\..+#1% + pkg1 configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% - %pkg2 configured 0\.1\.0-a\.0\..+#1% + pkg2 configured 0.1.0-a.0.19700101000000#1 in configuration @cfg2: - %pkg1 configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% - %pkg2 configured 0\.1\.0-a\.0\..+ available 0\.1\.0-a\.0\..+#1% + 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\) EOE @@ -165,20 +165,20 @@ deinit += -d prj in configuration @cfg2: synchronizing: % new libprj.+ \(required by pkg1\)% - % upgrade pkg1/0\.1\.0-a\.0\..+#1% - % upgrade pkg2/0\.1\.0-a\.0\..+#1% + upgrade pkg1/0.1.0-a.0.19700101000000#1 + upgrade pkg2/0.1.0-a.0.19700101000000#1 EOE $status >>~%EOE%; in configuration @cfg1: - %pkg1 configured 0\.1\.0-a\.0\..+#1% + pkg1 configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% - %pkg2 configured 0\.1\.0-a\.0\..+#1% + pkg2 configured 0.1.0-a.0.19700101000000#1 in configuration @cfg2: - %pkg1 configured 0\.1\.0-a\.0\..+#1% + pkg1 configured 0.1.0-a.0.19700101000000#1 % libprj configured 0.+% - %pkg2 configured 0\.1\.0-a\.0\..+#1% + pkg2 configured 0.1.0-a.0.19700101000000#1 EOE $build prj/pkg1/ 2>>/~%EOE%; diff --git a/tests/test.test b/tests/test.test index 713a25f..33952d5 100644 --- a/tests/test.test +++ b/tests/test.test @@ -85,8 +85,8 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+#1% - % upgrade pkg2.+#1% + % upgrade pkg1.+19700101000000#1% + % upgrade pkg2.+19700101000000#1% mkdir prj-cfg1/pkg2/fsdir{pkg2/} c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg1/pkg2/pkg2/ ld prj-cfg1/pkg2/pkg2/exe{pkg2} @@ -97,8 +97,8 @@ deinit += -d prj fetching dir:$~/libprj \(prerequisite of dir:$~/prj\) synchronizing: % new libprj.+ \\\(required by pkg1\\\)% - % upgrade pkg1.+#1% - % upgrade pkg2.+#1% + % upgrade pkg1.+19700101000000#1% + % upgrade pkg2.+19700101000000#1% mkdir prj-cfg2/pkg2/fsdir{pkg2/} c++ prj/pkg2/pkg2/cxx{pkg2}@prj-cfg2/pkg2/pkg2/ ld prj-cfg2/pkg2/pkg2/exe{pkg2} |