aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-build.cxx
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 /bpkg/pkg-build.cxx
parent89662f03d8dbc6f80334c7fdae9bc1a919c88dd0 (diff)
Add --no-fetch option for pkg-build
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r--bpkg/pkg-build.cxx45
1 files changed, 25 insertions, 20 deletions
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.
//