mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 17:32:46 +00:00
URPM-repoclosure 1.8: links to update repositories in the profile are not necessary now
This commit is contained in:
parent
2d05f43b01
commit
b505672f07
1 changed files with 73 additions and 58 deletions
|
@ -1,14 +1,14 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
########################################################
|
########################################################
|
||||||
# URPM Repo Closure Checker 1.7.4 for Linux
|
# URPM Repo Closure Checker 1.8 for Linux
|
||||||
# A tool for checking closure of a set of RPM packages
|
# A tool for checking closure of a set of RPM packages
|
||||||
#
|
#
|
||||||
# Copyright (C) 2011-2014 ROSA Lab
|
# Copyright (C) 2011-2014 NTC IT ROSA
|
||||||
# Written by Andrey Ponomarenko
|
# Written by Andrey Ponomarenko
|
||||||
#
|
#
|
||||||
# PLATFORMS
|
# PLATFORMS
|
||||||
# =========
|
# =========
|
||||||
# Linux (ROSA, Mandriva, Mageia)
|
# Linux (ROSA, OpenMandriva)
|
||||||
#
|
#
|
||||||
# REQUIREMENTS
|
# REQUIREMENTS
|
||||||
# ============
|
# ============
|
||||||
|
@ -38,17 +38,17 @@ use File::Copy qw(copy move);
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $TOOL_VERSION = "1.7.4";
|
my $TOOL_VERSION = "1.8";
|
||||||
my $CmdName = get_filename($0);
|
my $CmdName = get_filename($0);
|
||||||
|
|
||||||
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
|
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
|
||||||
$DynamicMode, $NoClean, $HDlist, $FileDeps, $ReportDir,
|
$DynamicMode, $NoClean, $HDlist, $FileDeps, $ReportDir,
|
||||||
$AddRPMs, $RTitle, $DepHDlists, $UpdateHDlists, $Profile,
|
$AddRPMs, $RTitle, $DepHDlists, $Profile, $Target,
|
||||||
$Target, $ExtInfo, $UseCache);
|
$ExtInfo, $UseCache);
|
||||||
|
|
||||||
my $ShortUsage = "URPM Repo Closure Checker $TOOL_VERSION
|
my $ShortUsage = "URPM Repo Closure Checker $TOOL_VERSION
|
||||||
A tool for checking closure of a set of RPM packages
|
A tool for checking closure of a set of RPM packages
|
||||||
Copyright (C) 2014 ROSA Lab
|
Copyright (C) 2014 NTC IT ROSA
|
||||||
License: GNU GPL
|
License: GNU GPL
|
||||||
|
|
||||||
Usage: $CmdName [options]
|
Usage: $CmdName [options]
|
||||||
|
@ -74,7 +74,6 @@ GetOptions("h|help!" => \$Help,
|
||||||
"report-dir=s" => \$ReportDir,
|
"report-dir=s" => \$ReportDir,
|
||||||
"title=s" => \$RTitle,
|
"title=s" => \$RTitle,
|
||||||
"dep-hdlists=s" => \$DepHDlists,
|
"dep-hdlists=s" => \$DepHDlists,
|
||||||
"update-hdlists=s" => \$UpdateHDlists,
|
|
||||||
"profile=s" => \$Profile,
|
"profile=s" => \$Profile,
|
||||||
"cache!" => \$UseCache,
|
"cache!" => \$UseCache,
|
||||||
"target=s" => \$Target,
|
"target=s" => \$Target,
|
||||||
|
@ -96,7 +95,7 @@ USAGE:
|
||||||
$CmdName --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz
|
$CmdName --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz
|
||||||
$CmdName --dir=rpms/ --static --file-deps=file-deps.txt
|
$CmdName --dir=rpms/ --static --file-deps=file-deps.txt
|
||||||
$CmdName --list=list.txt --dynamic
|
$CmdName --list=list.txt --dynamic
|
||||||
$CmdName --profile=profile.xml
|
$CmdName --profile=profile.xml --target=rosa2014.1/i586/main
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
-h|-help
|
-h|-help
|
||||||
|
@ -143,9 +142,6 @@ OPTIONS:
|
||||||
The list of HDlists that will
|
The list of HDlists that will
|
||||||
be used to resolve dependencies.
|
be used to resolve dependencies.
|
||||||
|
|
||||||
-update-hdlists <path>
|
|
||||||
The list of HDlists from update repositories.
|
|
||||||
|
|
||||||
-profile <path>
|
-profile <path>
|
||||||
Profile of the test run.
|
Profile of the test run.
|
||||||
|
|
||||||
|
@ -181,18 +177,12 @@ PROFILE FORMAT:
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/release/media_info/synthesis.hdlist.cz
|
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/release/media_info/synthesis.hdlist.cz
|
||||||
</hdlist>
|
</hdlist>
|
||||||
|
|
||||||
<updates>
|
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/updates/media_info/synthesis.hdlist.cz
|
|
||||||
</updates>
|
|
||||||
|
|
||||||
<deps>
|
<deps>
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/main/release/media_info/synthesis.hdlist.cz
|
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/main/release/media_info/synthesis.hdlist.cz
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/main/updates/media_info/synthesis.hdlist.cz
|
|
||||||
</deps>
|
</deps>
|
||||||
|
|
||||||
<info>
|
<info>
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/release/media_info/info.xml.lzma
|
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/release/media_info/info.xml.lzma
|
||||||
http://abf.rosalinux.ru/downloads/rosa2012lts/repository/i586/contrib/updates/media_info/info.xml.lzma
|
|
||||||
</info>
|
</info>
|
||||||
</repos>
|
</repos>
|
||||||
|
|
||||||
|
@ -336,7 +326,9 @@ sub installPackage($)
|
||||||
$Cmd .= " --root=\"$TMP_DIR/root\"";
|
$Cmd .= " --root=\"$TMP_DIR/root\"";
|
||||||
$Cmd .= " --noclean --auto --force";
|
$Cmd .= " --noclean --auto --force";
|
||||||
$Cmd .= " $Package";
|
$Cmd .= " $Package";
|
||||||
|
|
||||||
print "Running $Cmd\n";
|
print "Running $Cmd\n";
|
||||||
|
|
||||||
my $LogPath = $TMP_DIR."/ilog.txt";
|
my $LogPath = $TMP_DIR."/ilog.txt";
|
||||||
system($Cmd." >$LogPath 2>&1");
|
system($Cmd." >$LogPath 2>&1");
|
||||||
my $Log = readFile($LogPath);
|
my $Log = readFile($LogPath);
|
||||||
|
@ -562,7 +554,7 @@ sub readRPMlist($$)
|
||||||
my ($Path, $Type) = @_;
|
my ($Path, $Type) = @_;
|
||||||
if(not -f $Path)
|
if(not -f $Path)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$Path\'\n";
|
print STDERR "ERROR: can't access \'$Path\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
my @RPMs = split(/\s+/, readFile($Path));
|
my @RPMs = split(/\s+/, readFile($Path));
|
||||||
|
@ -581,7 +573,7 @@ sub readRPMlist($$)
|
||||||
}
|
}
|
||||||
elsif(not -f $P)
|
elsif(not -f $P)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$P\'\n";
|
print STDERR "ERROR: can't access \'$P\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -603,7 +595,7 @@ sub dynamicCheck()
|
||||||
{ # --dir option
|
{ # --dir option
|
||||||
if(not -d $RPMdir)
|
if(not -d $RPMdir)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$RPMdir\'\n";
|
print STDERR "ERROR: can't access \'$RPMdir\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@RPMs = searchRPMs($RPMdir);
|
@RPMs = searchRPMs($RPMdir);
|
||||||
|
@ -782,9 +774,9 @@ sub getCachedFile($)
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub downloadFile($)
|
sub downloadFile($$)
|
||||||
{
|
{
|
||||||
my $Url = $_[0];
|
my ($Url, $Kind) = @_;
|
||||||
|
|
||||||
if($UseCache)
|
if($UseCache)
|
||||||
{
|
{
|
||||||
|
@ -801,8 +793,11 @@ sub downloadFile($)
|
||||||
if(not -f $DownloadTo
|
if(not -f $DownloadTo
|
||||||
or not -s $DownloadTo)
|
or not -s $DownloadTo)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$Url\'\n";
|
if($Kind ne "Update") {
|
||||||
exit(1);
|
print STDERR "ERROR: can't access \'$Url\'\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
my %Extract = (
|
my %Extract = (
|
||||||
|
@ -819,7 +814,7 @@ sub downloadFile($)
|
||||||
my @Files = cmd_find($Dir, "f", "", "");
|
my @Files = cmd_find($Dir, "f", "", "");
|
||||||
if(not @Files)
|
if(not @Files)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot extract \'$Url\'\n";
|
print STDERR "ERROR: can't extract \'$Url\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
unlink($DownloadTo);
|
unlink($DownloadTo);
|
||||||
|
@ -834,20 +829,29 @@ sub downloadFile($)
|
||||||
return $DownloadTo;
|
return $DownloadTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub readInfo($$)
|
sub readInfo($$$)
|
||||||
{
|
{
|
||||||
my ($Path, $Info) = @_;
|
my ($Path, $Info, $Kind) = @_;
|
||||||
|
|
||||||
|
if($Kind eq "Update") {
|
||||||
|
$Path=~s#/release/#/updates/#g;
|
||||||
|
}
|
||||||
|
|
||||||
my $Content = "";
|
my $Content = "";
|
||||||
if($Path=~/(http|https|ftp):\/\//)
|
if($Path=~/(http|https|ftp):\/\//)
|
||||||
{
|
{
|
||||||
print "Downloading Info ...\n";
|
print "Downloading $Kind Info ...\n";
|
||||||
$Path = downloadFile($Path);
|
$Path = downloadFile($Path, $Kind);
|
||||||
|
|
||||||
|
if(not $Path) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(not -f $Path)
|
if(not -f $Path)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$Path\'\n";
|
print STDERR "ERROR: can't access \'$Path\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,7 +873,7 @@ sub readInfo($$)
|
||||||
{
|
{
|
||||||
if(index($_, "sourcerpm=")!=-1)
|
if(index($_, "sourcerpm=")!=-1)
|
||||||
{
|
{
|
||||||
if(/sourcerpm=\'(.+?)\'/)
|
if(/sourcerpm=[\'\"](.+?)[\'\"]/)
|
||||||
{
|
{
|
||||||
my $SRPM = $1;
|
my $SRPM = $1;
|
||||||
$SRPM=~s/\.src\.rpm//g;
|
$SRPM=~s/\.src\.rpm//g;
|
||||||
|
@ -890,11 +894,26 @@ sub readHDlist($$$$$)
|
||||||
{
|
{
|
||||||
my ($Path, $Dep, $RPMdep, $Registered, $Kind) = @_;
|
my ($Path, $Dep, $RPMdep, $Registered, $Kind) = @_;
|
||||||
|
|
||||||
|
if($Kind eq "Update") {
|
||||||
|
$Path=~s#/release/#/updates/#g;
|
||||||
|
}
|
||||||
|
|
||||||
my $Content = "";
|
my $Content = "";
|
||||||
if($Path=~/(http|https|ftp):\/\//)
|
if($Path=~/(http|https|ftp):\/\//)
|
||||||
{
|
{
|
||||||
print "Downloading $Kind HDlist ...\n";
|
print "Downloading $Kind HDlist ...\n";
|
||||||
my $DownloadTo = downloadFile($Path);
|
my $DownloadTo = downloadFile($Path, $Kind);
|
||||||
|
|
||||||
|
if(not $DownloadTo)
|
||||||
|
{
|
||||||
|
if($Kind eq "Update") {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(my $Line = readLineNum($DownloadTo, 1))
|
if(my $Line = readLineNum($DownloadTo, 1))
|
||||||
{
|
{
|
||||||
if($Line!~/\A\@\w+\@/)
|
if($Line!~/\A\@\w+\@/)
|
||||||
|
@ -909,7 +928,7 @@ sub readHDlist($$$$$)
|
||||||
{
|
{
|
||||||
if(not -f $Path)
|
if(not -f $Path)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$Path\'\n";
|
print STDERR "ERROR: can't access \'$Path\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$Content = readFile($Path);
|
$Content = readFile($Path);
|
||||||
|
@ -987,7 +1006,11 @@ sub staticCheck()
|
||||||
if($ExtInfo)
|
if($ExtInfo)
|
||||||
{
|
{
|
||||||
foreach my $Url (split(/\s+/, readFile($ExtInfo))) {
|
foreach my $Url (split(/\s+/, readFile($ExtInfo))) {
|
||||||
readInfo($Url, \%AddInfo);
|
readInfo($Url, \%AddInfo, "Update");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $Url (split(/\s+/, readFile($ExtInfo))) {
|
||||||
|
readInfo($Url, \%AddInfo, "Target");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,7 +1020,7 @@ sub staticCheck()
|
||||||
{
|
{
|
||||||
if(not -d $AddRPMs)
|
if(not -d $AddRPMs)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$AddRPMs\'\n";
|
print STDERR "ERROR: can't access \'$AddRPMs\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(my @AddedRPMs = searchRPMs($AddRPMs))
|
if(my @AddedRPMs = searchRPMs($AddRPMs))
|
||||||
|
@ -1011,18 +1034,6 @@ sub staticCheck()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($UpdateHDlists)
|
|
||||||
{
|
|
||||||
if(not -f $UpdateHDlists)
|
|
||||||
{
|
|
||||||
print STDERR "ERROR: cannot access \'$UpdateHDlists\'\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
foreach my $Url (split(/\s+/, readFile($UpdateHDlists))) {
|
|
||||||
readHDlist($Url, \%Dep, \%RPMdep, \%Registered, "Update");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if($RPMdir or $RPMlist)
|
if($RPMdir or $RPMlist)
|
||||||
{
|
{
|
||||||
print "Checking RPMs ...\n";
|
print "Checking RPMs ...\n";
|
||||||
|
@ -1031,7 +1042,7 @@ sub staticCheck()
|
||||||
{
|
{
|
||||||
if(not -d $RPMdir)
|
if(not -d $RPMdir)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$RPMdir\'\n";
|
print STDERR "ERROR: can't access \'$RPMdir\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@RPMs = searchRPMs($RPMdir);
|
@RPMs = searchRPMs($RPMdir);
|
||||||
|
@ -1051,7 +1062,9 @@ sub staticCheck()
|
||||||
readDeps($Path, \%Dep, \%RPMdep);
|
readDeps($Path, \%Dep, \%RPMdep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($HDlist) {
|
elsif($HDlist)
|
||||||
|
{
|
||||||
|
readHDlist($HDlist, \%Dep, \%RPMdep, \%Registered, "Update");
|
||||||
readHDlist($HDlist, \%Dep, \%RPMdep, \%Registered, "Target");
|
readHDlist($HDlist, \%Dep, \%RPMdep, \%Registered, "Target");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1059,9 +1072,14 @@ sub staticCheck()
|
||||||
{
|
{
|
||||||
if(not -f $DepHDlists)
|
if(not -f $DepHDlists)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$DepHDlists\'\n";
|
print STDERR "ERROR: can't access \'$DepHDlists\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach my $Url (split(/\s+/, readFile($DepHDlists))) {
|
||||||
|
readHDlist($Url, \%Dep_D, \%RPMdep_D, \%Registered, "Update");
|
||||||
|
}
|
||||||
|
|
||||||
foreach my $Url (split(/\s+/, readFile($DepHDlists))) {
|
foreach my $Url (split(/\s+/, readFile($DepHDlists))) {
|
||||||
readHDlist($Url, \%Dep_D, \%RPMdep_D, \%Registered, "Dep");
|
readHDlist($Url, \%Dep_D, \%RPMdep_D, \%Registered, "Dep");
|
||||||
}
|
}
|
||||||
|
@ -1072,7 +1090,7 @@ sub staticCheck()
|
||||||
{
|
{
|
||||||
if(not -f $FileDeps)
|
if(not -f $FileDeps)
|
||||||
{
|
{
|
||||||
print STDERR "ERROR: cannot access \'$FileDeps\'\n";
|
print STDERR "ERROR: can't access \'$FileDeps\'\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
%IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps));
|
%IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps));
|
||||||
|
@ -1538,7 +1556,7 @@ sub checkProfile()
|
||||||
while(my $Repos = parseTag(\$Content, "repos"))
|
while(my $Repos = parseTag(\$Content, "repos"))
|
||||||
{
|
{
|
||||||
my %Info = ();
|
my %Info = ();
|
||||||
foreach my $Tag ("distr", "name", "arch", "section", "hdlist", "updates", "deps", "info") {
|
foreach my $Tag ("distr", "name", "arch", "section", "hdlist", "deps", "info") {
|
||||||
$Info{$Tag} = parseTag(\$Repos, $Tag);
|
$Info{$Tag} = parseTag(\$Repos, $Tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,7 +1567,6 @@ sub checkProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
writeFile("dep.hdlists", $Info{"deps"});
|
writeFile("dep.hdlists", $Info{"deps"});
|
||||||
writeFile("update.hdlists", $Info{"updates"});
|
|
||||||
writeFile("info.hdlists", $Info{"info"});
|
writeFile("info.hdlists", $Info{"info"});
|
||||||
|
|
||||||
my $Cmd = "perl $0";
|
my $Cmd = "perl $0";
|
||||||
|
@ -1563,9 +1580,6 @@ sub checkProfile()
|
||||||
if($Info{"deps"}) {
|
if($Info{"deps"}) {
|
||||||
$Cmd .= " --dep-hdlists=dep.hdlists";
|
$Cmd .= " --dep-hdlists=dep.hdlists";
|
||||||
}
|
}
|
||||||
if($Info{"updates"}) {
|
|
||||||
$Cmd .= " --update-hdlists=update.hdlists";
|
|
||||||
}
|
|
||||||
if($Info{"info"} and $Info{"arch"} ne "SRPMS") {
|
if($Info{"info"} and $Info{"arch"} ne "SRPMS") {
|
||||||
$Cmd .= " --info=info.hdlists";
|
$Cmd .= " --info=info.hdlists";
|
||||||
}
|
}
|
||||||
|
@ -1587,6 +1601,7 @@ sub checkProfile()
|
||||||
}
|
}
|
||||||
unlink("dep.hdlists");
|
unlink("dep.hdlists");
|
||||||
unlink("update.hdlists");
|
unlink("update.hdlists");
|
||||||
|
unlink("info.hdlists");
|
||||||
|
|
||||||
my $Content = readFile($Info{"TXT"});
|
my $Content = readFile($Info{"TXT"});
|
||||||
|
|
||||||
|
@ -1722,7 +1737,7 @@ sub scenario()
|
||||||
}
|
}
|
||||||
if($ShowVersion)
|
if($ShowVersion)
|
||||||
{
|
{
|
||||||
print "URPM Repo Closure Checker $TOOL_VERSION\nCopyright (C) 2014 ROSA Lab\nLicense: GPL <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.\n";
|
print "URPM Repo Closure Checker $TOOL_VERSION\nCopyright (C) 2014 NTC IT ROSA\nLicense: GPL <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue