Skip to content

Commit c4ce453

Browse files
committed
Manually skip empty package.
1 parent f31e489 commit c4ce453

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

src/common/package_store.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ void PackageStore::process(const path &p, Config &root)
132132
// add more necessary actions here
133133
for (auto &cc : *this)
134134
{
135+
if (cc.first == Package())
136+
continue;
135137
root.getDefaultProject().checks += cc.second.config->getDefaultProject().checks;
136138
}
137139

@@ -141,6 +143,8 @@ void PackageStore::process(const path &p, Config &root)
141143
// do not multithread this! causes livelocks
142144
for (auto &cc : *this)
143145
{
146+
if (cc.first == Package())
147+
continue;
144148
auto &d = cc.first;
145149

146150
auto printer = Printer::create(Settings::get_local_settings().printerType);
@@ -218,6 +222,8 @@ void PackageStore::check_deps_changed()
218222
std::unordered_map<Package, String> clean_pkgs;
219223
for (auto &cc : *this)
220224
{
225+
if (cc.first == Package())
226+
continue;
221227
// make sure we have ordered deps
222228
Hasher h;
223229
StringSet deps;
@@ -256,41 +262,21 @@ void PackageStore::check_deps_changed()
256262

257263
PackageStore::iterator PackageStore::begin()
258264
{
259-
auto i = packages.find(Package());
260-
if (i == packages.begin())
261-
return ++i;
262265
return packages.begin();
263266
}
264267

265268
PackageStore::iterator PackageStore::end()
266269
{
267-
auto i = packages.find(Package());
268-
if (i != packages.end())
269-
{
270-
if (i == --packages.end())
271-
return i;
272-
throw std::logic_error("Oops! Empty package not at the end of packages");
273-
}
274270
return packages.end();
275271
}
276272

277273
PackageStore::const_iterator PackageStore::begin() const
278274
{
279-
auto i = packages.find(Package());
280-
if (i == packages.begin())
281-
return ++i;
282275
return packages.begin();
283276
}
284277

285278
PackageStore::const_iterator PackageStore::end() const
286279
{
287-
auto i = packages.find(Package());
288-
if (i != packages.end())
289-
{
290-
if (i == --packages.end())
291-
return i;
292-
throw std::logic_error("Oops! Empty package not at the end of packages");
293-
}
294280
return packages.end();
295281
}
296282

@@ -318,6 +304,8 @@ void PackageStore::write_index() const
318304
auto &sdb = getServiceDatabase();
319305
for (auto &cc : *this)
320306
{
307+
if (cc.first == Package())
308+
continue;
321309
sdb.addInstalledPackage(cc.first);
322310
#ifdef _WIN32
323311
create_link(cc.first.getDirSrc(), directories.storage_dir_lnk / "src" / (cc.first.target_name + ".lnk"));

src/common/resolver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,11 @@ void Resolver::download_and_unpack()
378378
void Resolver::post_download()
379379
{
380380
for (auto &cc : rd)
381+
{
382+
if (cc.first == Package())
383+
continue;
381384
prepare_config(cc);
385+
}
382386
}
383387

384388
void Resolver::prepare_config(PackageStore::PackageConfigs::value_type &cc)

0 commit comments

Comments
 (0)