Re: Source field in binary Packages list

2008-08-31 Thread Daniel Burrows
On Sat, Aug 30, 2008 at 07:13:50PM -0300, Thadeu Lima de Souza Cascardo [EMAIL 
PROTECTED] was heard to say:
 On Sat, Aug 30, 2008 at 03:21:36PM -0500, Raphael Geissert wrote:
  Thadeu Lima de Souza Cascardo wrote:
  
   Hello,
   
   I am working on a grouping feature for aptitude, to group binary
   packages by their source package. However, some packages in the Packages
   file do not have a Source field. My guess was to use the package name as
   the source package name. Is this right?
  
  Yup
  
   
   Thanks,
   Thadeu Cascardo.
 
 Thanks again!
 
 For those interested, I've submitted the patches to the BTS as bugs
 497205 and 497206. Note that 497205 should break libapt-pkg ABI, so take
 care.  :-)

  Why do you need #497205?  Is it too slow to just use SourcePkg() in
the package records object?

  Daniel


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Source field in binary Packages list

2008-08-31 Thread Thadeu Lima de Souza Cascardo
On Sun, Aug 31, 2008 at 02:20:27PM -0700, Daniel Burrows wrote:
   Why do you need #497205?  Is it too slow to just use SourcePkg() in
 the package records object?
 
   Daniel

Sorry! I was lazy/stupid/whatever enough to not read more about apt and
learn how to do it without adding a field to the cache. So, I am
attaching the patch to the patch for aptitude, which does not need this
other patch to APT. I will close the apt bug after that.

I still like the patch to be reviewed, if you can, please.

Thanks,
Thadeu Cascardo.
diff -u aptitude-0.4.11.8/src/pkg_grouppolicy.cc aptitude-0.4.11.8/src/pkg_grouppolicy.cc
--- aptitude-0.4.11.8/src/pkg_grouppolicy.cc
+++ aptitude-0.4.11.8/src/pkg_grouppolicy.cc
@@ -1676,11 +1676,11 @@
 
   void add_package(const pkgCache::PkgIterator pkg, pkg_subtree *root)
   {
-string source;
-if (!pkg.Source())
+if (pkg.VersionList().end() || pkg.VersionList().FileList().end())
+  return;
+string source=apt_package_records-Lookup(pkg.VersionList().FileList()).SourcePkg();
+if (source.length()==0)
   source=pkg.Name();
-else
-  source=pkg.Source();
 
 childmap::iterator found=children.find(source);
 


signature.asc
Description: Digital signature


Re: Source field in binary Packages list

2008-08-30 Thread Raphael Geissert
Thadeu Lima de Souza Cascardo wrote:

 Hello,
 
 I am working on a grouping feature for aptitude, to group binary
 packages by their source package. However, some packages in the Packages
 file do not have a Source field. My guess was to use the package name as
 the source package name. Is this right?

Yup

 
 Thanks,
 Thadeu Cascardo.



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Source field in binary Packages list

2008-08-30 Thread Thadeu Lima de Souza Cascardo
On Sat, Aug 30, 2008 at 03:21:36PM -0500, Raphael Geissert wrote:
 Thadeu Lima de Souza Cascardo wrote:
 
  Hello,
  
  I am working on a grouping feature for aptitude, to group binary
  packages by their source package. However, some packages in the Packages
  file do not have a Source field. My guess was to use the package name as
  the source package name. Is this right?
 
 Yup
 
  
  Thanks,
  Thadeu Cascardo.

Thanks again!

For those interested, I've submitted the patches to the BTS as bugs
497205 and 497206. Note that 497205 should break libapt-pkg ABI, so take
care.  :-)

Comments welcome. Regards,
Thadeu Cascardo.


signature.asc
Description: Digital signature