source: web/bin/sophie_rescan

Last change on this file was 344, checked in by nanardon, 13 years ago
  • add tools to rescan rpm
  • index desktop files (only if in /usr/share/applications)
File size: 841 bytes
Line 
1#!/bin/env perl
2
3use strict;
4use warnings;
5use Getopt::Long;
6use Sophie::Scan;
7
8$ENV{LC_ALL} = 'C';
9require Sophie::Scan::RpmsPath;
10
11GetOptions(
12    'p|parser=s' => \my @parsers,
13    'n|asnew'  => \my $asnew,
14) or die "Wrong options";
15
16my $scan = Sophie::Scan->new;
17
18foreach my $pkgid (@ARGV) {
19    # finding at least one file location
20    my ($item) = $scan->base->resultset('RpmFile')->search(
21        {
22            pkgid => $pkgid,
23        }
24    )->search_related(
25        'Path',
26        {},
27        { 'select' => [ 'path', 'filename' ] },
28    )->all;
29
30    my $rpm = $item->get_column('path') . '/' . $item->get_column('filename');
31    if (@parsers) {
32        foreach (@parsers) {
33            $scan->call_plugin_parser($_, $rpm, $pkgid, $asnew);
34        }
35    } else {
36        $scan->call_plugins_parser($rpm, $pkgid, $asnew);
37    }
38}
39
40
Note: See TracBrowser for help on using the repository browser.