aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-03-14 14:09:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-03-14 14:09:18 +0200
commit1a5ea4346a96a942d80fa6c58c6dd503a3690f99 (patch)
tree4289b27b7094f5d14cccb125e0ce55e082ed5c15
parent89662f03d8dbc6f80334c7fdae9bc1a919c88dd0 (diff)
Add --no-fetch option for pkg-build
-rw-r--r--bpkg/pkg-build.cli10
-rw-r--r--bpkg/pkg-build.cxx45
2 files changed, 33 insertions, 22 deletions
diff --git a/bpkg/pkg-build.cli b/bpkg/pkg-build.cli
index 4bc55a7..bb85dfd 100644
--- a/bpkg/pkg-build.cli
+++ b/bpkg/pkg-build.cli
@@ -148,10 +148,16 @@ namespace bpkg
downgrades. Refer to \l{bpkg-pkg-disfigure(1)} for details."
}
+ bool --no-fetch
+ {
+ "Don't fetch repositories specified as part of the build command."
+ }
+
bool --fetch-shallow
{
- "Do not re-fetch complement and prerequisite repositories. Refer to
- the \cb{--shallow} option in \l{bpkg-rep-fetch(1)} for details."
+ "Don't re-fetch complement and prerequisite repositories of repositories
+ specified as part of the build command. Refer to the \cb{--shallow}
+ option in \l{bpkg-rep-fetch(1)} for details."
}
};
}
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 94d4a4d..4621fb9 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -1163,45 +1163,50 @@ namespace bpkg
// the same canonical name.
//
strings args;
- vector<repository_location> locations;
{
+ vector<repository_location> locations;
+
transaction t (db.begin ());
while (a.more ())
{
string arg (a.next ());
- size_t p (find_location (arg));
- if (p != string::npos)
+ if (!o.no_fetch ())
{
- repository_location l (location (string (arg, p)));
+ size_t p (find_location (arg));
- auto pr = [&l] (const repository_location& i) -> bool
+ if (p != string::npos)
{
- return i.canonical_name () == l.canonical_name ();
- };
+ repository_location l (location (string (arg, p)));
- auto i (find_if (locations.begin (), locations.end (), pr));
+ auto pr = [&l] (const repository_location& i) -> bool
+ {
+ return i.canonical_name () == l.canonical_name ();
+ };
- if (i != locations.end ())
- *i = move (l);
- else
- locations.push_back (move (l));
+ auto i (find_if (locations.begin (), locations.end (), pr));
+
+ if (i != locations.end ())
+ *i = move (l);
+ else
+ locations.push_back (move (l));
+ }
}
args.push_back (move (arg));
}
t.commit ();
- }
- if (!locations.empty ())
- rep_fetch (o,
- c,
- db,
- locations,
- o.fetch_shallow (),
- string () /* reason for "fetching ..." */);
+ if (!locations.empty ())
+ rep_fetch (o,
+ c,
+ db,
+ locations,
+ o.fetch_shallow (),
+ string () /* reason for "fetching ..." */);
+ }
// Expand <packages>@<location> arguments.
//