- EditFileInSensibleEditor(sourceslist);
- _error->PushToStack();
- res = sl.Read(sourceslist);
- if (!res) {
- _error->DumpErrors(std::cerr, GlobalError::DEBUG, false);
- strprintf(outs, _("Failed to parse %s. Edit again? "),
- sourceslist.c_str());
- std::cout << outs;
+ if (EditFileInSensibleEditor(sourceslist) == false)
+ return false;
+ if (before.empty())
+ {
+ struct stat St;
+ if (stat(sourceslist.c_str(), &St) == 0 && St.st_size == 0)
+ RemoveFile("edit-sources", sourceslist);
+ }
+ else if (FileExists(sourceslist) && !before.VerifyFile(sourceslist))
+ {
+ file_changed = true;
+ pkgCacheFile::RemoveCaches();
+ }
+ pkgCacheFile CacheFile;
+ res = CacheFile.BuildCaches(nullptr);
+ if (res == false || _error->empty(GlobalError::WARNING) == false) {
+ std::string outs;
+ strprintf(outs, _("Failed to parse %s. Edit again? "), sourceslist.c_str());