[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#553661: bugs.debian.org: provide some way through the SOAP interface to determine if a package exists



Hi,

On Sun, Nov 01, 2009 at 03:21:33PM -0800, Don Armstrong wrote:
> reassign 553661 debbugs
> retitle 553661 expose Debbugs::Common::package_maintainer via soap
> thanks
> 
> On Sun, 01 Nov 2009, Ryan Niebur wrote:
> > one way I thought of is to check the maintainer. it looks like just
> > exposing Debbugs::Common::package_maintainer is all that's needed
> > for that. if there's a better way, of course please do that instead.
> 
> That's basically how Debbugs does it.
> 

how does this patch look? rather than exposing package_maintainer
itself, it uses package_maintainer to determine if the package exists.
this way the implimentation on how to tell if a package exists is left
to Debbugs rather than the client program. and feel free to make me
redo it, I just want this fixed. ;)

Cheers,
Ryan

-- 
_________________________
Ryan Niebur
ryanryan52@gmail.com
--- Debbugs/SOAP.pm	2009-08-15 19:02:13.000000000 -0700
+++ /usr/share/perl5/Debbugs/SOAP.pm	2009-12-23 13:33:53.000000000 -0800
@@ -49,6 +49,31 @@
 
 our $CURRENT_VERSION = 1;
 
+=head2 packages_exist
+
+     my %pkgs = packages_exist('pkg1', 'pkg2', 'src:srcpkg1');
+
+Returns a hashref of the packages, with a 0 value if it doesn't exist,
+and 1 value if it does exist.
+
+=cut
+
+sub packages_exist {
+     my $VERSION = __populate_version(pop);
+     my ($self, @list) = @_;
+     my %res;
+     foreach my $pkg(@list) {
+       my $keyword;
+       if($pkg =~ /^src:/) {
+         $keyword = "source";
+       } else {
+         $keyword = "binary";
+       }
+       $res{$pkg} = !!Debbugs::Common::package_maintainer($keyword => [($pkg)]) || 0;
+     }
+     return \%res;
+}
+
 =head2 get_usertag
 
      my %ut = get_usertag('don@donarmstrong.com','this-bug-sucks','eat-this-bug');

Attachment: signature.asc
Description: Digital signature


Reply to: