Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apt-pkg/pkgcachegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
};
struct hash {
uint32_t operator()(string_pointer const &that) const {
return XXH3_64bits(that.data(), that.size) & 0xFFFFFFFF;
// return XXH3_64bits(that.data(), that.size) & 0xFFFFFFFF;
return XXH3_64(that.data(), that.size) & 0xFFFFFFFF;
}
};

Expand Down
47 changes: 47 additions & 0 deletions apt-private/private-output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,24 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records, /*{{{*/
output.erase(output.length() - 1);

out << output;
string TarFullName = Start.TargetPkg().FullName(true);
out << "----------";
out << TarFullName;
out << "----------";
int n, m, v1, v2;
cin >> n >> m;
// 更好的实现
// Adj.assign(n, list<int>());
// inDegree.assign(n, 0);
// while (m--)
// {
// cin >> v1 >> v2;
// Adj[v1].push_back(v2);
// inDegree[v2]++;
// }
// for (int i = 0; i < n;i++)
// if (inDegree[i] == 0) stk.push(i);
// out << n;
}
/*}}}*/
// ShowBroken - Debugging aide /*{{{*/
Expand Down Expand Up @@ -442,6 +460,31 @@ static void ShowBrokenPackage(ostream &out, pkgCacheFile * const Cache, pkgCache
++Start;
}
}
// pkgCache::VerIterator myVer = (*Cache)[Targ].InstVerIter(*Cache);
// 拓扑排序
// int num = 0; //记录加入拓扑排序的顶点数
// queue<int> q;
// for (int i = 0; i < n; i++)
// if (inDegree[i] == 0)
// q.push(i); //将所有入度为0的顶点入队
// while (!q.empty()) {
// int u = q.front(); //取队首顶点u
// cout << u << " ";
// q.pop();
// for (int i = 0; i < G[u].size(); i++) {
// int v = G[u][i]; //u的后继节点
// inDegree[v]--; //v的入度减1
// if (inDegree[v] == 0) //顶点v的入度减为0则入队
// q.push(v);
// }
// G[u].clear(); //清空顶点u的所有出边
// num++;
// }
// if (num == n) //加入拓扑序列的顶点数为n,说明拓扑排序成功,否则,失败
// return true;
// else
// return false;

}
void ShowBroken(ostream &out, CacheFile &Cache, bool const Now)
{
Expand All @@ -468,6 +511,8 @@ void ShowBroken(ostream &out, pkgCacheFile &Cache, bool const Now)
void ShowNew(ostream &out,CacheFile &Cache)
{
SortedPackageUniverse Universe(Cache);

out << _("This is cited by zpc!!!") << endl;
ShowList(out,_("The following NEW packages will be installed:"), Universe,
[&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall(); },
&PrettyFullName,
Expand All @@ -478,6 +523,8 @@ void ShowNew(ostream &out,CacheFile &Cache)
void ShowDel(ostream &out,CacheFile &Cache)
{
SortedPackageUniverse Universe(Cache);

out << _("This is cited by zpc!!!") << endl;
ShowList(out,_("The following packages will be REMOVED:"), Universe,
[&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].Delete(); },
[&Cache](pkgCache::PkgIterator const &Pkg)
Expand Down
39 changes: 39 additions & 0 deletions apt-private/private-output.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ template<class Container, class PredicateC, class DisplayP, class DisplayV> bool
if (ShowVersions == true)
{
out << std::endl << " " << PkgDisplay(Pkg);
// out << std::endl << " this is cited by zpc" << PkgDisplay(Pkg);
std::string const verbose = VerboseDisplay(Pkg);
std::string const verbose_cp = VerboseDisplay(Pkg);
if (verbose.empty() == false)
out << " (" << verbose << ")";
}
Expand Down Expand Up @@ -88,6 +90,43 @@ template<class Container, class PredicateC, class DisplayP, class DisplayV> bool
return false;
}
return true;

pkgCache::DepIterator Start;
pkgCache::DepIterator End;
D.GlobOr(Start,End); // advances D

// if ((*Cache)->IsImportantDep(End) == false)
// continue;

// if (Now == true)
// {
// if (((*Cache)[End] & pkgDepCache::DepGNow) == pkgDepCache::DepGNow)
// continue;
// }
// else
// {
// if (((*Cache)[End] & pkgDepCache::DepGInstall) == pkgDepCache::DepGInstall)
// continue;
// }

// bool FirstOr = true;
// while (1)
// {
// if (First == false)
// for (unsigned J = 0; J != Indent; J++)
// out << ' ';
// First = false;

// if (FirstOr == false)
// {
// for (unsigned J = 0; J != strlen(End.DepType()) + 3; J++)
// out << ' ';
// }
// else
// out << ' ' << End.DepType() << ": ";
// FirstOr = false;

// out << Start.TargetPkg().FullName(true);
}

void ShowNew(std::ostream &out,CacheFile &Cache);
Expand Down