Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:Update
whohas
opensuse.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File opensuse.patch of Package whohas
diff -Naur whohas-0.29.orig/program/whohas whohas-0.29/program/whohas --- whohas-0.29.orig/program/whohas 2012-11-15 21:10:27.986182597 +0200 +++ whohas-0.29/program/whohas 2012-11-15 21:08:03.244036474 +0200 @@ -1221,6 +1221,7 @@ my $major = $opensuse_major; my $minor = $opensuse_minor; my $opensusebase = "http://software.opensuse.org"; + my @allnames; my @names; my @repos; my @groups; @@ -1229,39 +1230,46 @@ my @sizes; my @dates; my $distroname = "openSUSE"; - - my @lines = split /\n/, &fetchdoc($opensusebase."/search?q=".$_[0]."&baseproject=".$distroname."%3A".$release_string."&lang=en&exclude_debug=true"); - my $continuity = 2; + my @lines = split /\n/, &fetchdoc($opensusebase."/search?q=".$_[0]."&search_devel=false&search_unsupported=false&baseproject=ALL"); for (my $i = 0; $i < @lines; $i++) { - if ($lines[$i] =~ /div class="search_o_title"/) { - push @names, (split /<\/?h3>/, $lines[($i+2)])[1]; - for (my $a = $i+1; $a < $i + 20; $a++) { - if ($lines[$a] =~ /<h4><a class="blue_over" href=/) { - my @temps = split /\"\>|\<\/a\>/, $lines[$a]; - $temps[1] =~ s/\/openSUSE_$major\.$minor$//; - $temps[1] =~ s/^openSUSE\:$major\.$minor\///; - $temps[1] =~ s/\/$major\.$minor$//; - $temps[1] =~ s/^home/\~/; - push @repos, $temps[1]; - last; + # If the page contains "pkg-description" then there was only one search result and we got redirected to + # http://software.opensuse.org/package/$pkgname?search_term=$pkgname + if ($lines[$i] =~ /div id="pkg-description"/) { + @allnames = $_[0]; + last; + } + # If there are multiple results then the page contains "search-result-txt" followed by the package name + if ($lines[$i] =~ /div class="search-result-txt"/) { + push @allnames, (split /href="\/package\/|"/, $lines[($i+1)])[1]; + } + } + for (my $i = 0; $i < @allnames; $i++) { + # For every package the information is in + # http://software.opensuse.org/package/$pkgname + my @lines = split /\n/, &fetchdoc($opensusebase."/package/".$allnames[$i].""); + for (my $i = 0; $i < @lines; $i++) { + # Only show openSUSE official packages (otherwise there will be a lot of results) + if (($lines[$i] =~ /openSUSE.*official release/) || ($lines[$i] =~ /openSUSE.*official update/)) { + # Some times the url does not point to the respective package's project page but to the respective openSUSE version project page + # Difficult to fix because pkgname can be part of another package (e.g. kmail is part of kdepim4) + push @urls, (split /href="|"/, $lines[($i)])[1]; + for (my $a = $i; $a < $i + 75; $a++) { + if ($lines[$a] =~ /ul class="pkg-typ-options"/) { + push @versions, (split /<\/?li>/, $lines[($a+1)])[1]; + last; + } } - } - for (my $a = $i + 10; $a < $i + 50; $a++) { - if ($lines[$a] =~ /a style="margin-right: 2em" href/) { - my @parts = split /\"\>|\<\/a\>/, $lines[$a]; - my @segments = split /\-/, $parts[1]; - push @versions, $segments[(@segments-2)]; - last; + for (my $a = $i; $a < $i + 75; $a++) { + if ($lines[$a] =~ /a class="pkg-options-one-click"/) { + push @repos, (split /href="\/ymp\/|\//, $lines[($a)])[1]; + push @names, (split /query=|">/, $lines[($a)])[1]; + last; + } } + push @sizes, ''; + push @dates, ''; + push @groups, ''; } - push @urls, ''; - push @sizes, ''; - push @dates, ''; - push @groups, ''; - } - if ($lines[$i] =~ /type:'post', url:'\/search\/search.*'\}\); return false;">$continuity<\/a>/) { - push @lines, split /\n/, &fetchdoc($opensusebase."?q=".$_[0]."&baseproject=openSUSE:".$release_string.'&p='.$continuity); - $continuity++; } } for (my $i = 0; $i < @repos; $i++) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor