aboutsummaryrefslogtreecommitdiff
path: root/bdep
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-14 19:28:54 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-14 19:28:54 +0300
commit8e5f53fd249f08b0be0a7d4eec65f425cfb79eae (patch)
tree247b5321b3fda46c390525fab1cc194e64c20ddb /bdep
parentfc9dbf81953ebe3b0757638671eb31787f4f387d (diff)
Adapt to git_version() returning semantic_version now
Diffstat (limited to 'bdep')
-rw-r--r--bdep/git.cxx24
-rw-r--r--bdep/git.hxx10
-rw-r--r--bdep/git.ixx4
-rw-r--r--bdep/git.txx8
-rw-r--r--bdep/project-email.cxx4
-rw-r--r--bdep/publish.cxx3
-rw-r--r--bdep/types.hxx6
7 files changed, 31 insertions, 28 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