URPM-repoclosure 1.4: added visual HTML report

This commit is contained in:
Andrey Ponomarenko 2012-09-12 17:13:36 +04:00
parent fe4d955a90
commit 174c798bd9
7 changed files with 2903 additions and 1185 deletions

Binary file not shown.

View file

@ -1148,275 +1148,283 @@ msgstr "Ошибка: нужно оставить хотя бы одно ядр
msgid "Error: Cannot remove packages as a user, must be root" msgid "Error: Cannot remove packages as a user, must be root"
msgstr "Ошибка: невозможно удалить пакет, нужны права root." msgstr "Ошибка: невозможно удалить пакет, нужны права root."
#~ msgid "Running trunsaction..." msgid "Running trunsaction..."
#~ msgstr "Запуск транзакции..." msgstr "Запуск транзакции..."
#~ msgid "Downloading packages..." msgid "Downloading packages..."
#~ msgstr "Скачивание пакетов..." msgstr "Скачивание пакетов..."
#~ msgid "Could not download packages. Urpm-download output: " msgid "Could not download packages. Urpm-download output: "
#~ msgstr "Не удалось скачать пакеты. Вывод urpm-downloader: " msgstr "Не удалось скачать пакеты. Вывод urpm-downloader: "
#~ msgid "Output in HTML format, if --output is not present HTML will be created in current directory. --size and --simple options are ignored." msgid "Output in HTML format, if --output is not present HTML will be created in current directory. --size and --simple options are ignored."
#~ msgstr "Вывод в формате HTML. Если --output не указан, то HTML файл будет создан в текущей директории. Опции --size и --simple будут игнорироваться." msgstr "Вывод в формате HTML. Если --output не указан, то HTML файл будет создан в текущей директории. Опции --size и --simple будут игнорироваться."
#~ msgid "input is not correct url, path or name of repository" msgid "input is not correct url, path or name of repository"
#~ msgstr "Введенная строка не является корректным URL, путем или именем репозитория" msgstr "Введенная строка не является корректным URL, путем или именем репозитория"
#~ msgid "getting file %s from" msgid "getting file %s from"
#~ msgstr "получение файла %s из" msgstr "получение файла %s из"
#~ msgid "Error: file %s was not downloaded" msgid "Error: file %s was not downloaded"
#~ msgstr "Ошибка: файл %s не был скачан" msgstr "Ошибка: файл %s не был скачан"
#~ msgid "file %(from) was renamed to %(to)s" msgid "file %(from) was renamed to %(to)s"
#~ msgstr "файл %(from)s был переименован в %(to)s" msgstr "файл %(from)s был переименован в %(to)s"
#~ msgid "Error: cannot rename file %(from)s to %(from)s" msgid "Error: cannot rename file %(from)s to %(from)s"
#~ msgstr "Ошибка: не удалось переименовать файл %(from)s в %(to)s" msgstr "Ошибка: не удалось переименовать файл %(from)s в %(to)s"
#~ msgid "Output in HTML format, if --output is not present" msgid "Output in HTML format, if --output is not present"
#~ msgstr "Вывод в формате HTML, если --output не " msgstr "Вывод в формате HTML, если --output не "
#~ msgid "usage: " msgid "usage: "
#~ msgstr "ssdgfdf" msgstr "ssdgfdf"
#~ msgid "" msgid ""
#~ "URPM Repos Closure Checker [_1] for Mandriva Linux\n" "URPM Repos Closure Checker [_1] for Mandriva Linux\n"
#~ "A tool for checking closure of a set of RPM packages\n" "A tool for checking closure of a set of RPM packages\n"
#~ "Copyright (C) 2012 ROSA Laboratory\n" "Copyright (C) 2012 ROSA Laboratory\n"
#~ "License: GNU GPL\n" "License: GNU GPL\n"
#~ "\n" "\n"
#~ "Usage: [_2] [options]\n" "Usage: [_2] [options]\n"
#~ "Example: [_2] --hdlist=hdlist.txt\n" "Example: [_2] --hdlist=hdlist.txt\n"
#~ "\n" "\n"
#~ "More info: [_2] --help\n" "More info: [_2] --help\n"
#~ msgstr "" msgstr ""
#~ "URPM Repos Closure Checker [_1] для Mandriva Linux\n" "URPM Repos Closure Checker [_1] для Mandriva Linux\n"
#~ "Инструмент для определения замкнутости набора RPM пакетов\n" "Инструмент для определения замкнутости набора RPM пакетов\n"
#~ "Copyright (C) 2012 Лаборатория РОСА\n" "Copyright (C) 2012 Лаборатория РОСА\n"
#~ "Лицензия: GNU GPL\n" "Лицензия: GNU GPL\n"
#~ "\n" "\n"
#~ "Использование: [_2] [options]\n" "Использование: [_2] [options]\n"
#~ "Пример: [_2] --hdlist=hdlist.txt\n" "Пример: [_2] --hdlist=hdlist.txt\n"
#~ "\n" "\n"
#~ "Больше информации: [_2] --help\n" "Больше информации: [_2] --help\n"
#~ msgid "" msgid ""
#~ "\n" "\n"
#~ "NAME:\n" "NAME:\n"
#~ " URPM Repos Closure Checker 1.0 for Mandriva Linux\n" " URPM Repos Closure Checker 1.0 for Mandriva Linux\n"
#~ " A tool for checking closure of a set of RPM packages\n" " A tool for checking closure of a set of RPM packages\n"
#~ "\n" "\n"
#~ "USAGE:\n" "USAGE:\n"
#~ " [_1] --hdlist=hdlist.txt\n" " [_1] --hdlist=hdlist.txt\n"
#~ " [_1] --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz\n" " [_1] --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz\n"
#~ " [_1] --dir=rpms/ --static --file-deps=file-deps.txt\n" " [_1] --dir=rpms/ --static --file-deps=file-deps.txt\n"
#~ " [_1] --list=list.txt --dynamic\n" " [_1] --list=list.txt --dynamic\n"
#~ "\n" "\n"
#~ "OPTIONS:\n" "OPTIONS:\n"
#~ " -h|-help\n" " -h|-help\n"
#~ " Print this help.\n" " Print this help.\n"
#~ "\n" "\n"
#~ " -v|-version\n" " -v|-version\n"
#~ " Print version information.\n" " Print version information.\n"
#~ "\n" "\n"
#~ " -hdlist <path>\n" " -hdlist <path>\n"
#~ " Path or URL of HDlist (synthesis) to check.\n" " Path or URL of HDlist (synthesis) to check.\n"
#~ "\n" "\n"
#~ " -d|-dir <path>\n" " -d|-dir <path>\n"
#~ " The directory with RPM packages to check.\n" " The directory with RPM packages to check.\n"
#~ "\n" "\n"
#~ " -l|-list <path>\n" " -l|-list <path>\n"
#~ " The list of packages to check.\n" " The list of packages to check.\n"
#~ "\n" "\n"
#~ " -add|-update <path>\n" " -add|-update <path>\n"
#~ " The directory with RPM packages that should\n" " The directory with RPM packages that should\n"
#~ " be added to the repository or updated.\n" " be added to the repository or updated.\n"
#~ "\n" "\n"
#~ " -file-deps <path>\n" " -file-deps <path>\n"
#~ " Read file-deps to ignore some unresolved\n" " Read file-deps to ignore some unresolved\n"
#~ " dependencies.\n" " dependencies.\n"
#~ "\n" "\n"
#~ " -s|-static\n" " -s|-static\n"
#~ " Check statically if all required dependencies are\n" " Check statically if all required dependencies are\n"
#~ " satisfied by provided dependencies in the set of\n" " satisfied by provided dependencies in the set of\n"
#~ " RPM packages.\n" " RPM packages.\n"
#~ "\n" "\n"
#~ " -dynamic\n" " -dynamic\n"
#~ " Install a set of RPM packages to the local chroot\n" " Install a set of RPM packages to the local chroot\n"
#~ " and check if extra packages were installed.\n" " and check if extra packages were installed.\n"
#~ "\n" "\n"
#~ " -r|-check-release\n" " -r|-check-release\n"
#~ " Check installation media (DVD).\n" " Check installation media (DVD).\n"
#~ "\n" "\n"
#~ " -sign|-check-signature\n" " -sign|-check-signature\n"
#~ " Validate package signatures.\n" " Validate package signatures.\n"
#~ "\n" "\n"
#~ " -noclean\n" " -noclean\n"
#~ " Do not clean urpmi cache.\n" " Do not clean urpmi cache.\n"
#~ "\n" "\n"
#~ " -root <path>\n" " -root <path>\n"
#~ " Where to install packages.\n" " Where to install packages.\n"
#~ " Default:\n" " Default:\n"
#~ " /tmp/...\n" " /tmp/...\n"
#~ "\n" "\n"
#~ "EXIT CODES:\n" " -dep-hdlists <path>\n"
#~ " 0 - Suceess. The tool has run without any errors\n" " The list of hdlists that will\n"
#~ " non-zero - Failed or the tool has run with errors. In particular:\n" " be used to resolve dependencies.\n"
#~ " 1 - Failed to run the tool\n" "\n"
#~ " 2 - Discovered dependency problems\n" "EXIT CODES:\n"
#~ " \n" " 0 - Suceess. The tool has run without any errors\n"
#~ "\n" " non-zero - Failed or the tool has run with errors. In particular:\n"
#~ msgstr "" " 1 - Failed to run the tool\n"
#~ "\n" " 2 - Discovered dependency problems\n"
#~ "ИМЯ:\n" " \n"
#~ " URPM Repos Closure Checker 1.0 для Mandriva Linux\n" "\n"
#~ " Инструмент для определения замкнутости набора RPM пакетов\n" msgstr ""
#~ "\n" "\n"
#~ "ИСПОЛЬЗОВАНИЕ:\n" "ИМЯ:\n"
#~ " [_1] --hdlist=hdlist.txt\n" " URPM Repos Closure Checker 1.0 для Mandriva Linux\n"
#~ " [_1] --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz\n" " Инструмент для определения замкнутости набора RPM пакетов\n"
#~ " [_1] --dir=rpms/ --static --file-deps=file-deps.txt\n" "\n"
#~ " [_1] --list=list.txt --dynamic\n" "ИСПОЛЬЗОВАНИЕ:\n"
#~ "\n" " [_1] --hdlist=hdlist.txt\n"
#~ "ОПЦИИ:\n" " [_1] --hdlist=http://mirror.yandex.ru/mandriva/.../synthesis.hdlist.cz\n"
#~ " -h|-help\n" " [_1] --dir=rpms/ --static --file-deps=file-deps.txt\n"
#~ " Показать это сообщение.\n" " [_1] --list=list.txt --dynamic\n"
#~ "\n" "\n"
#~ " -v|-version\n" "ОПЦИИ:\n"
#~ " Показать информацию о версии программы.\n" " -h|-help\n"
#~ "\n" " Показать это сообщение.\n"
#~ " -hdlist <путь>\n" "\n"
#~ " Путь к HDlist (synthesis), который надо проверить.\n" " -v|-version\n"
#~ "\n" " Показать информацию о версии программы.\n"
#~ " -d|-dir <путь>\n" "\n"
#~ " Директория с RPM пакетами, которую надо проверить.\n" " -hdlist <путь>\n"
#~ "\n" " Путь к HD-листу (synthesis), который надо проверить.\n"
#~ " -l|-list <путь>\n" "\n"
#~ " Список пакетов, который надо проверить.\n" " -d|-dir <путь>\n"
#~ "\n" " Директория с RPM пакетами, которую надо проверить.\n"
#~ " -add|-update <путь>\n" "\n"
#~ " Директория с RPM пакетами которые\n" " -l|-list <путь>\n"
#~ " надо добавить в репозиторий или обновить.\n" " Список пакетов, который надо проверить.\n"
#~ "\n" "\n"
#~ " -file-deps <путь>\n" " -add|-update <путь>\n"
#~ " Использовать файл file-deps для игнорирования\n" " Директория с RPM пакетами которые\n"
#~ " некоторых зависимостей.\n" " надо добавить в репозиторий или обновить.\n"
#~ "\n" "\n"
#~ " -s|-static\n" " -file-deps <путь>\n"
#~ " Статический анализ зависимостей.\n" " Использовать файл file-deps для игнорирования\n"
#~ "\n" " некоторых зависимостей.\n"
#~ " -dynamic\n" "\n"
#~ " Динамический анализ зависимостей (через установку пакетов).\n" " -s|-static\n"
#~ "\n" " Статический анализ зависимостей.\n"
#~ " -r|-check-release\n" "\n"
#~ " Проверить установочный диск (CD/DVD).\n" " -dynamic\n"
#~ "\n" " Динамический анализ зависимостей (через установку пакетов).\n"
#~ " -sign|-check-signature\n" "\n"
#~ " Проверить сигнатуры пакетов.\n" " -r|-check-release\n"
#~ "\n" " Проверить установочный диск (CD/DVD).\n"
#~ " -noclean\n" "\n"
#~ " Не очищать кэш инструментария URPM.\n" " -sign|-check-signature\n"
#~ "\n" " Проверить сигнатуры пакетов.\n"
#~ " -root <путь>\n" "\n"
#~ " Куда устанавливать пакеты.\n" " -noclean\n"
#~ " Путь по-умолчанию:\n" " Не очищать кэш инструментария URPM.\n"
#~ " /tmp/...\n" "\n"
#~ "\n" " -root <путь>\n"
#~ "КОДЫ ОШИБОК:\n" " Куда устанавливать пакеты.\n"
#~ " 0 - Успех. Набор пакетов замкнут. Ошибок не произошло.\n" " Путь по-умолчанию:\n"
#~ " 1 - Ошибки во время выполнения программы.\n" " /tmp/...\n"
#~ " 2 - Набор пакетов не замкнут.\n" "\n"
#~ " \n" " -dep-hdlists <путь>\n"
#~ "\n" " Список дополнителных HD-листов для\n"
" разрешения зависимостей.\n"
"\n"
"КОДЫ ОШИБОК:\n"
" 0 - Успех. Набор пакетов замкнут. Ошибок не произошло.\n"
" 1 - Ошибки во время выполнения программы.\n"
" 2 - Набор пакетов не замкнут.\n"
" \n"
"\n"
#~ msgid "can't open file '[_1]': [_2]\n" msgid "can't open file '[_1]': [_2]\n"
#~ msgstr "не удалось открыть файл '[_1]': [_2]\n" msgstr "не удалось открыть файл '[_1]': [_2]\n"
#~ msgid "ERROR: you should be root\n" msgid "ERROR: you should be root\n"
#~ msgstr "ОШИБКА: требуются права администратора\n" msgstr "ОШИБКА: требуются права администратора\n"
#~ msgid "ERROR: cannot access '[_1]'\n" msgid "ERROR: cannot access '[_1]'\n"
#~ msgstr "ОШИБКА: не удалось найти '[_1]'\n" msgstr "ОШИБКА: не удалось найти '[_1]'\n"
#~ msgid "ERROR: the list of packages is empty\n" msgid "ERROR: the list of packages is empty\n"
#~ msgstr "ОШИБКА: список пакетов пуст\n" msgstr "ОШИБКА: список пакетов пуст\n"
#~ msgid "ERROR: file '[_1]' is not RPM package\n" msgid "ERROR: file '[_1]' is not RPM package\n"
#~ msgstr "ОШИБКА: файл '[_1]' не является RPM пакетом\n" msgstr "ОШИБКА: файл '[_1]' не является RPM пакетом\n"
#~ msgid "ERROR: --dir or --list option should be specified\n" msgid "ERROR: --dir or --list option should be specified\n"
#~ msgstr "ОШИБКА: одна из следующих опций должна быть предоставлена: --dir или --list\n" msgstr "ОШИБКА: одна из следующих опций должна быть предоставлена: --dir или --list\n"
#~ msgid "" msgid ""
#~ "Extra Packages:\n" "Extra Packages:\n"
#~ "\n" "\n"
#~ msgstr "" msgstr ""
#~ "Дополнительные Пакеты:\n" "Дополнительные Пакеты:\n"
#~ "\n" "\n"
#~ msgid " (required by: [_1])" msgid " (required by: [_1])"
#~ msgstr " (требуется в: [_1])" msgstr " (требуется в: [_1])"
#~ msgid "" msgid ""
#~ "Broken Packages:\n" "Broken Packages:\n"
#~ "\n" "\n"
#~ msgstr "" msgstr ""
#~ "Сломанные Пакеты:\n" "Сломанные Пакеты:\n"
#~ "\n" "\n"
#~ msgid "Report has been generated to:" msgid "Report has been generated to:"
#~ msgstr "Отчет создан:" msgstr "Отчет создан:"
#~ msgid "Checking RPMs ...\n" msgid "Checking RPMs ...\n"
#~ msgstr "Проверка RPM пакетов ...\n" msgstr "Проверка RPM пакетов ...\n"
#~ msgid "Checking [_1]\n" msgid "Checking [_1]\n"
#~ msgstr "Проверка [_1]\n" msgstr "Проверка [_1]\n"
#~ msgid " FAILED: invalid signature\n" msgid " FAILED: invalid signature\n"
#~ msgstr " ОШИБКА: некорректная сигнатура\n" msgstr " ОШИБКА: некорректная сигнатура\n"
#~ msgid "" msgid ""
#~ "Broken Signature:\n" "Broken Signature:\n"
#~ "\n" "\n"
#~ msgstr "" msgstr ""
#~ "Некорректные сигнатуры:\n" "Некорректные сигнатуры:\n"
#~ "\n" "\n"
#~ msgid "ERROR: --hdlist, --dir or --list option should be specified\n" msgid "ERROR: --hdlist, --dir or --list option should be specified\n"
#~ msgstr "ОШИБКА: одна из следующих опций должна быть предоставлена: --hdlist, --dir or --list\n" msgstr "ОШИБКА: одна из следующих опций должна быть определена: --hdlist, --dir or --list\n"
#~ msgid "Downloading HDlist ...\n" msgid "Downloading HDlist ...\n"
#~ msgstr "Загрузка HDlist-файла ...\n" msgstr "Загрузка HDlist-файла ...\n"
#~ msgid "ERROR: cannot extract '[_1]'\n" msgid "ERROR: cannot extract '[_1]'\n"
#~ msgstr "ОШИБКА: не удалось распаковать '[_1]'\n" msgstr "ОШИБКА: не удалось распаковать '[_1]'\n"
#~ msgid "ERROR: unknown format of hdlist\n" msgid "ERROR: unknown format of hdlist\n"
#~ msgstr "ОШИБКА: неизвестный формат HDlist-файла\n" msgstr "ОШИБКА: неизвестный формат HDlist-файла\n"
#~ msgid "Checking HDlist ...\n" msgid "Checking HDlist ...\n"
#~ msgstr "Проверка HDlist-файла ...\n" msgstr "Проверка HDlist-файла ...\n"
#~ msgid "Unresolved \"Required\" Dependencies ([_1]):" msgid "Unresolved Dependencies ([_1])"
#~ msgstr "Сломанные \"Requires\" Зависимости ([_1]):" msgstr "Сломанные Зависимости ([_1])"
#~ msgid "Unresolved \"Suggested\" Dependencies ([_1]):" msgid "Unresolved Suggests ([_1])"
#~ msgstr "Сломанные \"Suggests\" Зависимости ([_1]):" msgstr "Сломанные Легкие Зависимости ([_1])"
#~ msgid "Broken Packages ([_1]):" msgid "Broken Packages ([_1])"
#~ msgstr "Сломанные Пакеты ([_1]):" msgstr "Сломанные Пакеты ([_1])"
#~ msgid "" msgid ""
#~ "URPM Repos Closure Checker [_1] for Mandriva Linux\n" "URPM Repos Closure Checker [_1] for Mandriva Linux\n"
#~ "Copyright (C) 2012 ROSA Laboratory\n" "Copyright (C) 2012 ROSA Laboratory\n"
#~ "License: GPL <http://www.gnu.org/licenses/>\n" "License: GPL <http://www.gnu.org/licenses/>\n"
#~ "This program is free software: you can redistribute it and/or modify it.\n" "This program is free software: you can redistribute it and/or modify it.\n"
#~ "\n" "\n"
#~ "Written by Andrey Ponomarenko.\n" "Written by Andrey Ponomarenko.\n"
#~ msgstr "" msgstr ""
#~ "URPM Repos Closure Checker [_1] для Mandriva Linux\n" "URPM Repos Closure Checker [_1] для Mandriva Linux\n"
#~ "Copyright (C) 2012 Лаборатория РОСА\n" "Copyright (C) 2012 Лаборатория РОСА\n"
#~ "Лицензия: GPL <http://www.gnu.org/licenses/>\n" "Лицензия: GPL <http://www.gnu.org/licenses/>\n"

