aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.
//