1
/* rpackage.h - wrapper for accessing package information
3
* Copyright (c) 2000, 2001 Conectiva S/A
4
* 2002 Michael Vogt <mvo@debian.org>
6
* Author: Alfredo K. Kojima <kojima@conectiva.com.br>
7
* Michael Vogt <mvo@debian.org>
9
* Portions Taken from Gnome APT
10
* Copyright (C) 1998 Havoc Pennington <hp@pobox.com>
13
* This program is free software; you can redistribute it and/or
14
* modify it under the terms of the GNU General Public License as
15
* published by the Free Software Foundation; either version 2 of the
16
* License, or (at your option) any later version.
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* You should have received a copy of the GNU General Public License
24
* along with this program; if not, write to the Free Software
25
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
36
#include <apt-pkg/pkgcache.h>
46
RPackageLister *_lister;
49
pkgDepCache *_depcache;
50
pkgCache::PkgIterator *_package;
53
bool _orphanedPackage;
55
// virtual pkgs provided by this one
56
vector<pkgCache::PkgIterator> _virtualPackages;
58
// stuff for enumerators
60
pkgCache::DepIterator _rdepI;
62
pkgCache::DepIterator _wdepI;
63
pkgCache::DepIterator _wdepStart;
64
pkgCache::DepIterator _wdepEnd;
66
pkgCache::DepIterator _depI;
67
pkgCache::DepIterator _depStart;
68
pkgCache::DepIterator _depEnd;
70
bool isShallowDependency(RPackage *pkg);
72
bool isWeakDep(pkgCache::DepIterator &dep);
78
SInstalledBroken, // installed but broken
90
MPinned, /* only used for the pixmap position (make this go away) */
91
MNew /* only used for the pixmap position (make this go away) */
96
OPinned = 1<<1, /* apt-pined */
98
OResidualConfig = 1<<3
101
enum UpdateImportance {
108
pkgCache::PkgIterator *package() { return _package; };
111
inline const char *name() { return _package->Name(); };
113
const char *section();
114
const char *priority();
116
const string summary();
117
const char *description();
123
const char *availableDownloadableVersion();
125
const string maintainer();
126
const char *vendor();
128
const char *installedVersion();
129
long installedSize();
131
// if this is an update
132
UpdateImportance updateImportance();
133
const char *updateSummary();
134
const char *updateDate();
135
const char *updateURL();
137
// relative to version that would be installed
138
const char *availableVersion();
139
long availableSize();
140
long availableDownloadableSize();
142
long packageDownloadableSize();
145
// special case: alway get the deps of the latest available version
146
// (not necessary the installed one)
147
bool enumAvailDeps(const char *&type, const char *&what, const char *&pkg,
148
const char *&which, char *&summary, bool &satisfied);
150
// installed package if installed, scheduled/candidate if not or if marked
151
bool enumDeps(const char *&type, const char *&what, const char *&pkg,
152
const char *&which, char *&summary, bool &satisfied);
153
bool nextDeps(const char *&type, const char *&what, const char *&pkg,
154
const char *&which, char *&summary, bool &satisfied);
156
// reverse dependencies
157
bool enumRDeps(const char *&dep, const char *&what);
158
bool nextRDeps(const char *&dep, const char *&what);
161
bool enumWDeps(const char *&type, const char *&what, bool &satisfied);
162
bool nextWDeps(const char *&type, const char *&what, bool &satisfied);
164
// current status query
165
PackageStatus getStatus();
167
// selected status query
168
MarkedStatus getMarkedStatus();
170
// other information about the package (bitwise encoded in the returned int)
171
int getOtherStatus();
175
void inline setNew(bool isNew=true) { _newPackage=isNew; };
176
void setPinned(bool flag);
177
void setOrphaned(bool flag=true) { _orphanedPackage=flag; };
182
void setRemove(bool purge = false); //XXX: purge for debian
184
// shallow doesnt remove things other pkgs depend on
185
void setRemoveWithDeps(bool shallow, bool purge=false);
187
void addVirtualPackage(pkgCache::PkgIterator dep);
189
RPackage(RPackageLister *lister, pkgDepCache *depcache, pkgRecords *records,
190
pkgCache::PkgIterator &pkg);