View file

@ -1,6 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
######################################################## ########################################################
# URPM Repos Closure Checker 1.3.1 for Linux # URPM Repos Closure Checker 1.4 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) 2012 ROSA Laboratory # Copyright (C) 2012 ROSA Laboratory
@ -31,6 +31,7 @@
use Getopt::Long; use Getopt::Long;
Getopt::Long::Configure ("posix_default", "no_ignore_case"); Getopt::Long::Configure ("posix_default", "no_ignore_case");
use Cwd qw(abs_path cwd); use Cwd qw(abs_path cwd);
use POSIX qw(strftime);
use File::Path qw(mkpath rmtree); use File::Path qw(mkpath rmtree);
use File::Temp qw(tempdir); use File::Temp qw(tempdir);
use File::Copy qw(copy move); use File::Copy qw(copy move);
@ -38,16 +39,17 @@ use Data::Dumper;
use Locale::gettext; use Locale::gettext;
use strict; use strict;
my $TOOL_VERSION = "1.3.1"; my $TOOL_VERSION = "1.4";
my $CmdName = get_filename($0); my $CmdName = get_filename($0);
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode, my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
$DynamicMode, $CheckRelease, $CheckSignature, $SelectRepos, $DynamicMode, $CheckRelease, $CheckSignature, $SelectRepos,
$NoClean, $Root, $HDlist, $FileDeps, $ResDir, $AddRPMs); $NoClean, $Root, $HDlist, $FileDeps, $ResDir, $AddRPMs,
$RTitle, $DepHDlists);
textdomain("urpm-tools"); textdomain("urpm-tools");
sub gettext_(@) sub N_(@)
{ {
my ($Str, @Params) = @_; my ($Str, @Params) = @_;
if(not $Str) { if(not $Str) {
@ -62,7 +64,7 @@ sub gettext_(@)
return $Str; return $Str;
} }
my $ShortUsage = gettext_("URPM Repos Closure Checker [_1] for Mandriva Linux my $ShortUsage = N_("URPM Repos Closure Checker [_1] for Mandriva 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) 2012 ROSA Laboratory Copyright (C) 2012 ROSA Laboratory
License: GNU GPL License: GNU GPL
@ -91,7 +93,9 @@ GetOptions("h|help!" => \$Help,
"media=s" => \$SelectRepos, "media=s" => \$SelectRepos,
"noclean!" => \$NoClean, "noclean!" => \$NoClean,
"root=s" => \$Root, "root=s" => \$Root,
"o|res=s" => \$ResDir "o|res=s" => \$ResDir,
"title=s" => \$RTitle,
"dep-hdlists=s" => \$DepHDlists
) or ERR_MESSAGE(); ) or ERR_MESSAGE();
my %EXIT_CODES = ( my %EXIT_CODES = (
@ -100,7 +104,7 @@ my %EXIT_CODES = (
"FAILED" => 2 "FAILED" => 2
); );
my $HelpMessage = gettext_(" my $HelpMessage = N_("
NAME: NAME:
URPM Repos Closure Checker 1.0 for Mandriva Linux URPM Repos Closure Checker 1.0 for Mandriva Linux
A tool for checking closure of a set of RPM packages A tool for checking closure of a set of RPM packages
@ -158,6 +162,10 @@ OPTIONS:
Default: Default:
/tmp/... /tmp/...
-dep-hdlists <path>
The list of hdlists that will
be used to resolve dependencies.
EXIT CODES: EXIT CODES:
0 - Suceess. The tool has run without any errors 0 - Suceess. The tool has run without any errors
non-zero - Failed or the tool has run with errors. In particular: non-zero - Failed or the tool has run with errors. In particular:
@ -194,7 +202,7 @@ sub appendFile($$)
if(my $Dir = get_dirname($Path)) { if(my $Dir = get_dirname($Path)) {
mkpath($Dir); mkpath($Dir);
} }
open(FILE, ">>".$Path) || die gettext_("can't open file \'[_1]\': [_2]\n", $Path, $!); open(FILE, ">>".$Path) || die N_("can't open file \'[_1]\': [_2]\n", $Path, $!);
print FILE $Content; print FILE $Content;
close(FILE); close(FILE);
} }
@ -206,7 +214,7 @@ sub writeFile($$)
if(my $Dir = get_dirname($Path)) { if(my $Dir = get_dirname($Path)) {
mkpath($Dir); mkpath($Dir);
} }
open (FILE, ">".$Path) || die gettext_("can't open file \'[_1]\': [_2]\n", $Path, $!); open (FILE, ">".$Path) || die N_("can't open file \'[_1]\': [_2]\n", $Path, $!);
print FILE $Content; print FILE $Content;
close(FILE); close(FILE);
} }
@ -525,7 +533,7 @@ sub checkSignature($)
sub checkRoot() sub checkRoot()
{ {
if(not -w "/usr") { if(not -w "/usr") {
print STDERR gettext_("ERROR: you should be root\n"); print STDERR N_("ERROR: you should be root\n");
exit(1); exit(1);
} }
} }
@ -535,12 +543,12 @@ sub readRPMlist($$)
my ($Path, $Type) = @_; my ($Path, $Type) = @_;
if(not -f $Path) if(not -f $Path)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $Path); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $Path);
exit(1); exit(1);
} }
my @RPMs = split(/\s+/, readFile($Path)); my @RPMs = split(/\s+/, readFile($Path));
if($#RPMs==-1) { if($#RPMs==-1) {
print STDERR gettext_("ERROR: the list of packages is empty\n"); print STDERR N_("ERROR: the list of packages is empty\n");
exit(1); exit(1);
} }
if($Type eq "RPMs") if($Type eq "RPMs")
@ -549,12 +557,12 @@ sub readRPMlist($$)
{ {
if($P!~/\.rpm\Z/) if($P!~/\.rpm\Z/)
{ {
print STDERR gettext_("ERROR: file \'[_1]\' is not RPM package\n", $P); print STDERR N_("ERROR: file \'[_1]\' is not RPM package\n", $P);
exit(1); exit(1);
} }
elsif(not -f $P) elsif(not -f $P)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $P); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $P);
exit(1); exit(1);
} }
} }
@ -567,7 +575,7 @@ sub checkRelease()
checkRoot(); checkRoot();
if(not $RPMdir and not $RPMlist) if(not $RPMdir and not $RPMlist)
{ {
print STDERR gettext_("ERROR: --dir or --list option should be specified\n"); print STDERR N_("ERROR: --dir or --list option should be specified\n");
exit(1); exit(1);
} }
clearCache(); clearCache();
@ -584,7 +592,7 @@ sub checkRelease()
{ {
if(not -d $RPMdir) if(not -d $RPMdir)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $RPMdir); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $RPMdir);
exit(1); exit(1);
} }
@RPMs = searchRPMs($RPMdir); @RPMs = searchRPMs($RPMdir);
@ -610,7 +618,7 @@ sub dynamicCheck()
checkRoot(); checkRoot();
if(not $RPMdir and not $RPMlist) if(not $RPMdir and not $RPMlist)
{ {
print STDERR gettext_("ERROR: --dir or --list option should be specified\n"); print STDERR N_("ERROR: --dir or --list option should be specified\n");
exit(1); exit(1);
} }
clearCache(); clearCache();
@ -619,7 +627,7 @@ sub dynamicCheck()
{ # --dir option { # --dir option
if(not -d $RPMdir) if(not -d $RPMdir)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $RPMdir); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $RPMdir);
exit(1); exit(1);
} }
@RPMs = searchRPMs($RPMdir); @RPMs = searchRPMs($RPMdir);
@ -704,12 +712,12 @@ sub checkResult()
} }
if(my @Names = sort {lc($a) cmp lc($b)} keys(%ExtraPackages)) if(my @Names = sort {lc($a) cmp lc($b)} keys(%ExtraPackages))
{ {
my $Report = gettext_("Extra Packages:\n\n"); my $Report = N_("Extra Packages:\n\n");
foreach my $Name (@Names) foreach my $Name (@Names)
{ {
$Report .= $Name; $Report .= $Name;
if(my $Req = $RequiredBy{$Name}) { if(my $Req = $RequiredBy{$Name}) {
$Report .= gettext_(" (required by: [_1])", $Req); $Report .= N_(" (required by: [_1])", $Req);
} }
$Report .= "\n"; $Report .= "\n";
} }
@ -718,14 +726,14 @@ sub checkResult()
} }
if(my @Names = sort {lc($a) cmp lc($b)} keys(%BrokenPackages)) if(my @Names = sort {lc($a) cmp lc($b)} keys(%BrokenPackages))
{ {
my $Report = gettext_("Broken Packages:\n\n"); my $Report = N_("Broken Packages:\n\n");
foreach my $Name (@Names) { foreach my $Name (@Names) {
$Report .= "$Name\n"; $Report .= "$Name\n";
} }
print $Report; print $Report;
writeFile("$RESULTS_DIR/broken-packages.txt", $Report); writeFile("$RESULTS_DIR/broken-packages.txt", $Report);
} }
print gettext_("Report has been generated to:"); print N_("Report has been generated to:");
print "\n $RESULTS_DIR/extra-packages.txt\n $RESULTS_DIR/broken-packages.txt\n"; print "\n $RESULTS_DIR/extra-packages.txt\n $RESULTS_DIR/broken-packages.txt\n";
if(keys(%ExtraPackages) or keys(%BrokenPackages)) if(keys(%ExtraPackages) or keys(%BrokenPackages))
{ {
@ -740,16 +748,16 @@ sub sigCheck()
{ {
if(not $RPMdir and not $RPMlist) if(not $RPMdir and not $RPMlist)
{ {
print STDERR gettext_("ERROR: --dir or --list option should be specified\n"); print STDERR N_("ERROR: --dir or --list option should be specified\n");
exit(1); exit(1);
} }
print gettext_("Checking RPMs ...\n"); print N_("Checking RPMs ...\n");
my @RPMs = (); my @RPMs = ();
if($RPMdir) if($RPMdir)
{ {
if(not -d $RPMdir) if(not -d $RPMdir)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $RPMdir); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $RPMdir);
exit(1); exit(1);
} }
@RPMs = searchRPMs($RPMdir); @RPMs = searchRPMs($RPMdir);
@ -759,21 +767,21 @@ sub sigCheck()
} }
foreach my $Path (@RPMs) foreach my $Path (@RPMs)
{ {
print gettext_("Checking [_1]\n", get_filename($Path)); print N_("Checking [_1]\n", get_filename($Path));
if(not checkSignature($Path)) { if(not checkSignature($Path)) {
print gettext_(" FAILED: invalid signature\n"); print N_(" FAILED: invalid signature\n");
} }
} }
if(my @Names = sort {lc($a) cmp lc($b)} keys(%BrokenSignature)) if(my @Names = sort {lc($a) cmp lc($b)} keys(%BrokenSignature))
{ {
my $Report = gettext_("Broken Signature:\n\n"); my $Report = N_("Broken Signature:\n\n");
foreach my $Name (@Names) { foreach my $Name (@Names) {
$Report .= "$Name\n"; $Report .= "$Name\n";
} }
print $Report; print $Report;
writeFile("$RESULTS_DIR/report.txt", $Report); writeFile("$RESULTS_DIR/report.txt", $Report);
} }
print gettext_("Report has been generated to:"); print N_("Report has been generated to:");
print "\n $RESULTS_DIR/report.txt\n"; print "\n $RESULTS_DIR/report.txt\n";
if(keys(%BrokenSignature)) { if(keys(%BrokenSignature)) {
exit($EXIT_CODES{"FAILED"}); exit($EXIT_CODES{"FAILED"});
@ -833,19 +841,114 @@ sub readDeps($$$)
} }
} }
sub readHDlist($$$$)
{
my ($Path, $Dep, $RPMdep, $AddedRPMs) = @_;
my $Content = "";
if($Path=~/(http|https|ftp):\/\//)
{
print N_("Downloading HDlist ...\n");
my $DownloadTo = $TMP_DIR."/extract/".get_filename($Path);
$DownloadTo=~s/\.cz/\.gz/g; # cz == gz
my $Dir = get_dirname($DownloadTo);
mkdir($Dir);
system("wget -U '' --no-check-certificate \"$Path\" --connect-timeout=5 --tries=1 --output-document=\"$DownloadTo\" >/dev/null 2>&1");
if(not -f $DownloadTo
or not -s $DownloadTo)
{
print STDERR N_("ERROR: cannot access \'[_1]\'\n", $Path);
exit(1);
}
my %Extract = (
"xz"=>"unxz",
"lzma"=>"unlzma",
"gz"=>"gunzip"
);
if($DownloadTo=~/\.(gz|xz|lzma)\Z/)
{
my ($Format, $Cmd) = ($1, $Extract{$1});
if($Cmd) {
system("cd $Dir && $Cmd $DownloadTo");
}
my @Files = cmd_find($Dir, "f", "", "");
if(not @Files)
{
print STDERR N_("ERROR: cannot extract \'[_1]\'\n", $Path);
exit(1);
}
unlink($DownloadTo);
$DownloadTo = $Files[0];
}
if(my $Line = readLineNum($DownloadTo, 1))
{
if($Line!~/\A\@\w+\@/)
{
print STDERR N_("ERROR: unknown format of hdlist\n");
exit(1);
}
}
$Content = readFile($DownloadTo);
unlink($DownloadTo);
}
else
{
if(not -f $Path)
{
print STDERR N_("ERROR: cannot access \'[_1]\'\n", $Path);
exit(1);
}
$Content = readFile($Path);
}
print N_("Checking HDlist ...\n");
my $Name = "";
foreach (reverse(split(/\n/, $Content)))
{
$_=~s/\A\@//g;
my @Parts = split("\@", $_);
my $Type = shift(@Parts);
if($Type eq "info")
{
$Name = $Parts[0];
next;
}
if($AddRPMs)
{
if(my $PName = parse_RPMname($Name))
{
if($AddedRPMs->{$PName})
{ # already added
next;
}
}
}
if($Type=~/\A(requires|provides|suggests)\Z/)
{
foreach my $D (@Parts)
{
my ($N, $O, $V) = sepDep($D);
$N=~s/\[\*\]//g; # /sbin/ldconfig[*]
$Dep->{$Type}{$N}{$O}{$V} = $Name;
$RPMdep->{$Type}{$Name}{$D} = 1;
}
}
}
}
sub staticCheck() sub staticCheck()
{ {
if(not $RPMdir and not $HDlist and not $RPMlist) if(not $RPMdir and not $HDlist and not $RPMlist)
{ {
print STDERR gettext_("ERROR: --hdlist, --dir or --list option should be specified\n"); print STDERR N_("ERROR: --hdlist, --dir or --list option should be specified\n");
exit(1); exit(1);
} }
my (%Dep, %RPMdep, %AddedRPMs) = (); my (%Dep, %RPMdep, %AddedRPMs) = ();
my (%Dep_D, %RPMdep_D) = ();
if($AddRPMs) if($AddRPMs)
{ {
if(not -d $AddRPMs) if(not -d $AddRPMs)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $AddRPMs); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $AddRPMs);
exit(1); exit(1);
} }
if(my @AddedRPMs = searchRPMs($AddRPMs)) if(my @AddedRPMs = searchRPMs($AddRPMs))
@ -861,13 +964,13 @@ sub staticCheck()
} }
if($RPMdir or $RPMlist) if($RPMdir or $RPMlist)
{ {
print gettext_("Checking RPMs ...\n"); print N_("Checking RPMs ...\n");
my @RPMs = (); my @RPMs = ();
if($RPMdir) if($RPMdir)
{ {
if(not -d $RPMdir) if(not -d $RPMdir)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $RPMdir); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $RPMdir);
exit(1); exit(1);
} }
@RPMs = searchRPMs($RPMdir); @RPMs = searchRPMs($RPMdir);
@ -890,99 +993,28 @@ sub staticCheck()
readDeps($Path, \%Dep, \%RPMdep); readDeps($Path, \%Dep, \%RPMdep);
} }
} }
elsif($HDlist) elsif($HDlist) {
{ readHDlist($HDlist, \%Dep, \%RPMdep, \%AddedRPMs);
my $Content = readFile($HDlist);
if($HDlist=~/(http|https|ftp):\/\//)
{
print gettext_("Downloading HDlist ...\n");
my $DownloadTo = $TMP_DIR."/extract/".get_filename($HDlist);
$DownloadTo=~s/\.cz/\.gz/g; # cz == gz
my $Dir = get_dirname($DownloadTo);
mkdir($Dir);
system("wget -U '' --no-check-certificate \"$HDlist\" --connect-timeout=5 --tries=1 --output-document=\"$DownloadTo\" >/dev/null 2>&1");
if(not -f $DownloadTo
or not -s $DownloadTo) {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $HDlist);
exit(1);
} }
my %Extract = ( if($DepHDlists)
"xz"=>"unxz",
"lzma"=>"unlzma",
"gz"=>"gunzip"
);
if($DownloadTo=~/\.(gz|xz|lzma)\Z/)
{ {
my ($Format, $Cmd) = ($1, $Extract{$1}); if(not -f $DepHDlists)
if($Cmd) { {
system("cd $Dir && $Cmd $DownloadTo"); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $DepHDlists);
}
my @Files = cmd_find($Dir, "f", "", "");
if(not @Files) {
print STDERR gettext_("ERROR: cannot extract \'[_1]\'\n", $HDlist);
exit(1); exit(1);
} }
$DownloadTo = $Files[0]; foreach my $Url (split(/\s+/, readFile($DepHDlists))) {
} readHDlist($Url, \%Dep_D, \%RPMdep_D, \%AddedRPMs);
if(my $Line = readLineNum($DownloadTo, 1))
{
if($Line!~/\A\@\w+\@/) {
print STDERR gettext_("ERROR: unknown format of hdlist\n");
exit(1);
}
}
$Content = readFile($DownloadTo);
}
else
{
if(not -f $HDlist)
{
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $HDlist);
exit(1);
}
$Content = readFile($HDlist);
}
print gettext_("Checking HDlist ...\n");
my $Name = "";
foreach (reverse(split(/\n/, $Content)))
{
$_=~s/\A\@//g;
my @Parts = split("\@", $_);
my $Type = shift(@Parts);
if($Type eq "info")
{
$Name = $Parts[0];
next;
}
if($AddRPMs)
{
if(my $PName = parse_RPMname($Name))
{
if($AddedRPMs{$PName})
{ # already added
next;
}
}
}
if($Type=~/\A(requires|provides|suggests)\Z/)
{
foreach my $D (@Parts)
{
my ($N, $O, $V) = sepDep($D);
$N=~s/\[\*\]//g;# /sbin/ldconfig[*]
$Dep{$Type}{$N}{$O}{$V}=$Name;
$RPMdep{$Type}{$Name}{$D} = 1;
}
}
} }
} }
my %IgnoreDeps = (); my %IgnoreDeps = ();
if($FileDeps) if($FileDeps)
{ {
if(not -f $FileDeps) if(not -f $FileDeps)
{ {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $FileDeps); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $FileDeps);
exit(1); exit(1);
} }
%IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps)); %IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps));
@ -994,8 +1026,10 @@ sub staticCheck()
{ {
foreach my $V (keys(%{$Dep{"requires"}{$N}{$O}})) foreach my $V (keys(%{$Dep{"requires"}{$N}{$O}}))
{ {
if(not defined $Dep{"provides"}{$N} if((not defined $Dep{"provides"}{$N}
or not checkDeps($N, $O, $V, $Dep{"provides"}{$N})) or not checkDeps($N, $O, $V, $Dep{"provides"}{$N}))
and (not defined $Dep_D{"provides"}{$N}
or not checkDeps($N, $O, $V, $Dep_D{"provides"}{$N})))
{ # unresolved { # unresolved
if($N=~/\A(rpmlib|executable)\(.+\)\Z/) if($N=~/\A(rpmlib|executable)\(.+\)\Z/)
{ # rpmlib(PayloadIsLzma), ... { # rpmlib(PayloadIsLzma), ...
@ -1017,55 +1051,211 @@ sub staticCheck()
} }
} }
} }
my $Report = "";
my $TotalPkgs = keys(%{$RPMdep{"requires"}});
my $TotalDeps = keys(%{$Dep{"requires"}});
my ($Report, $VReport) = ();
$VReport .= "<h1>Urpm-repoclosure report</h1>\n";
$VReport .= "This report has been generated";
if($RTitle) {
$VReport .= " for <b>$RTitle</b>";
}
elsif($HDlist) {
$VReport .= " for this <a href=\'$HDlist\'>hdlist</a>";
}
$VReport .= " on ".strftime("%b %e %H:%M %Y", localtime(time)).".";
$VReport .= "<br/>\n";
$VReport .= "<h2>Test Info</h2><hr/>\n";
$VReport .= "<table class='summary'>\n";
my $UnresolvedLink = "0";
if(my $Num = keys(%Unresolved)) {
$UnresolvedLink = "<a href='#Unresolved'>".$Num."</a>"." (".show_number($Num*100/$TotalDeps)."%)";
}
$VReport .= "<tr><th>Unresolved<br/>Dependencies</th><td>$UnresolvedLink</td></tr>\n";
my $BrokenLink = "0";
if(my $Num = keys(%Broken)) {
$BrokenLink = "<a href='#Broken'>".$Num."</a>"." (".show_number($Num*100/$TotalPkgs)."%)";
}
$VReport .= "<tr><th>Broken<br/>Packages</th><td>$BrokenLink</td></tr>\n";
$VReport .= "</table>\n";
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Unresolved)) if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Unresolved))
{ {
$Report .= "\n".gettext_("Unresolved \"Required\" Dependencies ([_1]):", $#Ns+1)."\n\n"; my $Title = N_("Unresolved Dependencies ([_1])", $#Ns+1);
$Report .= "\n$Title:\n\n";
$VReport .= "<a name='Unresolved'></a>\n";
$VReport .= "<h2>$Title</h2><hr/>\n";
$VReport .= "<table class='report'>\n";
$VReport .= "<tr><th>Dependency</th><th>Required by</th></tr>\n";
foreach my $N (@Ns) foreach my $N (@Ns)
{ {
foreach my $O (keys(%{$Unresolved{$N}})) foreach my $O (keys(%{$Unresolved{$N}}))
{ {
foreach my $V (keys(%{$Unresolved{$N}{$O}})) foreach my $V (keys(%{$Unresolved{$N}{$O}}))
{ {
$Report .= showDep($N, $O, $V)." (".gettext_("required by [_1]", $Unresolved{$N}{$O}{$V}).")\n"; my $Dep = showDep($N, $O, $V);
my $Pkg = $Unresolved{$N}{$O}{$V};
$Report .= $Dep." (".N_("required by [_1]", $Pkg).")\n";
$VReport .= "<tr><td>$Dep</td><td>$Pkg</td></tr>\n";
} }
} }
} }
$VReport .= "</table>";
} }
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested)) if(my @Ns = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested))
{ {
if($Report) { if($Report) {
$Report .= "\n"; $Report .= "\n";
} }
$Report .= "\n".gettext_("Unresolved \"Suggested\" Dependencies ([_1]):", $#Ns+1)."\n\n";
my $Title = N_("Unresolved Suggests ([_1])", $#Ns+1);
$Report .= "\n$Title:\n\n";
$VReport .= "<h2>$Title</h2><hr/>\n";
$VReport .= "<table class='report'>\n";
$VReport .= "<tr><th>Dependency</th><th>Suggested by</th></tr>\n";
foreach my $N (@Ns) foreach my $N (@Ns)
{ {
foreach my $O (keys(%{$UnresolvedSuggested{$N}})) foreach my $O (keys(%{$UnresolvedSuggested{$N}}))
{ {
foreach my $V (keys(%{$UnresolvedSuggested{$N}{$O}})) foreach my $V (keys(%{$UnresolvedSuggested{$N}{$O}}))
{ {
$Report .= showDep($N, $O, $V)." (required by ".$UnresolvedSuggested{$N}{$O}{$V}.")\n"; my $Dep = showDep($N, $O, $V);
my $Pkg = $UnresolvedSuggested{$N}{$O}{$V};
$Report .= $Dep." (".N_("required by [_1]", $Pkg).")\n";
$VReport .= "<tr><td>$Dep</td><td>$Pkg</td></tr>\n";
} }
} }
} }
$VReport .= "</table>";
} }
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Broken)) if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Broken))
{ {
$Report .= "\n".gettext_("Broken Packages ([_1]):", $#Ns+1)."\n\n"; if($Report) {
foreach my $N (@Ns) { $Report .= "\n";
$Report .= parse_RPMname($N)."\n";
} }
my $Title = N_("Broken Packages ([_1])", $#Ns+1);
$Report .= "\n$Title:\n\n";
$VReport .= "<a name='Broken'></a>\n";
$VReport .= "<h2>$Title</h2><hr/>\n";
$VReport .= "<table class='report'>\n";
$VReport .= "<tr><th>Package</th></tr>\n";
foreach my $N (@Ns)
{
my $Name = parse_RPMname($N);
$Report .= $Name."\n";
$VReport .= "<tr><td>$Name</td></tr>\n";
} }
$VReport .= "</table>";
}
my $Styles = "
body {
font-family:Arial, sans-serif;
color:Black;
font-size:14px;
padding-left:15px;
}
hr {
color:Black;
background-color:Black;
height:1px;
border:0;
}
h1 {
margin-bottom:3px;
padding-bottom:3px;
}
h2 {
margin-bottom:0px;
padding-bottom:0px;
}
table.summary {
border-collapse:collapse;
border:1px outset black;
}
table.summary th {
background-color:#eeeeee;
font-weight:100;
text-align:left;
font-size:15px;
white-space:nowrap;
border:1px inset gray;
padding: 3px;
}
table.summary td {
text-align:right;
font-size:16px;
white-space:nowrap;
border:1px inset gray;
padding: 3px 5px 3px 10px;
}
table.report {
border-collapse:collapse;
border:1px outset black;
}
table.report th {
background-color:#eeeeee;
font-weight:bold;
text-align:left;
font-size:15px;
white-space:nowrap;
border:1px inset gray;
padding: 3px;
}
table.report td {
text-align:left;
font-size:16px;
white-space:nowrap;
border:1px inset gray;
padding: 3px;
}";
my $Footer = "<hr/><div style='width:99%;font-size:11px;' align='right'><i>Generated on ".(localtime time);
$Footer .= " by <a href='https://abf.rosalinux.ru/import/urpm-tools/'>Urpm-repoclosure</a> $TOOL_VERSION &#160;</i></div><div style='height:50px;'></div>";
$VReport = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>
Urpm-repoclosure report
</title>
<style type=\"text/css\">
$Styles
</style></head><body>".$VReport."\n".$Footer."\n</body></html>\n";
# report
if($Report) if($Report)
{ {
print $Report."\n"; print $Report."\n"; # on the screen
writeFile("$RESULTS_DIR/report.html", $VReport);
writeFile("$RESULTS_DIR/report.txt", $Report); writeFile("$RESULTS_DIR/report.txt", $Report);
} }
# debug info
writeFile("$RESULTS_DIR/debug/rpm-provides.txt", Dumper($RPMdep{"provides"})); writeFile("$RESULTS_DIR/debug/rpm-provides.txt", Dumper($RPMdep{"provides"}));
writeFile("$RESULTS_DIR/debug/rpm-requires.txt", Dumper($RPMdep{"requires"})); writeFile("$RESULTS_DIR/debug/rpm-requires.txt", Dumper($RPMdep{"requires"}));
writeFile("$RESULTS_DIR/debug/rpm-suggests.txt", Dumper($RPMdep{"suggests"})); writeFile("$RESULTS_DIR/debug/rpm-suggests.txt", Dumper($RPMdep{"suggests"}));
print gettext_("Report has been generated to:");
print "\n $RESULTS_DIR/report.txt\n"; print N_("Report has been generated to:");
print "\n $RESULTS_DIR/report.txt (html)\n\n";
# exit code
if(keys(%Unresolved)) { if(keys(%Unresolved)) {
exit($EXIT_CODES{"FAILED"}); exit($EXIT_CODES{"FAILED"});
} }
@ -1074,6 +1264,55 @@ sub staticCheck()
} }
} }
sub show_number($)
{
if($_[0])
{
my $Num = cut_off_number($_[0], 2, 0);
if($Num eq "0")
{
foreach my $P (3 .. 7)
{
$Num = cut_off_number($_[0], $P, 1);
if($Num ne "0") {
last;
}
}
}
if($Num eq "0") {
$Num = $_[0];
}
return $Num;
}
return $_[0];
}
sub cut_off_number($$$)
{
my ($num, $digs_to_cut, $z) = @_;
if($num!~/\./)
{
$num .= ".";
foreach (1 .. $digs_to_cut-1) {
$num .= "0";
}
}
elsif($num=~/\.(.+)\Z/ and length($1)<$digs_to_cut-1)
{
foreach (1 .. $digs_to_cut - 1 - length($1)) {
$num .= "0";
}
}
elsif($num=~/\d+\.(\d){$digs_to_cut,}/) {
$num=sprintf("%.".($digs_to_cut-1)."f", $num);
}
$num=~s/\.[0]+\Z//g;
if($z) {
$num=~s/(\.[1-9]+)[0]+\Z/$1/g;
}
return $num;
}
sub parse_RPMname($) sub parse_RPMname($)
{ {
my $Name = $_[0]; my $Name = $_[0];
@ -1109,7 +1348,7 @@ sub scenario()
} }
if($ShowVersion) if($ShowVersion)
{ {
print gettext_("URPM Repos Closure Checker [_1] for Mandriva Linux\nCopyright (C) 2012 ROSA Laboratory\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", $TOOL_VERSION); print N_("URPM Repos Closure Checker [_1] for Mandriva Linux\nCopyright (C) 2012 ROSA Laboratory\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", $TOOL_VERSION);
exit(0); exit(0);
} }
if($HDlist) { if($HDlist) {
@ -1118,16 +1357,14 @@ sub scenario()
if($Root) if($Root)
{ {
if(not -d $Root) { if(not -d $Root) {
print STDERR gettext_("ERROR: cannot access \'[_1]\'\n", $Root); print STDERR N_("ERROR: cannot access \'[_1]\'\n", $Root);
exit(1); exit(1);
} }
} }
if($ResDir) { if($ResDir) {
$RESULTS_DIR = $ResDir; $RESULTS_DIR = $ResDir;
} }
if(-d $RESULTS_DIR) if(-d $RESULTS_DIR) {
{
# print "Removing old $RESULTS_DIR directory\n";
rmtree($RESULTS_DIR); rmtree($RESULTS_DIR);
} }
if($CheckSignature) if($CheckSignature)

File diff suppressed because it is too large Load diff

Binary file not shown.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff