Re: Gnome-Apt
Thanks! I'm copying this message to the mailing list so people can comment
on the technical issues involved in showing new/updated packages, see
below.
On Sun, 8 Aug 1999, Diego Delgado Lages wrote:
>
> There is a file called gnome-apt.patch.gz that is a patch(ohh!). I've
> downloaded the CVS sources and hacked a little bit..
>
I'm having some trouble applying the patch - can you create the patch this
way:
- make your changes to your checked-out copy of the CVS repository
- in the gnome-apt directory (from CVS), type:
cvs diff -u > gnome-apt.patch
- if you've added new files, be sure to send me those as well - they
won't appear in the patch. I think wizard.h, add_wizard.h, pt_BR.po
aren't in the patch.
Then I'll be able to apply it a bit better. :-)
> There is another file called gnome-apt-logo.png that is a logo that I've
> done.. I hope that you don't mind putting me in the logo, since I'll
> contribute a lot :))
>
It's a very nice logo. I think maybe more of a splash screen?
Anyway, my only worry is that the background might become obsolete if we
change the tree view. If you have the background as a separate layer in
Gimp, we could change it later though... if you have a .xcf file, can you
send me that to put in CVS?
> Here is what I've done today :
> What I want to do tomorrow? Well.. I would like you to explain me how to
> show
> up the new packages(like dselect that shows he newest packages on the
> top). I think that is really interesting..
>
Look on the website under:
Task: Determine which are "new" packages after an update.
Here's a not-very-helpful email on the topic:
http://www.debian.org/Lists-Archives/deity-9905/msg00093.html
So you want to show both packages that are new since the update, and also
packages that have a new version since the last update. AFAIK there's no
easy way to do this using libapt-pkg. So here's more or less how to
compute it, I guess.
You just create a list of packages before you run Update, and a list
after, and compare them. To get the list of packages, do something like:
// "cache" is available using functions in cache.h
pkgCache::PkgIterator i = cache->PkgBegin();
while (!i.end())
{
const char* pkgname = i.Name();
// do something with name, such as add it to the list
++i;
}
To get the available version, here's some sample code from
pkgtree.cc:
const char* s;
pkgDepCache::StateCache & state = (*tree()->cache())[i];
pkgCache::VerIterator vi =
state.CandidateVerIter(*tree()->cache());
if (!vi.end())
s = vi.VerStr();
else
s = 0;
Notice that sometimes there is no available version, so vi.end() will
return true - the iterator points to an empty list.
So I'd say, in GAptCacheFile::UpdateAndReopen() (cache.cc), you need to
first save a vector of package/version pairs, then update and reopen, then
create a new vector of package/version pairs, compute the difference, and
store "new" and "updated" packages in some kind of data structure - maybe
a hash by package name, see what you think.
We need to work on saving the state of the tree view between sessions;
that is, what the user has marked for delete/keep/install, etc. When this
is done, we can save the list of new and updated packages in the same
file, so it will be persistent between gnome-apt sessions. This might be
nice to have in libapt-pkg so you could apt-get --postpone install foo,
etc. But as a start don't worry about saving to disk.
If this sounds complicated, feel free to attack a different problem. :-)
(But I assure you it's not as complicated as the stupid tree widget I
occasionally summon the guts to work on :-)
Havoc
Reply to: