Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37859495
en ru br
Репозитории ALT
S:0.07-alt1
5.1: 0.07-alt1
4.1: 0.01-alt1
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: repocop-collector-altlinux-alternatives

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

repocop-collector-altlinux-alternatives-0.07/000075500000000000000000000000001135175331200214275ustar00rootroot00000000000000repocop-collector-altlinux-alternatives-0.07/altlinux-alternatives.filepattern000064400000000000000000000000371135175331200302250ustar00rootroot00000000000000^/etc/alternatives/packages.d/
repocop-collector-altlinux-alternatives-0.07/altlinux-alternatives.sql000064400000000000000000000011321135175331200265040ustar00rootroot00000000000000-- -*- mode: sql -*-

-- altlinux_alternatives.db schema version --
PRAGMA user_version = 0;

CREATE TABLE IF NOT EXISTS altlinux_alternatives (
PKGID TEXT,
ALTFILE TEXT DEFAULT '',
ALTFILELINENO INTEGER,
ALTALTERNATIVE TEXT DEFAULT '',
ALTCANDIDATE TEXT DEFAULT '',
ALTCRITERIUM TEXT DEFAULT '',
ALTISMASTER INTEGER,
ALTISXML INTEGER,
ALTISBADSEP INTEGER,
PRIMARY KEY(PKGID,ALTFILE,ALTFILELINENO) ON CONFLICT REPLACE
);
CREATE INDEX IF NOT EXISTS altlinux_alternatives_IDX_ALTALTERNATIVE ON altlinux_alternatives(ALTALTERNATIVE);

repocop-collector-altlinux-alternatives-0.07/altlinux-alternatives.test000075500000000000000000000043631135175331200267000ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use DBI;

my $dbh;
my $sth_insert_files;

my $pkgkey=$ENV{'REPOCOP_PKG_KEY'};

&connect();

foreach my $filename (glob $ENV{'REPOCOP_PKG_ROOT'}."/etc/alternatives/packages.d/*") {
open my $fh, $filename or die $!;
$filename=~s/^$ENV{'REPOCOP_PKG_ROOT'}//;
my @content = <$fh>;
close $fh;
my $lineno=0;
my $is_badsep=0;
my $is_xml=0;
if ($content[0]=~/<group/) {
$is_xml=1;
my ($link,$real,$master_criteria,$slave_criteria);
foreach (@content){
chomp;
$link=$1 if m!<option\s*name="link">(.*)</option>!;
$real=$1 if m!<option\s*name="real">(.*)</option>!;
$master_criteria=$1 if m!<option\s*name="current">(.*)</option>!;
$master_criteria=$1 if m!<option\s*name="weight"(?:\s+type="number")?>(.*)</option>!;
if ($master_criteria) {
$sth_insert_files->execute($pkgkey,$filename,$lineno,$link,$real,$master_criteria,1,$is_xml,$is_badsep);
$lineno++;
$slave_criteria=$real;
$master_criteria=undef;
$link=undef;
$real=undef;
}
if (m!</group>! and $link and $real) {
$sth_insert_files->execute($pkgkey,$filename,$lineno,$link,$real,$slave_criteria,0,$is_xml,$is_badsep);
$lineno++;
}
}
} else {
for($lineno=0;$lineno<@content;$lineno++){
chomp $content[$lineno];
next unless $content[$lineno];
my @tripple0=split("\t",$content[$lineno]);
my @tripple=split(/\s+/,$content[$lineno]);
my $is_master=0;
$is_master=1 if $tripple[2]=~/^\d+$/;
$is_badsep=1 if $tripple0[0] ne $tripple[0] or $tripple0[1] ne $tripple[1] or $tripple0[2] ne $tripple[2];
$sth_insert_files->execute($pkgkey,$filename,$lineno,@tripple,$is_master,$is_xml,$is_badsep);
}
}
}

&disconnect();

sub connect {
my $dbfile=$ENV{'REPOCOP_TEST_DB'};
die "database is not initialized properly!" unless $dbfile;
$dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","", {
PrintError => 1,
AutoCommit => 0,
}) or die $dbh->errstr;
$sth_insert_files=$dbh->prepare('INSERT INTO altlinux_alternatives VALUES(?,?,?,?,?,?,?,?,?)') or die $dbh->errstr;
}

sub disconnect {
$dbh->commit;
$sth_insert_files->finish;
# hack around closing dbh with active statement handles bug
local $SIG{'__WARN__'} = sub {};
$dbh->disconnect;
}

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin