Lines 2091-2096
bool DoSource(CommandLine &CmdL)
Link Here
|
2091 |
|
2091 |
|
2092 |
return true; |
2092 |
return true; |
2093 |
} |
2093 |
} |
|
|
2094 |
|
2095 |
void DisplayChangelog(CacheFile& Cache, pkgCache::VerIterator V) { |
2096 |
pkgCache::VerFileIterator Vf = V.FileList(); |
2097 |
for (; Vf.end() == false; Vf++) |
2098 |
if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0) |
2099 |
break; |
2100 |
|
2101 |
if (Vf.end() == true) |
2102 |
Vf = V.FileList(); |
2103 |
|
2104 |
pkgRecords Recs(*Cache); |
2105 |
pkgRecords::Parser &P = Recs.Lookup(Vf); |
2106 |
|
2107 |
std::cout << "Changelog for " << P.Name() << ":\n"; |
2108 |
std::cout << P.Changelog() << "\n"; |
2109 |
} |
2110 |
|
2111 |
bool DoChangelog(CommandLine &CmdL) { |
2112 |
// Implementation is very similar to apt-cache show |
2113 |
CacheFile Cache(devnull, false /* not WithLock */); |
2114 |
if (Cache.Open() == false) |
2115 |
return false; |
2116 |
|
2117 |
if (CmdL.FileSize() <= 1) |
2118 |
return _error->Error(_("Must specify at least one package to get changelog for")); |
2119 |
|
2120 |
pkgDepCache::Policy Plcy; |
2121 |
|
2122 |
unsigned int found = 0; |
2123 |
|
2124 |
for (const char **I = CmdL.FileList + 1; *I != 0; ++I) { |
2125 |
pkgCache::PkgIterator Pkg = Cache->FindPkg(*I); |
2126 |
if (Pkg.end() == true) { |
2127 |
_error->Warning(_("Unable to locate package %s"), *I); |
2128 |
continue; |
2129 |
} |
2130 |
|
2131 |
++found; |
2132 |
|
2133 |
// If it's a virtual package, require user to select |
2134 |
if (Pkg.VersionList().end() == true and Pkg->ProvidesList != 0) { |
2135 |
ioprintf(cout, _("Package %s is a virtual package provided by:\n"), |
2136 |
Pkg.Name()); |
2137 |
for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() == false; |
2138 |
Prv++) { |
2139 |
pkgCache::VerIterator V = Plcy.GetCandidateVer(Prv.OwnerPkg()); |
2140 |
if (V.end() == true) |
2141 |
continue; |
2142 |
if (V != Prv.OwnerVer()) |
2143 |
continue; |
2144 |
cout << " " << Prv.OwnerPkg().Name() << " " << V.VerStr() << endl; |
2145 |
} |
2146 |
|
2147 |
_error->Error( |
2148 |
_("Package %s is a virtual package with multiple providers."), |
2149 |
Pkg.Name()); |
2150 |
return false; |
2151 |
} |
2152 |
|
2153 |
// Find the proper version to use. |
2154 |
pkgCache::VerIterator V = Plcy.GetCandidateVer(Pkg); |
2155 |
|
2156 |
if (V.end() == true || V.FileList().end() == true) |
2157 |
continue; |
2158 |
|
2159 |
DisplayChangelog(Cache, V); |
2160 |
} |
2161 |
|
2162 |
if (found > 0) |
2163 |
return true; |
2164 |
return _error->Error(_("No packages found")); |
2165 |
|
2166 |
} |
2167 |
|
2094 |
/*}}}*/ |
2168 |
/*}}}*/ |
2095 |
// DoBuildDep - Install/removes packages to satisfy build dependencies /*{{{*/ |
2169 |
// DoBuildDep - Install/removes packages to satisfy build dependencies /*{{{*/ |
2096 |
// --------------------------------------------------------------------- |
2170 |
// --------------------------------------------------------------------- |
Lines 2518-2523
bool ShowHelp(CommandLine &CmdL)
Link Here
|
2518 |
" clean - Erase downloaded archive files\n" |
2592 |
" clean - Erase downloaded archive files\n" |
2519 |
" autoclean - Erase old downloaded archive files\n" |
2593 |
" autoclean - Erase old downloaded archive files\n" |
2520 |
" check - Verify that there are no broken dependencies\n" |
2594 |
" check - Verify that there are no broken dependencies\n" |
|
|
2595 |
" changelog - Display the changelog for the given package\n" |
2521 |
// CNC:2003-03-16 |
2596 |
// CNC:2003-03-16 |
2522 |
); |
2597 |
); |
2523 |
#ifdef WITH_LUA |
2598 |
#ifdef WITH_LUA |
Lines 2648-2653
int main(int argc,const char *argv[])
Link Here
|
2648 |
{"source",&DoSource}, |
2723 |
{"source",&DoSource}, |
2649 |
{"moo",&DoMoo}, |
2724 |
{"moo",&DoMoo}, |
2650 |
{"autoremove", &DoAutoremove}, |
2725 |
{"autoremove", &DoAutoremove}, |
|
|
2726 |
{"changelog",&DoChangelog}, |
2651 |
{"help",&ShowHelp}, |
2727 |
{"help",&ShowHelp}, |
2652 |
// CNC:2003-03-19 |
2728 |
// CNC:2003-03-19 |
2653 |
#ifdef WITH_LUA |
2729 |
#ifdef WITH_LUA |