[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\npatreon: LINUXABI\ncustom: https://abi-laboratory.pro/?view=donate\n"
  },
  {
    "path": "INSTALL",
    "content": "\nCopyright (C) 2012-2025 Andrey Ponomarenko's ABI Laboratory\nAll rights reserved.\n\n\nRELEASE INFORMATION\n\nProject:           Package Changes Analyzer (pkgdiff)\nVersion:           1.8\nDate:              2025-01-11\n\n\nThis file explains how to install and setup environment\nfor the tool in your computer.\n\n\nContent:\n\n   1. Requirements for Linux and FreeBSD\n   2. Requirements for Mac OS X\n   3. Configure and Install\n   4. Usage\n\n\n1. REQUIREMENTS FOR LINUX AND FREEBSD\n=====================================\n\n   1. Perl 5 (5.8 or newer)\n   2. GNU Diff\n   3. GNU Wdiff\n   4. GNU Awk\n   5. GNU Binutils (readelf)\n   6. Perl-File-LibMagic\n\n1.1 Analysis of RPM packages\n\n   RPM (rpm, rpm2cpio)\n\n1.2 Analysis of DEB packages\n\n   DPKG (dpkg, dpkg-deb)\n\n1.3 Suggestions\n\n   1. ABI Compliance Checker (1.99.1 or newer)\n   2. ABI Dumper (0.97 or newer)\n\n\n\n2. REQUIREMENTS FOR MAC OS X\n============================\n\n   1. Perl 5 (5.8 or newer)\n   2. GNU Diff\n   3. GNU Wdiff\n   4. GNU Awk\n   5. Xcode (otool)\n\n2.1 Suggestions\n\n   1. ABI Compliance Checker (1.99.1 or newer)\n   2. ABI Dumper (0.97 or newer)\n\n\n\n3. CONFIGURE AND INSTALL\n========================\n\n   This command will install the pkgdiff program into the\n   PREFIX/bin system directory and private modules into the PREFIX/share:\n\n     sudo make install prefix=PREFIX [/usr, /usr/local, ...]\n\n3.1 Remove\n\n     sudo make uninstall prefix=PREFIX\n\n\n\n4. USAGE\n========\n\n   Compare two packages:\n\n     pkgdiff PKG1 PKG2\n     \n   For advanced usage, see output of --help option\n\n\n\nEnjoy!\n"
  },
  {
    "path": "LICENSE",
    "content": "            GNU GENERAL PUBLIC LICENSE\n               Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n            GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n             END OF TERMS AND CONDITIONS\n\n        How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License."
  },
  {
    "path": "Makefile",
    "content": "prefix ?= /usr\n\n.PHONY: install\ninstall:\n\tperl Makefile.pl -install -prefix \"$(prefix)\"\n\nuninstall:\n\tperl Makefile.pl -remove -prefix \"$(prefix)\"\n"
  },
  {
    "path": "Makefile.pl",
    "content": "#!/usr/bin/perl\n###########################################################################\n# Makefile for PkgDiff\n# Install/remove the tool for GNU/Linux, FreeBSD and Mac OS X\n#\n# Copyright (C) 2012-2015 Andrey Ponomarenko's ABI Laboratory\n#\n# Written by Andrey Ponomarenko\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n###########################################################################\nuse Getopt::Long;\nGetopt::Long::Configure (\"posix_default\", \"no_ignore_case\");\nuse File::Path qw(mkpath rmtree);\nuse File::Copy qw(copy);\nuse File::Basename qw(dirname);\nuse Cwd qw(abs_path);\nuse File::Find;\nuse strict;\n\nmy $TOOL_SNAME = \"pkgdiff\";\nmy $ARCHIVE_DIR = abs_path(dirname($0));\n\nmy $HELP_MSG = \"\nNAME:\n  Makefile for pkgdiff\n\nDESCRIPTION:\n  Install $TOOL_SNAME command and private modules.\n\nUSAGE:\n  sudo perl $0 -install -prefix /usr\n  sudo perl $0 -remove -prefix /usr\n\nOPTIONS:\n  -h|-help\n      Print this help.\n\n  --prefix=PREFIX\n      Install files in PREFIX [/usr].\n\n  -install\n      Command to install the tool.\n\n  -remove\n      Command to remove the tool.\n\nEXTRA OPTIONS:\n  --destdir=DESTDIR\n      This option is for maintainers to build\n      RPM or DEB packages inside the build root.\n      The environment variable DESTDIR is also\n      supported.\n\\n\";\n\nif(not @ARGV) {\n    print $HELP_MSG;\n    exit(0);\n}\n\nmy ($PREFIX, $DESTDIR, $Help, $Install, $Remove);\n\nGetOptions(\n    \"h|help!\" => \\$Help,\n    \"prefix=s\" => \\$PREFIX,\n    \"destdir=s\" => \\$DESTDIR,\n    \"install!\" => \\$Install,\n    \"remove!\" => \\$Remove\n) or exit(1);\n\nsub scenario()\n{\n    if($Help)\n    {\n        print $HELP_MSG;\n        exit(0);\n    }\n    if(not $Install and not $Remove)\n    {\n        print STDERR \"ERROR: command is not selected (-install or -remove)\\n\";\n        exit(1);\n    }\n    \n    if($Install)\n    { # remove old version first\n        $Remove = 1;\n    }\n    \n    if($PREFIX ne \"/\") {\n        $PREFIX=~s/[\\/]+\\Z//g;\n    }\n    if(not $PREFIX)\n    { # default prefix\n        $PREFIX = \"/usr\";\n    }\n    if(my $Var = $ENV{\"DESTDIR\"})\n    {\n        print \"Using DESTDIR environment variable\\n\";\n        $DESTDIR = $Var;\n    }\n    if($DESTDIR)\n    {\n        if($DESTDIR ne \"/\") {\n            $DESTDIR=~s/[\\/]+\\Z//g;\n        }\n        if($DESTDIR!~/\\A\\//)\n        {\n            print STDERR \"ERROR: destdir is not absolute path\\n\";\n            exit(1);\n        }\n        if(not -d $DESTDIR)\n        {\n            print STDERR \"ERROR: you should create destdir directory first\\n\";\n            exit(1);\n        }\n        $PREFIX = $DESTDIR.$PREFIX;\n        if(not -d $PREFIX)\n        {\n            print STDERR \"ERROR: you should create installation directory first (destdir + prefix):\\n  mkdir -p $PREFIX\\n\";\n            exit(1);\n        }\n    }\n    else\n    {\n        if($PREFIX!~/\\A\\//)\n        {\n            print STDERR \"ERROR: prefix is not absolute path\\n\";\n            exit(1);\n        }\n        if(not -d $PREFIX)\n        {\n            print STDERR \"ERROR: you should create prefix directory first\\n\";\n            exit(1);\n        }\n    }\n    \n    print \"INSTALL PREFIX: $PREFIX\\n\";\n    \n    # paths\n    my $EXE_PATH = \"$PREFIX/bin\";\n    my $MODULES_PATH = \"$PREFIX/share/$TOOL_SNAME\";\n    my $REL_PATH = \"../share/$TOOL_SNAME\";\n    \n    if(not -w $PREFIX)\n    {\n        print STDERR \"ERROR: you should be root\\n\";\n        exit(1);\n    }\n    if($Remove)\n    {\n        if(-e $EXE_PATH.\"/\".$TOOL_SNAME)\n        { # remove executable\n            print \"-- Removing $EXE_PATH/$TOOL_SNAME\\n\";\n            unlink($EXE_PATH.\"/\".$TOOL_SNAME);\n        }\n        elsif(not $Install) {\n            print \"The tool is not installed\\n\";\n        }\n        \n        if(-d $MODULES_PATH)\n        { # remove modules\n            print \"-- Removing $MODULES_PATH\\n\";\n            rmtree($MODULES_PATH);\n        }\n        elsif(not $Install) {\n            print \"The modules of the tool are not installed\\n\";\n        }\n    }\n    if($Install)\n    {\n        # configure\n        my $Content = readFile($ARCHIVE_DIR.\"/\".$TOOL_SNAME.\".pl\");\n        if($DESTDIR) { # relative path\n            $Content=~s/MODULES_INSTALL_PATH/$REL_PATH/;\n        }\n        else { # absolute path\n            $Content=~s/MODULES_INSTALL_PATH/$MODULES_PATH/;\n        }\n        \n        # copy executable\n        print \"-- Installing $EXE_PATH/$TOOL_SNAME\\n\";\n        mkpath($EXE_PATH);\n        writeFile($EXE_PATH.\"/\".$TOOL_SNAME, $Content);\n        chmod(0755, $EXE_PATH.\"/\".$TOOL_SNAME);\n        \n        # copy modules\n        if(-d $ARCHIVE_DIR.\"/modules\")\n        {\n            print \"-- Installing $MODULES_PATH\\n\";\n            mkpath($MODULES_PATH);\n            copyDir($ARCHIVE_DIR.\"/modules\", $MODULES_PATH);\n            \n            my $TOOLS_PATH = $MODULES_PATH.\"/modules/Internals/Tools\";\n            my @Tools = listDir($TOOLS_PATH);\n            foreach my $Tool (@Tools) {\n                chmod(0755, $TOOLS_PATH.\"/\".$Tool);\n            }\n        }\n        \n        # check PATH\n        if($ENV{\"PATH\"}!~/(\\A|:)\\Q$EXE_PATH\\E[\\/]?(\\Z|:)/) {\n            print \"WARNING: your PATH variable doesn't include \\'$EXE_PATH\\'\\n\";\n        }\n    }\n    exit(0);\n}\n\nsub listDir($)\n{\n    my $Path = $_[0];\n    return () if(not $Path or not -d $Path);\n    opendir(my $DH, $Path);\n    return () if(not $DH);\n    my @Contents = grep { $_ ne \".\" && $_ ne \"..\" } readdir($DH);\n    return @Contents;\n}\n\nsub copyDir($$)\n{\n    my ($From, $To) = @_;\n    my %Files;\n    find(\\&wanted, $From);\n    sub wanted {\n        $Files{$File::Find::dir.\"/$_\"} = 1 if($_ ne \".\");\n    }\n    foreach my $Path (sort keys(%Files))\n    {\n        my $Inst = $Path;\n        $Inst=~s/\\A\\Q$ARCHIVE_DIR\\E/$To/;\n        if(-d $Path)\n        { # directories\n            mkpath($Inst);\n        }\n        else\n        { # files\n            mkpath(dirname($Inst));\n            copy($Path, $Inst);\n        }\n    }\n}\n\nsub readFile($)\n{\n    my $Path = $_[0];\n    return \"\" if(not $Path or not -f $Path);\n    open(FILE, $Path) || die (\"can't open file \\'$Path\\': $!\\n\");\n    local $/ = undef;\n    my $Content = <FILE>;\n    close(FILE);\n    return $Content;\n}\n\nsub writeFile($$)\n{\n    my ($Path, $Content) = @_;\n    return if(not $Path);\n    open(FILE, \">\".$Path) || die (\"can't open file \\'$Path\\': $!\\n\");\n    print FILE $Content;\n    close(FILE);\n}\n\nscenario();\n"
  },
  {
    "path": "README.md",
    "content": "PkgDiff 1.8\n===========\n\nPackage Changes Analyzer (pkgdiff) — a tool for visualizing changes in Linux software packages (RPM, DEB, TAR.GZ, etc).\n\nContents\n--------\n\n1. [ About   ](#about)\n2. [ Install ](#install)\n3. [ Usage   ](#usage)\n\nAbout\n-----\n\nThe tool is intended for Linux maintainers who are interested in ensuring compatibility of old and new versions of packages. The tool can compare directories as well (with the help of the -d option).\n\nSample report: https://abi-laboratory.pro/tracker/package_diff/libssh/0.6.5/0.7.0/report.html\n\nThe tool is developed by Andrey Ponomarenko.\n\nInstall\n-------\n\n    sudo make install prefix=/usr\n\n###### Requires\n\n* Perl 5\n* GNU Diff\n* GNU Wdiff\n* GNU Awk\n* GNU Binutils\n* Perl-File-LibMagic\n\n###### Suggests\n\n* ABI Compliance Checker 1.99.1 or newer: https://github.com/lvc/abi-compliance-checker/\n* ABI Dumper 0.97 or newer: https://github.com/lvc/abi-dumper\n\nUsage\n-----\n\n    pkgdiff PKG1 PKG2 [options]\n\n###### Example\n\n    pkgdiff libssh-0.6.5.tar.xz libssh-0.7.0.tar.xz\n\n###### Compare directories\n\n    pkgdiff -d DIR1/ DIR2/ [options]\n\n###### Useful options\n\n| Option              | Meaning                                      |\n|---------------------|----------------------------------------------|\n| -c/-hide-unchanged  | Don't show unchanged files in the report     |\n| -list-added-removed | Show content of added and removed text files |\n| -skip-pattern REGEX | Don't check files matching REGEX             |\n| -tmp-dir DIR        | Use custom temp directory                    |\n| -d/-directories     | Compare directories instead of packages      |\n\n###### Adv. usage\n\nFor advanced usage, see output of -help option.\n"
  },
  {
    "path": "doc/index.html",
    "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\r\n<head>\r\n  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n  <meta name=\"keywords\" content=\"pkgdiff, rpm, deb, diff, changes\" />\r\n  <meta name=\"description\" content=\"A tool for visualizing changes in Linux software packages\" />\r\n  <title>pkgdiff - Package Changes Analyzer</title>\r\n\r\n  <style type=\"text/css\">\r\n    body {\r\n      margin-top: 1.0em;\r\n      background-color: #deeef7;\r\n      font-family: Helvetica, Arial, FreeSans, san-serif;\r\n      color: #000000;\r\n    }\r\n    #container {\r\n      margin: 0 auto;\r\n      width: 700px;\r\n    }\r\n    h1 { font-size: 3.8em; color: #211108; margin-bottom: 3px;margin-top:0px;padding-top:0px;}\r\n    h1 .small { font-size: 0.4em; }\r\n    h1 a { text-decoration: none }\r\n    h2 { font-size: 1.5em; color: #211108; }\r\n    h3 { text-align: center; color: #211108; }\r\n    a { color: #211108; }\r\n    .description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}\r\n    .download { float: right; }\r\n    pre { background: #000; color: #fff; padding: 15px;}\r\n    hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}\r\n    .footer { text-align:center; padding-top:30px; font-style: italic; }\r\n  </style>\r\n\r\n<script type=\"text/javascript\">\r\n\r\n  var _gaq = _gaq || [];\r\n  _gaq.push(['_setAccount', 'UA-19501755-2']);\r\n  _gaq.push(['_trackPageview']);\r\n\r\n  (function() {\r\n    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\r\n    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\r\n    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\r\n  })();\r\n\r\n</script>\r\n\r\n</head>\r\n\r\n<body>\r\n  <a href=\"https://github.com/lvc/pkgdiff\"><img style=\"position: absolute; top: 0; right: 0; border: 0;\" src=\"https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png\" alt=\"Fork me on GitHub\" /></a>\r\n\r\n  <div id=\"container\">\r\n\r\n    <div class=\"download\">\r\n      <a href=\"https://github.com/lvc/pkgdiff/zipball/master\">\r\n        <img style=\"border: 0;\" width=\"90\" src=\"https://github.com/images/modules/download/zip.png\" alt=\"\" /></a>\r\n      <a href=\"https://github.com/lvc/pkgdiff/tarball/master\">\r\n        <img style=\"border: 0;\" width=\"90\" src=\"https://github.com/images/modules/download/tar.png\" alt=\"\" /></a>\r\n    </div>\r\n   \r\n    <h1><a href=\"https://github.com/lvc/pkgdiff\">pkgdiff</a></h1>\r\n\r\n    <div class=\"description\">\r\n      A tool for visualizing changes in Linux software packages\r\n    </div>\r\n\r\n    \r\n      <p>Package Changes Analyzer (pkgdiff) is a tool for visualizing changes in Linux software packages (RPM, DEB, TAR.GZ, etc). The tool is intended for Linux maintainers who are interested in ensuring compatibility of old and new versions of packages.</p>\r\n      \r\n      <p/>\r\n      The tool is developed by Andrey Ponomarenko: <a href='https://abi-laboratory.pro/'>https://abi-laboratory.pro/</a>\r\n\r\n<table style='border:1px solid grey;'><tr><td>\r\n<div>Table of Contents</div>\r\n<ul>\r\n<li><a href=\"#Downloads\" rel=\"nofollow\">Downloads</a></li>\r\n<li><a href=\"#License\" rel=\"nofollow\">License</a></li>\r\n<li><a href=\"#Supported_Platforms\" rel=\"nofollow\">Supported Platforms</a></li>\r\n<li><a href=\"#Dependencies\" rel=\"nofollow\">Dependencies</a></li>\r\n<li><a href=\"#Installation\" rel=\"nofollow\">Installation</a></li>\r\n<li><a href=\"#Usage\" rel=\"nofollow\">Usage</a></li>\r\n<li><a href=\"#Examples\" rel=\"nofollow\">Examples</a></li>\r\n<li><a href=\"#Adv_Usage\" rel=\"nofollow\">Adv. Usage</a></li>\r\n<li><a href=\"#Adv_Examples\" rel=\"nofollow\">Adv. Examples</a></li>\r\n<li><a href=\"#Bugs\" rel=\"nofollow\">Bugs</a></li>\r\n<li><a href=\"#Maintainers\" rel=\"nofollow\">Maintainers</a></li>\r\n<li><a href=\"#ChangeLog\" rel=\"nofollow\">Changes</a></li>\r\n</ul>\r\n</td></tr></table>\r\n\r\n<a name=\"Downloads\"></a>\r\n<h2>Downloads</h2>\r\n<p>All releases can be downloaded from <a href=\"https://github.com/lvc/pkgdiff/releases\">this page</a>.</p>\r\n\r\n<p>Latest release: <a href=\"https://github.com/lvc/pkgdiff/archive/1.7.2.tar.gz\">pkgdiff-1.7.2.tar.gz</a></p>\r\n\r\n<p>Read-only access to the latest development version:</p>\r\n\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;git clone git://github.com/lvc/pkgdiff&nbsp;</code>\r\n\r\n<a name=\"License\"></a>\r\n<h2>License</h2>\r\n<p>This program is free software. You may use, redistribute and/or modify it under the terms of the <a href=\"http://www.gnu.org/licenses/\" rel=\"nofollow\">GNU GPL</a></p>\r\n\r\n<a name=\"Supported_Platforms\"></a>\r\n<h2>Supported Platforms</h2>\r\nGNU/Linux, FreeBSD, Mac OS X\r\n    \r\n<a name=\"Dependencies\"></a>\r\n<h2>Dependencies</h2>\r\nRequires:\r\n<ul>\r\n<li>\r\n  <a href=\"http://www.perl.org/\" rel=\"nofollow\">Perl 5</a> (5.8 or newer)\r\n</li>\r\n<li>\r\n  <a href=\"http://www.gnu.org/software/diffutils/\" rel=\"nofollow\">GNU Diff</a>\r\n</li>\r\n<li>\r\n  <a href=\"http://www.gnu.org/software/wdiff/\" rel=\"nofollow\">GNU Wdiff</a>\r\n</li>\r\n<li>\r\n  <a href=\"http://www.gnu.org/software/gawk/\" rel=\"nofollow\">GNU Awk</a>\r\n</li>\r\n<li>\r\n  <a href=\"http://www.gnu.org/software/binutils/\" rel=\"nofollow\">GNU Binutils</a> (readelf)\r\n</li>\r\n<li>\r\n  <a href=\"http://rpm.org/\" rel=\"nofollow\">RPM</a> (rpm2cpio, rpm) for analysis of RPM packages\r\n</li>\r\n<li>\r\n  <a href=\"http://packages.debian.org/squeeze/dpkg\" rel=\"nofollow\">DPKG</a> (dpkg-deb, dpkg) for analysis of DEB packages\r\n</li>\r\n</ul>\r\n\r\nSuggests:\r\n<ul>\r\n<li>\r\n  <a href=\"https://github.com/lvc/abi-compliance-checker/\">ABI Compliance Checker</a> (1.99.1 or newer)\r\n</li>\r\n<li>\r\n  <a href=\"https://github.com/lvc/abi-dumper/\">ABI Dumper</a> (0.97 or newer)\r\n</li>\r\n</ul>\r\n    \r\n<a name=\"Installation\"></a>\r\n<h2>Installation</h2>\r\n<p>The tool is <b>ready-to-use</b> after extracting the archive.</p>\r\n\r\n<p>You can also use a <b>Makefile</b> to install the tool into the system:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;sudo make install prefix=PREFIX [/usr, /usr/local]&nbsp;</code>\r\n<p>This command will install a  <code>pkgdiff</code>  program to the <code>PREFIX/bin</code> system directory and private modules into the <code>PREFIX/share</code>.</p>\r\n\r\n<a name=\"Usage\"></a>\r\n<h2>Usage</h2>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff PKG1 PKG2&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/&lt;pkg&gt;/&lt;v1&gt;_to_&lt;v2&gt;/changes_report.html&nbsp;</code>\r\n\r\n<a name=\"Examples\"></a>\r\n<h2>Examples</h2>\r\n<p>Compare 0.4.1 and 0.8.1 versions of libqb SRPM-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff libqb-0.4.1-2.fc15.src.rpm libqb-0.8.1-2.fc16.src.rpm&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/libqb/0.4.1_to_0.8.1/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/libqb/0.4.1_to_0.8.1/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<br/><br/>\r\n<p>Compare 0.10.23 and 0.10.32 versions of gstreamer TXZ-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff gstreamer-0.10.23-i486-1.txz gstreamer-0.10.32-i486-1.txz&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/gstreamer/0.10.23-i486-1_to_0.10.32-i486-1/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/gstreamer/0.10.23-i486-1_to_0.10.32-i486-1/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<br/><br/>\r\n<p>Compare 0.3.4 and 0.4.0 versions of libssh TAR.GZ-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff libssh-0.3.4.tar.gz libssh-0.4.0.tar.gz&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/libssh/0.3.4_to_0.4.0/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/libssh/0.3.4_to_0.4.0/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<br/><br/>\r\n<p>Compare 1.10.2 and 1.12.2 versions of cairo DEB-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff libcairo2-dev_1.10.2-6.1_i386.deb libcairo2-dev_1.12.2-1_i386.deb&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/libcairo2-dev/1.10.2-6.1_to_1.12.2-1/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/libcairo2-dev/1.10.2-6.1_to_1.12.2-1/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<br/><br/>\r\n<p>Compare 2.24.1 and 2.28.8 versions of glib RPM-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff libglib2.0-devel-2.24.1.i586.rpm libglib2.0-devel-2.28.8.i586.rpm&nbsp;</code>\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/libglib2.0-devel/2.24.1_to_2.28.8/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/libglib2.0-devel/2.24.1_to_2.28.8/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<a name=\"Adv_Usage\"></a>\r\n<h2>Adv. Usage</h2>\r\n<p>For advanced usage, see output of --help option:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff --help&nbsp;</code>\r\n<p>If you need to analyze a group of packages then you can create an XML-descriptor of this group (OLD.xml file):</p>\r\n\r\n<div style='padding-left:20px;border:1px solid black;width:70%;'>\r\n  &lt;version&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;2.24.1<br/>\r\n  &lt;/version&gt;<br/><br/>\r\n\r\n  &lt;group&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libglib<br/>\r\n  &lt;/group&gt;<br/><br/>\r\n\r\n  &lt;packages&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libglib2.0-devel-2.24.1-1mdv2010.1.i586.rpm<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libglib2.0_0-2.24.1-1mdv2010.1.i586.rpm<br/>\r\n  &lt;/packages&gt;<br/>\r\n</div>\r\n\r\n<p>And then pass XML-descriptors of old and new versions of a group to the tool:</p>\r\n\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff OLD.xml NEW.xml&nbsp;</code>\r\n\r\n<p>The HTML report will be generated to:</p>\r\n\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/&lt;group&gt;/&lt;v1&gt;_to_&lt;v2&gt;/changes_report.html&nbsp;</code>\r\n\r\n<a name=\"Adv_Examples\"></a>\r\n<h2>Adv. Examples</h2>\r\n<p>Compare 2.3.12 and 2.4.5 versions of libfreetype6 group of RPM-packages:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff 2.3.12.xml 2.4.5.xml&nbsp;</code>\r\n\r\n<p>File 2.3.12.xml:</p>\r\n<div style='padding-left:20px;border:1px solid black;width:70%;'>\r\n  &lt;version&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;2.3.12<br/>\r\n  &lt;/version&gt;<br/><br/>\r\n\r\n  &lt;group&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6<br/>\r\n  &lt;/group&gt;<br/><br/>\r\n\r\n  &lt;packages&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-2.3.12-1mdv2010.1.i586.rpm<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-devel-2.3.12-1mdv2010.1.i586.rpm<br/>\r\n  &lt;/packages&gt;<br/>\r\n</div>\r\n\r\n<p>File 2.4.5.xml:</p>\r\n<div style='padding-left:20px;border:1px solid black;width:70%;'>\r\n  &lt;version&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;2.4.5<br/>\r\n  &lt;/version&gt;<br/><br/>\r\n\r\n  &lt;group&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6<br/>\r\n  &lt;/group&gt;<br/><br/>\r\n\r\n  &lt;packages&gt;<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-2.4.5-2-mdv2011.0.i586.rpm<br/>\r\n      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-devel-2.4.5-2-mdv2011.0.i586.rpm<br/>\r\n  &lt;/packages&gt;<br/>\r\n</div>\r\n\r\n<p>The HTML report will be generated to:</p>\r\n<code style=\"border: dashed 1px gray; background-color: #f0f0f0;\">&nbsp;pkgdiff_reports/libfreetype6/2.3.12_to_2.4.5/<a style='color:Blue;' href=\"http://lvc.github.io/pkgdiff/pkgdiff_reports/libfreetype6/2.3.12_to_2.4.5/changes_report.html\">changes_report.html</a>&nbsp;</code>\r\n\r\n<a name=\"Bugs\"></a>\r\n<h2>Bugs</h2>\r\n<p>Please post your bug reports, feature requests and questions to the <a href=\"https://github.com/lvc/pkgdiff/issues\" rel=\"nofollow\">issue tracker</a>.</p>\r\n\r\n<a name=\"Maintainers\"></a>\r\n<h2>Maintainers</h2>\r\nThe tool is developed by <a href=\"https://abi-laboratory.pro/\" rel=\"nofollow\">Andrey Ponomarenko</a>.\r\n\r\n<a name=\"ChangeLog\"></a>\r\n<h2>Changes</h2>\r\n\r\n<b>Version 1.8 (January 28, 2017)</b><br/>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Fixed -d option to compare large directories\r\n    </li>\r\n    <li>\r\n        Added more file classes\r\n    </li>\r\n    <li>\r\n        5% performance improvement\r\n    </li>\r\n    <li>\r\n        Omit *.N suffix when determining the file format\r\n    </li>\r\n    <li>\r\n        Do not print warning about missed wdiff into the report\r\n    </li>\r\n    <li>\r\n        Increased default width of the report to 80 chars\r\n    </li>\r\n</ul>\r\n<br/>\r\n\r\n<b>Version 1.7.2 (March 18, 2016)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Ability to download plain-text added/removed patches from the report\r\n    </li>\r\n</ul>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Do not show time stamp in the report\r\n    </li>\r\n    <li>\r\n        Fixed removal of tmp directory in the rfcdiff-1.41-CUSTOM.sh\r\n    </li>\r\n</ul>\r\n<br/>\r\n\r\n<b>Version 1.7.1 (December 11, 2015)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Added -skip-pattern option: skip checking of paths within archives matching a regex\r\n    </li>\r\n</ul>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Fixed incompatibility with the latest versions of the ABICC tool\r\n    </li>\r\n    <li>\r\n        Fixed comparison of the RPM/Deb packages info\r\n    </li>\r\n</ul>\r\n<br/>\r\n\r\n<b>Version 1.7.0 (October 18, 2015)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Added -d option: compare directories instead of packages\r\n    </li>\r\n    <li>\r\n        Added -list-added-removed option: show content of added/removed text files\r\n    </li>\r\n    <li>\r\n        Added -vnum1 and -vnum2 options: set version numbers of input packages\r\n    </li>\r\n    <li>\r\n        Added -title option: set name of the package in the title of the report\r\n    </li>\r\n    <li>\r\n        Added -skip-subarchives option: skip checking of archives inside packages\r\n    </li>\r\n</ul>\r\n<br/>\r\n\r\n<b>Version 1.6.4 (September 08, 2015)</b><br/>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Fixed style of the report\r\n    </li>\r\n    <li>\r\n        Fixed install permissions\r\n    </li>\r\n    <li>\r\n        Fixed errors when comparing man pages\r\n    </li>\r\n    <li>\r\n        Added check for wdiff\r\n    </li>\r\n    <li>\r\n        Simplified Makefile\r\n    </li>\r\n</ul>\r\n\r\n<br/>\r\n\r\n<b>Version 1.6.3 (November 05, 2014)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Added -hide-unchanged option: don't show unchanged files in the report\r\n    </li>\r\n    <li>\r\n        Show change rate in the extra info files.xml (moved, changed, renamed)\r\n    </li>\r\n    <li>\r\n        Check if we can remove a common prefix from files of both packages\r\n    </li>\r\n    <li>\r\n        Encoding of diff reports has been changed to utf-8\r\n    </li>\r\n</ul>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Fixed a problem with spaces in package name\r\n    </li>\r\n    <li>\r\n        Added -o option to unzip command\r\n    </li>\r\n    <li>\r\n        Fixed -tmp-dir option\r\n    </li>\r\n</ul>\r\n\r\n<br/>\r\n\r\n<b>Version 1.6 (June 07, 2013)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        ABI compatibility check for shared objects and kernel modules containing DWARF debugging information (in <i>-details</i> mode)\r\n    </li>\r\n    <li>\r\n        ABI status section in the report for debuginfo-packages\r\n    </li>\r\n    <li>\r\n        Suggests ABI Compliance Checker 1.99.1\r\n    </li>\r\n    <li>\r\n        Suggests ABI Dumper 0.97\r\n    </li>\r\n</ul>\r\n\r\n<br/>\r\n\r\n<b>Version 1.5 (April 04, 2013)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Added -extra-info option to dump extra analysis information\r\n    </li>\r\n    <li>\r\n        Improved identification of moved files\r\n    </li>\r\n    <li>\r\n        Classifying files by magic bytes\r\n    </li>\r\n    <li>\r\n        Compare public symbols in shared objects before detailed comparison\r\n    </li>\r\n    <li>\r\n        Added statistics comment line in the report\r\n    </li>\r\n    <li>\r\n        Support for more file types\r\n    </li>\r\n</ul>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Corrected Makefile\r\n    </li>\r\n    <li>\r\n        Corrected parser of package version\r\n    </li>\r\n</ul>\r\n\r\n<br/>\r\n\r\n<b>Version 1.4.1 (December 14, 2012)</b><br/>\r\n<b>Bug Fixes</b>\r\n<ul>\r\n    <li>\r\n        Corrected parser of package version\r\n    </li>\r\n    <li>\r\n        Opening file diffs in a separate window\r\n    </li>\r\n</ul>\r\n\r\n<br/>\r\n\r\n<b>Version 1.4 (October 25, 2012)</b><br/>\r\n<b>New Features</b>\r\n<ul>\r\n    <li>\r\n        Sorting by status, delta and file name in the report\r\n    </li>\r\n    <li>\r\n        New -open option to open report in the default browser\r\n    </li>\r\n    <li>\r\n        Printing of estimated change rate to the console\r\n    </li>\r\n    <li>\r\n        Simplified usage: pkgdiff PKG1 PKG2\r\n    </li>\r\n    <li>\r\n        Support for Mac OS X\r\n    </li>\r\n    <li>\r\n        Support for more file formats\r\n    </li>\r\n</ul>\r\n\r\n    <div class=\"footer\">\r\n      get the source code on GitHub : <a href=\"https://github.com/lvc/pkgdiff\">lvc/pkgdiff</a>\r\n    </div>\r\n    <div style=\"height:350px;\"></div>\r\n\r\n  </div>\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "modules/FileType.xml",
    "content": "<files>\n\n<type>\n    <id>\n        HEADER\n    </id>\n    <summary>\n        Header file\n    </summary>\n    <extensions>\n        h, hh, H, hp, hxx, hpp, HPP, h++, tcc\n    </extensions>\n    <weight>\n        100\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SHARED_OBJECT\n    </id>\n    <summary>\n        Shared library\n    </summary>\n    <extensions>\n        so\n    </extensions>\n    <weight>\n        90\n    </weight>\n</type>\n\n<type>\n    <id>\n        KERNEL_MODULE\n    </id>\n    <summary>\n        Kernel module\n    </summary>\n    <extensions>\n        ko\n    </extensions>\n    <weight>\n        85\n    </weight>\n</type>\n\n<type>\n    <id>\n        DEBUG_INFO\n    </id>\n    <summary>\n        Debug info file\n    </summary>\n    <extensions>\n        debug\n    </extensions>\n    <weight>\n        80\n    </weight>\n</type>\n\n<type>\n    <id>\n        DLL\n    </id>\n    <summary>\n        DLL library\n    </summary>\n    <extensions>\n        dll\n    </extensions>\n    <weight>\n        85\n    </weight>\n</type>\n\n<type>\n    <id>\n        SHARED_LIBRARY\n    </id>\n    <summary>\n        Dynamic library\n    </summary>\n    <extensions>\n        dylib\n    </extensions>\n    <weight>\n        85\n    </weight>\n</type>\n\n<type>\n    <id>\n        SPEC\n    </id>\n    <summary>\n        Spec file\n    </summary>\n    <extensions>\n        spec\n    </extensions>\n    <weight>\n        90\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        C_SOURCE\n    </id>\n    <summary>\n        C program\n    </summary>\n    <extensions>\n        c, i\n    </extensions>\n    <weight>\n        90\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PATCH\n    </id>\n    <summary>\n        Patch\n    </summary>\n    <extensions>\n        patch, diff, diffs\n    </extensions>\n    <terms>\n        diff output\n    </terms>\n    <weight>\n        80\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        STATIC_LIBRARY\n    </id>\n    <summary>\n        Static library\n    </summary>\n    <extensions>\n        a\n    </extensions>\n    <weight>\n        80\n    </weight>\n</type>\n\n<type>\n    <id>\n        CPP_SOURCE\n    </id>\n    <summary>\n        C++ program\n    </summary>\n    <extensions>\n        cc, cp, cxx, cpp, CPP, c++, C, ii\n    </extensions>\n    <weight>\n        90\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ADA\n    </id>\n    <summary>\n        Ada program\n    </summary>\n    <extensions>\n        ads, adb\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        FORTRAN\n    </id>\n    <summary>\n        Fortran program\n    </summary>\n    <extensions>\n        f, for, ftn\n        F, FOR, fpp, FPP, FTN\n        f90, f95. f03, f08,\n        F90, F95, F03, F08\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SYMBOL\n    </id>\n    <summary>\n        Symbols file\n    </summary>\n    <extensions>\n        sym, syms, fncs\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LIBTOOL\n    </id>\n    <summary>\n        Libtool file\n    </summary>\n    <extensions>\n        la, lo, plo\n    </extensions>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        MANPAGE\n    </id>\n    <summary>\n        Man page\n    </summary>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        DOCBOOK\n    </id>\n    <summary>\n        DocBook document\n    </summary>\n    <extensions>\n        docbook\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        NVDL\n    </id>\n    <summary>\n        NVDL script\n    </summary>\n    <extensions>\n        nvdl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        RSS\n    </id>\n    <summary>\n        RSS file\n    </summary>\n    <extensions>\n        rss\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MMP\n    </id>\n    <summary>\n        Symbian Project file\n    </summary>\n    <extensions>\n        mmp\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        BINARY_TERRAIN\n    </id>\n    <summary>\n        Binary Terrain file\n    </summary>\n    <extensions>\n        bt\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        X3D\n    </id>\n    <summary>\n        X3D Image\n    </summary>\n    <extensions>\n        x3d, x3dv\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        S_EXPRESSION_FILE\n    </id>\n    <summary>\n        S-Expression file\n    </summary>\n    <extensions>\n        sexpr\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LOG_FILE\n    </id>\n    <summary>\n        Log file\n    </summary>\n    <names>\n        xorg.log.1\n    </names>\n    <extensions>\n        log, log.1\n    </extensions>\n    <dirs>\n        logs, log\n    </dirs>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ARGUMENT_FILE\n    </id>\n    <summary>\n        Argument file\n    </summary>\n    <extensions>\n        arg, args, argv\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ML_PROGRAM\n    </id>\n    <summary>\n        ML program\n    </summary>\n    <extensions>\n        ml\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        AUGEAS_FILE\n    </id>\n    <summary>\n        Augeas file\n    </summary>\n    <extensions>\n        aug\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        VMWARE_SCRIPT\n    </id>\n    <summary>\n        VMware Configuration file\n    </summary>\n    <extensions>\n        vmx\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        STAP_SCRIPT\n    </id>\n    <summary>\n        SystemTap script\n    </summary>\n    <extensions>\n        stp\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PPD_FILE\n    </id>\n    <summary>\n        PPD file\n    </summary>\n    <extensions>\n        ppd\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LDAP\n    </id>\n    <summary>\n        LDAP Data file\n    </summary>\n    <extensions>\n        ldif\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ESRI_SHAPEFILE\n    </id>\n    <summary>\n        ESRI Shape file\n    </summary>\n    <extensions>\n        shp, shx\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        DBASE_DATABASE\n    </id>\n    <summary>\n        dBASE Database file\n    </summary>\n    <extensions>\n        dbf\n    </extensions>\n    <terms>\n        DBase 3 data\n    </terms>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        DJVU\n    </id>\n    <summary>\n        DjVu document\n    </summary>\n    <extensions>\n        djvu, djv\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        XPT\n    </id>\n    <summary>\n        XPConnect Typelib file\n    </summary>\n    <extensions>\n        xpt\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        ELF_BINARY\n    </id>\n    <summary>\n        ELF Binary file\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        TDF\n    </id>\n    <summary>\n        TDF file\n    </summary>\n    <extensions>\n        tdf\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MESSAGE_FILE\n    </id>\n    <summary>\n        Message file\n    </summary>\n    <extensions>\n        eml, msg\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XINDY\n    </id>\n    <summary>\n        Xindy file\n    </summary>\n    <extensions>\n        xdy\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GNAT_PROJECT\n    </id>\n    <summary>\n        GNAT Project file\n    </summary>\n    <extensions>\n        gpr\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        BIBTEX\n    </id>\n    <summary>\n        BibTeX document\n    </summary>\n    <extensions>\n        bst, bbl, bib, csf\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        INCLUDE\n    </id>\n    <summary>\n        Include file\n    </summary>\n    <extensions>\n        inc, inl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LANGUAGE_DATA\n    </id>\n    <summary>\n        Language Data file\n    </summary>\n    <extensions>\n        lng\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        XIB\n    </id>\n    <summary>\n        Interface Builder file\n    </summary>\n    <extensions>\n        xib, nib\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MDMP\n    </id>\n    <summary>\n        Memory Dump file\n    </summary>\n    <extensions>\n        dmp, mdmp\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        REGISTRY\n    </id>\n    <summary>\n        Registry file\n    </summary>\n    <extensions>\n        rgs, reg\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        RPC\n    </id>\n    <summary>\n        RPC file\n    </summary>\n    <extensions>\n        srpc, rpc, x\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        BINHEX\n    </id>\n    <summary>\n        BinHex Encoded file\n    </summary>\n    <extensions>\n        hqx\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        PROTOBUF\n    </id>\n    <summary>\n        Protocol Buffer file\n    </summary>\n    <extensions>\n        proto\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        OPTIONS\n    </id>\n    <summary>\n        Options file\n    </summary>\n    <extensions>\n        opt\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SCONS\n    </id>\n    <summary>\n        SCons file\n    </summary>\n    <names>\n        SConstruct, SConscript\n    </names>\n    <extensions>\n        scons\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MD5\n    </id>\n    <summary>\n        MD5 Checksum file\n    </summary>\n    <extensions>\n        md5\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SIGNATURE\n    </id>\n    <summary>\n        Signature file\n    </summary>\n    <extensions>\n        sig\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        OPERA_MAILBOX\n    </id>\n    <summary>\n        Opera Mailbox file\n    </summary>\n    <extensions>\n        mbs\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        OPERA_BOOKMARK\n    </id>\n    <summary>\n        Opera Bookmark file\n    </summary>\n    <extensions>\n        adr\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        QT_UI\n    </id>\n    <summary>\n        Qt UI file\n    </summary>\n    <extensions>\n        ui\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_SS\n    </id>\n    <summary>\n        Qt style sheet\n    </summary>\n    <extensions>\n        qss\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_MESSAGE\n    </id>\n    <summary>\n        Qt Message file\n    </summary>\n    <extensions>\n        qm\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        QT_HELP\n    </id>\n    <summary>\n        Qt Help file\n    </summary>\n    <extensions>\n        qhp, qch, qhc, qhcp\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        OBJECTIVE_C\n    </id>\n    <summary>\n        Objective-C program\n    </summary>\n    <extensions>\n        m, mi\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        OBJECTIVE_CPP\n    </id>\n    <summary>\n        Objective-C++ program\n    </summary>\n    <extensions>\n        mm, mii, M\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SGML\n    </id>\n    <summary>\n        SGML document\n    </summary>\n    <extensions>\n        sgml, sgm\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_PROJECT\n    </id>\n    <summary>\n        Qt Project file\n    </summary>\n    <extensions>\n        pro, pri, prf\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        FSH\n    </id>\n    <summary>\n        OpenGL FSH file\n    </summary>\n    <extensions>\n        fsh\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GLSL\n    </id>\n    <summary>\n        GLSL Shader file\n    </summary>\n    <extensions>\n        glsl, glslf, glslv, vert, frag\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XCODE\n    </id>\n    <summary>\n        Xcode file\n    </summary>\n    <extensions>\n        xcconfig, pbxproj, xcodeproj, nib, pbxbtree, pbxuser\n        xcworkspace, xcsnapshots, xcode\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        PROPERTY_LIST\n    </id>\n    <summary>\n        Property list\n    </summary>\n    <extensions>\n        plist\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        POLICY_FILE\n    </id>\n    <summary>\n        Policy file\n    </summary>\n    <extensions>\n        policy, Policy\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JAVA_ASSEMBLER\n    </id>\n    <summary>\n        Java assembler program\n    </summary>\n    <extensions>\n        jasm, jsasm\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PROPERTY_FILE\n    </id>\n    <summary>\n        Property file\n    </summary>\n    <extensions>\n        prp, pty, props, properties\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SWG_FILE\n    </id>\n    <summary>\n        SWG file\n    </summary>\n    <extensions>\n        swg\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        INITIALIZATION\n    </id>\n    <summary>\n        Initialization file\n    </summary>\n    <extensions>\n        ini\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MANIFEST\n    </id>\n    <summary>\n        Manifest file\n    </summary>\n    <names>\n        manifest, MANIFEST\n    </names>\n    <extensions>\n        manifest, mf, MF, nmf, mn\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        RESOURCE\n    </id>\n    <summary>\n        Resource file\n    </summary>\n    <extensions>\n        res, rc, resource, mc, grd, rsrc, rc2\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XTB\n    </id>\n    <summary>\n        XTB data file\n    </summary>\n    <extensions>\n        xtb\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        MOLECULE_SPEC\n    </id>\n    <summary>\n        Molecule spec file\n    </summary>\n    <extensions>\n        xyz\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_RESOURCE\n    </id>\n    <summary>\n        Qt Resource file\n    </summary>\n    <extensions>\n        qrc\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_DOC\n    </id>\n    <summary>\n        Qt Doc file\n    </summary>\n    <extensions>\n        qdoc, qdocconf, qdocinc\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XBEL\n    </id>\n    <summary>\n        XBEL bookmark\n    </summary>\n    <extensions>\n        xbel\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        IDL\n    </id>\n    <summary>\n        IDL file\n    </summary>\n    <extensions>\n        idl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QML\n    </id>\n    <summary>\n        QML file\n    </summary>\n    <extensions>\n        qml, qs\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XML\n    </id>\n    <summary>\n        XML document\n    </summary>\n    <extensions>\n        xml\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        WML\n    </id>\n    <summary>\n        WML document\n    </summary>\n    <extensions>\n        wml\n    </extensions>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        MAKEFILE\n    </id>\n    <summary>\n        Makefile\n    </summary>\n    <extensions>\n        mk, make, makefile, Makefile, nmake, kmk, mak\n    </extensions>\n    <names>\n        Makefile, GNUmakefile, Imakefile, Makeconfig, Makerules\n    </names>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JAVA_MAKEFILE\n    </id>\n    <summary>\n        Java Makefile\n    </summary>\n    <extensions>\n        jmk, gmk\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        UCM\n    </id>\n    <summary>\n        UCM file\n    </summary>\n    <description>\n        Unicode Character Mapping\n    </description>\n    <extensions>\n        ucm\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CHARMAP\n    </id>\n    <summary>\n        Charmap file\n    </summary>\n    <extensions>\n        cm\n    </extensions>\n    <dirs>\n        charmaps\n    </dirs>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ABI_LIST\n    </id>\n    <summary>\n        ABI list\n    </summary>\n    <extensions>\n        abilist\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LOCALE_DATA\n    </id>\n    <summary>\n        Localization data\n    </summary>\n    <dirs>\n        iconvdata, localedata, locales\n    </dirs>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        TIMEZONE_DATA\n    </id>\n    <summary>\n        Timezone data\n    </summary>\n    <dirs>\n        timezone\n    </dirs>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CONFIGURE_SCRIPT\n    </id>\n    <summary>\n        Configure script\n    </summary>\n    <names>\n        configure, preconfigure\n    </names>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        VERSIONING\n    </id>\n    <summary>\n        Version file\n    </summary>\n    <names>\n        Version, Versions\n    </names>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GYP\n    </id>\n    <summary>\n        GYP file\n    </summary>\n    <extensions>\n        gyp, gypi\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PKGCONFIG\n    </id>\n    <summary>\n        Pkg-config file\n    </summary>\n    <extensions>\n        pc\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <anchor>\n        PkgConfigFiles\n    </anchor>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        OOO\n    </id>\n    <summary>\n        OpenOffice document\n    </summary>\n    <extensions>\n        sxd, sxi, sxm, smf, sds, odf, odp, otp, odg\n        odb, otg, odt, ott, sda, sdc, ods, ots\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        QT_QPH\n    </id>\n    <summary>\n        Qt Translation file\n    </summary>\n    <extensions>\n        qph\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QT_MS_TS\n    </id>\n    <summary>\n        Qt Translation or MS TypeScript file\n    </summary>\n    <extensions>\n        ts\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DOT\n    </id>\n    <summary>\n        DOT Graph file\n    </summary>\n    <extensions>\n        dot\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DESKTOP\n    </id>\n    <summary>\n        Desktop file\n    </summary>\n    <extensions>\n        desktop\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MS_VISUAL_STUDIO\n    </id>\n    <summary>\n        MS Visual Studio file\n    </summary>\n    <extensions>\n        vcxproj, vcproj, vcprojin, vcxproj.filters, vcxproj.filtersin\n        sln, vc9, resx, vc6, vcwin32, dsw, dsp, csproj, vsprops, xsx\n        cbproj, vbp, vbproj, vcp, vcw, vbg, vbz, vdp, vdproj, vc4, frm\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        WINDOWS\n    </id>\n    <summary>\n        MS Windows file\n    </summary>\n    <extensions>\n        clp, clg, hme, msi, msu, chm, hlp, wmf, emf\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        CSV_FILE\n    </id>\n    <summary>\n        CSV file\n    </summary>\n    <extensions>\n        csv\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        COMMAND\n    </id>\n    <summary>\n        Command file\n    </summary>\n    <extensions>\n        cmd, com, COM\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        WIX\n    </id>\n    <summary>\n        WiX Installer file\n    </summary>\n    <extensions>\n        wxi, wxs\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        STRINGS\n    </id>\n    <summary>\n        Text Strings file\n    </summary>\n    <extensions>\n        strings\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        OVF\n    </id>\n    <summary>\n        OVF file\n    </summary>\n    <extensions>\n        ovf\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        DISK_IMAGE\n    </id>\n    <summary>\n        Disk Image file\n    </summary>\n    <extensions>\n        vdi, vmdk, vhd, iso, vco\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        VIRTUAL_BOX\n    </id>\n    <summary>\n        VirtualBox file\n    </summary>\n    <extensions>\n        vbox\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MMC\n    </id>\n    <summary>\n        Windows MMC file\n    </summary>\n    <extensions>\n        msc\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        VISUAL_BASIC\n    </id>\n    <summary>\n        Visual Basic program\n    </summary>\n    <extensions>\n        vbs, vb, vbx\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LEX\n    </id>\n    <summary>\n        Lex program\n    </summary>\n    <extensions>\n        l\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        YACC\n    </id>\n    <summary>\n        Yacc program\n    </summary>\n    <extensions>\n        y\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LISP\n    </id>\n    <summary>\n        Lisp program\n    </summary>\n    <extensions>\n        lsp, lisp, el\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SEED7_INCLUDE\n    </id>\n    <summary>\n        Seed7 include/library\n    </summary>\n    <extensions>\n        s7i\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SEED7_PROGRAM\n    </id>\n    <summary>\n        Seed7 program\n    </summary>\n    <extensions>\n        sd7\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        HASKELL_SOURCE\n    </id>\n    <summary>\n        Haskell program\n    </summary>\n    <extensions>\n        hs\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        HASKELL_CABAL\n    </id>\n    <summary>\n        Haskell metadata\n    </summary>\n    <extensions>\n        cabal\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        RUST\n    </id>\n    <summary>\n        Rust program\n    </summary>\n    <extensions>\n        rs\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PASCAL\n    </id>\n    <summary>\n        Pascal program\n    </summary>\n    <extensions>\n        pas\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DOS_BATCH\n    </id>\n    <summary>\n        DOS Batch file\n    </summary>\n    <extensions>\n        bat\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        POSTSCRIPT\n    </id>\n    <summary>\n        PostScript file\n    </summary>\n    <extensions>\n        ps, eps, pfa\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        JAVASCRIPT\n    </id>\n    <summary>\n        JavaScript file\n    </summary>\n    <extensions>\n        js, sjs, jsm\n    </extensions>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        COFFEESCRIPT\n    </id>\n    <summary>\n        CoffeeScript file\n    </summary>\n    <extensions>\n        coffee\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        NSIS\n    </id>\n    <summary>\n        NSIS script\n    </summary>\n    <extensions>\n        nsi, nsh\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PARAM\n    </id>\n    <summary>\n        Parameter file\n    </summary>\n    <extensions>\n        prm, par, ff\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DOXYGEN\n    </id>\n    <summary>\n        Doxygen file\n    </summary>\n    <extensions>\n        dox, doxy, doxyfile, doxygen\n    </extensions>\n    <names>\n        Doxyfile, Doxyfile.in\n    </names>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        QML_PROJECT\n    </id>\n    <summary>\n        QML Project file\n    </summary>\n    <extensions>\n        qmlproject\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CMAKE\n    </id>\n    <summary>\n        CMake file\n    </summary>\n    <extensions>\n        cmake, cmakein\n    </extensions>\n    <names>\n        CMakeLists.txt\n    </names>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        EXE\n    </id>\n    <summary>\n        Executable file\n    </summary>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        PE_BINARY\n    </id>\n    <summary>\n        PE Binary file\n    </summary>\n    <weight>\n        45\n    </weight>\n    <terms>\n        PE32, PE64, MS-DOS executable\n    </terms>\n</type>\n\n<type>\n    <id>\n        AUTOMAKE\n    </id>\n    <summary>\n        Automake file\n    </summary>\n    <extensions>\n        am, ac\n    </extensions>\n    <names>\n        Makefile.am, Makefile.ac\n    </names>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        IPDL\n    </id>\n    <summary>\n        IPDL file\n    </summary>\n    <extensions>\n        ipdl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XPI\n    </id>\n    <summary>\n        XPI file\n    </summary>\n    <extensions>\n        xpi\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        CERTIFICATE\n    </id>\n    <summary>\n        Certificate file\n    </summary>\n    <extensions>\n        ca, crt, cert, crl, cer, pem\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        ICC\n    </id>\n    <summary>\n        ICC profile\n    </summary>\n    <extensions>\n        icc, icm, pf\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        CGI\n    </id>\n    <summary>\n        CGI script\n    </summary>\n    <extensions>\n        cgi\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XUL\n    </id>\n    <summary>\n        XML UI file\n    </summary>\n    <extensions>\n        xul\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XBL\n    </id>\n    <summary>\n        XBL file\n    </summary>\n    <extensions>\n        xbl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XSL\n    </id>\n    <summary>\n        XML style sheet\n    </summary>\n    <extensions>\n        xsl\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XSD\n    </id>\n    <summary>\n        XML schema definition\n    </summary>\n    <extensions>\n        xsd\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XSLT\n    </id>\n    <summary>\n        XSL transformation file\n    </summary>\n    <extensions>\n        xslt\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DTD\n    </id>\n    <summary>\n        DTD file\n    </summary>\n    <extensions>\n        dtd\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ENTITY_FILE\n    </id>\n    <summary>\n        Entity file\n    </summary>\n    <extensions>\n        ent\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        XML_RNG\n    </id>\n    <summary>\n        RNG file\n    </summary>\n    <extensions>\n        rng\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        RDF\n    </id>\n    <summary>\n        RDF file\n    </summary>\n    <extensions>\n        rdf\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SQLITE\n    </id>\n    <summary>\n        QSLite database\n    </summary>\n    <extensions>\n        sqlite\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        BERKELEY_DB\n    </id>\n    <summary>\n        Berkeley database\n    </summary>\n    <extensions>\n        db\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        GPERF\n    </id>\n    <summary>\n        GNU Gperf file\n    </summary>\n    <extensions>\n        gperf\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        YAML\n    </id>\n    <summary>\n        YAML file\n    </summary>\n    <extensions>\n        yml, yaml, yml2\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        TCL\n    </id>\n    <summary>\n        Tcl program\n    </summary>\n    <extensions>\n        tcl\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PYTHON\n    </id>\n    <summary>\n        Python program\n    </summary>\n    <extensions>\n        py\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PYTHON_COMPILED\n    </id>\n    <summary>\n        Python compiled program\n    </summary>\n    <bytes>\n        d1f20d0a\n    </bytes>\n    <extensions>\n        pyc, pyo\n    </extensions>\n    <weight>\n        60\n    </weight>\n</type>\n\n<type>\n    <id>\n        SED\n    </id>\n    <summary>\n        Sed program\n    </summary>\n    <extensions>\n        sed\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        FONT\n    </id>\n    <summary>\n        Font file\n    </summary>\n    <extensions>\n        bdf, ttf, TTF, ttc, pfb, qpf, qpf2, otf, eot\n        woff, fnt, bfc, afm, xafm, tfm, vf, ofm, sfd\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        BINARY_DTD\n    </id>\n    <summary>\n        Binary DTD file\n    </summary>\n    <extensions>\n        bdtd\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        ENCODING\n    </id>\n    <summary>\n        Encoding file\n    </summary>\n    <extensions>\n        enc, utf\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        GO\n    </id>\n    <summary>\n        Go program\n    </summary>\n    <extensions>\n        go\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        IBY\n    </id>\n    <summary>\n        ROM Image file\n    </summary>\n    <extensions>\n        iby\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JAVA\n    </id>\n    <summary>\n        Java program\n    </summary>\n    <extensions>\n        java, jsp, jj, sjava, java.template\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CS\n    </id>\n    <summary>\n        C# program\n    </summary>\n    <extensions>\n        cs\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SCALA\n    </id>\n    <summary>\n        Scala program\n    </summary>\n    <extensions>\n        scl\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SHELL\n    </id>\n    <summary>\n        Shell program\n    </summary>\n    <extensions>\n        sh, SH, csh, ksh, bash, tcsh, zsh\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ASSEMBLER\n    </id>\n    <summary>\n        Assembler program\n    </summary>\n    <extensions>\n        asm, s, S, sx, il\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PERL_TEST\n    </id>\n    <summary>\n        Perl test program\n    </summary>\n    <extensions>\n        t\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PERL\n    </id>\n    <summary>\n        Perl program\n    </summary>\n    <extensions>\n        pl, PL, plx, e2x, ph\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LUA\n    </id>\n    <summary>\n        Lua program\n    </summary>\n    <extensions>\n        lua\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        AWK\n    </id>\n    <summary>\n        Awk program\n    </summary>\n    <extensions>\n        awk\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PYTHON_EGG\n    </id>\n    <summary>\n        Python egg\n    </summary>\n    <extensions>\n        egg\n    </extensions>\n    <title>\n        Python Eggs\n    </title>\n    <weight>\n        60\n    </weight>\n</type>\n\n<type>\n    <id>\n        RUBY\n    </id>\n    <summary>\n        Ruby program\n    </summary>\n    <extensions>\n        rb\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PHP\n    </id>\n    <summary>\n        PHP program\n    </summary>\n    <extensions>\n        php, phpt\n    </extensions>\n    <weight>\n        60\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        VIM\n    </id>\n    <summary>\n        Vim Settings file\n    </summary>\n    <extensions>\n        vim\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        SQL\n    </id>\n    <summary>\n        SQL file\n    </summary>\n    <extensions>\n        sql\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SHELL_ARCHIVE\n    </id>\n    <summary>\n        Shell archive\n    </summary>\n    <extensions>\n        shar\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        WEB_SOURCE\n    </id>\n    <summary>\n        WEB Source file\n    </summary>\n    <extensions>\n        web, w\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GETTEXT\n    </id>\n    <summary>\n        Gettext file\n    </summary>\n    <extensions>\n        po, pot\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GETTEXT_MO\n    </id>\n    <summary>\n        Gettext object\n    </summary>\n    <extensions>\n        gmo, mo\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        GPG\n    </id>\n    <summary>\n        GNU GPG file\n    </summary>\n    <extensions>\n        gpg\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        RTF\n    </id>\n    <summary>\n        RTF file\n    </summary>\n    <extensions>\n        rtf\n    </extensions>\n    <terms>\n        Rich Text\n    </terms>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        RST\n    </id>\n    <summary>\n        RST file\n    </summary>\n    <extensions>\n        rst\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        VRML\n    </id>\n    <summary>\n        VRML file\n    </summary>\n    <extensions>\n        wrl, vrml\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        IV\n    </id>\n    <summary>\n        Scene graph file\n    </summary>\n    <extensions>\n        iv\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        MATLAB\n    </id>\n    <summary>\n        MATLAB file\n    </summary>\n    <extensions>\n        mat\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        TEX_DOCUMENT\n    </id>\n    <summary>\n        TeX document\n    </summary>\n    <extensions>\n        latex, tex, sty\n    </extensions>\n    <terms>\n        LaTeX\n    </terms>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        DVI\n    </id>\n    <summary>\n        DVI file\n    </summary>\n    <extensions>\n        dvi, xdv\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        XQ\n    </id>\n    <summary>\n        XQuery file\n    </summary>\n    <extensions>\n        xq\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JAVA_CLASS\n    </id>\n    <summary>\n        Java class\n    </summary>\n    <extensions>\n        class\n    </extensions>\n    <weight>\n        60\n    </weight>\n</type>\n\n<type>\n    <id>\n        PERL_MODULE\n    </id>\n    <summary>\n        Perl module\n    </summary>\n    <extensions>\n        pm\n    </extensions>\n    <weight>\n        70\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PERL_XS\n    </id>\n    <summary>\n        Perl XS file\n    </summary>\n    <extensions>\n        xs\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JSON\n    </id>\n    <summary>\n        JSON file\n    </summary>\n    <extensions>\n        json\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        POD\n    </id>\n    <summary>\n        POD document\n    </summary>\n    <extensions>\n        pod\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SKIN\n    </id>\n    <summary>\n        Skin file\n    </summary>\n    <extensions>\n        skin\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        COMPILED_OBJECT\n    </id>\n    <summary>\n        Compiled object\n    </summary>\n    <extensions>\n        o, obj\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        MACRO\n    </id>\n    <summary>\n        Macro file\n    </summary>\n    <extensions>\n        mac\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        INFODOC\n    </id>\n    <summary>\n        Info document\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        GNU_LD_SCRIPT\n    </id>\n    <summary>\n        GNU LD script\n    </summary>\n    <extensions>\n        ld, lds\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DEF\n    </id>\n    <summary>\n        Module-Definition file\n    </summary>\n    <extensions>\n        def\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GIT\n    </id>\n    <summary>\n        Git file\n    </summary>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CVS\n    </id>\n    <summary>\n        CVS file\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        SVN\n    </id>\n    <summary>\n        Subversion file\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        HG\n    </id>\n    <summary>\n        Mercurial file\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        BZR\n    </id>\n    <summary>\n        Bazaar file\n    </summary>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        TEXINFO\n    </id>\n    <summary>\n        Texinfo file\n    </summary>\n    <extensions>\n        texi, texinfo\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        MS_OFFICE\n    </id>\n    <summary>\n        MS office document\n    </summary>\n    <extensions>\n        doc, docx, xl, xls, xlsb, xlsx, tsv, dex\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        CSS\n    </id>\n    <summary>\n        CSS style sheet\n    </summary>\n    <extensions>\n        css\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n    <anchor>\n        CSS\n    </anchor>\n</type>\n\n<type>\n    <id>\n        SCSS\n    </id>\n    <summary>\n        Sass CSS style sheet\n    </summary>\n    <extensions>\n        scss\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        DATA\n    </id>\n    <summary>\n        Data file\n    </summary>\n    <extensions>\n        data, dat, out, stdout, stdin, tbl, input, exp, ex\n    </extensions>\n    <weight>\n        30\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        M4\n    </id>\n    <summary>\n        M4 macro file\n    </summary>\n    <extensions>\n        m4\n    </extensions>\n    <weight>\n        50\n    </weight>\n    <anchor>\n        M4\n    </anchor>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SYMLINK\n    </id>\n    <summary>\n        Symbolic link\n    </summary>\n    <weight>\n        50\n    </weight>\n</type>\n\n<type>\n    <id>\n        HTML\n    </id>\n    <summary>\n        HTML page\n    </summary>\n    <extensions>\n        html, htm, xhtml, dhtml, shtml, shtm\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <anchor>\n        HTML\n    </anchor>\n</type>\n\n<type>\n    <id>\n        PRECOMPILED_HEADER\n    </id>\n    <summary>\n        Precompiled header\n    </summary>\n    <extensions>\n        gch, pch\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        PACKAGE\n    </id>\n    <summary>\n        Package file\n    </summary>\n    <extensions>\n        pkg\n    </extensions>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        PACKAGE_INFO\n    </id>\n    <summary>\n        Package Info file\n    </summary>\n    <names>\n        PkgInfo\n    </names>\n    <extensions>\n        pkginfo\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        JAM_FILE\n    </id>\n    <summary>\n        Jam file\n    </summary>\n    <names>\n        Jamfile, Jamrules\n    </names>\n    <extensions>\n        jam\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        LIST_FILE\n    </id>\n    <summary>\n        Data List\n    </summary>\n    <extensions>\n        list, lst\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        GLADE\n    </id>\n    <summary>\n        Glade interface\n    </summary>\n    <extensions>\n        glade\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        CACHE\n    </id>\n    <summary>\n        Cache file\n    </summary>\n    <extensions>\n        cache\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        HIDDEN\n    </id>\n    <summary>\n        Hidden file\n    </summary>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        BACKUP\n    </id>\n    <summary>\n        Backup file\n    </summary>\n    <extensions>\n        bak\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        SERVICE\n    </id>\n    <summary>\n        Service file\n    </summary>\n    <extensions>\n        service\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        YUM_DB\n    </id>\n    <summary>\n        Yum DB file\n    </summary>\n    <dirs>\n        yumdb\n    </dirs>\n    <weight>\n        40\n    </weight>\n</type>\n\n<type>\n    <id>\n        FIRMWARE\n    </id>\n    <summary>\n        Firmware file\n    </summary>\n    <extensions>\n        fw\n    </extensions>\n    <weight>\n        40\n    </weight>\n    <format>\n        Binary\n    </format>\n</type>\n\n<type>\n    <id>\n        CONFIGURATION\n    </id>\n    <summary>\n        Configuration file\n    </summary>\n    <extensions>\n        conf, config, cfg, cnf, inf, INF, sysconf, sysconfig, rules\n    </extensions>\n    <names>\n        Config, config\n    </names>\n    <weight>\n        50\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        PDF\n    </id>\n    <summary>\n        PDF file\n    </summary>\n    <extensions>\n        pdf\n    </extensions>\n    <weight>\n        30\n    </weight>\n</type>\n\n<type>\n    <id>\n        X_PIXMAP\n    </id>\n    <summary>\n        X Pixmap file\n    </summary>\n    <extensions>\n        xpm, xbm\n    </extensions>\n    <weight>\n        30\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        IMAGE\n    </id>\n    <summary>\n        Image file\n    </summary>\n    <extensions>\n        png, jpg, jpeg, exif, raw, bmp, pbm, webp, spp, tga\n        img, gif, tiff, xcf, cur, svgz, cct, jp2, jpx\n        ppm, tif, yuv, jps, mng, pcx, blend\n    </extensions>\n    <weight>\n        30\n    </weight>\n</type>\n\n<type>\n    <id>\n        VECTOR_IMAGE\n    </id>\n    <summary>\n        Vector Image file\n    </summary>\n    <extensions>\n        svg, emf, dia, asy, fig, cdr, cvx, fxg, hpl, vsd\n    </extensions>\n    <weight>\n        30\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        AUDIO\n    </id>\n    <summary>\n        Audio file\n    </summary>\n    <extensions>\n        wav, aiff, flac, aac, mpc, ogg, wma, sf2, aa, ac3\n        m3u, midi, wave, wax, wow, mp1, mp2, mp3, mpa, mpga\n        mpu, oga, omg, omx, omf, pcast, pls, acm, afc, mid\n        dls, flw, amr\n    </extensions>\n    <weight>\n        30\n    </weight>\n</type>\n\n<type>\n    <id>\n        VIDEO\n    </id>\n    <summary>\n        Video file\n    </summary>\n    <extensions>\n        swf, flv, mng, avi, 3gp, divx, ogv, movie, mov, swf, wmv, xvid\n        mp4, mpeg, mjpeg, mjp, mpeg4, mpg, mpg2, mpv, mpv2, webm\n    </extensions>\n    <weight>\n        30\n    </weight>\n</type>\n\n<type>\n    <id>\n        ICON\n    </id>\n    <summary>\n        Icon\n    </summary>\n    <extensions>\n        ico, icon, ICO, icns\n    </extensions>\n    <weight>\n        30\n    </weight>\n</type>\n\n<type>\n    <id>\n        RPM\n    </id>\n    <summary>\n        RPM package\n    </summary>\n    <extensions>\n        rpm\n    </extensions>\n    <weight>\n        20\n    </weight>\n</type>\n\n<type>\n    <id>\n        SRPM\n    </id>\n    <summary>\n        SRPM package\n    </summary>\n    <extensions>\n        src.rpm, srpm\n    </extensions>\n    <weight>\n        20\n    </weight>\n</type>\n\n<type>\n    <id>\n        DEB\n    </id>\n    <summary>\n        Deb package\n    </summary>\n    <extensions>\n        deb\n    </extensions>\n    <weight>\n        20\n    </weight>\n</type>\n\n<type>\n    <id>\n        DIR\n    </id>\n    <summary>\n        Directory\n    </summary>\n    <weight>\n        20\n    </weight>\n</type>\n\n<type>\n    <id>\n        TEXT\n    </id>\n    <summary>\n        Text file\n    </summary>\n    <extensions>\n        txt, TXT\n    </extensions>\n    <weight>\n        10\n    </weight>\n    <format>\n        Text\n    </format>\n</type>\n\n<type>\n    <id>\n        ARCHIVE\n    </id>\n    <summary>\n        Archive\n    </summary>\n    <extensions>\n        tar.gz, tgz, tar.Z, taz, tar.xz, txz\n        tar.bz2, tbz2, tbz, tb2, tar.lzma, tlzma\n        tar.lz, tlz, zip, zae, tar, lzma, gz\n        jar, war, ear, xz, 7z, rar, sfx, ace\n        bz, bz2, zipx, apk\n    </extensions>\n    <weight>\n        10\n    </weight>\n</type>\n\n<type>\n    <id>\n        INFORM\n    </id>\n    <summary>\n        Information file\n    </summary>\n    <names>\n        PATCHING, ANNOUNCE, FAQ, HACKING, BUGS, CONFORMANCE\n        TRADEMARK, THANKYOU, PACKAGERS, DEBUG, HOWTO, MAINTAINERS\n        TODO, NOTES, AUTHORS, THANKS, IDEAS, HOWTO.DEBUG, DESIGN\n        PKG-INFO, CREDITS, HISTORY, INSTALL, INDEX, RELEASE\n        CONTRIB, NOTE, INSTALLATION, NEW, DEPS, LEGAL.NOTICE\n    </names>\n    <inames>\n        CONTRIBUTORS.txt, BUILDING.txt, Install.txt, BLACKLIST.txt\n        WISHLIST.TXT, HOWTO.txt\n    </inames>\n    <extensions>\n        install, INSTALL\n    </extensions>\n    <weight>\n        10\n    </weight>\n</type>\n\n<type>\n    <id>\n        CHANGELOG\n    </id>\n    <summary>\n        Change log\n    </summary>\n    <names>\n        CHANGES, ChangeLog, NEWS, HISTORY\n    </names>\n    <inames>\n        Release_notes.txt, RELEASE.txt, CHANGES.txt\n    </inames>\n    <weight>\n        10\n    </weight>\n</type>\n\n<type>\n    <id>\n        README\n    </id>\n    <summary>\n        Readme file\n    </summary>\n    <names>\n        README\n    </names>\n    <inames>\n        Readme.txt, README.Debian\n    </inames>\n    <iextensions>\n        readme.txt, README\n    </iextensions>\n    <weight>\n        10\n    </weight>\n</type>\n\n<type>\n    <id>\n        LICENSE\n    </id>\n    <summary>\n        License\n    </summary>\n    <names>\n        LGPL-2, LGPL-3, LICENSE, COPYING, COPYING3\n        COPYING3.LIB, COPYING.LIB, LGPL, COPYING.LESSER\n        LICENSE.LESSER, LICENSE-MPL\n    </names>\n    <inames>\n        LGPL.txt, COPYING.txt, COPYRIGHT, License.txt, COPYING.GPLv2\n        APACHE.license, LGPL.license, COPYING.readme, COPYING.GPLv3\n        COPYING.LGPL, LICENSING.txt, COPYING.LGPLv2.1, GPL.txt\n        GPL-LICENSE.txt, MIT-LICENSE.txt, COPYING.MPL, MPL-1.1.txt\n    </inames>\n    <iextensions>\n        license, licence\n    </iextensions>\n    <weight>\n        10\n    </weight>\n</type>\n\n<type>\n    <id>\n        OTHER\n    </id>\n    <summary>\n        Other\n    </summary>\n    <title>\n        Other Files\n    </title>\n    <weight>\n        0\n    </weight>\n</type>\n\n</files>\n"
  },
  {
    "path": "modules/Internals/Scripts/Sort.js",
    "content": "function sort(el, status)\n{ \n    var col_sort = el.innerHTML;\n    var tr = el.parentNode;\n    var table = tr.parentNode;\n    var td, col_sort_num;\n    for (var i=0; (td = tr.getElementsByTagName('th').item(i)); i++)\n    {\n        if(td.innerHTML == col_sort)\n        {\n            col_sort_num = i;\n            if(td.prevsort == 'y') {\n                el.up = Number(!el.up);\n            }\n            else if(td.prevsort == 'n') {\n                td.prevsort = 'y';\n                el.up = 0;\n            }\n            else\n            {\n                if(col_sort_num==0)\n                { // already sorted\n                    td.prevsort = 'n';\n                    el.up = 1;\n                }\n                else if(col_sort_num==2)\n                { // delta\n                    td.prevsort = 'n';\n                    el.up = 1;\n                }\n                else\n                {\n                    td.prevsort = 'y';\n                    el.up = 0;\n                }\n            }\n        }\n        else\n        {\n            if(td.prevsort == 'y') {\n                td.prevsort = 'n';\n            }\n        }\n    }\n    \n    var a = new Array();\n    for(var i=1; i < table.rows.length; i++)\n    {\n        var cols = table.rows[i].getElementsByTagName('td');\n        if(cols.item(status)==null)\n        { // double status\n            a[i-2][2] = table.rows[i];\n        }\n        else\n        {\n            a[i-1] = new Array();\n            var indent = cols.item(col_sort_num).innerHTML;\n            if(indent=='') indent='0';\n            if(indent.substr(indent.length-1, 1)==\"%\")\n            { // delta\n                indent = indent.substr(0, indent.length-1)*100;\n            }\n            a[i-1][0] = indent;\n            a[i-1][1] = table.rows[i];\n            a[i-1][2] = null;\n        }\n    }\n    \n    // sort table\n    a.sort(sort_array);\n    if(el.up) a.reverse();\n    \n    // draw table\n    for(var i in a)\n    {\n        table.appendChild(a[i][1]);\n        if(a[i][2]!=null) {\n            table.appendChild(a[i][2]);\n        }\n    }\n}\n\nfunction sort_array(a,b)\n{\n    if(a[0] == b[0]) return 0;\n    if(a[0] > b[0]) return 1;\n    return -1;\n}"
  },
  {
    "path": "modules/Internals/Styles/Index.css",
    "content": "@font-face {\n    font-family:\"Open Sans\";\n    src:url(\"../fonts/OpenSans.ttf\") format(\"truetype\");\n}\n\n@font-face {\n    font-family:\"VeraMono\";\n    src:url(\"../fonts/VeraMono.ttf\") format(\"truetype\");\n}\n\nbody {\n    font-family:'Open Sans', Arial, sans-serif;\n    background-color:White;\n    color:Black;\n}\nhr {\n    color:#ececec;\n    background-color:#ececec;\n    height:3px;\n    border:0;\n}\nh1 {\n    font-size:1.625em;\n    text-decoration:underline;\n}\nh2 {\n    font-size:1.25em;\n    white-space:nowrap;\n    text-decoration:underline;\n}\ntable.summary {\n    border-collapse:collapse;\n    border:1px solid Gray;\n}\ntable.summary td, table.summary th {\n    border:1px solid Gray;\n    white-space:nowrap;\n}\ntable.summary th {\n    background-color:#EEEEEE;\n    font-weight:bold;\n    text-align:left;\n    padding: 3px;\n}\ntable.summary td {\n    text-align:right;\n    padding: 3px 5px 3px 5px;\n    font-family:'VeraMono', Consolas, 'DejaVu Sans Mono', 'Droid Sans Mono', Monaco, Monospace;\n}\ntable.summary td.left {\n    text-align:left;\n}\ntable.summary th.left {\n    text-align:left;\n    font-weight:100;\n}\ntable.summary td.f_path {\n    white-space:normal;\n    word-wrap:break-word;\n    max-width:57em;\n}\ntable.summary td.value {\n    padding-left:10px;\n}\ntable.highlight tr:hover {\n    background-color:#E0E0E0;\n}\ntd.passed, tr.passed {\n    background-color:#CCFFCC;\n}\ntd.warning, tr.warning {\n    background-color:#F4F4AF;\n}\ntd.renamed, tr.renamed {\n    background-color:#FFDAA3;\n}\ntd.moved, tr.moved {\n    background-color:#FFDAA3;\n}\ntd.failed, tr.failed {\n    background-color:#FFC3CE;\n}\ntd.new, tr.new {\n    background-color:#C6DEFF;\n}\na.default {\n    color:#336699;\n}\ndiv.p_list {\n    padding-left:10px;\n    color:#333333;\n    font-size:0.94em;\n}\n.top_ref {\n    font-size:0.69em;\n}\n.footer {\n    font-size:1.2em;\n    margin-top:23px;\n}\n"
  },
  {
    "path": "modules/Internals/Styles/View.css",
    "content": "body {\n    margin:0.4em;\n}\n\n.view {\n    cursor:text;\n    /*margin-top:7px;*/\n    font-family:Consolas, 'DejaVu Sans Mono', 'Droid Sans Mono', Monaco, Monospace;\n    background-color:White;\n    word-wrap:break-word;\n    background-color: #FFF;\n    max-width:100em;\n    display: inline-block;\n    text-align:left;\n    white-space:pre-wrap;\n}\n\n.header, .plain {\n    background-color:Orange;\n    text-align:center;\n    font-weight:bold;\n    padding-left:1em;\n    padding-right:1em;\n}\n\n.plain {\n    background-color:#BFEFFF;\n    width:0px;\n}\n\n.add {\n    background-color:#C6DEFF;\n}\n\n.rm {\n    background-color:#FFCCCC;\n}\n"
  },
  {
    "path": "modules/Internals/Tools/java-dump.sh",
    "content": "#!/bin/bash\n\nfunction decompile {\n    # Decompile class and include private members. In preparation for the\n    # hashing below, strip references on the form #[0-9]+.\n    javap -c -p \"$1\" \\\n        | sed '/^Compiled from /d' \\\n        | sed '/^[ ]*}[ ]*$/d' \\\n        | sed 's/[ ]\\(#[1-9][0-9]*\\)[ ,]/ /' \\\n        | sed 's/[ ]\\([0-9]*[:]\\)//' \\\n        | sed 's/[ ][ ]*/ /g' \\\n        | sed '/Code:$/,/^$/s/^[ ]*\\([^ ]\\)/    \\1/g' \\\n        | sed '/Code:$/d' \\\n        | sed 's/ *{$//'\n}\n\nfunction hash_bodies {\n    # Generate hashes of the instructions making up the method bodies; Yields\n    # more concise summaries.\n    awk '/^[  ]{0,3}[^ ]/{if (x)print x\"\\n\";x=\"\";}{x=(!x)?$0\"\\n--\":x\" \"$0;}END{print x;}' \\\n        | sed '/^--[ ]*$/d' \\\n        | awk \"{ if(/^--/) system(\\\"printf '    '; (echo '\\\"\\$0\\\"' | shasum --algorithm 256)\\\"); else print }\" \\\n        | sed 's/[ ][ ]*-$//'\n}\n\nif [[ \"$1\" == \"-s\" ]]; then\n    shift 1\n    decompile \"$1\" | hash_bodies\nelse\n    javap -c -s -p -verbose \"$1\"\nfi\n"
  },
  {
    "path": "modules/Internals/Tools/rfcdiff-1.41-CUSTOM.sh",
    "content": "#!/bin/bash\n#\n# Synopsis:\n#\tShow changes between 2 internet-drafts using changebars or html\n#\tside-by-side diff.\n#\t\n# Usage:\n#\trfcdiff [options] file1 file2\n#\t\n#\trfcdiff takes two RFCs or Internet-Drafts in text form as input, and\n#\tproduces output which indicates the differences found in one of various\n#\tforms, controlled by the options listed below. In all cases, page\n#\theaders and page footers are stripped before looking for changes.\n#\t\n#\t--html\t\tProduce side-by-side .html diff (default)\n#\t\n#\t--chbars\tProduce changebar marked .txt output\n#\t\n#\t--diff\t\tProduce a regular diff output\n#\t\n#\t--wdiff\t\tProduce paged wdiff output\n#\t\n#\t--hwdiff\tProduce html-wrapped coloured wdiff output\n#\t\n#\t--oldcolour COLOURNAME\tColour for new file in hwdiff (default is \"green\")\n#\t--oldcolor COLORNAME\tColor for old file in hwdiff (default is \"red\")\n#\n#\t--newcolour COLOURNAME\tColour for new file in hwdiff (default is \"green\")\n#\t--newcolor COLORNAME\tColor for new file in hwdiff (default is \"green\")\n#\n#\t--larger        Make difference text in hwdiff slightly larger\n#\t\n#\t--keep\t\tDon't delete temporary workfiles\n#\t\n#\t--version\tShow version\n#\t\n#\t--help\t\tShow this help\n#\t\n#\t--info \"Synopsis|Usage|Copyright|Description|Log\"\n#\t\t\tShow various info\n#\t\n#\t--width\tN\tSet a maximum width of N characters for the\n#\t\t\tdisplay of each half of the old/new html diff\n#\t\n#\t--linenum\tShow linenumbers for each line, not only at the\n#\t\t\tstart of each change section\n#\t\n#\t--body\t\tStrip document preamble (title, boilerplate and\n#\t\t\ttable of contents) and postamble (Intellectual\n#\t\t\tProperty Statement, Disclaimer etc)\n#\t\n#\t--nostrip\tDon't strip headers and footers (or body)\n#\t\n#\t--ab-diff\tBefore/After diff, suitable for rfc-editor\n#\t--abdiff\n#\t\n#\t--stdout\tSend output to stdout instead to a file\n#\t\n#       --tmpdiff       Path to intermediate diff file\n#\n#       --prelines N    Set value for diff -U option\n#\n#       --minimal       Set value for diff -d option\n#\n#       --ignore-space-change\n#                       Ignore changes in the amount of white space.\n#\n#       --ignore-all-space\n#                       Ignore all white space.\n#\n#       --ignore-blank-lines\n#                       Ignore changes whose lines are all blank.\n#       \n#\n# Copyright:\n#\t-----------------------------------------------------------------\n#\t\n#\tCopyright 2002 Henrik Levkowetz\n#\t\n#\tThis program is free software; you can redistribute it and/or modify\n#\tit under the terms of the GNU General Public License as published by\n#\tthe Free Software Foundation; either version 2 of the License, or\n#\t(at your option) any later version.\n#\t\n#\tThis program is distributed in the hope that it will be useful,\n#\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n#\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n#\tGNU General Public License for more details.\n#\t\n#\tYou should have received a copy of the GNU General Public License\n#\talong with this program; if not, write to the Free Software\n#\tFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n#\n#\t-----------------------------------------------------------------\n#\n# Description:\n#\n#\tThe purpose of this program is to compare two versions of an\n#\tinternet-draft, and as output produce a diff in one of several\n#\tformats:\n#\t\n#\t\t- side-by-side html diff\n#\t\t- paged wdiff output in a text terminal\n#\t\t- a text file with changebars in the left margin\n#\t\t- a simple unified diff output\n#\t\n#\tIn all cases, internet-draft headers and footers are stripped before\n#\tgenerating the diff, to produce a cleaner diff.\n#\t\n#\tIt is called as\n#\t\n#\t\trfcdiff first-file second-file\n#\t\n#\tThe latest version is available from\n#\t\thttp://tools.ietf.org/tools/rfcdiff/\n#\n\nexport version=\"1.41\"\nexport prelines=\"10\"\nexport basename=$(basename $0)\nexport workdir=`mktemp -d -t rfcdiff.XXXXXXXX`\nexport pagecache1=\"$workdir/pagecache1\"\nexport pagecache2=\"$workdir/pagecache2\"\n\n# ----------------------------------------------------------------------\n# Utility to find an executable\n# ----------------------------------------------------------------------\nlookfor() {\n    for b in \"$@\"; do\n\tfound=$(which \"$b\" 2>/dev/null)\n\tif [ -n \"$found\" ]; then\n\t    if [ -x \"$found\" ]; then\n\t\techo \"$found\"\n\t\treturn\n\t    fi\n\tfi\n    done\n}\n\nAWK=awk\n\n# ----------------------------------------------------------------------\n# Strip headers footers and formfeeds from infile to stdout\n# ----------------------------------------------------------------------\nstrip() {\n  $AWK '\n\t\t\t\t{ gsub(/\\r/, \"\"); }\n\t\t\t\t{ gsub(/[ \\t]+$/, \"\"); }\n\t\t\t\t{ pagelength++; }\n/\\[?[Pp]age [0-9ivx]+\\]?[ \\t\\f]*$/\t{\n\t\t\t\t    match($0, /[Pp]age [0-9ivx]+/);\n\t\t\t\t    num = substr($0, RSTART+5, RLENGTH-5);\n\t\t\t\t    print num, outline > ENVIRON[\"pagecache\" ENVIRON[\"which\"]]\n\t\t\t\t    pagelength = 0;\n\t\t\t\t}\n/\\f/\t\t\t\t{ newpage=1;\n\t\t\t\t  pagelength=1;\n\t\t\t\t}\n/\\f$/\t\t\t\t{\n\t\t\t\t    # a form feed followed by a \\n does not contribute to the\n\t\t\t\t    # line count.  (But a \\f followed by something else does.)\n\t\t\t\t    pagelength--;\n\t\t\t\t}\n/\\f/\t\t\t\t{ next; }\n/\\[?[Pp]age [0-9ivx]+\\]?[ \\t\\f]*$/\t\t{ preindent = indent; next; }\n\n/^ *Internet.Draft.+[12][0-9][0-9][0-9] *$/ && (FNR > 15)\t{ newpage=1; next; }\n/^ *INTERNET.DRAFT.+[12][0-9][0-9][0-9] *$/ && (FNR > 15)\t{ newpage=1; next; }\n/^ *Draft.+(  +)[12][0-9][0-9][0-9] *$/\t    && (FNR > 15)\t{ newpage=1; next; }\n/^RFC[ -]?[0-9]+.*(  +).* [12][0-9][0-9][0-9]$/ && (FNR > 15)\t{ newpage=1; next; }\n/^draft-[-a-z0-9_.]+.*[0-9][0-9][0-9][0-9]$/ && (FNR > 15)\t{ newpage=1; next; }\n/(Jan|Feb|Mar|March|Apr|April|May|Jun|June|Jul|July|Aug|Sep|Oct|Nov|Dec) (19[89][0-9]|20[0-9][0-9]) *$/ && pagelength < 3  { newpage=1; next; }\nnewpage && $0 ~ /^ *draft-[-a-z0-9_.]+ *$/ { newpage=1; next; }\n\n/^[ \\t]+\\[/\t\t\t{ sentence=1; }\n/[^ \\t]/\t\t\t{\n\t\t\t\t   indent = match($0, /[^ ]/);\n\t\t\t\t   if (indent < preindent) {\n\t\t\t\t      sentence = 1;\n\t\t\t\t   }\n\t\t\t\t   if (newpage) {\n\t\t\t\t      if (sentence) {\n\t\t\t\t\t outline++; print \"\";\n\t\t\t\t      }\n\t\t\t\t   } else {\n\t\t\t\t      if (haveblank) {\n\t\t\t\t\t  outline++; print \"\";\n\t\t\t\t      }\n\t\t\t\t   }\n\t\t\t\t   haveblank=0;\n\t\t\t\t   sentence=0;\n\t\t\t\t   newpage=0;\n\n\t\t\t\t   line = $0;\n\t\t\t\t   sub(/^ *\\t/, \"        \", line);\n\t\t\t\t   thiscolumn = match(line, /[^ ]/);\n\t\t\t\t}\n/[.:][ \\t]*$/\t\t\t{ sentence=1; }\n/\\(http:\\/\\/trustee\\.ietf\\.org\\/license-info\\)\\./ { sentence=0; }\n/^[ \\t]*$/\t\t\t{ haveblank=1; next; }\n\t\t\t\t{ outline++; print; }\n' \"$1\"\n}\n\n\n# ----------------------------------------------------------------------\n# Strip preamble (title, boilerplate and table of contents) and\n# postamble (Intellectual Property Statement, Disclaimer etc)\n# ----------------------------------------------------------------------\nbodystrip() {\n    $AWK '\n    /^[ \\t]*Acknowledgment/\t\t{ inbody = 0; }\n    /^(Full )*Copyright Statement$/\t{ inbody = 0; }\n    /^[ \\t]*Disclaimer of Validid/\t{ inbody = 0; }\n    /^[ \\t]*Intellectual Property/\t{ inbody = 0; }\n    /^Abstract$/\t\t\t{ inbody = 0; }\n    /^Table of Contents$/\t\t{ inbody = 0; }\n    /^1.[ \\t]*Introduction$/\t{ inbody = 1; }\n\n    inbody\t\t\t{ print; }\n    ' \"$1\"\n}\n\n\n# ----------------------------------------------------------------------\n# From two words, find common prefix and differing part, join descriptively\n# ----------------------------------------------------------------------\nworddiff() {\n   $AWK '\nBEGIN\t{\n\t\tw1 = ARGV[1]\n\t\tw2 = ARGV[2]\n\t\tformat = ARGV[3]\n\n\t\tdo {\n\t\t\tif (substr(w1,1,1) == substr(w2,1,1)) {\n\t\t\t\tw1 = substr(w1,2)\n\t\t\t\tw2 = substr(w2,2)\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tprefixlen++;\n\t\t} while (length(w1) && length(w2))\n\n\t\tprefix = substr(ARGV[1],1,prefixlen);\n\n\t\tdo {\n\t\t\tl1 = length(w1);\n\t\t\tl2 = length(w2);\n\t\t\tif (substr(w1,l1,1) == substr(w2,l2,1)) {\n\t\t\t\tw1 = substr(w1,1,l1-1)\n\t\t\t\tw2 = substr(w2,1,l2-1)\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (l1 && l2)\n\n\t\tsuffix = substr(ARGV[1], prefixlen+length(w1))\n\n\t\tprintf format, prefix, w1, w2, suffix;\n\t}\n' \"$1\" \"$2\" \"$3\"\n}\n\n# ----------------------------------------------------------------------\n# Generate a html page with side-by-side diff from a unified diff\n# ----------------------------------------------------------------------\nhtmldiff() {\n   $AWK '\nBEGIN\t{\n           FS = \"[ \\t,]\";\n\n\t   # Read pagecache1\n\t   maxpage[1] = 1\n\t   pageend[1,0] = 2;\n\t   while ( getline < ENVIRON[\"pagecache1\"] > 0) {\n\t      pageend[1,$1] = $2;\n\t      if ($1+0 > maxpage[1]) maxpage[1] = $1+0;\n\t   }\n\n\t   # Read pagecache2\n\t   maxpage[2] = 1\n\t   pageend[2,0] = 2;\n\t   while ( getline < ENVIRON[\"pagecache2\"] > 0) {\n\t      pageend[2,$1] = $2;\n\t      if ($1+0 > maxpage[2]) maxpage[2] = $1+0;\n\t   }\n\n\t   wdiff = ENVIRON[\"wdiffbin\"]\n\t   base1 = ENVIRON[\"base1\"]\n\t   base2 = ENVIRON[\"base2\"]\n\t   optwidth = ENVIRON[\"optwidth\"]\n\t   optnums =  ENVIRON[\"optnums\"]\n\t   optlinks = ENVIRON[\"optlinks\"]\n\t   header(base1, base2)\n\n\t   difflines1 = 0\n\t   difflines2 = 0\n\t}\n\nfunction header(file1, file2) {\n   url1 = file1;\n   url2 = file2;\n   if (optlinks) {\n      if (file1 ~ /^draft-/) { url1 = sprintf(\"<a href=\\\"/html/%s\\\" style=\\\"color:#008\\\">%s</a>\", file1, file1); }\n      if (file1 ~ /^draft-/) { prev = sprintf(\"<a href=\\\"/rfcdiff?url2=%s\\\" style=\\\"color:#008; text-decoration:none;\\\">&lt;</a>\", file1); }\n      if (file2 ~ /^draft-/) { url2 = sprintf(\"<a href=\\\"/html/%s\\\" style=\\\"color:#008\\\">%s</a>\", file2, file2); }\n      if (file2 ~ /^draft-/) { nxt  = sprintf(\"<a href=\\\"/rfcdiff?url1=%s\\\" style=\\\"color:#008; text-decoration:none;\\\">&gt;</a>\", file2) }\n   }   \n   printf \"\" \\\n\"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\"> \\n\" \\\n\"<!-- <!DOCTYPE html PUBLIC \\\"-//W3C//DTD HTML 4.01 Transitional\\\" > -->\\n\" \\\n\"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xml:lang=\\\"en\\\" lang=\\\"en\\\"> \\n\" \\\n\"<head> \\n\" \\\n\"  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\" /> \\n\" \\\n\"  <meta http-equiv=\\\"Content-Style-Type\\\" content=\\\"text/css\\\" /> \\n\" \\\n\"  <title>Diff: %s - %s</title> \\n\" \\\n\"  <style type=\\\"text/css\\\"> \\n\" \\\n\"    body    { font-family: Arial, sans-serif; margin: 0.4ex; margin-right: auto; } \\n\" \\\n\"    table   { width: 100%; } \\n\" \\\n\"    tr      { } \\n\" \\\n\"    td      { white-space: pre; font-family: Consolas, \\\"DejaVu Sans Mono\\\", \\\"Droid Sans Mono\\\", Monaco, Monospace; vertical-align: top;} \\n\" \\\n\"    th      { font-size: 0.86em; } \\n\" \\\n\"    .small  { font-size: 0.6em; font-style: italic; font-family: Verdana, Helvetica, sans-serif; } \\n\" \\\n\"    .left   { background-color: #EEE; } \\n\" \\\n\"    .right  { background-color: #FFF; } \\n\" \\\n\"    .diff   { background-color: #CCF; } \\n\" \\\n\"    .lblock { background-color: #BFB; } \\n\" \\\n\"    .rblock { background-color: #FF8; } \\n\" \\\n\"    .insert { background-color: #8FF; } \\n\" \\\n\"    .delete { background-color: #ACF; } \\n\" \\\n\"    .void   { background-color: #FFB; } \\n\" \\\n\"    .cont   { background-color: #EEE; } \\n\" \\\n\"    .linebr { background-color: #AAA; } \\n\" \\\n\"    .lineno { color: red; background-color: #FFF; font-size: 0.7em; text-align: right; padding: 0 2px; } \\n\" \\\n\"    .elipsis{ background-color: #AAA; } \\n\" \\\n\"    .left .cont { background-color: #DDD; } \\n\" \\\n\"    .right .cont { background-color: #EEE; } \\n\" \\\n\"    .lblock .cont { background-color: #9D9; } \\n\" \\\n\"    .rblock .cont { background-color: #DD6; } \\n\" \\\n\"    .insert .cont { background-color: #0DD; } \\n\" \\\n\"    .delete .cont { background-color: #8AD; } \\n\" \\\n\"    .stats, .stats td, .stats th { background-color: #EEE; padding: 2px 0; } \\n\" \\\n\"  </style> \\n\" \\\n\"</head> \\n\" \\\n\"<body > \\n\" \\\n\"  <table border=\\\"0\\\" cellpadding=\\\"0\\\" cellspacing=\\\"0\\\"> \\n\" \\\n\"  <tr bgcolor=\\\"orange\\\"><th></th><th>%s&nbsp;%s&nbsp;</th><th> </th><th>&nbsp;%s&nbsp;%s</th><th></th></tr> \\n\" \\\n\"\", file1, file2, prev, url1, url2, nxt;\n}\n\nfunction worddiff(w1, w2) {\n   prefixlen = 0;\n   word1 = w1;\n   do {\n      if (substr(w1,1,1) == substr(w2,1,1)) {\n\t w1 = substr(w1,2);\n\t w2 = substr(w2,2);\n      } else {\n\t break;\n      }\n      prefixlen++;\n   } while (length(w1) && length(w2));\n\n   prefix = substr(word1,1,prefixlen);\n\n   do {\n      l1 = length(w1);\n      l2 = length(w2);\n      if (substr(w1,l1,1) == substr(w2,l2,1)) {\n\t w1 = substr(w1,1,l1-1);\n\t w2 = substr(w2,1,l2-1);\n      } else {\n\t break;\n      }\n   } while (l1 && l2);\n\n   suffix = substr(word1, prefixlen+length(w1)+1);\n\n   wordpart[0] = prefix;\n   wordpart[1] = w1;\n   wordpart[2] = w2;\n   wordpart[3] = suffix;\n}\n\nfunction numdisplay(which, line) {\n    if (optnums && (line != prevline[which])) {\n\tprevline[which] = line;\n\treturn line-1;\n    }\n    return \"\";\n}\n\nfunction fixesc(line) {\n#    Making this a no-op for now -- the change in line-breaking\n#    \"<br><span...>\" => \"\\n\" should make this less necessary.\n#    line = gensub(/&(<[^>]*>)/, \"\\\\1\\\\&\", \"g\", line);\n\n#   We still have to handle cases where we have a broken up \"&lt;\" / \"&gt;\"\n    gsub(/&l<\\/span>t;/, \"\\\\&lt;</span>\", line);\n    gsub(/&g<\\/span>t;/, \"\\\\&gt;</span>\", line);\n\n    gsub(/&<span class=\"delete\">amp;/, \"<span class=\\\"delete\\\">\\\\&\", line)\n    gsub(/&<span class=\"insert\">amp;/, \"<span class=\\\"insert\\\">\\\\&\", line)\n\n    gsub(/&<span class=\"delete\">lt;/, \"<span class=\\\"delete\\\">\\\\&lt;\", line);\n    gsub(/&<span class=\"delete\">gt;/, \"<span class=\\\"delete\\\">\\\\&gt;\", line);\n    gsub(/&<span class=\"insert\">lt;/, \"<span class=\\\"insert\\\">\\\\&lt;\", line);\n    gsub(/&<span class=\"insert\">gt;/, \"<span class=\\\"insert\\\">\\\\&gt;\", line);\n\n    gsub(/&<span class=\"delete\">l<\\/span>t;/, \"<span class=\\\"delete\\\">\\\\&lt;</span>\", line);\n    gsub(/&<span class=\"delete\">g<\\/span>t;/, \"<span class=\\\"delete\\\">\\\\&gt;</span>\", line);\n    gsub(/&<span class=\"insert\">l<\\/span>t;/, \"<span class=\\\"insert\\\">\\\\&lt;</span>\", line);\n    gsub(/&<span class=\"insert\">g<\\/span>t;/, \"<span class=\\\"insert\\\">\\\\&gt;</span>\", line);\n\n\n    return line;\n}\n\nfunction chunkdiff(chunk) {\n   if (difflines1 == 0 && difflines2 == 0) return;\n\n   chunkfile1= sprintf(\"1/chunk%04d\", chunk);\n   chunkfile2= sprintf(\"2/chunk%04d\", chunk);\n   printf \"\" > chunkfile1;\n   printf \"\" > chunkfile2;\n   for (l = 0; l < difflines1; l++) { print stack1[l] >> chunkfile1; }\n   for (l = 0; l < difflines2; l++) { print stack2[l] >> chunkfile2; }\n   close(chunkfile1);\n   close(chunkfile2);\n\n   cmd1 = sprintf(\"%s -n -2 -w \\\"<span class=\\\\\\\"delete\\\\\\\">\\\"  -x \\\"</span>\\\" %s %s\", wdiff, chunkfile1, chunkfile2);\n   cmd2 = sprintf(\"%s -n -1 -y \\\"<span class=\\\\\\\"insert\\\\\\\">\\\"  -z \\\"</span>\\\" %s %s\", wdiff, chunkfile1, chunkfile2);\n\n   l=0; while (cmd1 | getline > 0) { stack1[l] = fixesc($0); l++; }\n   difflines1 = l;\n   l=0; while (cmd2 | getline > 0) { stack2[l] = fixesc($0); l++; }\n   difflines2 = l;\n\n   close(cmd1);\n   close(cmd2);\n}\n\nfunction flush() {\n   if (difflines1 || difflines2) {\n      difftag++;\n      multiline = (difflines1 > 1) || (difflines2 > 1);\n      if (multiline && (wdiff != \"\")) chunkdiff(difftag);\n\n      printf \"      <tr><td><a name=\\\"diff%04d\\\" /></td></tr>\\n\", difftag;\n      for (l = 0; l < difflines1 || l < difflines2; l++) {\n\t if (l in stack1) {\n\t    line1 = stack1[l];\n\t    delete stack1[l];\n\t    linenum1++\n\t    if (line1 == \"\")\n\t       if (optwidth > 0) {\n\t\t   line1 = substr(\"                                                                                                                                                                \",0,optwidth);\n\t       } else {\n\t\t   line1 = \"                                                                         \";\n\t       }\n\t } else {\n\t    line1 = \"\";\n\t }\n\t if (l in stack2) {\n\t    line2 = stack2[l];\n\t    delete stack2[l];\n\t    linenum2++;\n\t    if (line2 == \"\")\n\t       if (optwidth > 0) {\n\t\t   line2 = substr(\"                                                                                                                                                                \",0,optwidth);\n\t       } else {\n\t\t   line2 = \"                                                                         \";\n\t       }\n\t } else {\n\t    line2 = \"\";\n\t }\n\n\t if (!multiline || (wdiff == \"\")) {\n\t    worddiff(line1, line2);\n\t    line1 = fixesc(sprintf(\"%s<span class=\\\"delete\\\">%s</span>%s\", wordpart[0], wordpart[1], wordpart[3]));\n\t    line2 = fixesc(sprintf(\"%s<span class=\\\"insert\\\">%s</span>%s\", wordpart[0], wordpart[2], wordpart[3]));\n\t    # Clean up; remove empty spans\n\t    sub(/<span class=\"delete\"><\\/span>/,\"\", line1);\n\t    sub(/<span class=\"insert\"><\\/span>/,\"\", line2);\n\t }\n\t left  = sprintf(\"<td class=\\\"lineno\\\" valign=\\\"top\\\">%s</td><td class=\\\"lblock\\\">%s</td>\", numdisplay(1, linenum1), line1);\n\t right = sprintf(\"<td class=\\\"rblock\\\">%s</td><td class=\\\"lineno\\\" valign=\\\"top\\\">%s</td>\", line2, numdisplay(2, linenum2));\n\t printf \"      <tr>%s<td> </td>%s</tr>\\n\", left, right;\n      }\n   }\n}\n\nfunction getpage(which, line) {\n    line = line + ENVIRON[\"prelines\"];\n    page = \"?\";\n    for (p=1; p <= maxpage[which]; p++) {\n\tif (pageend[which,p] == 0) continue;\n\tif (line <= pageend[which,p]) {\n\t    page = p;\n\t    break;\n\t}\n    }\n    return page;\n}\n\nfunction getpageline(which, line, page) {\n    if (page == \"?\") {\n\treturn line + ENVIRON[\"prelines\"];\n    } else {\n\tif (pageend[which,page-1]+0 != 0) {\n\t    return line + ENVIRON[\"prelines\"] - pageend[which,page-1] + 3; # numbers of header lines stripped\n\t} else {\n\t    return \"?\";\n\t}\n    }\n}\n\nfunction htmlesc(line) {\n    gsub(\"&\", \"\\\\&amp;\", line);\n    gsub(\"<\", \"\\\\&lt;\", line);\n    gsub(\">\", \"\\\\&gt;\", line);\n    return line;\n}\n\nfunction expandtabs(line) {\n    spaces = \"        \";\n    while (pos = index(line, \"\\t\")) {\n\tsub(\"\\t\", substr(spaces, 0, (8-pos%8)), line);\n    }\n    return line;\n}\n\nfunction maybebreakline(line,    width) {\n    width = optwidth;\n    new = \"\";\n    if (width > 0) {\n\tline = expandtabs(line);\n\twhile (length(line) > width) {\n\t    new = new htmlesc(substr(line, 1, width)) \"\\n\";\n\t    line = substr(line, width+1);\n\t}\n    }\n    line = new htmlesc(line) ;\n    return line;\n}\n\n/^@@/\t{\n\t   linenum1 = 0 - $2;\n\t   linenum2 = 0 + $4;\n\t   diffnum ++;\n\t   if (linenum1 > 1) {\n\t      printf \"      <tr><td class=\\\"lineno\\\"></td><td class=\\\"left\\\"></td><td> </td><td class=\\\"right\\\"></td><td class=\\\"lineno\\\"></td></tr>\\n\";\n\t      page1 = getpage(1,linenum1);\n\t      page2 = getpage(2,linenum2);\n\t      if (page1 == \"?\") {\n\t\t posinfo1 = sprintf(\"<a name=\\\"part-l%s\\\" /><small>skipping to change at</small><em> line %s</em>\", diffnum, getpageline(1, linenum1, page1));\n\t      } else {\n\t\t posinfo1 = sprintf(\"<a name=\\\"part-l%s\\\" /><small>skipping to change at</small><em> page %s, line %s</em>\", diffnum, page1, getpageline(1, linenum1, page1));\n\t      }\n\n\t      if (page2 == \"?\") {\n\t\t posinfo2 = sprintf(\"<a name=\\\"part-r%s\\\" /><small>skipping to change at</small><em> line %s</em>\", diffnum, getpageline(2, linenum2, page2));\n\t      } else {\n\t\t posinfo2 = sprintf(\"<a name=\\\"part-r%s\\\" /><small>skipping to change at</small><em> page %s, line %s</em>\", diffnum, page2, getpageline(2, linenum2, page2));\n\t      }\n\n\t      printf \"      <tr bgcolor=\\\"#c0c0c0\\\" ><td></td><th>%s</th><th> </th><th>%s</th><td></td></tr>\\n\", posinfo1, posinfo2;\n\t   }\n\t}\n\n/^---/\t{  next; }\n/^[+][+][+]/\t{  next; }\n/^[ ]/\t{\n\t   line = substr($0, 2);\n\t   line = maybebreakline(line);\n\n\t   flush();\n\t   linenum1++;\n\t   linenum2++;\n\t   printf \"      <tr><td class=\\\"lineno\\\" valign=\\\"top\\\">%s</td><td class=\\\"left\\\">%s</td><td> </td>\", numdisplay(1, linenum1), line;\n\t   printf \"<td class=\\\"right\\\">%s</td><td class=\\\"lineno\\\" valign=\\\"top\\\">%s</td></tr>\\n\", line, numdisplay(2, linenum2);\n\t   diffcount1 += difflines1\n\t   difflines1 = 0\n\t   diffcount2 += difflines2\n\t   difflines2 = 0\n\t}\n/^-/\t{\n\t   line = substr($0, 2);\n\t   line = maybebreakline(line);\n\n\t   stack1[difflines1] = line;\n\t   difflines1++;\n\t}\n/^[+]/\t{\n\t   line = substr($0, 2);\n\t   line = maybebreakline(line);\n\n\t   stack2[difflines2] = line;\n\t   difflines2++;\n\t}\n\nEND\t{\n\t   flush();\n\t   printf(\"\\n\" \\\n\"     <tr><td></td><td class=\\\"left\\\"></td><td> </td><td class=\\\"right\\\"></td><td></td></tr>\\n\" \\\n\"     <tr bgcolor=\\\"#c0c0c0\\\"><th colspan=\\\"5\\\" align=\\\"center\\\"><a name=\\\"end\\\">&nbsp;%s. %s change block(s).&nbsp;</a></th></tr>\\n\" \\\n\"     <tr class=\\\"stats\\\"><td></td><th><i>%s line(s) changed or deleted</i></th><th><i> </i></th><th><i>%s line(s) changed or added</i></th><td></td></tr>\\n\" \\\n\"     <tr><td colspan=\\\"5\\\" align=\\\"center\\\" class=\\\"small\\\"><br/>This html diff was produced by rfcdiff %s</td></tr>\\n\" \\\n\"   </table>\\n\" \\\n\"   </body>\\n\" \\\n\"   </html>\\n\", diffnum?\"End of changes\":\"No changes\", difftag, diffcount1, diffcount2, ENVIRON[\"version\"]);\n\t}\n' \"$1\"\n}\n\n# ----------------------------------------------------------------------\n# Generate before/after text output from a context diff\n# ----------------------------------------------------------------------\nabdiff() {\n$AWK '\nBEGIN\t{\n\t   # Read pagecache1\n\t   maxpage[1] = 1\n\t   pageend[1,0] = 2;\n\t   while ( getline < ENVIRON[\"pagecache1\"] > 0) {\n\t      pageend[1,$1] = $2;\n\t      if ($1+0 > maxpage[1]) maxpage[1] = $1+0;\n\t   }\n\n\t   # Read pagecache2\n\t   maxpage[2] = 1\n\t   pageend[2,0] = 2;\n\t   while ( getline < ENVIRON[\"pagecache2\"] > 0) {\n\t      pageend[2,$1] = $2;\n\t      if ($1+0 > maxpage[2]) maxpage[2] = $1+0;\n\t   }\n\n\t   base1 = ENVIRON[\"base1\"]\n\t   base2 = ENVIRON[\"base2\"]\n\n\t   section = \"INTRODUCTION\";\n\t   para = 0;\n\n\t}\n/^\\+\\+/ {\n\t   next;\n\t}\n/^\\-\\-/ {\n\t   next;\n\t}\n/^ Appendix ./\t{\n\t   section = $1 \" \" $2;\n\t   para = 0;\n\t}\n/^  ? ? ?[0-9]+(\\.[0-9]+)*\\.? /\t{\n\t   section = \"Section \" $1;\n\t   para = 0;\n\t}\n/^ ?$/\t{\n\t   if (inpara) {\n\t      printf \"\\n%s, paragraph %s:\\n\", section, para;\n\t      print \"OLD:\\n\"\n\t      print oldpara\n\t      print \"NEW:\\n\"\n\t      print newpara\n\t   }\n\t   oldpara = \"\";\n\t   newpara = \"\";\n\t   para ++;\n\t   inpara = 0\n\t}\n/^ ./\t{\n\t   oldpara = oldpara $0 \"\\n\"\n\t   newpara = newpara $0 \"\\n\"\n\t}\n/^\\-/\t{\n\t   sub(/^./, \" \");\n\t   oldpara = oldpara $0 \"\\n\"\n\t   inpara++;\n\t}\n/^\\+/\t{\n\t   sub(/^./, \" \");\n\t   newpara = newpara $0 \"\\n\"\n\t   inpara++;\n\t}\nEND\t{\n\t   if (inpara) {\n\t      printf \"\\n%s, paragraph %s:\\n\", section, para;\n\t      print \"OLD:\\n\"\n\t      print oldpara\n\t      print \"NEW:\\n\"\n\t      print newpara\n\t   }\t\n\t}\n'\n}\n\n\n# ----------------------------------------------------------------------\n# Utility to extract keyword info\n# ----------------------------------------------------------------------\nextract() {\n    $AWK -v keyword=\"$1\" '\n\tBEGIN {\n\t    # print \"Keyword\", keyword;\n\t}\n\t/^# [A-Z]/ {\n\t    # print \"New key\", $2;\n\t    if ($2 == keyword \":\" ) { output=1; } else { output=0; }\n\t    # print \"Output\", output;\n\t}\n\t/^#\\t/\t{\n\t    # print \"Content\", output, $0;\n\t    if ( output ) {\n\t\tsub(/^#/,\"\");\n\t\tprint;\n\t    }\n\t}\n\t{\n\t    next;\n\t}\n\n    ' \"$2\"\n}\n\n\n# ----------------------------------------------------------------------\n# Utility for error exit\n# ----------------------------------------------------------------------\ndie() {\n   echo $*;\n   exit 1;\n}\n\n# ----------------------------------------------------------------------\n# Process options\n# ----------------------------------------------------------------------\n\n# Default values\nopthtml=1; optdiff=0; optchbars=0; optwdiff=0; optnowdiff=0;\noptkeep=0; optinfo=0; optwidth=0;  optnums=0;  optbody=0; optabdiff=0;\noptstrip=1; opthwdiff=0; optlinks=0;\noptoldcolour=\"red\"; optnewcolour=\"green\"; optlarger=\"\"\noptstdout=0;\nopttmpdiff=0; tmpdiff=$workdir/diff;\n\nwhile [ $# -gt 0 ]; do\n   case \"$1\" in\n      --html)   opthtml=1; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=0;;\n      --diff)   opthtml=0; optdiff=1; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=0;;\n      --chbars) opthtml=0; optdiff=0; optchbars=1; optwdiff=0; opthwdiff=0; optabdiff=0;;\n      --wdiff)  opthtml=0; optdiff=0; optchbars=0; optwdiff=1; opthwdiff=0; optabdiff=0;;\n      --hwdiff) opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=1; optabdiff=0;;\n      --changes)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;\n      --abdiff)\topthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;\n      --ab-diff)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;\n      --rfc-editor-diff)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;\n      --version)echo -e \"$basename\\t$version\"; exit 0;;\n      --nowdiff)optnowdiff=1;;\n      --keep)\toptkeep=1;;\n      --info)\toptinfo=1; keyword=$2; shift;;\n      --help)\toptinfo=1; keyword=\"Usage\";;\n      --width)\toptwidth=$2; shift;;\n      --oldcolor)     optoldcolour=$2; shift;;\n      --oldcolour)    optoldcolour=$2; shift;;\n      --newcolor)     optnewcolour=$2; shift;;\n      --newcolour)    optnewcolour=$2; shift;;\n      --larger)       optlarger='size=\"+1\"';;\n      --linenum)optnums=1;;\n      --body)\toptbody=1;;\n      --nostrip)optstrip=0; optbody=0;;\n      --stdout) optstdout=1;;\n      --links)  optlinks=1;;\n      --ignore-space-change) optnospacechange=1;;\n      --ignore-all-space) optignorewhite=1;;\n      --ignore-blank-lines) optignoreblank=1;;\n      --wdiff-args) optwdiffargs=$2; shift;;\n      --tmpdiff) opttmpdiff=1; tmpdiff=$2; shift;;\n      --prelines)  export prelines=$2; shift;;\n      --minimal) optminimal=1;;\n      --)\tshift; break;;\n\n      -v) echo \"$basename $version\"; exit 0;;\n      -*) echo \"Unrecognized option: $1\";\n\t  exit 1;;\n      *)  break;;\n   esac\n   shift\ndone\n\nexport optwidth\nexport optnums\nexport optlinks\n\n# ----------------------------------------------------------------------\n# Determine output file name. Maybe output usage and exit.\n# ----------------------------------------------------------------------\n#set -x\n\nif [ $optinfo -gt 0 ]; then\n   extract $keyword $0\n   exit\nfi\nif [ $# -ge 2 ]; then\n   if [ \"$1\" = \"$2\" ]; then\n      echo \"The files are the same file\"\n      exit\n   fi\n   export base1=$(basename \"$1\")\n   export base2=$(basename \"$2\")\n   outbase=$(worddiff \"$base2\" \"$base1\" \"%s%s-from-%s\")\nelse\n   extract Usage $0\n   exit 1\nfi\n\n\n# ----------------------------------------------------------------------\n# create working directory.\n# ----------------------------------------------------------------------\nmkdir $workdir/1 || die \"$0: Error: Failed to create temporary directory '$workdir/1'.\"\nmkdir $workdir/2 || die \"$0: Error: Failed to create temporary directory '$workdir/2'.\"\n\n# ----------------------------------------------------------------------\n# Copy files to a work directory\n# ----------------------------------------------------------------------\ncp \"$1\" $workdir/1/\"$base1\"\ncp \"$2\" $workdir/2/\"$base2\"\n\n\n# ----------------------------------------------------------------------\n# Maybe strip headers/footers from both files\n# ----------------------------------------------------------------------\n\nif [ $optstrip -gt 0 ]; then\n   export which=1\n   strip $workdir/1/\"$base1\" > $workdir/1/\"$base1\".stripped\n   mv -f $workdir/1/\"$base1\".stripped $workdir/1/\"$base1\"\n   export which=2\n   strip $workdir/2/\"$base2\" > $workdir/2/\"$base2\".stripped\n   mv -f $workdir/2/\"$base2\".stripped $workdir/2/\"$base2\"\nfi\n\n# ----------------------------------------------------------------------\n# Maybe do html quoting\n# ----------------------------------------------------------------------\n\nif [ $opthwdiff -gt 0 ]; then\n   sed -e 's/&/&amp;/g' -e 's/</\\&lt;/g' -e 's/>/\\&gt;/g' $workdir/1/\"$base1\" > $workdir/1/\"$base1\".quoted\n   mv -f $workdir/1/\"$base1\".quoted $workdir/1/\"$base1\"\n   sed -e 's/&/&amp;/g' -e 's/</\\&lt;/g' -e 's/>/\\&gt;/g' $workdir/2/\"$base2\" > $workdir/2/\"$base2\".quoted\n   mv -f $workdir/2/\"$base2\".quoted $workdir/2/\"$base2\"\nfi\n\n# ----------------------------------------------------------------------\n# Maybe strip preamble (title, boilerplate and table of contents) and\n# postamble (Intellectual Property Statement, Disclaimer etc)\n# ----------------------------------------------------------------------\nif [ $optbody -gt 0 ]; then\n   bodystrip $workdir/1/\"$base1\" > $workdir/1/\"$base1\".stripped\n   mv $workdir/1/\"$base1\".stripped $workdir/1/\"$base1\"\n   bodystrip $workdir/2/\"$base2\" > $workdir/2/\"$base2\".stripped\n   mv $workdir/2/\"$base2\".stripped $workdir/2/\"$base2\"\nfi\n\n# ----------------------------------------------------------------------\n# Get output file name\n# ----------------------------------------------------------------------\nif [ \"$3\" ]; then\n  outfile=\"$3\"\nelse\n    if [ $opthtml -gt 0 ]; then\n      outfile=./\"$outbase\".diff.html\n    fi\n    if [ $optchbars -gt 0 ]; then\n      outfile=./\"$outbase\".chbar\n    fi\n    if [ $optdiff -gt 0 ]; then\n      outfile=./\"$outbase\".diff\n    fi\n    if [ $optabdiff -gt 0 ]; then\n      outfile=./\"$outbase\".changes\n    fi\n    if [ $opthwdiff -gt 0 ]; then\n      outfile=./\"$outbase\".wdiff.html\n    fi\nfi\nif [ \"$outfile\" ]; then\n   tempout=./$(basename \"$outfile\")\nfi\n\n# ----------------------------------------------------------------------\n# Check if we can use wdiff for block diffs\n# ----------------------------------------------------------------------\nif [ $optnowdiff -eq 0 ]; then\n   wdiffbin=$(lookfor wdiff)\n   export wdiffbin\nfi\n\n# ----------------------------------------------------------------------\n# Do diff\n# ----------------------------------------------------------------------\n\norigdir=$PWD\ncd $workdir\nif cmp 1/\"$base1\" 2/\"$base2\" >/dev/null; then\n   echo \"\"\n   echo \"The files are identical.\"\nfi\n\nif [ $opthtml -gt 0 ]; then\n   diff ${optignoreblank:+-B} ${optminimal:+-d} ${optnospacechange:+-b} ${optignorewhite:+-w} -U $prelines 1/\"$base1\" 2/\"$base2\" | tee $tmpdiff | htmldiff > \"$tempout\"\nfi\nif [ $optchbars -gt 0 ]; then\n   diff -Bwd -U 10000 1/\"$base1\" 2/\"$base2\" | tee $tmpdiff | grep -v \"^-\" | tail -n +3 | sed 's/^+/|/' > \"$tempout\"\nfi\nif [ $optdiff -gt 0 ]; then\n   diff -Bwd -U $prelines 1/\"$base1\" 2/\"$base2\" | tee $tmpdiff > \"$tempout\"\nfi\nif [ $optabdiff -gt 0 ]; then\n   diff -wd -U 1000 1/\"$base1\" 2/\"$base2\" | tee $tmpdiff | abdiff\nfi\nif [ $optwdiff -gt 0 ]; then\n   wdiff -a $optwdiffargs 1/\"$base1\" 2/\"$base2\"\nfi\nif [ $opthwdiff -gt 0 ]; then\n    echo \"<html><head><title>wdiff \"$base1\" \"$base2\"</title></head><body>\"\t>  \"$tempout\"\n    echo \"<pre>\"\t\t\t\t\t\t\t\t>> \"$tempout\"\n    wdiff -w \"<strike><font color='$optoldcolour' $optlarger>\" -x \"</font></strike>\"\t\\\n          -y \"<strong><font color='$optnewcolour' $optlarger>\" -z \"</font></strong>\"\t\\\n\t  1/\"$base1\" 2/\"$base2\"\t\t\t\t\t\t\t>> \"$tempout\"\n    echo \"</pre>\"\t\t\t\t\t\t\t\t>> \"$tempout\"\n    echo \"</body></html>\"\t\t\t\t\t\t\t>> \"$tempout\"\nfi\n\nif [ $optstdout -gt 0 ]; then\n  cat \"$tempout\"\n  rm  \"$tempout\"\nelse\n  cd \"$origdir\"; if [ -f $workdir/\"$tempout\" ]; then mv $workdir/\"$tempout\" \"$outfile\"; fi\nfi\n\nif [ $optkeep -eq 0 ]; then\n   if [ -f $pagecache1 ]; then rm $pagecache1; fi\n   if [ -f $pagecache2 ]; then rm $pagecache2; fi\n   rm -fr $workdir/1\n   rm -fr $workdir/2\n   if [ -f $tmpdiff ]; then\n      if [ $opttmpdiff -eq 0 ]; then\n          rm $tmpdiff\n      fi\n   fi\n   rm -f $workdir/$tmpdiff\n   rmdir $workdir\nelse\n   cd /tmp\n   tar czf $basename-$$.tgz $basename-$$\n   echo \"\n   Temporary workfiles have been left in $workdir/, and packed up in $workdir.tgz\"\nfi\n\n"
  },
  {
    "path": "pkgdiff.pl",
    "content": "#!/usr/bin/perl\n###########################################################################\n# PkgDiff - Package Changes Analyzer 1.8\n# A tool for visualizing changes in Linux software packages\n#\n# Copyright (C) 2012-2025 Andrey Ponomarenko's ABI Laboratory\n#\n# Written by Andrey Ponomarenko\n#\n# PLATFORMS\n# =========\n#  GNU/Linux, FreeBSD, Mac OS X\n#\n# PACKAGE FORMATS\n# ===============\n#  RPM, DEB, TAR.GZ, JAR, etc.\n#\n# REQUIREMENTS\n# ============\n#  Perl 5 (5.8 or newer)\n#  GNU Diff\n#  GNU Wdiff\n#  GNU Awk\n#  GNU Binutils (readelf)\n#  Perl-File-LibMagic\n#  RPM (rpm, rpmbuild, rpm2cpio) for analysis of RPM-packages\n#  DPKG (dpkg, dpkg-deb) for analysis of DEB-packages\n#\n# SUGGESTIONS\n# ===========\n#  ABI Compliance Checker (1.99.1 or newer)\n#  ABI Dumper (0.97 or newer)\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n###########################################################################\nuse strict;\nuse Getopt::Long;\nGetopt::Long::Configure (\"posix_default\", \"no_ignore_case\", \"permute\");\nuse File::Path qw(mkpath rmtree);\nuse File::Temp qw(tempdir);\nuse File::Copy qw(move copy);\nuse File::Compare;\nuse Cwd qw(abs_path cwd);\nuse Config;\nuse Fcntl;\n\nmy $TOOL_VERSION = \"1.8\";\nmy $ORIG_DIR = cwd();\n\n# Internal modules\nmy $MODULES_DIR = getModules();\npush(@INC, getDirname($MODULES_DIR));\n\nmy $DIFF = $MODULES_DIR.\"/Internals/Tools/rfcdiff-1.41-CUSTOM.sh\";\nmy $JAVA_DUMP = $MODULES_DIR.\"/Internals/Tools/java-dump.sh\";\nmy $ACC = \"abi-compliance-checker\";\nmy $ACC_VER = \"1.99.1\";\nmy $ABI_DUMPER = \"abi-dumper\";\nmy $ABI_DUMPER_VER = \"0.97\";\n\nmy ($Help, $ShowVersion, $DumpVersion, $GenerateTemplate, %Descriptor,\n$CheckUsage, $PackageManager, $OutputReportPath, $ShowDetails, $Debug,\n$SizeLimit, $QuickMode, $DiffWidth, $DiffLines, $Minimal, $NoWdiff,\n$IgnoreSpaceChange, $IgnoreAllSpace, $IgnoreBlankLines, $ExtraInfo,\n$CustomTmpDir, $HideUnchanged, $TargetName, $TargetTitle, %TargetVersion,\n$CompareDirs, $ListAddedRemoved, $SkipSubArchives, $LinksTarget,\n$SkipPattern, $AllText, $CheckByteCode, $FullMethodDiffs, $TrackUnchanged,\n$MoveStyles);\n\nmy $CmdName = getFilename($0);\n\nmy %ERROR_CODE = (\n    # Unchanged verdict\n    \"Unchanged\"=>0,\n    # Changed verdict\n    \"Changed\"=>1,\n    # Undifferentiated error code\n    \"Error\"=>2,\n    # System command is not found\n    \"Not_Found\"=>3,\n    # Cannot access input files\n    \"Access_Error\"=>4,\n    # Cannot find a module\n    \"Module_Error\"=>9\n);\n\nmy $HomePage = \"https://github.com/lvc/pkgdiff\";\n\nmy $ShortUsage = \"Package Changes Analyzer (PkgDiff) $TOOL_VERSION\nA tool for visualizing changes in Linux software packages\nCopyright (C) 2022 Andrey Ponomarenko's ABI Laboratory\nLicense: GNU GPL\n\nUsage: $CmdName PKG1 PKG2 [options]\nExample: $CmdName OLD.rpm NEW.rpm\n\nMore info: $CmdName --help\\n\";\n\nif($#ARGV==-1)\n{\n    printMsg(\"INFO\", $ShortUsage);\n    exit(0);\n}\n\nGetOptions(\"h|help!\" => \\$Help,\n  \"v|version!\" => \\$ShowVersion,\n  \"dumpversion!\" => \\$DumpVersion,\n# arguments\n  \"old=s\" => \\$Descriptor{1},\n  \"new=s\" => \\$Descriptor{2},\n# options\n  \"check-usage!\" => \\$CheckUsage,\n  \"pkg-manager=s\" => \\$PackageManager,\n  \"template!\" => \\$GenerateTemplate,\n  \"report-path=s\" => \\$OutputReportPath,\n  \"details!\" => \\$ShowDetails,\n  \"size-limit=s\" => \\$SizeLimit,\n  \"width=s\" => \\$DiffWidth,\n  \"prelines=s\" => \\$DiffLines,\n  \"ignore-space-change\" => \\$IgnoreSpaceChange,\n  \"ignore-all-space\" => \\$IgnoreAllSpace,\n  \"ignore-blank-lines\" => \\$IgnoreBlankLines,\n  \"quick!\" => \\$QuickMode,\n  \"minimal!\" => \\$Minimal,\n  \"no-wdiff!\" => \\$NoWdiff,\n  \"extra-info=s\" => \\$ExtraInfo,\n  \"tmp-dir=s\" => \\$CustomTmpDir,\n  \"c|hide-unchanged!\" => \\$HideUnchanged,\n  \"debug!\" => \\$Debug,\n  \"v1|vnum1=s\" => \\$TargetVersion{1},\n  \"v2|vnum2=s\" => \\$TargetVersion{2},\n  \"name=s\" => \\$TargetName,\n  \"title=s\" => \\$TargetTitle,\n  \"d|directories!\" => \\$CompareDirs,\n  \"list-added-removed!\" => \\$ListAddedRemoved,\n  \"skip-subarchives!\" => \\$SkipSubArchives,\n  \"skip-pattern=s\" => \\$SkipPattern,\n  \"all-text!\" => \\$AllText,\n  \"links-target=s\" => \\$LinksTarget,\n  \"check-byte-code!\" => \\$CheckByteCode,\n  \"full-method-diffs!\" => \\$FullMethodDiffs,\n  \"track-unchanged!\" => \\$TrackUnchanged,\n  \"move-styles=s\" => \\$MoveStyles\n) or errMsg();\n\nmy $TMP_DIR = undef;\n\nif($CustomTmpDir)\n{\n    printMsg(\"INFO\", \"using custom temp directory: $CustomTmpDir\");\n    $TMP_DIR = abs_path($CustomTmpDir);\n    mkpath($TMP_DIR);\n    cleanTmp();\n}\nelse {\n    $TMP_DIR = tempdir(CLEANUP=>1);\n}\n\nsub cleanTmp()\n{\n    foreach my $E (\"null\", \"error\",\n    \"unpack\", \"output\", \"fmt\",\n    \"content1\", \"content2\",\n    \"xcontent1\", \"xcontent2\")\n    {\n        if(-f $TMP_DIR.\"/\".$E) {\n            unlink($TMP_DIR.\"/\".$E);\n        }\n        elsif(-d $TMP_DIR.\"/\".$E) {\n            rmtree($TMP_DIR.\"/\".$E);\n        }\n    }\n}\n\nif(@ARGV)\n{\n    if($#ARGV==1)\n    { # pkgdiff OLD.pkg NEW.pkg\n        $Descriptor{1} = $ARGV[0];\n        $Descriptor{2} = $ARGV[1];\n    }\n    else {\n        errMsg();\n    }\n}\n\nsub errMsg()\n{\n    printMsg(\"INFO\", \"\\n\".$ShortUsage);\n    exit($ERROR_CODE{\"Error\"});\n}\n\nmy $HelpMessage=\"\nNAME:\n  Package Changes Analyzer\n  A tool for visualizing changes in Linux software packages\n\nDESCRIPTION:\n  Package Changes Analyzer (PkgDiff) is a tool for visualizing\n  changes in Linux software packages (RPM, DEB, TAR.GZ, etc).\n  \n  The tool can compare directories as well (with the help of\n  the -d option).\n\n  The tool is intended for Linux maintainers who are interested\n  in ensuring compatibility of old and new versions of packages.\n\n  This tool is free software: you can redistribute it and/or\n  modify it under the terms of the GNU GPL.\n\nUSAGE:\n  $CmdName PKG1 PKG2 [options]\n  $CmdName -d DIR1/ DIR2/ [options]\n\nEXAMPLES:\n  $CmdName OLD.rpm NEW.rpm\n  $CmdName OLD.deb NEW.deb\n  $CmdName OLD.tar.gz NEW.tar.gz\n\nARGUMENTS:\n   PKG1\n      Path to the old version of a package (RPM, DEB, TAR.GZ, etc).\n      \n      If you need to analyze a group of packages then you can\n      pass an XML-descriptor of this group (VERSION.xml file):\n\n          <version>\n            /* Group version */\n          </version>\n\n          <group>\n            /* Group name */\n          </group>\n        \n          <packages>\n            /path1/to/package(s)\n            /path2/to/package(s)\n            ...\n          </packages>\n\n   PKG2\n      Path to the new version of a package (RPM, DEB, TAR.GZ, etc).\n\nINFORMATION OPTIONS:\n  -h|-help\n      Print this help.\n\n  -v|-version\n      Print version information.\n\n  -dumpversion\n      Print the tool version ($TOOL_VERSION) and don't do anything else.\n\nGENERAL OPTIONS:\n  -report-path PATH\n      Path to the report.\n      Default:\n        pkgdiff_reports/<pkg>/<v1>_to_<v2>/changes_report.html\n\n  -details\n      Try to create detailed reports.\n\n  -size-limit SIZE\n      Don't analyze files larger than SIZE in kilobytes.\n\n  -width WIDTH\n      Width of the Visual Diff.\n      Default: 80\n\n  -prelines NUM\n      Size of the context in the Visual Diff.\n      Default: 10\n\n  -ignore-space-change\n      Ignore changes in the amount of white space.\n\n  -ignore-all-space\n      Ignore all white space.\n\n  -ignore-blank-lines\n      Ignore changes whose lines are all blank.\n\n  -quick\n      Quick mode without creating of Visual Diffs for files.\n\n  -minimal\n      Try to find a smaller set of changes.\n  \n  -no-wdiff\n      Do not use GNU Wdiff for analysis of changes.\n      This may be two times faster, but produces lower\n      quality reports.\n\nOTHER OPTIONS:\n  -check-usage\n      Check if package content is used by other\n      packages in the repository.\n\n  -pkg-manager NAME\n      Specify package management tool.\n      Supported:\n        urpm - Mandriva URPM\n\n  -template\n      Create XML-descriptor template ./VERSION.xml\n      \n  -extra-info DIR\n      Dump extra info to DIR.\n      \n  -tmp-dir DIR\n      Use custom temp directory.\n  \n  -c|-hide-unchanged\n      Don't show unchanged files in the report.\n\n  -debug\n      Show debug info.\n  \n  -name NAME\n      Set name of the package to NAME.\n  \n  -title TITLE\n      Set name of the package in the title of the report to TITLE.\n  \n  -vnum1 NUM\n      Set version number of the old package to NUM.\n  \n  -vnum2 NUM\n      Set version number of the new package to NUM.\n  \n  -links-target TARGET\n      Set target attribute for links in the report:\n        _self (default)\n        _blank\n  \n  -list-added-removed\n      Show content of added and removed text files.\n  \n  -skip-subarchives\n      Skip checking of archives inside the input packages.\n  \n  -skip-pattern REGEX\n      Don't check files matching REGEX.\n  \n  -d|-directories\n      Compare directories instead of packages.\n  \n  -all-text\n      Treat all files in the archive as text files.\n\n  -check-byte-code\n      When comparing Java classes, also check for byte code changes.\n\n  -full-method-diffs\n      Perform a full diff of method bodies when -check-byte-code is specified.\n\n  -track-unchanged\n      Track unchanged files in extra info.\n\nREPORT:\n    Report will be generated to:\n        pkgdiff_reports/<pkg>/<v1>_to_<v2>/changes_report.html\n\nEXIT CODES:\n    0 - Unchanged. The tool has run without any errors.\n    non-zero - Changed or the tool has run with errors.\n\nMORE INFORMATION:\n    \".$HomePage.\"\\n\";\n\nsub helpMsg() {\n    printMsg(\"INFO\", $HelpMessage.\"\\n\");\n}\n\nmy $DescriptorTemplate = \"\n<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\n<descriptor>\n\n/* Primary sections */\n\n<version>\n    /* Version of a group of packages */\n</version>\n\n<group>\n    /* Name of a group of packages */\n</group>\n\n<packages>\n    /* The list of paths to packages and/or\n       directories with packages, one per line */\n</packages>\n\n<skip_files>\n    /* The list of files that should\n       not be analyzed, one per line */\n</skip_files>\n\n</descriptor>\";\n\n# Settings\nmy $RENAME_FILE_MATCH = 0.25; # 0.55\nmy $RENAME_CONTENT_MATCH = 0.85;\nmy $MOVE_CONTENT_MATCH = 0.90;\nmy $MOVE_DEPTH = 4;\nmy $DEFAULT_WIDTH = 80;\nmy $DIFF_PRE_LINES = 10;\nmy $EXACT_DIFF_SIZE = 256*1024;\nmy $EXACT_DIFF_RATE = 0.1;\n\nmy $USE_LIBMAGIC = 0;\n\nmy %Group = (\n    \"Count1\"=>0,\n    \"Count2\"=>0\n);\n\nmy %FormatInfo = ();\nmy %FileFormat = ();\n\nmy %TermFormat = ();\nmy %DirFormat = ();\nmy %BytesFormat = ();\n\n# Cache\nmy %Cache;\n\n# Modes\nmy $CheckMode = \"Single\";\n\n# Packages\nmy %TargetPackages;\nmy %PackageFiles;\nmy %PathName;\nmy %FileChanges;\nmy %PackageInfo;\nmy %InfoChanges;\nmy %PackageUsage;\nmy %TotalUsage;\nmy %RemovePrefix;\n\n# Deps\nmy %PackageDeps;\nmy %TotalDeps;\nmy %DepChanges;\n\n# Files\nmy %AddedFiles;\nmy %RemovedFiles;\nmy %ChangedFiles;\nmy %UnchangedFiles;\nmy %StableFiles;\nmy %RenamedFiles;\nmy %RenamedFiles_R;\nmy %MovedFiles;\nmy %MovedFiles_R;\nmy %ChangeRate;\n\nmy %SkipFiles;\n\n# Symbols\nmy %AddedSymbols;\nmy %RemovedSymbols;\n\n# Report\nmy $REPORT_PATH;\nmy $REPORT_DIR;\nmy %RESULT;\nmy $STAT_LINE;\n\n# ABI\nmy %ABI_Change;\n\n# Other\nmy %ArchiveFormats = (\n    \"TAR.GZ\"   => [\"tar.gz\", \"tgz\",\n                   \"tar.Z\", \"taz\"],\n\n    \"TAR.XZ\"   => [\"tar.xz\", \"txz\"],\n\n    \"TAR.BZ2\"  => [\"tar.bz2\", \"tbz2\",\n                   \"tbz\", \"tb2\"],\n\n    \"TAR.LZMA\" => [\"tar.lzma\",\n                   \"tlzma\"],\n\n    \"TAR.LZ\"   => [\"tar.lz\", \"tlz\"],\n\n    \"ZIP\"      => [\"zip\", \"zae\"],\n    \"TAR\"      => [\"tar\"],\n    \"LZMA\"     => [\"lzma\"],\n    \"GZ\"       => [\"gz\"],\n    \"XZ\"       => [\"xz\"],\n\n    \"JAR\"      => [\"jar\", \"war\",\n                   \"ear\", \"aar\"],\n    \"APK\"      => [\"apk\"]\n);\n\nmy $ARCHIVE_EXT = getArchivePattern();\n\nsub getModules()\n{\n    my $TOOL_DIR = getDirname($0);\n    if(not $TOOL_DIR) {\n        $TOOL_DIR = \".\";\n    }\n    my @SEARCH_DIRS = (\n        # tool's directory\n        abs_path($TOOL_DIR),\n        # relative path to modules\n        abs_path($TOOL_DIR).\"/../share/pkgdiff\",\n        # system directory\n        'MODULES_INSTALL_PATH'\n    );\n    foreach my $DIR (@SEARCH_DIRS)\n    {\n        if($DIR!~/\\A\\//)\n        { # relative path\n            $DIR = abs_path($TOOL_DIR).\"/\".$DIR;\n        }\n        if(-d $DIR.\"/modules\") {\n            return $DIR.\"/modules\";\n        }\n    }\n    exitStatus(\"Module_Error\", \"can't find modules\");\n}\n\nsub readModule($$)\n{\n    my ($Module, $Name) = @_;\n    my $Path = getModulePath($Module, $Name);\n    if(not -f $Path) {\n        exitStatus(\"Module_Error\", \"can't access \\'$Path\\'\");\n    }\n    return readFile($Path);\n}\n\nsub getModulePath($$)\n{\n    my ($Module, $Name) = @_;\n    return $MODULES_DIR.\"/Internals/$Module/\".$Name;\n}\n\nsub readBytes($)\n{ # ELF: 7f454c46\n    sysopen(FILE, $_[0], O_RDONLY);\n    sysread(FILE, my $Header, 4);\n    close(FILE);\n    my @Bytes = map { sprintf('%02x', ord($_)) } split (//, $Header);\n    return join(\"\", @Bytes);\n}\n\nsub readSymbols($)\n{\n    my $Path = $_[0];\n    \n    my %Symbols = ();\n    \n    open(LIB, \"readelf -WhlSsdA \\\"$Path\\\" 2>\\\"$TMP_DIR/null\\\" |\");\n    my $symtab = undef; # indicates that we are processing 'symtab' section of 'readelf' output\n    while(<LIB>)\n    {\n        if(defined $symtab)\n        { # do nothing with symtab\n            if(index($_, \"'.dynsym'\")!=-1)\n            { # dynamic table\n                $symtab = undef;\n            }\n        }\n        elsif(index($_, \"'.symtab'\")!=-1)\n        { # symbol table\n            $symtab = 1;\n        }\n        elsif(my @Info = readline_ELF($_))\n        {\n            my ($Bind, $Ndx, $Symbol) = ($Info[3], $Info[5], $Info[6]);\n            if($Ndx ne \"UND\"\n            and $Bind ne \"WEAK\")\n            { # only imported symbols\n                $Symbols{$Symbol} = 1;\n            }\n        }\n    }\n    close(LIB);\n    \n    return %Symbols;\n}\n\nmy %ELF_BIND = map {$_=>1} (\n    \"WEAK\",\n    \"GLOBAL\"\n);\n\nmy %ELF_TYPE = map {$_=>1} (\n    \"FUNC\",\n    \"IFUNC\",\n    \"OBJECT\",\n    \"COMMON\"\n);\n\nmy %ELF_VIS = map {$_=>1} (\n    \"DEFAULT\",\n    \"PROTECTED\"\n);\n\nsub readline_ELF($)\n{ # read the line of 'readelf' output corresponding to the symbol\n    my @Info = split(/\\s+/, $_[0]);\n    #  Num:   Value      Size Type   Bind   Vis       Ndx  Name\n    #  3629:  000b09c0   32   FUNC   GLOBAL DEFAULT   13   _ZNSt12__basic_fileIcED1Ev@@GLIBCXX_3.4\n    shift(@Info); # spaces\n    shift(@Info); # num\n    if($#Info!=6)\n    { # other lines\n        return ();\n    }\n    return () if(not defined $ELF_TYPE{$Info[2]});\n    return () if(not defined $ELF_BIND{$Info[3]});\n    return () if(not defined $ELF_VIS{$Info[4]});\n    if($Info[5] eq \"ABS\" and $Info[0]=~/\\A0+\\Z/)\n    { # 1272: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS CXXABI_1.3\n        return ();\n    }\n    if(index($Info[2], \"0x\") == 0)\n    { # size == 0x3d158\n        $Info[2] = hex($Info[2]);\n    }\n    return @Info;\n}\n\nsub compareSymbols($$)\n{\n    my ($P1, $P2) = @_;\n    \n    my %Symbols1 = readSymbols($P1);\n    my %Symbols2 = readSymbols($P2);\n    \n    my $Changed = 0;\n    \n    foreach my $Symbol (keys(%Symbols1))\n    {\n        if(not defined $Symbols2{$Symbol})\n        {\n            $Changed = 1;\n            if(defined $AddedSymbols{$Symbol})\n            { # moved\n                delete($AddedSymbols{$Symbol});\n            }\n            else\n            { # removed\n                $RemovedSymbols{$Symbol} = 1;\n            }\n        }\n    }\n    \n    foreach my $Symbol (keys(%Symbols2))\n    {\n        if(not defined $Symbols1{$Symbol})\n        {\n            $Changed = 1;\n            if(defined $RemovedSymbols{$Symbol})\n            { # moved\n                delete($RemovedSymbols{$Symbol})\n            }\n            else\n            { # added\n                $AddedSymbols{$Symbol} = 1;\n            }\n        }\n    }\n    \n    return $Changed;\n}\n\nsub compareFiles($$$$)\n{\n    my ($P1, $P2, $N1, $N2) = @_;\n    if(not -f $P1\n    or not -f $P2)\n    {\n        if(not -l $P1)\n        { # broken symlinks\n            return (0, \"\", \"\", 0, {});\n        }\n    }\n    my $Format = getFormat($P1);\n    if($Format ne getFormat($P2)) {\n        return (0, \"\", \"\", 0, {});\n    }\n    if(getSize($P1) == getSize($P2))\n    { # equal size\n        if(compare($P1, $P2)==0)\n        { # equal content\n            return (-1, \"\", \"\", 0, {});\n        }\n    }\n    if($QuickMode)\n    { # --quick\n        return (3, \"\", \"\", 1, {});\n    }\n    if(skipFileCompare($P1, 1))\n    { # <skip_files>\n        return (2, \"\", \"\", 1, {});\n    }\n    if(defined $SizeLimit)\n    {\n        if(getSize($P1) > $SizeLimit*1024\n        or getSize($P2) > $SizeLimit*1024)\n        {\n            return (2, \"\", \"\", 1, {});\n        }\n    }\n    my ($Changed, $DLink, $RLink, $Rate, $Adv) = (0, \"\", \"\", 0, {});\n    \n    if(not $ShowDetails)\n    {\n        if($Format eq \"SHARED_OBJECT\"\n        or $Format eq \"KERNEL_MODULE\"\n        or $Format eq \"DEBUG_INFO\")\n        {\n            if(not compareSymbols($P1, $P2))\n            { # equal sets of symbols\n                return (0, \"\", \"\", 0, {});\n            }\n        }\n    }\n    \n    if(defined $FormatInfo{$Format}{\"Format\"}\n    and $FormatInfo{$Format}{\"Format\"} eq \"Text\") {\n        ($DLink, $Rate) = diffFiles($P1, $P2, getRPath(\"diffs\", $N1));\n    }\n    elsif($Format eq \"LICENSE\"\n    or $Format eq \"CHANGELOG\"\n    or $Format eq \"README\"\n    or $Format eq \"INFORM\")\n    {\n        if($P1=~/\\.($ARCHIVE_EXT)\\Z/i)\n        { # changelog.Debian.gz\n            my $Page1 = showFile($P1, \"ARCHIVE\", 1);\n            my $Page2 = showFile($P2, \"ARCHIVE\", 2);\n            ($DLink, $Rate) = diffFiles($Page1, $Page2, getRPath(\"diffs\", $N1));\n            \n            # clean space\n            unlink($Page1);\n            unlink($Page2);\n        }\n        else\n        { \n            ($DLink, $Rate) = diffFiles($P1, $P2, getRPath(\"diffs\", $N1));\n        }\n    }\n    elsif($Format eq \"SHARED_OBJECT\"\n    or $Format eq \"KERNEL_MODULE\"\n    or $Format eq \"DEBUG_INFO\"\n    or $Format eq \"STATIC_LIBRARY\"\n    or $Format eq \"COMPILED_OBJECT\"\n    or $Format eq \"SHARED_LIBRARY\"\n    or $Format eq \"EXE\"\n    or $Format eq \"MANPAGE\"\n    or $Format eq \"INFODOC\"\n    or $Format eq \"SYMLINK\"\n    or $Format eq \"JAVA_CLASS\"\n    or $Format eq \"JAVASCRIPT\"\n    or $Format eq \"GETTEXT_MO\")\n    {\n        my $Page1 = showFile($P1, $Format, 1);\n        my $Page2 = showFile($P2, $Format, 2);\n        if($Format eq \"SYMLINK\")\n        {\n            if(readFile($Page1) eq readFile($Page2))\n            {\n                # clean space\n                unlink($Page1);\n                unlink($Page2);\n                \n                return (0, \"\", \"\", 0, {});\n            }\n        }\n        ($DLink, $Rate) = diffFiles($Page1, $Page2, getRPath(\"diffs\", $N1));\n        \n        # clean space\n        unlink($Page1);\n        unlink($Page2);\n    }\n    else\n    {\n        $Changed = 1;\n        $Rate = checkDiff($P1, $P2);\n    }\n    \n    if($DLink or $Changed)\n    {\n        if($ShowDetails)\n        { # --details\n            if($ACC and $ABI_DUMPER)\n            {\n                if($Format eq \"SHARED_OBJECT\"\n                or $Format eq \"KERNEL_MODULE\"\n                or $Format eq \"DEBUG_INFO\"\n                or $Format eq \"STATIC_LIBRARY\") {\n                    ($RLink, $Adv) = compareABIs($P1, $P2, $N1, $N2, getRPath(\"details\", $N1));\n                }\n            }\n        }\n        $DLink=~s/\\A\\Q$REPORT_DIR\\E\\///;\n        $RLink=~s/\\A\\Q$REPORT_DIR\\E\\///;\n        return (1, $DLink, $RLink, $Rate, $Adv);\n    }\n    \n    return (0, \"\", \"\", 0, {});\n}\n\nsub hexDump($)\n{\n    my $Path = $_[0];\n    my ($Hex, $Byte) = ();\n    open(FILE, \"<\", $Path);\n    while(my $Size = read(FILE, $Byte, 16*1024))\n    {\n        foreach my $Pos (0 .. $Size-1) {\n            $Hex .= sprintf('%02x', ord(substr($Byte, $Pos, 1))).\"\\n\";\n        }\n    }\n    close(FILE);\n    return $Hex;\n}\n\nsub checkDiff($$)\n{\n    my ($P1, $P2) = @_;\n    my $Size1 = getSize($P1);\n    if(not $Size1)\n    { # empty\n        return 1;\n    }\n    my $Size2 = getSize($P2);\n    my $Rate = abs($Size1 - $Size2)/$Size1;\n    my $AvgSize = ($Size1 + $Size2)/2;\n    if($AvgSize<$EXACT_DIFF_SIZE\n    and $Rate<$EXACT_DIFF_RATE)\n    {\n        my $TmpFile = $TMP_DIR.\"/null\";\n        if(-T $P1)\n        { # Text\n            my $TDiff = $TMP_DIR.\"/txtdiff\";\n            qx/diff -Bw \\\"$P1\\\" \\\"$P2\\\" >$TDiff 2>$TmpFile/;\n            $Rate = getRate($P1, $P2, $TDiff);\n            unlink($TDiff);\n        }\n        else\n        { # Binary\n            my $TDiff = $TMP_DIR.\"/txtdiff\";\n            my $T1 = $TMP_DIR.\"/tmp1.txt\";\n            my $T2 = $TMP_DIR.\"/tmp2.txt\";\n            writeFile($T1, hexDump($P1));\n            writeFile($T2, hexDump($P2));\n            qx/diff -Bw \\\"$T1\\\" \\\"$T2\\\" >$TDiff 2>$TmpFile/;\n            unlink($T1);\n            unlink($T2);\n            $Rate = getRate($P1, $P2, $TDiff);\n            unlink($TDiff);\n        }\n    }\n    if($Rate>1) {\n        $Rate=1;\n    }\n    return $Rate;\n}\n\nsub showFile($$$)\n{\n    my ($Path, $Format, $Version) = @_;\n    my ($Dir, $Name) = sepPath($Path);\n    \n    my $Cmd = undef;\n    \n    if($Format eq \"MANPAGE\")\n    {\n        $Name=~s/\\.(gz|bz2|xz)\\Z//;\n        $Cmd = \"man \\\"$Path\\\" 2>&1|col -bfx\";\n    }\n    elsif($Format eq \"INFODOC\")\n    {\n        $Name=~s/\\.(gz|bz2|xz)\\Z//;\n        $Path=~s/\\.(gz|bz2|xz)\\Z//;\n        $Cmd = \"info \\\"$Path\\\"\";\n    }\n    elsif($Format eq \"ARCHIVE\")\n    {\n        my $Unpack = $TMP_DIR.\"/unpack/\";\n        rmtree($Unpack);\n        unpackArchive($Path, $Unpack);\n        my @Contents = listDir($Unpack);\n        if($#Contents==0) {\n            $Cmd = \"cat \\\"$Unpack/\".$Contents[0].\"\\\"\";\n        }\n        else {\n            return undef;\n        }\n    }\n    elsif($Format eq \"SHARED_OBJECT\"\n    or $Format eq \"KERNEL_MODULE\"\n    or $Format eq \"DEBUG_INFO\"\n    or $Format eq \"EXE\"\n    or $Format eq \"COMPILED_OBJECT\"\n    or $Format eq \"STATIC_LIBRARY\")\n    {\n        $Cmd = \"readelf -Wa \\\"$Path\\\"\";\n    }\n    elsif($Format eq \"SHARED_LIBRARY\")\n    {\n        $Cmd = \"otool -TVL \\\"$Path\\\"\";\n    }\n    elsif($Format eq \"SYMLINK\")\n    {\n        $Cmd = \"file -b \\\"$Path\\\"\";\n    }\n    elsif($Format eq \"JAVA_CLASS\")\n    {\n        if(not checkCmd(\"javap\")) {\n            return undef;\n        }\n        $Name=~s/\\.class\\Z//;\n        $Name=~s/\\$/./;\n        $Path = $Name;\n        if ($CheckByteCode) {\n            if ($FullMethodDiffs) {\n                $Cmd = \"$JAVA_DUMP \\\"$Path\\\"\";\n            } else {\n                $Cmd = \"$JAVA_DUMP -s \\\"$Path\\\"\";\n            }\n        } else {\n            $Cmd = \"javap \\\"$Path\\\"\"; # -c -private -verbose\n        }\n        chdir($Dir);\n    }\n    elsif($Format eq \"JAVASCRIPT\")\n    {\n        if(not checkCmd(\"js-beautify\")) {\n            return undef;\n        }\n        $Cmd = \"js-beautify \\\"$Path\\\"\";\n    }\n    elsif($Format eq \"GETTEXT_MO\")\n    {\n        if(not checkCmd(\"msgunfmt\")) {\n            return undef;\n        }\n        $Cmd = \"msgunfmt \\\"$Path\\\"\";\n    }\n    else\n    { # error\n        return undef;\n    }\n    \n    my $SPath = $TMP_DIR.\"/fmt/\".$Format.\"/\".$Version.\"/\".$Name;\n    mkpath(getDirname($SPath));\n    \n    my $TmpFile = $TMP_DIR.\"/null\";\n    qx/$Cmd >\"$SPath\" 2>$TmpFile/;\n    \n    if($Format eq \"JAVA_CLASS\") {\n        chdir($ORIG_DIR);\n    }\n    \n    if($Format eq \"SHARED_OBJECT\"\n    or $Format eq \"KERNEL_MODULE\"\n    or $Format eq \"DEBUG_INFO\"\n    or $Format eq \"EXE\"\n    or $Format eq \"COMPILED_OBJECT\"\n    or $Format eq \"STATIC_LIBRARY\")\n    {\n        my $Content = readFile($SPath);\n        # 00bf608c  00000008 R_386_RELATIVE\n        # 00bf608c  00000008 R_386_NONE\n        $Content=~s/[0-9a-f]{8}\\s+[0-9a-f]{8}\\s+R_386_(RELATIVE|NONE)\\s*//g;\n        # 0000000000210028  0000000000000008 R_X86_64_RELATIVE 0000000000210028\n        $Content=~s/[0-9a-f]{16}\\s+[0-9a-f]{16}\\s+R_X86_64_RELATIVE\\s+[0-9a-f]{16}\\s*//g;\n        # 00be77ec  0001d507 R_386_JUMP_SLOT        00000000   dlclose\n        # 0000000000210348  0000001800000007 R_X86_64_JUMP_SLOT     0000000000000000 mq_receive + 0\n        $Content=~s/\\n([0-9a-f]{8}|[0-9a-f]{16})\\s+([0-9a-f]{8}|[0-9a-f]{16}) /\\nXXX YYY /g;\n        $Content=~s/    [0-9a-f]{16} / ZZZ /g;\n        # 563: 00000000     0 FUNC    GLOBAL DEFAULT  UND FT_New_Face\n        # 17: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sem_trywait@GLIBC_2.2.5 (2)\n        $Content=~s/\\n\\s*\\d+:(\\s+[0-9a-f]{8}|\\s+[0-9a-f]{16})\\s+\\d+\\s+/\\nN: XXX W /g;\n        $Content=~s/\\Q$Dir\\E\\///g;\n        # Build ID: 88a916b3973e1a27b027706385af41c553a94061\n        $Content=~s/\\s+Build ID: \\w+\\s+//g;\n        writeFile($SPath, uniqStr($Content));\n    }\n    \n    return $SPath;\n}\n\nsub uniqStr($)\n{\n    my $Str = $_[0];\n    my ($Prev, $Res) = (\"\", \"\");\n    foreach my $Line (split(/\\n/, $Str))\n    {\n        if($Line ne $Prev)\n        {\n            $Prev = $Line;\n            $Res .= $Line.\"\\n\";\n        }\n    }\n    return $Res;\n}\n\nsub getRPath($$)\n{\n    my ($Prefix, $N) = @_;\n    $N=~s/\\A\\///g;\n    my $RelPath = $Prefix.\"/\".$N.\"-diff.html\";\n    my $Path = $REPORT_DIR.\"/\".$RelPath;\n    return $Path;\n}\n\nsub compareABIs($$$$$)\n{\n    my ($P1, $P2, $N1, $N2, $Path) = @_;\n    \n    my $Sect = `readelf -S \\\"$P1\\\" 2>\\\"$TMP_DIR/error\\\"`;\n    my $Name = getFilename($P1);\n    \n    if($Sect!~/\\.debug_info/)\n    { # No DWARF info\n        printMsg(\"WARNING\", \"No debug info in \".$Name);\n        return (\"\", {});\n    }\n    \n    mkpath(getDirname($Path));\n    my $Adv = {};\n    \n    $Name=~s/\\.debug\\Z//;\n    printMsg(\"INFO\", \"Compare ABIs of \".$Name.\" (\".showNumber(getSize($P1)/1048576).\"M) ...\");\n    \n    $N1=~s/\\A\\///;\n    $N2=~s/\\A\\///;\n    \n    my $Cmd = undef;\n    my $Ret = undef;\n    \n    my $D1 = $REPORT_DIR.\"/abi_dumps/\".$Group{\"V1\"}.\"/\".$N1.\"-ABI.dump\";\n    my $D2 = $REPORT_DIR.\"/abi_dumps/\".$Group{\"V2\"}.\"/\".$N2.\"-ABI.dump\";\n    \n    $Adv->{\"ABIDump\"}{1} = $D1;\n    $Adv->{\"ABIDump\"}{2} = $D2;\n    \n    $Adv->{\"ABIDump\"}{1}=~s/\\A\\Q$REPORT_DIR\\E\\///;\n    $Adv->{\"ABIDump\"}{2}=~s/\\A\\Q$REPORT_DIR\\E\\///;\n    \n    $Cmd = $ABI_DUMPER.\" \\\"$P1\\\" -lver \\\"\".$Group{\"V1\"}.\"\\\" -o \\\"$D1\\\" -sort\";\n    if($Debug)\n    {\n        $Cmd .= \" -extra-info \\\"$TMP_DIR/extra-info\\\"\";\n        printMsg(\"INFO\", \"Running $Cmd\");\n    }\n    system($Cmd.\" >\\\"$TMP_DIR/output\\\"\");\n    $Ret = $?>>8;\n    if($Ret!=0)\n    { # error\n        printMsg(\"ERROR\", \"Failed to run ABI Dumper ($Ret)\");\n        return (\"\", {});\n    }\n    \n    if($Debug)\n    {\n        my $DP = $REPORT_DIR.\"/dwarf_dumps/\".$Group{\"V1\"}.\"/\".$N1.\"-DWARF.dump\";\n        mkpath(getDirname($DP));\n        move(\"$TMP_DIR/extra-info/debug_info\", $DP);\n        \n        $Adv->{\"DWARFDump\"}{1} = $DP;\n        $Adv->{\"DWARFDump\"}{1}=~s/\\A\\Q$REPORT_DIR\\E\\///;\n    }\n    \n    $Cmd = $ABI_DUMPER.\" \\\"$P2\\\" -lver \\\"\".$Group{\"V2\"}.\"\\\" -o \\\"$D2\\\" -sort\";\n    if($Debug)\n    {\n        $Cmd .= \" -extra-info \\\"$TMP_DIR/extra-info\\\"\";\n        printMsg(\"INFO\", \"Running $Cmd\");\n    }\n    system($Cmd.\" >\\\"$TMP_DIR/output\\\"\");\n    $Ret = $?>>8;\n    if($Ret!=0)\n    { # error\n        printMsg(\"ERROR\", \"Failed to run ABI Dumper ($Ret)\");\n        return (\"\", {});\n    }\n    \n    if($Debug)\n    {\n        my $DP = $REPORT_DIR.\"/dwarf_dumps/\".$Group{\"V2\"}.\"/\".$N2.\"-DWARF.dump\";\n        mkpath(getDirname($DP));\n        move(\"$TMP_DIR/extra-info/debug_info\", $DP);\n        \n        $Adv->{\"DWARFDump\"}{2} = $DP;\n        $Adv->{\"DWARFDump\"}{2}=~s/\\A\\Q$REPORT_DIR\\E\\///;\n    }\n    \n    # clean space\n    rmtree(\"$TMP_DIR/extra-info\");\n    \n    $Cmd = $ACC.\" -d1 \\\"$D1\\\" -d2 \\\"$D2\\\"\";\n    \n    $Cmd .= \" -l \\\"\".$Name.\"\\\"\";\n    \n    $Cmd .= \" --report-path=\\\"$Path\\\"\";\n    $Cmd .= \" -quiet\";\n    \n    if($Debug) {\n        printMsg(\"INFO\", \"Running $Cmd\");\n    }\n    system($Cmd);\n    $Ret = $?>>8;\n    if($Ret!=0 and $Ret!=1)\n    { # error\n        printMsg(\"ERROR\", \"Failed to run ABI Compliance Checker ($Ret)\");\n        return (\"\", {});\n    }\n    \n    my ($Bin, $Src) = (0, 0);\n    if(my $Meta = readFilePart($Path, 2))\n    {\n        my @Info = split(/\\n/, $Meta);\n        if($Info[0]=~/affected:([\\d\\.]+)/) {\n            $Bin = $1;\n        }\n        if($Info[1]=~/affected:([\\d\\.]+)/) {\n            $Src = $1;\n        }\n    }\n    \n    $ABI_Change{\"Bin\"} += $Bin;\n    $ABI_Change{\"Src\"} += $Src;\n    $ABI_Change{\"Total\"} += 1;\n    \n    return ($Path, $Adv);\n}\n\nsub checkModule($)\n{\n    foreach my $P (@INC)\n    {\n        if(-e $P.\"/\".$_[0])\n        {\n            return 1;\n        }\n    }\n    \n    return 0;\n}\n\nsub getSize($)\n{\n    my $Path = $_[0];\n    if(not $Path) {\n        return 0;\n    }\n    if($Cache{\"getSize\"}{$Path}) {\n        return $Cache{\"getSize\"}{$Path};\n    }\n    if(-l $Path)\n    { # symlinks\n        return ($Cache{\"getSize\"}{$Path} = length(getType($Path)));\n    }\n    return ($Cache{\"getSize\"}{$Path} = -s $Path);\n}\n\nsub diffFiles($$$)\n{\n    my ($P1, $P2, $Path) = @_;\n    \n    if(not $P1 or not $P2) {\n        return ();\n    }\n    \n    mkpath(getDirname($Path));\n    \n    my $TmpPath = $TMP_DIR.\"/diff\";\n    unlink($TmpPath);\n    \n    my $Cmd = \"sh $DIFF --width $DiffWidth --stdout\";\n    $Cmd .= \" --tmpdiff \\\"$TmpPath\\\" --prelines $DiffLines\";\n    \n    if($IgnoreSpaceChange) {\n        $Cmd .= \" --ignore-space-change\";\n    }\n    if($IgnoreAllSpace) {\n        $Cmd .= \" --ignore-all-space\";\n    }\n    if($IgnoreBlankLines) {\n        $Cmd .= \" --ignore-blank-lines\";\n    }\n    if($Minimal)\n    { # diff --minimal\n        $Cmd .= \" --minimal\";\n    }\n    if($NoWdiff) {\n        $Cmd .= \" --nowdiff\";\n    }\n    \n    $Cmd .= \" \\\"\".$P1.\"\\\" \\\"\".$P2.\"\\\" >\\\"\".$Path.\"\\\" 2>$TMP_DIR/null\";\n    $Cmd=~s/\\$/\\\\\\$/g;\n    \n    qx/$Cmd/;\n    \n    if(getSize($Path)<3500)\n    { # may be identical\n        if(readFilePart($Path, 2)=~/The files are identical/i)\n        {\n            unlink($Path);\n            return ();\n        }\n    }\n    \n    if(getSize($Path)<3100)\n    { # may be identical or non-text\n        if(index(readFile($Path), \"No changes\")!=-1)\n        {\n            unlink($Path);\n            return ();\n        }\n    }\n    \n    my $Rate = getRate($P1, $P2, $TmpPath);\n    \n    # clean space\n    unlink($TmpPath);\n    \n    return ($Path, $Rate);\n}\n\nsub getRate($$$)\n{\n    my ($P1, $P2, $PatchPath) = @_;\n    \n    my $Size1 = getSize($P1);\n    if(not $Size1) {\n        return 1;\n    }\n    \n    my $Size2 = getSize($P2);\n    \n    my $Rate = 1;\n    # count removed/changed bytes\n    my $Patch = readFile($PatchPath);\n    $Patch=~s/(\\A|\\n)([^\\-]|[\\+]{3}|[\\-]{3}).*//g;\n    $Rate = length($Patch);\n    # count added bytes\n    if($Size2>$Size1) {\n        $Rate += $Size2-$Size1;\n    }\n    $Rate /= $Size1;\n    if($Rate>1) {\n        $Rate=1;\n    }\n    return $Rate;\n}\n\nsub readFilePart($$)\n{\n    my ($Path, $Num) = @_;\n    \n    open (FILE, $Path);\n    my $Lines = \"\";\n    foreach (1 ... $Num) {\n        $Lines .= <FILE>;\n    }\n    close(FILE);\n    \n    return $Lines;\n}\n\nsub getType($)\n{\n    my $Path = $_[0];\n    \n    if($Cache{\"getType\"}{$Path}) {\n        return $Cache{\"getType\"}{$Path};\n    }\n    \n    if($USE_LIBMAGIC)\n    {\n        my $Magic = File::LibMagic->new();\n        return ($Cache{\"getType\"}{$Path} = $Magic->describe_filename($Path));\n    }\n    \n    return ($Cache{\"getType\"}{$Path} = qx/file -b \\\"$Path\\\"/);\n}\n\nsub isRenamed($$$)\n{\n    my ($P1, $P2, $Match) = @_;\n    my ($D1, $N1) = sepPath($P1);\n    my ($D2, $N2) = sepPath($P2);\n    if($D1 ne $D2) {\n        return 0;\n    }\n    if($N1 eq $N2) {\n        return 0;\n    }\n    my $L1 = length($N1);\n    my $L2 = length($N2);\n    if($L1<=8)\n    { # too short names\n        if($N1=~/\\.(\\w+)\\Z/)\n        { # with equal extensions\n            my $E = $1;\n            if($N2=~s/\\.\\Q$E\\E\\Z//g)\n            { # compare without extensions\n                $N1=~s/\\.\\Q$E\\E\\Z//g;\n            }\n        }\n    }\n    my $HL = ($L1+$L2)*$RENAME_FILE_MATCH/$Match;\n    return (getBaseLen($N1, $N2)>=$HL);\n}\n\nsub minNum($$)\n{\n    if($_[0]<$_[1]) {\n        return $_[0];\n    }\n    \n    return $_[1];\n}\n\nsub getDepth($) {\n    return ($_[0]=~tr![\\/]!!);\n}\n\nsub getBaseLen($$)\n{\n    my ($Str1, $Str2) = @_;\n    \n    if(defined $Cache{\"getBaseLen\"}{$Str1}{$Str2}) {\n        return $Cache{\"getBaseLen\"}{$Str1}{$Str2};\n    }\n    \n    if($Str1 eq $Str2) {\n        return length($Str1);\n    }\n    \n    my $BLen = 0;\n    my $Len1 = length($Str1);\n    my $Len2 = length($Str2);\n    my $Min = minNum($Len1, $Len2) - 1;\n    \n    foreach my $Pos (0 .. $Min)\n    {\n        my $S1 = substr($Str1, $Pos, 1);\n        my $S2 = substr($Str2, $Pos, 1);\n        if($S1 eq $S2) {\n            $BLen+=1;\n        }\n        else {\n            last;\n        }\n    }\n    \n    foreach my $Pos (0 .. $Min)\n    {\n        my $S1 = substr($Str1, $Len1-$Pos-1, 1);\n        my $S2 = substr($Str2, $Len2-$Pos-1, 1);\n        if($S1 eq $S2) {\n            $BLen+=1;\n        }\n        else {\n            last;\n        }\n    }\n    \n    return ($Cache{\"getBaseLen\"}{$Str1}{$Str2}=$BLen);\n}\n\nsub isMoved($$)\n{\n    my ($P1, $P2) = @_;\n    my ($D1, $N1) = sepPath($P1);\n    my ($D2, $N2) = sepPath($P2);\n    if($N1 eq $N2\n    and $D1 ne $D2) {\n        return 1;\n    }\n    return 0;\n}\n\nsub writeExtraInfo()\n{\n    my $FILES = \"\";\n    \n    $FILES .= \"<rate>\\n    \".$RESULT{\"affected\"}.\"\\n</rate>\\n\\n\";\n    \n    if(my @Added = sort {lc($a) cmp lc($b)} keys(%AddedFiles)) {\n        $FILES .= \"<added>\\n    \".join(\"\\n    \", @Added).\"\\n</added>\\n\\n\";\n    }\n    if(my @Removed = sort {lc($a) cmp lc($b)} keys(%RemovedFiles)) {\n        $FILES .= \"<removed>\\n    \".join(\"\\n    \", @Removed).\"\\n</removed>\\n\\n\";\n    }\n    if(my @Moved = sort {lc($a) cmp lc($b)} keys(%MovedFiles))\n    {\n        $FILES .= \"<moved>\\n\";\n        foreach (@Moved) {\n            $FILES .= \"    \".$_.\";\".$MovedFiles{$_}.\";\".showNumber($ChangeRate{$_}*100).\"\\n\";\n        }\n        $FILES .= \"</moved>\\n\\n\";\n    }\n    if(my @Renamed = sort {lc($a) cmp lc($b)} keys(%RenamedFiles))\n    {\n        $FILES .= \"<renamed>\\n\";\n        foreach (@Renamed) {\n            $FILES .= \"    \".$_.\";\".$RenamedFiles{$_}.\";\".showNumber($ChangeRate{$_}*100).\"\\n\";\n        }\n        $FILES .= \"</renamed>\\n\\n\";\n    }\n    if(my @Changed = sort {lc($a) cmp lc($b)} keys(%ChangedFiles))\n    {\n        foreach (0 .. $#Changed) {\n            $Changed[$_] .= \";\".showNumber($ChangeRate{$Changed[$_]}*100);\n        }\n        \n        $FILES .= \"<changed>\\n    \".join(\"\\n    \", @Changed).\"\\n</changed>\\n\\n\";\n    }\n    if ($TrackUnchanged) {\n        if(my @Unchanged = sort {lc($a) cmp lc($b)} keys(%UnchangedFiles))\n        {\n            $FILES .= \"<unchanged>\\n    \".join(\"\\n    \", @Unchanged).\"\\n</unchanged>\\n\\n\";\n        }\n    }\n    writeFile($ExtraInfo.\"/files.xml\", $FILES);\n    \n    my $SYMBOLS = \"\";\n    if(my @AddedSymbols = sort {lc($a) cmp lc($b)} keys(%AddedSymbols)) {\n        $SYMBOLS .= \"<added>\\n    \".join(\"\\n    \", @AddedSymbols).\"\\n</added>\\n\\n\";\n    }\n    if(my @RemovedSymbols = sort {lc($a) cmp lc($b)} keys(%RemovedSymbols)) {\n        $SYMBOLS .= \"<removed>\\n    \".join(\"\\n    \", @RemovedSymbols).\"\\n</removed>\\n\\n\";\n    }\n    writeFile($ExtraInfo.\"/symbols.xml\", $SYMBOLS);\n}\n\nsub skipFile($)\n{\n    my $Name = $_[0];\n    \n    if(defined $SkipPattern)\n    {\n        if($Name=~/($SkipPattern)/)\n        {\n            printMsg(\"INFO\", \"skipping (pattern match) \".$Name);\n            return 1;\n        }\n    }\n    \n    return 0;\n}\n\nsub detectChanges()\n{\n    foreach my $E (\"info-diffs\", \"diffs\") {\n        mkpath($REPORT_DIR.\"/\".$E);\n    }\n\n    if($ShowDetails) {\n        mkpath($REPORT_DIR.\"/details\");\n    }\n    \n    foreach my $Format (keys(%FormatInfo))\n    {\n        %{$FileChanges{$Format}} = (\n            \"Total\"=>0,\n            \"Added\"=>0,\n            \"Removed\"=>0,\n            \"Changed\"=>0,\n            \"Size\"=>0,\n            \"SizeDelta\"=>0\n        );\n    }\n    \n    my (%AddedByDir, %RemovedByDir, %AddedByName,\n    %RemovedByName, %AddedByPrefix, %RemovedByPrefix) = ();\n    \n    foreach my $Name (sort keys(%{$PackageFiles{1}}))\n    { # checking old files\n        my $Format = getFormat($PackageFiles{1}{$Name});\n        if(not defined $PackageFiles{2}{$Name})\n        { # removed files\n            $RemovedFiles{$Name} = 1;\n            $RemovedByDir{getDirname($Name)}{$Name} = 1;\n            $RemovedByName{getFilename($Name)}{$Name} = 1;\n            foreach (getPrefixes($Name, $MOVE_DEPTH)) {\n                $RemovedByPrefix{$_}{$Name} = 1;\n            }\n        }\n        else {\n            $StableFiles{$Name} = 1;\n        }\n    }\n    \n    foreach my $Name (keys(%{$PackageFiles{2}}))\n    { # checking new files\n        my $Format = getFormat($PackageFiles{2}{$Name});\n        if(not defined $PackageFiles{1}{$Name})\n        { # added files\n            $AddedFiles{$Name} = 1;\n            $AddedByDir{getDirname($Name)}{$Name} = 1;\n            $AddedByName{getFilename($Name)}{$Name} = 1;\n            foreach (getPrefixes($Name, $MOVE_DEPTH)) {\n                $AddedByPrefix{$_}{$Name} = 1;\n            }\n        }\n    }\n    \n    foreach my $Name (sort keys(%RemovedFiles))\n    { # checking removed files\n        my $Path = $PackageFiles{1}{$Name};\n        my $Format = getFormat($Path);\n        $FileChanges{$Format}{\"Total\"} += 1;\n        $FileChanges{$Format}{\"Removed\"} += 1;\n        if(my $Size = getSize($Path))\n        {\n            $FileChanges{$Format}{\"SizeDelta\"} += $Size;\n            $FileChanges{$Format}{\"Size\"} += $Size;\n        }\n        $FileChanges{$Format}{\"Details\"}{$Name}{\"Status\"} = \"removed\";\n    }\n    \n    foreach my $Name (sort {getDepth($b)<=>getDepth($a)} sort keys(%RemovedFiles))\n    { # checking moved files\n        my $Format = getFormat($PackageFiles{1}{$Name});\n        \n        my $FileName = getFilename($Name);\n        my @Removed = keys(%{$RemovedByName{$FileName}});\n        my @Added = keys(%{$AddedByName{$FileName}});\n        \n        my @Removed = grep {not defined $MovedFiles{$_}} @Removed;\n        my @Added = grep {not defined $MovedFiles_R{$_}} @Added;\n        \n        if($#Added!=0 or $#Removed!=0)\n        {\n            my $Found = 0;\n            foreach my $Prefix (getPrefixes($Name, $MOVE_DEPTH))\n            {\n                my @RemovedPrefix = keys(%{$RemovedByPrefix{$Prefix}});\n                my @AddedPrefix = keys(%{$AddedByPrefix{$Prefix}});\n                \n                my @RemovedPrefix = grep {not defined $MovedFiles{$_}} @RemovedPrefix;\n                my @AddedPrefix = grep {not defined $MovedFiles_R{$_}} @AddedPrefix;\n                \n                if($#AddedPrefix==0 and $#RemovedPrefix==0)\n                {\n                    @Added = @AddedPrefix;\n                    $Found = 1;\n                }\n                \n            }\n            if(not $Found) {\n                next;\n            }\n        }\n        \n        foreach my $File (@Added)\n        {\n            if($Format ne getFormat($PackageFiles{2}{$File}))\n            { # different formats\n                next;\n            }\n            if(defined $MovedFiles_R{$File}) {\n                next;\n            }\n            if(isMoved($Name, $File))\n            {\n                $MovedFiles{$Name} = $File;\n                $MovedFiles_R{$File} = $Name;\n                last;\n            }\n        }\n    }\n    \n    foreach my $Name (sort keys(%RemovedFiles))\n    { # checking renamed files\n        if(defined $MovedFiles{$Name})\n        { # moved\n            next;\n        }\n        my $Format = getFormat($PackageFiles{1}{$Name});\n        my @Removed = keys(%{$RemovedByDir{getDirname($Name)}});\n        my @Added = keys(%{$AddedByDir{getDirname($Name)}});\n        my $Match = 2;\n        if($#Removed==0 and $#Added==0) {\n            $Match *= 2;\n        }\n        my $FName = getFilename($Name);\n        my $Len = length($FName);\n        foreach my $File (sort {getBaseLen($FName, getFilename($b)) <=> getBaseLen($FName, getFilename($a))}\n        sort { abs(length(getFilename($a))-$Len) <=> abs(length(getFilename($b))-$Len) } @Added)\n        {\n            if($Format ne getFormat($PackageFiles{2}{$File}))\n            { # different formats\n                next;\n            }\n            if(defined $RenamedFiles_R{$File}\n            or defined $MovedFiles_R{$File})\n            { # renamed or moved\n                next;\n            }\n            if(isRenamed($Name, $File, $Match))\n            {\n                $RenamedFiles{$Name} = $File;\n                $RenamedFiles_R{$File} = $Name;\n                last;\n            }\n        }\n    }\n    \n    foreach my $Name (sort (keys(%StableFiles), keys(%RenamedFiles), keys(%MovedFiles)))\n    { # checking files\n        my $Path = $PackageFiles{1}{$Name};\n        my $Size = getSize($Path);\n        if($Debug) {\n            printMsg(\"INFO\", $Name);\n        }\n        my ($NewPath, $NewName) = ($PackageFiles{2}{$Name}, $Name);\n        my $Format = getFormat($Path);\n        if($StableFiles{$Name})\n        { # stable files\n            $FileChanges{$Format}{\"Total\"} += 1;\n            $FileChanges{$Format}{\"Size\"} += $Size;\n        }\n        elsif($NewName = $RenamedFiles{$Name})\n        { # renamed files\n            $NewPath = $PackageFiles{2}{$NewName};\n        }\n        elsif($NewName = $MovedFiles{$Name})\n        { # moved files\n            $NewPath = $PackageFiles{2}{$NewName};\n        }\n        \n        my ($Changed, $DLink, $RLink, $Rate, $Adv) = compareFiles($Path, $NewPath, $Name, $NewName);\n        my %Details = %{$Adv};\n        \n        if($Changed==1 or $Changed==3)\n        {\n            if($NewName eq $Name)\n            { # renamed and moved files should\n              # not be shown in the summary\n                $FileChanges{$Format}{\"Changed\"} += 1;\n                $FileChanges{$Format}{\"Rate\"} += $Rate;\n                $FileChanges{$Format}{\"SizeDelta\"} += $Size*$Rate;\n            }\n            $Details{\"Status\"} = \"changed\";\n            if($Changed==1)\n            {\n                $Details{\"Rate\"} = $Rate;\n                $Details{\"Diff\"} = $DLink;\n                $Details{\"Report\"} = $RLink;\n                $ChangeRate{$Name} = $Rate;\n            }\n            \n            $ChangedFiles{$Name} = 1;\n        }\n        elsif($Changed==2)\n        {\n            $Details{\"Status\"} = \"changed\";\n            $Details{\"Skipped\"} = 1;\n        }\n        elsif($Changed==-1)\n        {\n            $Details{\"Status\"} = \"unchanged\";\n            $Details{\"Empty\"} = 1;\n            $Details{\"Rate\"} = 0;\n            $UnchangedFiles{$Name} = 1;\n        }\n        else\n        {\n            $Details{\"Status\"} = \"unchanged\";\n            $Details{\"Rate\"} = 0;\n            $UnchangedFiles{$Name} = 1;\n        }\n        if($NewName = $RenamedFiles{$Name})\n        { # renamed files\n            if($Rate<$RENAME_CONTENT_MATCH) {\n                $Details{\"Status\"} = \"renamed\";\n            }\n            else\n            {\n                %Details = (\n                    \"Status\"=>\"removed\"\n                );\n                delete($RenamedFiles_R{$RenamedFiles{$Name}});\n                delete($RenamedFiles{$Name});\n                delete($ChangedFiles{$Name});\n                unlink($REPORT_DIR.\"/\".$DLink);\n            }\n        }\n        elsif($NewName = $MovedFiles{$Name})\n        { # moved files\n            if($Rate<$MOVE_CONTENT_MATCH) {\n                $Details{\"Status\"} = \"moved\";\n            }\n            else\n            {\n                %Details = (\n                    \"Status\"=>\"removed\"\n                );\n                delete($MovedFiles_R{$MovedFiles{$Name}});\n                delete($MovedFiles{$Name});\n                delete($ChangedFiles{$Name});\n                unlink($REPORT_DIR.\"/\".$DLink);\n            }\n        }\n        %{$FileChanges{$Format}{\"Details\"}{$Name}} = %Details;\n    }\n    \n    foreach my $Name (keys(%AddedFiles))\n    { # checking added files\n        my $Path = $PackageFiles{2}{$Name};\n        my $Format = getFormat($Path);\n        $FileChanges{$Format}{\"Total\"} += 1;\n        $FileChanges{$Format}{\"Added\"} += 1;\n        if(my $Size = getSize($Path))\n        {\n            $FileChanges{$Format}{\"SizeDelta\"} += $Size;\n            $FileChanges{$Format}{\"Size\"} += $Size;\n        }\n        $FileChanges{$Format}{\"Details\"}{$Name}{\"Status\"} = \"added\";\n    }\n\n    # Deps\n    foreach my $Kind (keys(%{$PackageDeps{1}}))\n    { # removed/changed deps\n        %{$DepChanges{$Kind}} = (\n            \"Added\"=>0,\n            \"Removed\"=>0,\n            \"Changed\"=>0,\n            \"Total\"=>0,\n            \"Size\"=>0,\n            \"SizeDelta\"=>0\n        );\n        \n        foreach my $Name (keys(%{$PackageDeps{1}{$Kind}}))\n        {\n            my $Size = length($Name);\n            $DepChanges{$Kind}{\"Total\"} += 1;\n            $DepChanges{$Kind}{\"Size\"} += $Size;\n            \n            if(not defined($PackageDeps{2}{$Kind})\n            or not defined($PackageDeps{2}{$Kind}{$Name}))\n            { # removed deps\n                $DepChanges{$Kind}{\"Details\"}{$Name}{\"Status\"} = \"removed\";\n                $DepChanges{$Kind}{\"Removed\"} += 1;\n                $DepChanges{$Kind}{\"SizeDelta\"} += $Size;\n                next;\n            }\n            \n            my %Info1 = %{$PackageDeps{1}{$Kind}{$Name}};\n            my %Info2 = %{$PackageDeps{2}{$Kind}{$Name}};\n            if($Info1{\"Op\"} and $Info1{\"V\"}\n            and ($Info1{\"Op\"} ne $Info2{\"Op\"} or $Info1{\"V\"} ne $Info2{\"V\"}))\n            {\n                $DepChanges{$Kind}{\"Details\"}{$Name}{\"Status\"} = \"changed\";\n                $DepChanges{$Kind}{\"Changed\"} += 1;\n                $DepChanges{$Kind}{\"SizeDelta\"} += $Size;\n            }\n            else {\n                $DepChanges{$Kind}{\"Details\"}{$Name}{\"Status\"} = \"unchanged\";\n            }\n        }\n    }\n    \n    foreach my $Kind (keys(%{$PackageDeps{2}}))\n    { # added deps\n        foreach my $Name (keys(%{$PackageDeps{2}{$Kind}}))\n        {\n            if(not defined($PackageDeps{1}{$Kind})\n            or not defined($PackageDeps{1}{$Kind}{$Name}))\n            {\n                $DepChanges{$Kind}{\"Total\"} += 1;\n                $DepChanges{$Kind}{\"Details\"}{$Name}{\"Status\"} = \"added\";\n                $DepChanges{$Kind}{\"Added\"} += 1;\n                if(my $Size = length($Name))\n                {\n                    $DepChanges{$Kind}{\"Size\"} += $Size;\n                    $DepChanges{$Kind}{\"SizeDelta\"} += $Size;\n                }\n            }\n        }\n    }\n    \n    # Info\n    %InfoChanges = (\n        \"Added\"=>0,\n        \"Removed\"=>0,\n        \"Changed\"=>0,\n        \"Total\"=>0,\n        \"Size\"=>0,\n        \"SizeDelta\"=>0\n    );\n    \n    my $OldPkgs = keys(%{$TargetPackages{1}});\n    my $NewPkgs = keys(%{$TargetPackages{2}});\n    \n    if(keys(%PackageInfo)==2\n    and $OldPkgs==1\n    and $NewPkgs==1)\n    { # renamed?\n        my @Names = keys(%PackageInfo);\n        my $N1 = $Names[0];\n        my $N2 = $Names[1];\n        \n        if(defined $PackageInfo{$N1}{\"V2\"})\n        {\n            $PackageInfo{$N2}{\"V2\"} = $PackageInfo{$N1}{\"V2\"};\n            delete($PackageInfo{$N1});\n        }\n        elsif(defined $PackageInfo{$N2}{\"V2\"})\n        {\n            $PackageInfo{$N1}{\"V2\"} = $PackageInfo{$N2}{\"V2\"};\n            delete($PackageInfo{$N2});\n        }\n    }\n    \n    foreach my $Package (sort keys(%PackageInfo))\n    {\n        my $Old = $PackageInfo{$Package}{\"V1\"};\n        my $New = $PackageInfo{$Package}{\"V2\"};\n        \n        my $OldSize = length($Old);\n        my $NewSize = length($New);\n        \n        $InfoChanges{\"Total\"} += 1;\n        if($Old and not $New)\n        {\n            $InfoChanges{\"Details\"}{$Package}{\"Status\"} = \"removed\";\n            $InfoChanges{\"Removed\"} += 1;\n            $InfoChanges{\"Size\"} += $OldSize;\n            $InfoChanges{\"SizeDelta\"} += $OldSize;\n        }\n        elsif(not $Old and $New)\n        {\n            $InfoChanges{\"Details\"}{$Package}{\"Status\"} = \"added\";\n            $InfoChanges{\"Added\"} += 1;\n            $InfoChanges{\"Size\"} += $NewSize;\n            $InfoChanges{\"SizeDelta\"} += $NewSize;\n        }\n        elsif($Old ne $New)\n        {\n            my $P1 = $TMP_DIR.\"/1/\".$Package.\"-info\";\n            my $P2 = $TMP_DIR.\"/2/\".$Package.\"-info\";\n            \n            writeFile($P1, $Old);\n            writeFile($P2, $New);\n            \n            my ($DLink, $Rate) = diffFiles($P1, $P2, getRPath(\"info-diffs\", $Package.\"-info\"));\n            \n            # clean space\n            rmtree($TMP_DIR.\"/1/\");\n            rmtree($TMP_DIR.\"/2/\");\n            \n            $DLink =~s/\\A\\Q$REPORT_DIR\\E\\///;\n            \n            my %Details = ();\n            $Details{\"Status\"} = \"changed\";\n            $Details{\"Rate\"} = $Rate;\n            $Details{\"Diff\"} = $DLink;\n            \n            %{$InfoChanges{\"Details\"}{$Package}} = %Details;\n            $InfoChanges{\"Changed\"} += 1;\n            $InfoChanges{\"Rate\"} += $Rate;\n            $InfoChanges{\"Size\"} += $OldSize;\n            $InfoChanges{\"SizeDelta\"} += $OldSize*$Rate;\n        }\n        else\n        {\n            $InfoChanges{\"Details\"}{$Package}{\"Status\"} = \"unchanged\";\n            $InfoChanges{\"Size\"} += $OldSize;\n            $InfoChanges{\"SizeDelta\"} += $OldSize;\n        }\n    }\n    \n    $STAT_LINE .= \"added:\".keys(%AddedFiles).\";\";\n    $STAT_LINE .= \"removed:\".keys(%RemovedFiles).\";\";\n    $STAT_LINE .= \"moved:\".keys(%MovedFiles).\";\";\n    $STAT_LINE .= \"renamed:\".keys(%RenamedFiles).\";\";\n    $STAT_LINE .= \"changed:\".keys(%ChangedFiles).\";\";\n    $STAT_LINE .= \"unchanged:\".keys(%UnchangedFiles).\";\";\n}\n\nsub htmlSpecChars($)\n{\n    my $Str = $_[0];\n    $Str=~s/\\&([^#])/&amp;$1/g;\n    $Str=~s/</&lt;/g;\n    $Str=~s/>/&gt;/g;\n    $Str=~s/\\\"/&quot;/g;\n    $Str=~s/\\'/&#39;/g;\n    return $Str;\n}\n\nsub getReportUsage()\n{\n    if(not keys(%PackageUsage)) {\n        return \"\";\n    }\n    \n    my $Report = \"<a name='Usage'></a>\\n\";\n    $Report .= \"<h2>Usage Analysis</h2>\\n\";\n    $Report .= \"<table class='summary highlight'>\\n\";\n    $Report .= \"<tr><th>Package</th><th>Status</th><th>Used By</th></tr>\\n\";\n    \n    foreach my $Package (sort keys(%PackageUsage))\n    {\n        my $Num = keys(%{$PackageUsage{$Package}{\"UsedBy\"}});\n        $Report .= \"<tr>\\n\";\n        $Report .= \"<td class='left f_path'>$Package</td>\\n\";\n        if($Num)\n        {\n            $Report .= \"<td class='warning'>used</td>\\n\";\n            if($Num==1) {\n                $Report .= \"<td>$Num package</td>\\n\";\n            }\n            else {\n                $Report .= \"<td>$Num packages</td>\\n\";\n            }\n        }\n        else\n        {\n            $Report .= \"<td class='passed'>unused</td>\\n\";\n            $Report .= \"<td></td>\\n\";\n        }\n        \n        $Report .= \"</tr>\\n\";\n    }\n    $Report .= \"</table>\\n\";\n    \n    return $Report;\n}\n\nsub getReportHeaders()\n{\n    if(not keys(%PackageInfo)) {\n        return \"\";\n    }\n    \n    my $Report = \"<a name='Info'></a>\\n\";\n    $Report .= \"<h2>Changes In Package Info</h2>\\n\";\n    $Report .= \"<table class='summary highlight'>\\n\";\n    $Report .= \"<tr><th>Package</th><th>Status</th><th>Delta</th><th>Visual Diff</th></tr>\\n\";\n    \n    my %Details = %{$InfoChanges{\"Details\"}};\n    foreach my $Package (sort keys(%Details))\n    {\n        my $Status = $Details{$Package}{\"Status\"};\n        $Report .= \"<tr>\\n\";\n        if($Status eq \"removed\")\n        {\n            $Report .= \"<td class='left f_path failed'>$Package</td>\\n\";\n            $Report .= \"<td class='failed'>removed</td><td></td><td></td>\\n\";\n        }\n        elsif($Status eq \"added\")\n        {\n            $Report .= \"<td class='left f_path new'>$Package</td>\\n\";\n            $Report .= \"<td class='new'>added</td><td></td><td></td>\\n\";\n        }\n        else\n        {\n            $Report .= \"<td class='left f_path'>$Package</td>\\n\";\n            if($Status eq \"changed\")\n            {\n                $Report .= \"<td class='warning'>changed</td>\\n\";\n                $Report .= \"<td class='value'>\".showNumber($Details{$Package}{\"Rate\"}*100).\"%</td>\\n\";\n                $Report .= \"<td><a href='\".encodeUrl($Details{$Package}{\"Diff\"}).\"' target=\\'$LinksTarget\\'>diff</a></td>\\n\";\n            }\n            else\n            {\n                $Report .= \"<td class='passed'>unchanged</td>\\n\";\n                $Report .= \"<td>0%</td><td></td>\\n\";\n            }\n        }\n        $Report .= \"</tr>\\n\";\n    }\n    $Report .= \"</table>\\n\";\n    \n    return $Report;\n}\n\nsub getReportDeps()\n{\n    my $Report = \"<a name='Deps'></a>\\n\";\n    foreach my $Kind (sort keys(%DepChanges))\n    {\n        my @Names = keys(%{$DepChanges{$Kind}{\"Details\"}});\n        if(not @Names) {\n            next;\n        }\n        $Report .= \"<h2>Changes In \\\"\".ucfirst($Kind).\"\\\" Dependencies</h2>\\n\";\n        $Report .= \"<table class='summary highlight'>\\n\";\n        $Report .= \"<tr><th>Name</th><th>Status</th><th>Old<br/>Version</th><th>New<br/>Version</th></tr>\\n\";\n        foreach my $Name (sort {lc($a) cmp lc($b)} @Names)\n        {\n            my $Status = $DepChanges{$Kind}{\"Details\"}{$Name}{\"Status\"};\n            my $Color = \"\";\n            if($Status eq \"removed\") {\n                $Color = \" failed\";\n            }\n            elsif($Status eq \"added\") {\n                $Color = \" new\";\n            }\n            $Report .= \"<tr>\\n\";\n            $Report .= \"<td class='left f_path$Color\\'>$Name</td>\\n\";\n            if($Status eq \"changed\") {\n                $Report .= \"<td class='warning'>\".$Status.\"</td>\\n\";\n            }\n            elsif($Status eq \"removed\") {\n                $Report .= \"<td class='failed'>\".$Status.\"</td>\\n\";\n            }\n            elsif($Status eq \"added\") {\n                $Report .= \"<td class='new'>\".$Status.\"</td>\\n\";\n            }\n            else {\n                $Report .= \"<td class='passed'>\".$Status.\"</td>\\n\";\n            }\n            if($PackageDeps{1}{$Kind}{$Name})\n            {\n                my %Info1 = %{$PackageDeps{1}{$Kind}{$Name}};\n                $Report .= \"<td class='value'>\".showOp($Info1{\"Op\"}).htmlSpecChars($Info1{\"V\"}).\"</td>\\n\";\n            }\n            else {\n                $Report .= \"<td></td>\\n\";\n            }\n            if($PackageDeps{2}{$Kind}{$Name})\n            {\n                my %Info2 = %{$PackageDeps{2}{$Kind}{$Name}};\n                $Report .= \"<td class='value'>\".showOp($Info2{\"Op\"}).htmlSpecChars($Info2{\"V\"}).\"</td>\\n\";\n            }\n            else {\n                $Report .= \"<td></td>\\n\";\n            }\n            $Report .= \"</tr>\\n\";\n        }\n        $Report .= \"</table>\\n\";\n    }\n    return $Report;\n}\n\nsub showOp($)\n{\n    my $Op = $_[0];\n\n    #$Op=~s/<=/&le;/g;\n    #$Op=~s/>=/&ge;/g;\n\n    if($Op eq \"=\")\n    { # do not show \"=\"\n        $Op = \"\";\n    }\n    if($Op) {\n        $Op = $Op.\" \";\n    }\n    return $Op;\n}\n\nsub createFileView($$$)\n{\n    my ($File, $V, $Dir) = @_;\n    \n    my $Path = $PackageFiles{$V}{$File};\n    \n    if(not -T $Path)\n    {\n        return undef;\n    }\n    \n    my $Name = getFilename($File);\n    my $Content = readFile($Path);\n    my $CssStyles = readModule(\"Styles\", \"View.css\");\n    \n    $Content = htmlSpecChars($Content);\n    \n    if($Name=~/\\.patch\\Z/)\n    {\n       while($Content=~s&(\\A|\\n)(\\+.*?)(\\n|\\Z)&$1<span class='add'>$2</span>$3&mg){};\n       while($Content=~s&(\\A|\\n)(\\-.*?)(\\n|\\Z)&$1<span class='rm'>$2</span>$3&mg){};\n    }\n    \n    $Content = \"<pre class='view'>\".$Content.\"</pre>\\n\";\n    \n    $Content = \"<table cellspacing='0' cellpadding='0'>\\n<tr>\\n<td class='header'>\\n\".$Name.\"</td><td class='plain'><a href=\\'\".encodeUrl($Name).\"\\'>plain</a></td>\\n</tr>\\n<tr>\\n<td valign='top' colspan='2'>\\n\".$Content.\"</td>\\n</tr>\\n</table>\\n\";\n    $Content = composeHTMLHead($Name, \"\", \"View file \".$File, \"\", \"\", $CssStyles).\"\\n<body>\\n\".$Content;\n    $Content .= \"</body></html>\";\n    \n    my $R = $Dir.\"/\".$File.\"-view.html\";\n    writeFile($REPORT_DIR.\"/\".$R, $Content);\n    \n    # plain copy\n    copy($Path, $REPORT_DIR.\"/\".$Dir.\"/\".getDirname($File).\"/\");\n    \n    return $R;\n}\n\nsub getReportFiles()\n{\n    my $Report = \"\";\n    my $JSort = \"title='sort' onclick='javascript:sort(this, 1)' style='cursor:pointer'\";\n    foreach my $Format (sort {$FormatInfo{$b}{\"Weight\"}<=>$FormatInfo{$a}{\"Weight\"}}\n    sort {lc($FormatInfo{$a}{\"Summary\"}) cmp lc($FormatInfo{$b}{\"Summary\"})} keys(%FileChanges))\n    {\n        my $Total = $FileChanges{$Format}{\"Total\"};\n        \n        if($HideUnchanged) {\n            $Total = $FileChanges{$Format}{\"Added\"} + $FileChanges{$Format}{\"Removed\"} + $FileChanges{$Format}{\"Changed\"};\n        }\n        \n        if(not $Total) {\n            next;\n        }\n        \n        if($HideUnchanged)\n        {\n            if(not $Total)\n            { # do not show unchanged files\n                next;\n            }\n            \n            $FileChanges{$Format}{\"Total\"} = $Total;\n        }\n        \n        $Report .= \"<a name='\".$FormatInfo{$Format}{\"Anchor\"}.\"'></a>\\n\";\n        $Report .= \"<h2>\".$FormatInfo{$Format}{\"Title\"}.\" (\".$FileChanges{$Format}{\"Total\"}.\")</h2>\\n\";\n        $Report .= \"<table class='summary highlight'>\\n\";\n        $Report .= \"<tr>\\n\";\n        $Report .= \"<th $JSort>Name</th>\\n\";\n        $Report .= \"<th $JSort>Status</th>\\n\";\n        if($Format ne \"DIR\")\n        {\n            $Report .= \"<th $JSort>Delta</th>\\n\";\n            $Report .= \"<th>Visual<br/>Diff</th>\\n\";\n            \n            if($ShowDetails)\n            {\n                $Report .= \"<th>Detailed<br/>Report</th>\\n\";\n                \n                if($Format eq \"SHARED_OBJECT\"\n                or $Format eq \"KERNEL_MODULE\"\n                or $Format eq \"DEBUG_INFO\"\n                or $Format eq \"STATIC_LIBRARY\")\n                {\n                    $Report .= \"<th>ABI<br/>Dumps</th>\\n\";\n                    if($Debug) {\n                        $Report .= \"<th>DWARF<br/>Dumps</th>\\n\";\n                    }\n                }\n            }\n        }\n        $Report .= \"</tr>\\n\";\n        my %Details = %{$FileChanges{$Format}{\"Details\"}};\n        foreach my $File (sort {lc($a) cmp lc($b)} keys(%Details))\n        {\n            if($RenamedFiles_R{$File}\n            or $MovedFiles_R{$File}) {\n                next;\n            }\n            \n            my %Info = %{$Details{$File}};\n            \n            if($HideUnchanged)\n            {\n                if($Info{\"Status\"} eq \"unchanged\")\n                { # do not show unchanged files\n                    next;\n                }\n            }\n            \n            my ($Join, $Color1, $Color2) = (\"\", \"\", \"\");\n            if($Info{\"Status\"} eq \"renamed\"\n            or $Info{\"Status\"} eq \"moved\")\n            {\n                $Join = \" rowspan='2'\";\n                $Color1 = \" failed\";\n                $Color2 = \" new\";\n            }\n            elsif($Info{\"Status\"} eq \"added\") {\n                $Color1 = \" new\";\n            }\n            elsif($Info{\"Status\"} eq \"removed\") {\n                $Color1 = \" failed\";\n            }\n            \n            my $ShowFile = $File;\n            \n            if(defined $ListAddedRemoved\n            and $Info{\"Status\"}=~/added|removed/)\n            {\n                my $FN = getFilename($ShowFile);\n                if($Info{\"Status\"} eq \"added\")\n                {\n                    if(my $View = encodeUrl(createFileView($File, 2, \"view/added\"))) {\n                        $ShowFile=~s&(\\A|/)(\\Q$FN\\E)\\Z&$1<a href=\\'$View\\' target=\\'$LinksTarget\\' title='View file'>$2</a>&;\n                    }\n                }\n                elsif($Info{\"Status\"} eq \"removed\")\n                {\n                    if(my $View = encodeUrl(createFileView($File, 1, \"view/removed\"))) {\n                        $ShowFile=~s&(\\A|/)(\\Q$FN\\E)\\Z&$1<a href=\\'$View\\' target=\\'$LinksTarget\\' title='View file'>$2</a>&;\n                    }\n                }\n            }\n            \n            $Report .= \"<tr>\\n\";\n            $Report .= \"<td class='left f_path$Color1\\'>$ShowFile</td>\\n\";\n            if($Info{\"Status\"} eq \"changed\") {\n                $Report .= \"<td class='warning'>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            elsif($Info{\"Status\"} eq \"unchanged\") {\n                $Report .= \"<td class='passed'>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            elsif($Info{\"Status\"} eq \"removed\") {\n                $Report .= \"<td class='failed'>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            elsif($Info{\"Status\"} eq \"added\") {\n                $Report .= \"<td class='new'>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            elsif($Info{\"Status\"} eq \"renamed\") {\n                $Report .= \"<td class='renamed'$Join>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            elsif($Info{\"Status\"} eq \"moved\") {\n                $Report .= \"<td class='moved'$Join>\".$Info{\"Status\"}.\"</td>\\n\";\n            }\n            else {\n                $Report .= \"<td>unknown</td>\\n\";\n            }\n            if($Format ne \"DIR\")\n            {\n                if(not $QuickMode and not $Info{\"Skipped\"}\n                and $Info{\"Status\"}=~/\\A(changed|moved|renamed)\\Z/) {\n                    $Report .= \"<td class='value'$Join>\".showNumber($Info{\"Rate\"}*100).\"%</td>\\n\";\n                }\n                else {\n                    $Report .= \"<td$Join></td>\\n\";\n                }\n                if(my $Link = $Info{\"Diff\"}) {\n                    $Report .= \"<td$Join><a href='\".encodeUrl($Link).\"' target=\\'$LinksTarget\\'>diff</a></td>\\n\";\n                }\n                elsif($Info{\"Empty\"}) {\n                    $Report .= \"<td$Join></td>\\n\";\n                }\n                elsif($Info{\"Skipped\"}) {\n                    $Report .= \"<td$Join>skipped</td>\\n\";\n                }\n                else {\n                    $Report .= \"<td$Join></td>\\n\";\n                }\n                \n                if($ShowDetails)\n                {\n                    if(my $Link = $Info{\"Report\"}) {\n                        $Report .= \"<td$Join><a href='\".encodeUrl($Link).\"' target=\\'$LinksTarget\\'>report</a></td>\\n\";\n                    }\n                    else {\n                        $Report .= \"<td$Join></td>\\n\";\n                    }\n                    \n                    if($Format eq \"SHARED_OBJECT\"\n                    or $Format eq \"KERNEL_MODULE\"\n                    or $Format eq \"DEBUG_INFO\"\n                    or $Format eq \"STATIC_LIBRARY\")\n                    {\n                        if(defined $Info{\"ABIDump\"})\n                        {\n                            my $Link1 = $Info{\"ABIDump\"}{1};\n                            my $Link2 = $Info{\"ABIDump\"}{2};\n                            \n                            $Report .= \"<td$Join><a href='\".encodeUrl($Link1).\"' target=\\'$LinksTarget\\'>1</a>, <a href='\".encodeUrl($Link2).\"' target=\\'$LinksTarget\\'>2</a></td>\\n\";\n                        }\n                        else {\n                            $Report .= \"<td$Join></td>\\n\";\n                        }\n                        if($Debug)\n                        {\n                            if(defined $Info{\"DWARFDump\"})\n                            {\n                                my $Link1 = $Info{\"DWARFDump\"}{1};\n                                my $Link2 = $Info{\"DWARFDump\"}{2};\n                                \n                                $Report .= \"<td$Join><a href='\".encodeUrl($Link1).\"' target=\\'$LinksTarget\\'>1</a>, <a href='\".encodeUrl($Link2).\"' target=\\'$LinksTarget\\'>2</a></td>\\n\";\n                            }\n                            else {\n                                $Report .= \"<td$Join></td>\\n\";\n                            }\n                        }\n                    }\n                }\n            }\n            $Report .= \"</tr>\\n\";\n            if(my $RenamedTo = $RenamedFiles{$File}) {\n                $Report .= \"<tr><td class='left f_path $Color2\\'>\".$RenamedTo.\"</td></tr>\\n\";\n            }\n            elsif(my $MovedTo = $MovedFiles{$File}) {\n                $Report .= \"<tr><td class='left f_path $Color2\\'>\".$MovedTo.\"</td></tr>\\n\";\n            }\n        }\n        $Report .= \"</table>\\n\";\n    }\n    return $Report;\n}\n\nsub writeFile($$)\n{\n    my ($Path, $Content) = @_;\n    \n    if(my $Dir = getDirname($Path)) {\n        mkpath($Dir);\n    }\n    \n    open(FILE, \">\", $Path) || die (\"can't open file \\'$Path\\': $!\\n\");\n    print FILE $Content;\n    close(FILE);\n}\n\nsub readFile($)\n{\n    my $Path = $_[0];\n    \n    open(FILE, \"<\", $Path);\n    local $/ = undef;\n    my $Content = <FILE>;\n    close(FILE);\n    \n    return $Content;\n}\n\nsub getPrefixes($$)\n{\n    my @Parts = split(/[\\/]+/, $_[0]);\n    my $Prefix = $Parts[$#Parts];\n    my @Res = ();\n    foreach (1 .. $_[1])\n    {\n        if($_<$#Parts)\n        {\n            $Prefix = $Parts[$#Parts-$_].\"/\".$Prefix;\n            push(@Res, $Prefix);\n        }\n    }\n    return @Res;\n}\n\nsub getFilename($)\n{ # much faster than basename() from File::Basename module\n    if($_[0]=~/([^\\/]+)[\\/]*\\Z/) {\n        return $1;\n    }\n    return \"\";\n}\n\nsub getDirname($)\n{ # much faster than dirname() from File::Basename module\n    if($_[0]=~/\\A(.*?)[\\/]+[^\\/]*[\\/]*\\Z/) {\n        return $1;\n    }\n    return \"\";\n}\n\nsub sepPath($) {\n    return (getDirname($_[0]), getFilename($_[0]));\n}\n\nsub exitStatus($$)\n{\n    my ($Code, $Msg) = @_;\n    printMsg(\"ERROR\", $Msg);\n    exit($ERROR_CODE{$Code});\n}\n\nsub printMsg($$)\n{\n    my ($Type, $Msg) = @_;\n    if($Type!~/\\AINFO/) {\n        $Msg = $Type.\": \".$Msg;\n    }\n    if($Type!~/_C\\Z/) {\n        $Msg .= \"\\n\";\n    }\n    if($Type eq \"ERROR\") {\n        print STDERR $Msg;\n    }\n    else {\n        print $Msg;\n    }\n}\n\nsub cutPathPrefix($$)\n{\n    my ($Path, $Prefix) = @_;\n    \n    if(not $Prefix) {\n        return $Path;\n    }\n    \n    $Prefix=~s/[\\/]+\\Z//;\n    $Path=~s/\\A\\Q$Prefix\\E([\\/]+|\\Z)//;\n    \n    return $Path;\n}\n\nsub getAbsPath($)\n{ # abs_path() should NOT be called for absolute inputs\n  # because it can change them (symlinks)\n    my $Path = $_[0];\n    if($Path!~/\\A\\//) {\n        $Path = abs_path($Path);\n    }\n    return $Path;\n}\n\nsub cmdFind(@)\n{\n    if(not checkCmd(\"find\")) {\n        exitStatus(\"Not_Found\", \"can't find a \\\"find\\\" command\");\n    }\n    \n    my $Path = shift(@_);\n    \n    my ($Type, $Name, $MaxDepth, $UseRegex) = ();\n    \n    if(@_) {\n        $Type = shift(@_);\n    }\n    if(@_) {\n        $Name = shift(@_);\n    }\n    if(@_) {\n        $MaxDepth = shift(@_);\n    }\n    if(@_) {\n        $UseRegex = shift(@_);\n    }\n    \n    $Path = getAbsPath($Path);\n    \n    if(-d $Path and -l $Path\n    and $Path!~/\\/\\Z/)\n    { # for directories that are symlinks\n        $Path .= \"/\";\n    }\n    \n    my $Cmd = \"find \\\"$Path\\\"\";\n    if($MaxDepth) {\n        $Cmd .= \" -maxdepth $MaxDepth\";\n    }\n    if($Type) {\n        $Cmd .= \" -type $Type\";\n    }\n    if($Name and not $UseRegex)\n    { # wildcards\n        $Cmd .= \" -name \\\"$Name\\\"\";\n    }\n    \n    my $Res = `$Cmd 2>\\\"$TMP_DIR/null\\\"`;\n    if($?) {\n        printMsg(\"ERROR\", \"problem with \\'find\\' utility ($?): $!\");\n    }\n    \n    my @Files = split(/\\n/, $Res);\n    if($Name and $UseRegex)\n    { # regex\n        @Files = grep { /\\A$Name\\Z/ } @Files;\n    }\n    \n    return @Files;\n}\n\nsub generateTemplate()\n{\n    writeFile(\"VERSION.xml\", $DescriptorTemplate.\"\\n\");\n    printMsg(\"INFO\", \"XML-descriptor template ./VERSION.xml has been generated\");\n}\n\nsub isSCM_File($)\n{ # .svn, .git, .bzr, .hg and CVS\n    my $Dir = getDirname($_[0]);\n    my $Name = getFilename($_[0]);\n    \n    if($Dir=~/(\\A|[\\/\\\\])\\.(svn|git|bzr|hg)([\\/\\\\]|\\Z)/) {\n        return uc($2);\n    }\n    elsif($Name=~/\\A\\.(git|cvs|hg).*/)\n    { # .gitignore, .gitattributes, .gitmodules, etc.\n      # .cvsignore\n        return uc($1);\n    }\n    elsif($Dir=~/(\\A|[\\/\\\\])(CVS)([\\/\\\\]|\\Z)/) {\n        return \"cvs\";\n    }\n    \n    return undef;\n}\n\nsub identifyFile($$)\n{\n    my ($Name, $Type) = @_;\n    if($Type eq \"iName\"\n    or $Type eq \"iExt\") {\n        $Name=lc($Name);\n    }\n    if($Type eq \"Name\"\n    or $Type eq \"iName\")\n    {\n        if(my $ID = $FileFormat{$Type}{$Name})\n        { # Exact name\n            return $ID;\n        }\n    }\n    if($Type eq \"Ext\"\n    or $Type eq \"iExt\")\n    {\n        if($Name=~/\\.(\\w+\\.\\w+)(\\.(in|\\d+)|)\\Z/i)\n        { # Double extension\n            if(my $ID = $FileFormat{$Type}{$1}) {\n                return $ID;\n            }\n        }\n        if($Name=~/\\.(\\w+)(\\.(in|\\d+)|)\\Z/i)\n        { # Single extension\n            if(my $ID = $FileFormat{$Type}{$1}) {\n                return $ID;\n            }\n        }\n    }\n    return \"\";\n}\n\nsub getFormat($)\n{\n    my $Path = $_[0];\n    \n    if(defined $Cache{\"getFormat\"}{$Path}) {\n        return $Cache{\"getFormat\"}{$Path};\n    }\n    my $Format = getFormat_I($Path);\n    \n    if($Format=~/\\A(OTHER|INFORM|DATA|TEXT)\\Z/)\n    { # by directory\n        if(my $Dir = getDirname($PathName{$Path}))\n        {\n            my $ID = undef;\n            \n            # by dir\n            foreach my $SDir (reverse(split(/\\//, $Dir)))\n            {\n                if($ID = $DirFormat{$SDir})\n                {\n                    $Format = $ID;\n                    last;\n                }\n            }\n            \n            if(not defined $ID)\n            {\n                # by subdir\n                foreach my $SDir (keys(%DirFormat))\n                {\n                    if(index($SDir, \"/\")==-1) {\n                        next;\n                    }\n                    \n                    if(index($Dir, $SDir)!=-1)\n                    {\n                        if($Dir=~/(\\A|\\/)\\Q$SDir\\E(\\/|\\Z)/)\n                        {\n                            $Format = $DirFormat{$SDir};\n                            last;\n                        }\n                    }\n                }\n            }\n        }\n    }\n    \n    if($Format eq \"OTHER\")\n    {\n        my $Bytes = readBytes($Path);\n        if(my $ID = $BytesFormat{$Bytes}) {\n            $Format = $ID;\n        }\n        \n        my $Ext = getExt($Path);\n        if(not $Ext\n        and $Bytes eq \"7f454c46\")\n        { # ELF executable\n            $Format = \"EXE\";\n        }\n    }\n    \n    if($Format eq \"OTHER\")\n    { # semi-automatic\n        if(my $Info = getType($Path))\n        {\n            # by terms\n            my @Terms = getTerms($Info);\n            foreach my $Term (@Terms)\n            {\n                if($Term eq \"TEXT\"\n                or $Term eq \"DATA\") {\n                    next;\n                }\n                if(defined $FormatInfo{$Term}\n                and my $ID = $FormatInfo{$Term}{\"ID\"})\n                {\n                    $Format = $ID;\n                    last;\n                }\n                elsif(my $ID2 = $TermFormat{$Term})\n                {\n                    $Format = $ID2;\n                    last;\n                }\n            }\n        }\n    }\n    \n    if($Format eq \"OTHER\")\n    { # automatic\n        if(my $Info = getType($Path))\n        {\n            if($Info=~/compressed|Zip archive/i) {\n                $Format = \"ARCHIVE\";\n            }\n            elsif($Info=~/data/i) {\n                $Format = \"DATA\";\n            }\n            elsif($Info=~/text/i) {\n                $Format = \"TEXT\";\n            }\n            elsif($Info=~/executable/i) {\n                $Format = \"EXE\";\n            }\n            elsif($Info=~/\\AELF\\s/) {\n                $Format = \"ELF_BINARY\";\n            }\n        }\n    }\n    \n    if($Format eq \"SHARED_OBJECT\")\n    {\n        if(getType($Path)=~/ASCII/i)\n        {\n            if(readFilePart($Path, 1)=~/GNU ld script/i) {\n                $Format = \"GNU_LD_SCRIPT\";\n            }\n            else {\n                $Format = \"TEXT\";\n            }\n        }\n    }\n    \n    if($Format eq \"SHARED_OBJECT\"\n    or $Format eq \"KERNEL_MODULE\"\n    or $Format eq \"DEBUG_INFO\")\n    { # double-check\n        if(readBytes($Path) ne \"7f454c46\") {\n            $Format = \"OTHER\";\n        }\n    }\n    \n    if(not defined $FormatInfo{$Format}\n    or not $FormatInfo{$Format}{\"Summary\"})\n    { # Unknown\n        $Format = \"OTHER\";\n    }\n    \n    if($Format eq \"OTHER\")\n    {\n        if($AllText) {\n            $Format = \"TEXT\";\n        }\n    }\n    \n    return ($Cache{\"getFormat\"}{$Path}=$Format);\n}\n\nsub getFormat_I($)\n{\n    my $Path = $_[0];\n    \n    my $Dir = getDirname($Path);\n    my $Name = getFilename($Path);\n    \n    $Name=~s/\\~\\Z//g; # backup files\n    \n    if(-l $Path) {\n        return \"SYMLINK\";\n    }\n    elsif(-d $Path) {\n        return \"DIR\";\n    }\n    elsif(my $ID = identifyFile($Name, \"Name\"))\n    { # check by exact name (case sensitive)\n        return $ID;\n    }\n    elsif(my $ID2 = identifyFile($Name, \"iName\"))\n    { # check by exact name (case insensitive)\n        return $ID2;\n    }\n    elsif($Path=~/svn|git|bzr|hg|cvs/i\n    and my $Kind = isSCM_File($Path)) {\n        return $Kind;\n    }\n    elsif($Name!~/\\.(\\w+)\\Z/i\n    and $Dir=~/(\\A|\\/)(include|includes)(\\/|\\Z)/)\n    { # include/QtWebKit/QWebSelectData\n      # includes/KService\n        return \"HEADER\";\n    }\n    elsif($Name=~/\\.(so)(|\\.\\d[0-9\\-\\.\\_]*)\\Z/i)\n    { # Shared library\n        return \"SHARED_OBJECT\";\n    }\n    elsif($Name=~/\\A(readme)(\\W|\\_|\\Z)/i\n    or $Name=~/(\\W|\\_)(readme)(\\.txt|)\\Z/i) {\n        return \"README\";\n    }\n    elsif($Name=~/\\A(license|licenses|licence|copyright|copying)(\\W|\\_|\\Z)/i\n    or $Name=~/\\.(license|licence)\\Z/i or $Name=~/\\A(gpl|lgpl|bsd|qpl|artistic)(\\W|\\_|)(v|)([\\d\\.]+|)(\\.txt|)\\Z/i)\n    { # APACHE.license\n      # LGPL.license\n      # COPYRIGHT.IBM\n        return \"LICENSE\";\n    }\n    elsif($Name=~/\\A(changelog|changes|relnotes)(\\W|\\Z)/i\n    or $Name=~/\\A(NEWS)(\\W|\\Z)/)\n    { # ChangeLog-2003-10-25\n      # docs/CHANGES\n      # freetype/ChangeLog\n        return \"CHANGELOG\";\n    }\n    elsif($Name=~/\\A(INSTALL|TODO)(\\.|\\-|\\Z)/\n    or $Name=~/\\A[A-Z\\-\\_]+(\\.txt|\\.TXT|\\Z)/\n    or $Name=~/\\A[A-Z\\_]+\\.[A-Z\\_]+\\Z/)\n    { # HOWTO.DEBUG, BUGS, WISHLIST.TXT\n        return \"INFORM\";\n    }\n    elsif((($Name=~/\\.(gz|xz|lzma)\\Z/i or $Name=~/\\.(\\d+)\\Z/i)\n    and $Dir=~/\\/(man\\d*|manpages)(\\/|\\Z)/)\n    or ($Name=~/\\.(\\d+)\\Z/i and $Dir=~/\\/(doc|docs|src|libs|utils)(\\/|\\Z)/)\n    or $Name=~/\\.(man)\\Z/\n    or ($Name=~/[a-z]{3,}\\.(\\d+)\\Z/i and $Name!~/\\.($ARCHIVE_EXT)\\./i and $Dir!~/log/i))\n    { # harmattan/manpages/uic.1\n      # t1utils-1.36/t1asm.1\n        return \"MANPAGE\";\n    }\n    elsif($Name=~/\\.info(|\\-\\d+)(|\\.(gz|xz|lzma))\\Z/i\n    and $Dir=~/\\/(info|share|doc|docs)(\\/|\\Z)/)\n    { # /usr/share/info/libc.info-1.gz\n        return \"INFODOC\";\n    }\n    elsif($Name=~/\\ADoxyfile(\\W|\\Z)/i) {\n        return \"DOXYGEN\";\n    }\n    elsif($Name=~/(make|conf)[^\\.]*(\\.in)+\\Z/i) {\n        return \"AUTOMAKE\";\n    }\n    elsif($Name=~/\\A(g|)(makefile)(\\.|\\Z)/i) {\n        return \"MAKEFILE\";\n    }\n    elsif($Name=~/\\A(CMakeLists.*\\.txt)\\Z/i) {\n        return \"CMAKE\";\n    }\n    elsif(my $ID3 = identifyFile($Name, \"Ext\"))\n    { # check by extension (case sensitive)\n        return $ID3;\n    }\n    elsif(my $ID4 = identifyFile($Name, \"iExt\"))\n    { # check by extension (case insensitive)\n        return $ID4;\n    }\n    elsif(substr($Name, 0, 1) eq \".\") {\n        return \"HIDDEN\";\n    }\n    return \"OTHER\";\n}\n\nsub getTerms($)\n{\n    my $Str = $_[0];\n    my %Terms = ();\n    my ($Prev, $Num) = (\"\", 0);\n    while($Str=~s/([\\w\\-]+)//)\n    {\n        if($Prev) {\n            $Terms{uc($Prev.\"_\".$1)}=$Num++;\n        }\n        $Terms{uc($1)}=$Num++;\n        $Prev = $1;\n    }\n    return sort {$Terms{$a}<=>$Terms{$b}} keys(%Terms);\n}\n\nsub parseTag($$)\n{\n    my ($CodeRef, $Tag) = @_;\n    return \"\" if(not $CodeRef or not ${$CodeRef} or not $Tag);\n    if(${$CodeRef}=~s/\\<\\Q$Tag\\E\\>((.|\\n)+?)\\<\\/\\Q$Tag\\E\\>//)\n    {\n        my $Content = $1;\n        $Content=~s/(\\A\\s+|\\s+\\Z)//g;\n        return $Content;\n    }\n    else {\n        return \"\";\n    }\n}\n\nsub readDescriptor($$)\n{\n    my ($Version, $Path) = @_;\n    \n    my $Content = readFile($Path);\n    if(not $Content) {\n        exitStatus(\"Error\", \"XML-descriptor is empty\");\n    }\n    if($Content!~/\\</) {\n        exitStatus(\"Error\", \"XML-descriptor has a wrong format\");\n    }\n    $Content=~s/\\/\\*(.|\\n)+?\\*\\///g;\n    $Content=~s/<\\!--(.|\\n)+?-->//g;\n    if(my $GV = parseTag(\\$Content, \"version\")) {\n        $Group{\"V\".$Version} = $GV;\n    }\n    else {\n        exitStatus(\"Error\", \"version in the XML-descriptor is not specified (<version> section)\");\n    }\n    if(my $GN = parseTag(\\$Content, \"group\")) {\n        $Group{\"Name\".$Version} = $GN;\n    }\n    else {\n        exitStatus(\"Error\", \"group name in the XML-descriptor is not specified (<group> section)\");\n    }\n    if(my $Pkgs = parseTag(\\$Content, \"packages\"))\n    {\n        foreach my $Path (split(/\\s*\\n\\s*/, $Pkgs))\n        {\n            if(not -e $Path) {\n                exitStatus(\"Access_Error\", \"can't access \\'\".$Path.\"\\'\");\n            }\n            if(-d $Path)\n            {\n                my @Files = cmdFind($Path, \"f\", \"*.rpm\");\n                @Files = (@Files, cmdFind($Path, \"f\", \"*.src.rpm\"));\n                if(not @Files)\n                { # search for DEBs\n                    @Files = (@Files, cmdFind($Path, \"f\", \"*.deb\"));\n                }\n                foreach my $F (@Files) {\n                    registerPackage($F, $Version);\n                }\n            }\n            else {\n                registerPackage($Path, $Version);\n            }\n        }\n    }\n    else {\n        exitStatus(\"Error\", \"packages in the XML-descriptor are not specified (<packages> section)\");\n    }\n    foreach my $Path (split(/\\s*\\n\\s*/, parseTag(\\$Content, \"skip_files\")))\n    {\n        my ($CPath, $Type) = classifyPath($Path);\n        $SkipFiles{$Version}{$Type}{$CPath} = 1;\n    }\n}\n\nsub classifyPath($)\n{\n    my $Path = $_[0];\n    if($Path=~/[\\*\\[]/)\n    { # wildcard\n        $Path=~s/\\*/.*/g;\n        $Path=~s/\\\\/\\\\\\\\/g;\n        return ($Path, \"Pattern\");\n    }\n    elsif($Path=~/[\\/\\\\]/)\n    { # directory or relative path\n        return ($Path, \"Path\");\n    }\n    \n    return ($Path, \"Name\");\n}\n\nsub skipFileCompare($$)\n{\n    my ($Path, $Version) = @_;\n    \n    my $Name = getFilename($Path);\n    if($SkipFiles{$Version}{\"Name\"}{$Name}) {\n        return 1;\n    }\n    foreach my $Dir (keys(%{$SkipFiles{$Version}{\"Path\"}}))\n    {\n        if($Path=~/\\Q$Dir\\E/) {\n            return 1;\n        }\n    }\n    foreach my $Pattern (keys(%{$SkipFiles{$Version}{\"Pattern\"}}))\n    {\n        if($Name=~/($Pattern)/) {\n            return 1;\n        }\n        if($Pattern=~/[\\/\\\\]/ and $Path=~/($Pattern)/) {\n            return 1;\n        }\n    }\n    return 0;\n}\n\nsub sepDep($)\n{\n    my $Dep = $_[0];\n    if($Dep=~/\\A(.+?)(\\s+|\\[|\\()(=|==|<=|>=|<|>)\\s+(.+?)(\\]|\\)|\\Z)/)\n    {\n        my ($N, $O, $V) = ($1, $3, $4);\n        # canonify version (1:3.2.5-5:2011.0)\n        $V=~s/\\A[^\\-\\:]+\\://;# cut prefix (1:)\n        return ($N, $O, $V);\n    }\n    \n    return ($Dep, \"\", \"\");\n}\n\nsub registerPackage(@)\n{\n    my ($Path, $Version, $Ph) = @_;\n    \n    if(not $Path) {\n        return ();\n    }\n    \n    my $PkgName = getFilename($Path);\n    my $PkgFormat = getFormat($Path);\n    \n    my ($CPath, $Attr) = ();\n    if($Ph)\n    { # already opened\n        ($CPath, $Attr) = ($Ph->{\"CPath\"}, $Ph->{\"Attr\"});\n    }\n    else\n    { # not opened\n        ($CPath, $Attr) = readPackage($Path, $Version);\n    }\n    \n    $TargetPackages{$Version}{$PkgName} = 1;\n    $Group{\"Count$Version\"} += 1;\n    \n    # search for all files\n    my @Files = cmdFind($CPath);\n    foreach my $File (sort @Files)\n    {\n        my $FName = cutPathPrefix($File, $CPath);\n        if($PkgFormat eq \"RPM\"\n        or $PkgFormat eq \"DEB\")\n        { # files installed to the system\n            $FName = \"/\".$FName;\n        }\n        elsif($PkgFormat eq \"ARCHIVE\")\n        {\n            if(my $RmPrefix = $RemovePrefix{$Version})\n            { # cut common prefix from all files\n                $FName = cutPathPrefix($FName, $RmPrefix);\n            }\n        }\n        if(not $FName) {\n            next;\n        }\n        \n        if(defined $SkipPattern)\n        {\n            if(skipFile($FName)) {\n                next;\n            }\n        }\n        \n        $PackageFiles{$Version}{$FName} = $File;\n        $PathName{$File} = $FName;\n        \n        if(not defined $CompareDirs\n        and not defined $SkipSubArchives\n        and not getDirname($FName)\n        and getFormat($File) eq \"ARCHIVE\")\n        { # go into archives (for SRPM)\n            my $SubDir = \"$TMP_DIR/xcontent$Version/$FName\";\n            unpackArchive($File, $SubDir);\n            \n            my @SubContents = listDir($SubDir);\n            if($#SubContents==0 and -d $SubDir.\"/\".$SubContents[0])\n            { # libsample-x.y.z.tar.gz/libsample-x.y.z\n                $SubDir .= \"/\".$SubContents[0];\n            }\n            \n            foreach my $SubFile (cmdFind($SubDir))\n            { # search for all files in archive\n                my $SFName = cutPathPrefix($SubFile, $SubDir);\n                if(not $SFName) {\n                    next;\n                }\n                \n                if(defined $SkipPattern)\n                {\n                    if(skipFile($SFName)) {\n                        next;\n                    }\n                }\n                \n                $PackageFiles{$Version}{$SFName} = $SubFile;\n            }\n        }\n    }\n    \n    delete($PackageFiles{$Version}{\"/\"});\n    \n    if($CheckUsage) {\n        checkUsage($Attr->{\"Name\"});\n    }\n    \n    return $Attr;\n}\n\nsub checkUsage($)\n{\n    my $Name = $_[0];\n    if($PackageManager eq \"urpm\")\n    {\n        foreach my $Pkg (split(/\\s*\\n\\s*/, `urpmq --whatrequires $Name`))\n        {\n            $PackageUsage{$Name}{\"UsedBy\"}{$Pkg} = 1;\n            $TotalUsage{$Pkg}=1;\n        }\n    }\n}\n\nsub listDir($)\n{\n    my $Path = $_[0];\n    \n    opendir(my $DH, $Path);\n    \n    if(not $DH)\n    { # error\n        return ();\n    }\n    \n    my @Contents = grep { $_ ne \".\" && $_ ne \"..\" } readdir($DH);\n    return @Contents;\n}\n\nsub getArchiveFormat($)\n{\n    my $Pkg = getFilename($_[0]);\n    foreach (sort {length($b)<=>length($a)} keys(%ArchiveFormats))\n    {\n        my $P = $ArchiveFormats{$_};\n        if($Pkg=~/\\.($P)(|\\.\\d+)\\Z/i) {\n            return $_;\n        }\n    }\n    return undef;\n}\n\nsub unpackArchive($$)\n{ # TODO: tar -xf for all tar.* formats\n    my ($Pkg, $OutDir) = @_;\n    \n    my $Format = getArchiveFormat($Pkg);\n    if(not $Format)\n    {\n        printMsg(\"ERROR\", \"can't determine format of archive \\'\".getFilename($Pkg).\"\\'\");\n        return 1;\n    }\n    \n    my $Cmd = undef;\n    \n    if($Format=~/TAR\\.\\w+/i or $Format eq \"TAR\") {\n        $Cmd = \"tar -xf \\\"$Pkg\\\" --directory=\\\"$OutDir\\\"\";\n    }\n    elsif($Format eq \"GZ\") {\n        $Cmd = \"cp -f \\\"$Pkg\\\" \\\"$OutDir\\\" && cd \\\"$OutDir\\\" && gunzip \\\"\".getFilename($Pkg).\"\\\"\";\n    }\n    elsif($Format eq \"LZMA\") {\n        $Cmd = \"cp -f \\\"$Pkg\\\" \\\"$OutDir\\\" && cd \\\"$OutDir\\\" && unlzma \\\"\".getFilename($Pkg).\"\\\"\";\n    }\n    elsif($Format eq \"XZ\") {\n        $Cmd = \"cp -f \\\"$Pkg\\\" \\\"$OutDir\\\" && cd \\\"$OutDir\\\" && unxz \\\"\".getFilename($Pkg).\"\\\"\";\n    }\n    elsif($Format eq \"ZIP\") {\n        $Cmd = \"unzip -o \\\"$Pkg\\\" -d \\\"$OutDir\\\"\";\n    }\n    elsif($Format eq \"JAR\") {\n        $Cmd = \"cd \\\"$OutDir\\\" && jar -xf \\\"$Pkg\\\"\";\n    }\n    elsif($Format eq \"APK\") {\n        $Cmd = \"apktool d -f -o \\\"$OutDir\\\" \\\"$Pkg\\\"\";\n\n        if(not defined $SkipPattern) {\n            $SkipPattern = \"apktool.yml|original\\/META-INF\";\n        }\n        elsif(not $SkipPattern=~m/apktool.yml|original\\/META-INF/) {\n            $SkipPattern = \"apktool.yml|original\\/META-INF|$SkipPattern\";\n        }\n    }\n    \n    if($Cmd)\n    {\n        mkpath($OutDir);\n        my $TmpFile = $TMP_DIR.\"/output\";\n        qx/$Cmd >$TmpFile 2>&1/;\n        return 0;\n    }\n    \n    return 1;\n}\n\nsub readPackage($$)\n{\n    my ($Path, $Version) = @_;\n    \n    if(not $Path) {\n        return ();\n    }\n    \n    my $Format = getFormat($Path);\n    \n    if($CompareDirs and $Format eq \"DIR\")\n    {\n        return ($Path, {});\n    }\n    \n    my $CDir = \"$TMP_DIR/content$Version\";\n    my $CPath = $CDir.\"/\".getFilename($Path);\n    \n    my %Attr = ();\n    \n    if($Format eq \"DEB\")\n    { # Deb package\n        if(not checkCmd(\"dpkg-deb\")) {\n            exitStatus(\"Not_Found\", \"can't find \\\"dpkg-deb\\\"\");\n        }\n        mkpath($CPath);\n        system(\"dpkg-deb --extract \\\"$Path\\\" \\\"$CPath\\\"\");\n        if($?) {\n            exitStatus(\"Error\", \"can't extract package v$Version\");\n        }\n        if(not checkCmd(\"dpkg\")) {\n            exitStatus(\"Not_Found\", \"can't find \\\"dpkg\\\"\");\n        }\n        my $Info = `dpkg -f $Path`;\n        if($Info=~/Version\\s*:\\s*(.+)/) {\n            $Attr{\"Version\"} = $1;\n        }\n        if($Info=~/Package\\s*:\\s*(.+)/) {\n            $Attr{\"Name\"} = $1;\n        }\n        if($Info=~/Architecture\\s*:\\s*(.+)/) {\n            $Attr{\"Arch\"} = $1;\n        }\n        foreach my $Kind (\"Depends\", \"Provides\")\n        {\n            if($Info=~/$Kind\\s*:\\s*(.+)/)\n            {\n                foreach my $Dep (split(/\\s*,\\s*/, $1))\n                {\n                    my ($N, $Op, $V) = sepDep($Dep);\n                    %{$PackageDeps{$Version}{$Kind}{$N}} = ( \"Op\"=>$Op, \"V\"=>$V );\n                    $TotalDeps{$Kind.\" \".$N} = 1;\n                }\n            }\n        }\n        $PackageInfo{$Attr{\"Name\"}}{\"V$Version\"} = $Info;\n        $Group{\"Format\"}{$Format} = 1;\n    }\n    elsif($Format eq \"RPM\" or $Format eq \"SRPM\")\n    { # RPM or SRPM package\n        if(not checkCmd(\"rpm\"))\n        { # rpm and rpm2cpio\n            exitStatus(\"Not_Found\", \"can't find \\\"rpm\\\"\");\n        }\n        if(not checkCmd(\"cpio\")) {\n            exitStatus(\"Not_Found\", \"can't find \\\"cpio\\\"\");\n        }\n        mkpath($CPath);\n        system(\"cd \\\"$CPath\\\" && rpm2cpio \\\"\".abs_path($Path).\"\\\" | cpio -id --quiet\");\n        if($?) {\n            exitStatus(\"Error\", \"can't extract package v$Version\");\n        }\n        ($Attr{\"Version\"}, $Attr{\"Release\"},\n        $Attr{\"Name\"}, $Attr{\"Arch\"}) = split(\",\", queryRPM($Path, \"--queryformat \\%{version},\\%{release},\\%{name},\\%{arch}\"));\n        if($Attr{\"Release\"}) {\n            $Attr{\"Version\"} .= \"-\".$Attr{\"Release\"};\n        }\n        foreach my $Kind (\"requires\", \"provides\", \"suggests\")\n        {\n            foreach my $D (split(\"\\n\", queryRPM($Path, \"--\".$Kind)))\n            {\n                my ($N, $Op, $V) = sepDep($D);\n                %{$PackageDeps{$Version}{$Kind}{$N}} = ( \"Op\"=>$Op, \"V\"=>$V );\n                $TotalDeps{$Kind.\" \".$N} = 1;\n            }\n        }\n        $PackageInfo{$Attr{\"Name\"}}{\"V$Version\"} = queryRPM($Path, \"--info\");\n        $Group{\"Format\"}{$Format} = 1;\n    }\n    elsif($Format eq \"ARCHIVE\")\n    { # TAR.GZ and others\n        if(unpackArchive(abs_path($Path), $CPath)!=0) {\n            exitStatus(\"Error\", \"can't extract package \\'\".getFilename($Path).\"\\'\");\n        }\n        \n        if(my ($N, $V) = parseVersion(getFilename($Path))) {\n            ($Attr{\"Name\"}, $Attr{\"Version\"}) = ($N, $V);\n        }\n        if(not $Attr{\"Version\"})\n        { # default version\n            $Attr{\"Version\"} = $Version==1?\"X\":\"Y\";\n        }\n        if(not $Attr{\"Name\"})\n        { # default name\n            $Attr{\"Name\"} = getFilename($Path);\n            $Attr{\"Name\"}=~s/\\.($ARCHIVE_EXT)\\Z//;\n        }\n        $Group{\"Format\"}{uc(getExt($Path))} = 1;\n    }\n    return ($CPath, \\%Attr);\n}\n\nsub parseVersion($)\n{\n    my $Name = $_[0];\n    if(my $Extension = getExt($Name)) {\n        $Name=~s/\\.(\\Q$Extension\\E)\\Z//;\n    }\n    if($Name=~/\\A(.+[a-z])[\\-\\_](v|ver|)(\\d.+?)\\Z/i)\n    { # libsample-N\n      # libsample-vN\n        return ($1, $3);\n    }\n    elsif($Name=~/\\A([\\d\\.\\-]+)\\Z/i)\n    { # X.Y-Z\n        return (\"\", $Name);\n    }\n    elsif($Name=~/\\A(.+?)[\\-\\_]*(\\d[\\d\\.\\-]*)\\Z/i)\n    { # libsampleN\n      # libsampleN-X.Y\n        return ($1, $2);\n    }\n    elsif($Name=~/\\A(.+)[\\-\\_](v|ver|)(.+?)\\Z/i)\n    { # libsample-N\n      # libsample-vN\n        return ($1, $3);\n    }\n    elsif($Name=~/\\A([a-z_\\-]+)(\\d.+?)\\Z/i)\n    { # libsampleNb\n        return ($1, $2);\n    }\n    return ();\n}\n\nsub getExt($)\n{\n    if($_[0]=~/\\.($ARCHIVE_EXT)\\Z/) {\n        return $1;\n    }\n    elsif($_[0]=~/\\.(\\w+)(\\.in|)\\Z/) {\n        return $1;\n    }\n    return \"\";\n}\n\nsub queryRPM($$)\n{\n    my ($Path, $Query) = @_;\n    return `rpm -qp $Query \\\"$Path\\\" 2>$TMP_DIR/null`;\n}\n\nsub composeHTMLHead($$$$$$)\n{\n    my ($Title, $Keywords, $Description, $StylesPath, $ScriptsPath, $Styles) = @_;\n    return \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\">\n    <html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" xml:lang=\\\"en\\\" lang=\\\"en\\\">\n    <head>\n    <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\" />\n    <meta name=\\\"viewport\\\" content=\\\"width=device-width,initial-scale=1\\\" />\n    <meta name=\\\"keywords\\\" content=\\\"$Keywords\\\" />\n    <meta name=\\\"description\\\" content=\\\"$Description\\\" />\n    <title>\n        $Title\n    </title>\n    <link rel='stylesheet' type='text/css' href=\\'$StylesPath\\' />\n    <script type='text/javascript' src=\\'$ScriptsPath\\'></script>\n    <style type=\\\"text/css\\\">\n        $Styles\n    </style>\n    </head>\";\n}\n\nsub getTitle()\n{\n    if($TargetTitle) {\n        return $TargetTitle;\n    }\n    \n    return $Group{\"Name\"};\n}\n\nsub getHeader()\n{\n    my $Header = \"\";\n    \n    if($CompareDirs and not $TargetName)\n    {\n        $Header = \"Changes report between <span style='color:Red;'>\".$Group{\"Name1\"}.\"</span> and <span style='color:Red;'>\".$Group{\"Name2\"}.\"</span>\";\n    }\n    elsif($CheckMode eq \"Group\") {\n        $Header = \"Changes report for <span style='color:Blue;'>\".getTitle().\"</span> group of packages between <span style='color:Red;'>\".$Group{\"V1\"}.\"</span> and <span style='color:Red;'>\".$Group{\"V2\"}.\"</span> versions\";\n    }\n    else\n    { # single package\n        $Header = \"Changes report for <span style='color:Blue;'>\".getTitle().\"</span> package between <span style='color:Red;'>\".$Group{\"V1\"}.\"</span> and <span style='color:Red;'>\".$Group{\"V2\"}.\"</span> versions\";\n    }\n    \n    #if($HideUnchanged) {\n    #    $Header .= \" (hidden unchanged files)\";\n    #}\n    \n    return \"<h1>\".$Header.\"</h1>\";\n}\n\nsub showNumber($)\n{\n    if($_[0])\n    {\n        my $Num = cutNumber($_[0], 2, 0);\n        if($Num eq \"0\")\n        {\n            foreach my $P (3 .. 7)\n            {\n                $Num = cutNumber($_[0], $P, 1);\n                if($Num ne \"0\") {\n                    last;\n                }\n            }\n        }\n        if($Num eq \"0\") {\n            $Num = $_[0];\n        }\n        return $Num;\n    }\n    return $_[0];\n}\n\nsub cutNumber($$$)\n{\n    my ($num, $digs_to_cut, $z) = @_;\n    if($num!~/\\./)\n    {\n        $num .= \".\";\n        foreach (1 .. $digs_to_cut-1) {\n            $num .= \"0\";\n        }\n    }\n    elsif($num=~/\\.(.+)\\Z/ and length($1)<$digs_to_cut-1)\n    {\n        foreach (1 .. $digs_to_cut - 1 - length($1)) {\n            $num .= \"0\";\n        }\n    }\n    elsif($num=~/\\d+\\.(\\d){$digs_to_cut,}/) {\n      $num=sprintf(\"%.\".($digs_to_cut-1).\"f\", $num);\n    }\n    $num=~s/\\.[0]+\\Z//g;\n    if($z) {\n        $num=~s/(\\.[1-9]+)[0]+\\Z/$1/g;\n    }\n    return $num;\n}\n\nsub getSummary()\n{\n    my $TestInfo = \"<h2>Test Info</h2>\\n\";\n    $TestInfo .= \"<table class='summary highlight'>\\n\";\n    \n    if(not $CompareDirs or $TargetName)\n    {\n        if($CheckMode eq \"Group\") {\n            $TestInfo .= \"<tr><th class='left'>Group Name</th><td>\".$Group{\"Name\"}.\"</td></tr>\\n\";\n        }\n        else {\n            $TestInfo .= \"<tr><th class='left'>Package Name</th><td>\".getTitle().\"</td></tr>\\n\";\n        }\n    }\n    \n    if(not $CompareDirs)\n    {\n        my @Formats = sort keys(%{$Group{\"Format\"}});\n        $TestInfo .= \"<tr><th class='left'>Package Format</th><td>\".join(\", \", @Formats).\"</td></tr>\\n\";\n        if($Group{\"Arch\"}) {\n            $TestInfo .= \"<tr><th class='left'>Package Arch</th><td>\".$Group{\"Arch\"}.\"</td></tr>\\n\";\n        }\n    }\n    \n    $TestInfo .= \"<tr><th class='left'>Version #1</th><td>\".$Group{\"V1\"}.\"</td></tr>\\n\";\n    $TestInfo .= \"<tr><th class='left'>Version #2</th><td>\".$Group{\"V2\"}.\"</td></tr>\\n\";\n    if($QuickMode) {\n        $TestInfo .= \"<tr><th class='left'>Mode</th><td>Quick</td></tr>\\n\";\n    }\n    $TestInfo .= \"</table>\\n\";\n\n    my $TestResults = \"<h2>Test Results</h2>\\n\";\n    $TestResults .= \"<table class='summary highlight'>\\n\";\n    \n    if(not $CompareDirs)\n    {\n        my $Packages_Link = \"0\";\n        my %TotalPackages = map {$_=>1} (keys(%{$TargetPackages{1}}), keys(%{$TargetPackages{2}}));\n        if(keys(%TotalPackages)>0) {\n            $Packages_Link = \"<a href='#Packages' style='color:Blue;'>\".keys(%TotalPackages).\"</a>\";\n        }\n        $TestResults .= \"<tr><th class='left'>Total Packages</th><td>\".$Packages_Link.\"</td></tr>\\n\";\n    }\n    \n    my $Deps_Link = \"0\";\n    if(keys(%TotalDeps)>0) {\n        $Deps_Link = \"<a href='#Deps' style='color:Blue;'>\".keys(%TotalDeps).\"</a>\";\n    }\n    if($Group{\"Format\"}{\"DEB\"} or $Group{\"Format\"}{\"RPM\"} or $Group{\"Format\"}{\"SRPM\"}) {\n        $TestResults .= \"<tr><th class='left'>Total Dependencies</th><td>\".$Deps_Link.\"</td></tr>\\n\";\n    }\n    \n    my $Files_Link = \"0\";\n    my %TotalFiles = map {$_=>1} (keys(%{$PackageFiles{1}}), keys(%{$PackageFiles{2}}));\n    if(keys(%TotalFiles)>0) {\n        $Files_Link = \"<a href='#Files' style='color:Blue;'>\".keys(%TotalFiles).\"</a>\";\n    }\n    $TestResults .= \"<tr><th class='left'>Total Files</th><td>\".$Files_Link.\"</td></tr>\\n\";\n\n    if(my $UsedBy = keys(%TotalUsage)) {\n        $TestResults .= \"<tr><th class='left'>Usage In Other<br/>Packages</th><td><a href='#Usage'>$UsedBy</a></td></tr>\\n\";\n    }\n    \n    my ($TotalChanged, $Total) = (0, 0);\n    # Files\n    foreach my $Format (sort keys(%FileChanges))\n    {\n        $TotalChanged += $FileChanges{$Format}{\"SizeDelta\"};\n        $Total += $FileChanges{$Format}{\"Size\"};\n    }\n    # Deps\n    foreach my $Kind (keys(%DepChanges))\n    {\n        $TotalChanged += $DepChanges{$Kind}{\"SizeDelta\"};\n        $Total += $DepChanges{$Kind}{\"Size\"};\n    }\n    # Info\n    $TotalChanged += $InfoChanges{\"SizeDelta\"};\n    $Total += $InfoChanges{\"Size\"};\n    \n    my $Affected = 0;\n    if($Total) {\n        $Affected = 100*$TotalChanged/$Total;\n    }\n    $Affected = showNumber($Affected);\n    if($Affected>=100) {\n        $Affected = 100;\n    }\n    $RESULT{\"affected\"} = $Affected;\n    \n    my $Verdict = \"\";\n    if($TotalChanged)\n    {\n        $Verdict = \"<span style='color:Red;'><b>Changed<br/>(\".$Affected.\"%)</b></span>\";\n        $RESULT{\"status\"} = \"Changed\";\n    }\n    else\n    {\n        $Verdict = \"<span style='color:Green;'><b>Unchanged</b></span>\";\n        $RESULT{\"status\"} = \"Unchanged\";\n    }\n    $TestResults .= \"<tr><th class='left'>Verdict</th><td>$Verdict</td></tr>\\n\";\n    $TestResults .= \"</table>\\n\";\n    \n    if(defined $ABI_Change{\"Total\"})\n    {\n        $TestResults .= \"<h2>ABI Status</h2>\\n\";\n        $TestResults .= \"<table class='summary highlight'>\\n\";\n        $TestResults .= \"<tr><th class='left'>Total Objects<br/>(with debug-info)</th><td>\".$ABI_Change{\"Total\"}.\"</td></tr>\\n\";\n        my $Status = $ABI_Change{\"Bin\"}/$ABI_Change{\"Total\"};\n        if($Status==100) {\n            $TestResults .= \"<tr><th class='left'>ABI Compatibility</th><td><span style='color:Green;'><b>100%</b></span></td></tr>\\n\";\n        }\n        else {\n            $TestResults .= \"<tr><th class='left'>ABI Compatibility</th><td><span style='color:Red;'><b>\".showNumber(100-$Status).\"%</b></span></td></tr>\\n\";\n        }\n        $TestResults .= \"</table>\\n\";\n    }\n    \n    my $FileChgs = \"<a name='Files'></a><h2>Changes In Files</h2>\\n\";\n    \n    if(keys(%TotalFiles))\n    {\n        $FileChgs .= \"<table class='summary highlight'>\\n\";\n        $FileChgs .= \"<tr>\";\n        $FileChgs .= \"<th>File Type</th>\";\n        $FileChgs .= \"<th>Total</th>\";\n        $FileChgs .= \"<th>Added</th>\";\n        $FileChgs .= \"<th>Removed</th>\";\n        $FileChgs .= \"<th>Changed</th>\";\n        $FileChgs .= \"</tr>\\n\";\n        foreach my $Format (sort {$FormatInfo{$b}{\"Weight\"}<=>$FormatInfo{$a}{\"Weight\"}}\n        sort {lc($FormatInfo{$a}{\"Summary\"}) cmp lc($FormatInfo{$b}{\"Summary\"})} keys(%FormatInfo))\n        {\n            my $Total = $FileChanges{$Format}{\"Total\"};\n            \n            if($HideUnchanged) {\n                $Total = $FileChanges{$Format}{\"Added\"} + $FileChanges{$Format}{\"Removed\"} + $FileChanges{$Format}{\"Changed\"};\n            }\n            \n            if(not $Total) {\n                next;\n            }\n            \n            if($HideUnchanged)\n            {\n                if(not $Total)\n                { # do not show unchanged files\n                    next;\n                }\n                \n                $FileChanges{$Format}{\"Total\"} = $Total;\n            }\n            \n            $FileChgs .= \"<tr>\\n\";\n            $FileChgs .= \"<td class='left'>\".$FormatInfo{$Format}{\"Summary\"}.\"</td>\\n\";\n            foreach (\"Total\", \"Added\", \"Removed\", \"Changed\")\n            {\n                if($FileChanges{$Format}{$_}>0)\n                {\n                    my $Link = \"<a href='#\".$FormatInfo{$Format}{\"Anchor\"}.\"' style='color:Blue;'>\".$FileChanges{$Format}{$_}.\"</a>\";\n                    if($_ eq \"Added\") {\n                        $FileChgs .= \"<td class='new'>\".$Link.\"</td>\\n\";\n                    }\n                    elsif($_ eq \"Removed\") {\n                        $FileChgs .= \"<td class='failed'>\".$Link.\"</td>\\n\";\n                    }\n                    elsif($_ eq \"Changed\") {\n                        $FileChgs .= \"<td class='warning'>\".$Link.\"</td>\\n\";\n                    }\n                    else {\n                        $FileChgs .= \"<td>\".$Link.\"</td>\\n\";\n                    }\n                }\n                else {\n                    $FileChgs .= \"<td>0</td>\\n\";\n                }\n            }\n            $FileChgs .= \"</tr>\\n\";\n        }\n        $FileChgs .= \"</table>\\n\";\n    }\n    else\n    {\n        $FileChgs .= \"No files\\n\";\n    }\n    \n    return $TestInfo.$TestResults.getReportHeaders().getReportDeps().$FileChgs;\n}\n\nsub getSource()\n{\n    my $Packages = \"<a name='Packages'></a>\\n\";\n    my %Pkgs = map {$_=>1} (keys(%{$TargetPackages{1}}), keys(%{$TargetPackages{2}}));\n    $Packages .= \"<h2>Packages (\".keys(%Pkgs).\")</h2>\\n\";\n    $Packages .= \"<div class='p_list'>\\n\";\n    foreach my $Name (sort keys(%Pkgs)) {\n        $Packages .= $Name.\"<br/>\\n\";\n    }\n    $Packages .= \"</div>\\n\";\n    return $Packages;\n}\n\nsub createReport($)\n{\n    my $Path = $_[0];\n\n    my $CssStyles = getModulePath(\"Styles\", \"Index.css\");\n    my $JScripts = getModulePath(\"Scripts\", \"Sort.js\");\n    my $VeraMono = getModulePath(\"Fonts\", \"VeraMono.ttf\");\n    my $OpenSans = getModulePath(\"Fonts\", \"OpenSans.ttf\");\n\n    my $StuffDir = getDirname($Path);\n    my $SuffixDir = \"\";\n    if($MoveStyles) {\n        $SuffixDir = $MoveStyles;\n    }\n\n    my $EmbedStyles = $StuffDir.\"/\".$SuffixDir.\"css/Index.css\";\n    my $EmbedJS = $StuffDir.\"/\".$SuffixDir.\"js/Sort.js\";\n    my $EmbedVeraMono = $StuffDir.\"/\".$SuffixDir.\"fonts/VeraMono.ttf\";\n    my $EmbedOpenSans = $StuffDir.\"/\".$SuffixDir.\"fonts/OpenSans.ttf\";\n\n    mkpath(getDirname($EmbedStyles));\n    mkpath(getDirname($EmbedJS));\n    mkpath(getDirname($EmbedVeraMono));\n\n    copy($CssStyles, $EmbedStyles);\n    copy($JScripts, $EmbedJS);\n    copy($VeraMono, $EmbedVeraMono);\n    copy($OpenSans, $EmbedOpenSans);\n\n    printMsg(\"INFO\", \"creating report ...\");\n    \n    my $Title = undef;\n    my $Keywords = undef;\n    \n    if($CompareDirs and not $TargetName)\n    {\n        $Title = \"Changes report between \".$Group{\"Name1\"}.\"/ and \".$Group{\"Name2\"}.\"/ directories\";\n        $Keywords = $Group{\"Name1\"}.\", \".$Group{\"Name2\"}.\", changes, report\";\n    }\n    else\n    {\n        $Title = getTitle().\": \".$Group{\"V1\"}.\" to \".$Group{\"V2\"}.\" changes report\";\n        $Keywords = getTitle().\", changes, report\";\n    }\n    \n    my $Header = getHeader();\n    my $Description = $Header;\n    $Description=~s/<[^<>]+>//g;\n    \n    my $Report = $Header.\"\\n\";\n    my $MainReport = getReportFiles();\n    \n    my $Legend = \"<table class='summary highlight'>\n    <tr><td class='new' width='80px'>added</td><td class='passed' width='80px'>unchanged</td></tr>\n    <tr><td class='warning'>changed</td><td class='failed'>removed</td></tr></table>\\n\";\n    \n    $Report .= $Legend;\n    $Report .= getSummary();\n    $Report .= $MainReport;\n    \n    if(not $CompareDirs)\n    {\n        $Report .= getReportUsage();\n        $Report .= getSource();\n    }\n    \n    $Report .= \"<br/><a class='top_ref' href='#Top'>to the top</a><br/>\\n\";\n    \n    $STAT_LINE = \"changed:\".$RESULT{\"affected\"}.\";\".$STAT_LINE.\"tool_version:\".$TOOL_VERSION;\n    $Report = \"<!-- $STAT_LINE -->\\n\".composeHTMLHead($Title, $Keywords, $Description, $SuffixDir.\"css/Index.css\", $SuffixDir.\"js/Sort.js\", \"\").\"\\n<body>\\n<div><a name='Top'></a>\\n\".$Report;\n    $Report .= \"</div>\\n<br/><hr/>\\n\";\n    \n    # footer\n    $Report .= \"<div class='footer' style='width:100%;' align='center'><a href='\".$HomePage.\"'>github.com/lvc/pkgdiff</a></div><br/>\\n\";\n    \n    $Report .= \"</body></html>\";\n    writeFile($Path, $Report);\n    \n    if($RESULT{\"status\"} eq \"Changed\") {\n        printMsg(\"INFO\", \"result: CHANGED (\".$RESULT{\"affected\"}.\"%)\");\n    }\n    else {\n        printMsg(\"INFO\", \"result: UNCHANGED\");\n    }\n    \n    printMsg(\"INFO\", \"report: $Path\");\n}\n\nsub checkCmd($)\n{\n    my $Cmd = $_[0];\n    \n    if(defined $Cache{\"checkCmd\"}{$Cmd}) {\n        return $Cache{\"checkCmd\"}{$Cmd};\n    }\n    foreach my $Path (sort {length($a)<=>length($b)} split(/:/, $ENV{\"PATH\"}))\n    {\n        if(-x $Path.\"/\".$Cmd) {\n            return ($Cache{\"checkCmd\"}{$Cmd} = 1);\n        }\n    }\n    return ($Cache{\"checkCmd\"}{$Cmd} = 0);\n}\n\nsub readFileTypes()\n{\n    my $FileTypes = readFile($MODULES_DIR.\"/FileType.xml\");\n    while(my $FileType = parseTag(\\$FileTypes, \"type\"))\n    {\n        my $ID = parseTag(\\$FileType, \"id\");\n        if(not $ID) {\n            next;\n        }\n        $FormatInfo{$ID}{\"ID\"} = $ID;\n        if(my $Summary = parseTag(\\$FileType, \"summary\")) {\n            $FormatInfo{$ID}{\"Summary\"} = $Summary;\n        }\n        if(my $Title = parseTag(\\$FileType, \"title\")) {\n            $FormatInfo{$ID}{\"Title\"} = $Title;\n        }\n        $FormatInfo{$ID}{\"Weight\"} = parseTag(\\$FileType, \"weight\");\n        if(my $Anchor = parseTag(\\$FileType, \"anchor\")) {\n            $FormatInfo{$ID}{\"Anchor\"} = $Anchor;\n        }\n        if(my $Format = parseTag(\\$FileType, \"format\")) {\n            $FormatInfo{$ID}{\"Format\"} = $Format;\n        }\n        foreach my $Ext (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"extensions\")))\n        {\n            $FormatInfo{$ID}{\"Ext\"}{$Ext} = 1;\n            $FileFormat{\"Ext\"}{$Ext} = $ID;\n        }\n        foreach my $Ext (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"iextensions\")))\n        {\n            $FormatInfo{$ID}{\"iExt\"}{lc($Ext)} = 1;\n            $FileFormat{\"iExt\"}{lc($Ext)} = $ID;\n        }\n        foreach my $Name (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"names\")))\n        {\n            $FormatInfo{$ID}{\"Name\"}{$Name} = 1;\n            $FileFormat{\"Name\"}{$Name} = $ID;\n        }\n        foreach my $Name (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"inames\")))\n        {\n            $FormatInfo{$ID}{\"iName\"}{lc($Name)} = 1;\n            $FileFormat{\"iName\"}{lc($Name)} = $ID;\n        }\n        foreach my $Term (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"terms\")))\n        {\n            $Term=~s/\\s+/_/g;\n            $TermFormat{uc($Term)} = $ID;\n        }\n        foreach my $Dir (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"dirs\")))\n        {\n            $DirFormat{$Dir} = $ID;\n        }\n        foreach my $Bytes (split(/\\s*(\\n|,)\\s*/, parseTag(\\$FileType, \"bytes\")))\n        {\n            $BytesFormat{$Bytes} = $ID;\n        }\n    }\n    foreach my $Format (keys(%FormatInfo))\n    {\n        if(not $FormatInfo{$Format}{\"Title\"}) {\n            $FormatInfo{$Format}{\"Title\"} = autoTitle($FormatInfo{$Format}{\"Summary\"});\n        }\n        if(not $FormatInfo{$Format}{\"Anchor\"}) {\n            $FormatInfo{$Format}{\"Anchor\"} = autoAnchor($FormatInfo{$Format}{\"Title\"});\n        }\n    }\n}\n\nsub autoTitle($)\n{\n    my $Summary = $_[0];\n    my $Title = $Summary;\n    while($Title=~/ ([a-z]+)/)\n    {\n        my ($W, $UW) = ($1, ucfirst($1));\n        $Title=~s/ $W/ $UW/g;\n    }\n    if($Title!~/data\\Z/i)\n    {\n        if(not $Title=~s/y\\Z/ies/)\n        { # scripts, files, libraries\n            if(not $Title=~s/ss\\Z/sses/)\n            { # classes\n                if(not $Title=~s/ch\\Z/ches/)\n                { # patches\n                    $Title .= \"s\";\n                }\n            }\n        }\n    }\n    return $Title;\n}\n\nsub autoAnchor($)\n{\n    my $Title = $_[0];\n    my $Anchor = $Title;\n    $Anchor=~s/\\+\\+/PP/g;\n    $Anchor=~s/C#/CS/g;\n    $Anchor=~s/\\W//g;\n    return $Anchor;\n}\n\nsub getDumpversion($)\n{\n    my $Cmd = $_[0];\n    return `$Cmd -dumpversion 2>$TMP_DIR/null`;\n}\n\nsub cmpVersions($$)\n{ # compare two versions in dotted-numeric format\n    my ($V1, $V2) = @_;\n    return 0 if($V1 eq $V2);\n    return undef if($V1!~/\\A\\d+[\\.\\d+]*\\Z/);\n    return undef if($V2!~/\\A\\d+[\\.\\d+]*\\Z/);\n    my @V1Parts = split(/\\./, $V1);\n    my @V2Parts = split(/\\./, $V2);\n    for (my $i = 0; $i <= $#V1Parts && $i <= $#V2Parts; $i++) {\n        return -1 if(int($V1Parts[$i]) < int($V2Parts[$i]));\n        return 1 if(int($V1Parts[$i]) > int($V2Parts[$i]));\n    }\n    return -1 if($#V1Parts < $#V2Parts);\n    return 1 if($#V1Parts > $#V2Parts);\n    return 0;\n}\n\nsub getArchivePattern()\n{\n    my @Groups = ();\n    foreach (sort {length($b)<=>length($a)} keys(%ArchiveFormats))\n    {\n        my @Fmts = @{$ArchiveFormats{$_}};\n        $ArchiveFormats{$_} = join(\"|\", @Fmts);\n        $ArchiveFormats{$_}=~s/\\./\\\\./g;\n        push(@Groups, $ArchiveFormats{$_});\n    }\n    return join(\"|\", @Groups);\n}\n\nsub encodeUrl($)\n{\n    my $Url = $_[0];\n    $Url=~s/#/\\%23/g;\n    return $Url;\n}\n\nsub scenario()\n{\n    if($Help)\n    {\n        helpMsg();\n        exit(0);\n    }\n    if($ShowVersion)\n    {\n        printMsg(\"INFO\", \"Package Changes Analyzer (PkgDiff) $TOOL_VERSION\\nCopyright (C) 2022 Andrey Ponomarenko's ABI Laboratory\\nLicense: GNU 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);\n    }\n    if($DumpVersion)\n    {\n        printMsg(\"INFO\", $TOOL_VERSION);\n        exit(0);\n    }\n    if($GenerateTemplate)\n    {\n        generateTemplate();\n        exit(0);\n    }\n    \n    if(checkModule(\"File/LibMagic.pm\"))\n    {\n        $USE_LIBMAGIC = 1;\n        require File::LibMagic;\n    }\n    else {\n        printMsg(\"WARNING\", \"perl-File-LibMagic is not installed\");\n    }\n    \n    if(not $DiffWidth) {\n        $DiffWidth = $DEFAULT_WIDTH;\n    }\n    if(not $DiffLines) {\n        $DiffLines = $DIFF_PRE_LINES;\n    }\n    if($CheckUsage)\n    {\n        if(not $PackageManager) {\n            exitStatus(\"Error\", \"-pkg-manager option is not specified\");\n        }\n    }\n    if(not -f $DIFF) {\n        exitStatus(\"Not_Found\", \"can't access \\\"$DIFF\\\"\");\n    }\n    \n    if(not checkCmd(\"wdiff\")) {\n        print STDERR \"WARNING: wdiff is not installed\\n\";\n    }\n    \n    if(not $LinksTarget)\n    {\n        $LinksTarget = \"_self\";\n    }\n    else\n    {\n        if($LinksTarget!~/\\A(_blank|_self)\\Z/)\n        {\n            exitStatus(\"Error\", \"incorrect value of links target\");\n        }\n    }\n    \n    if($ShowDetails)\n    {\n        if(my $V = getDumpversion($ACC))\n        {\n            if(cmpVersions($V, $ACC_VER)==-1)\n            {\n                printMsg(\"ERROR\", \"the version of ABI Compliance Checker should be $ACC_VER or newer\");\n                $ACC = undef;\n            }\n        }\n        else\n        {\n            printMsg(\"ERROR\", \"cannot find ABI Compliance Checker\");\n            $ACC = undef;\n        }\n        \n        if(my $V = getDumpversion($ABI_DUMPER))\n        {\n            if(cmpVersions($V, $ABI_DUMPER_VER)==-1)\n            {\n                printMsg(\"ERROR\", \"the version of ABI Dumper should be $ABI_DUMPER_VER or newer\");\n                $ABI_DUMPER = undef;\n            }\n        }\n        else\n        {\n            printMsg(\"ERROR\", \"cannot find ABI Dumper\");\n            $ABI_DUMPER = undef;\n        }\n    }\n    if(not $Descriptor{1}) {\n        exitStatus(\"Error\", \"-old option is not specified\");\n    }\n    \n    if(not $Descriptor{2}) {\n        exitStatus(\"Error\", \"-new option is not specified\");\n    }\n    \n    \n    if($CompareDirs)\n    {\n        if(not -d $Descriptor{1}) {\n            exitStatus(\"Access_Error\", \"can't access directory \\'\".$Descriptor{1}.\"\\'\");\n        }\n        if(not -d $Descriptor{2}) {\n            exitStatus(\"Access_Error\", \"can't access directory \\'\".$Descriptor{2}.\"\\'\");\n        }\n        $Descriptor{1} = getAbsPath($Descriptor{1});\n        $Descriptor{2} = getAbsPath($Descriptor{2});\n    }\n    else\n    {\n        if(not -f $Descriptor{1}) {\n            exitStatus(\"Access_Error\", \"can't access file \\'\".$Descriptor{1}.\"\\'\");\n        }\n        if(not -f $Descriptor{2}) {\n            exitStatus(\"Access_Error\", \"can't access file \\'\".$Descriptor{2}.\"\\'\");\n        }\n    }\n    \n    readFileTypes();\n    \n    if($CompareDirs) {\n        printMsg(\"INFO\", \"Reading directories ...\");\n    }\n    else {\n        printMsg(\"INFO\", \"Reading packages ...\");\n    }\n    \n    my $Fmt1 = getFormat($Descriptor{1});\n    my $Fmt2 = getFormat($Descriptor{2});\n    \n    my ($Ph1, $Ph2) = ();\n    \n    if($CompareDirs and $Fmt1 eq \"DIR\")\n    {\n        $RemovePrefix{1} = getDirname($Descriptor{1});\n        $RemovePrefix{2} = getDirname($Descriptor{2});\n    }\n    elsif($Fmt1 eq \"ARCHIVE\" and $Fmt2 eq \"ARCHIVE\")\n    { # check if we can remove a common prefix from files of BOTH packages\n        ($Ph1->{\"CPath\"}, $Ph1->{\"Attr\"}) = readPackage($Descriptor{1}, 1);\n        ($Ph2->{\"CPath\"}, $Ph2->{\"Attr\"}) = readPackage($Descriptor{2}, 2);\n        \n        my @Cnt1 = listDir($Ph1->{\"CPath\"});\n        my @Cnt2 = listDir($Ph2->{\"CPath\"});\n        if($#Cnt1==0 and $#Cnt2==0)\n        {\n            if(-d $Ph1->{\"CPath\"}.\"/\".$Cnt1[0] and -d $Ph2->{\"CPath\"}.\"/\".$Cnt2[0])\n            {\n                $RemovePrefix{1} = $Cnt1[0];\n                $RemovePrefix{2} = $Cnt2[0];\n            }\n        }\n    }\n    \n    if($CompareDirs and $Fmt1 eq \"DIR\")\n    {\n        registerPackage($Descriptor{1}, 1);\n        $Group{\"Name1\"} = getFilename($Descriptor{1});\n        if($TargetVersion{1}) {\n            $Group{\"V1\"} = $TargetVersion{1};\n        }\n        else {\n            $Group{\"V1\"} = \"X\";\n        }\n    }\n    elsif($Fmt1=~/\\A(RPM|SRPM|DEB|ARCHIVE)\\Z/)\n    {\n        my $Attr = registerPackage($Descriptor{1}, 1, $Ph1);\n        $Group{\"Name1\"} = $Attr->{\"Name\"};\n        $Group{\"V1\"} = $Attr->{\"Version\"};\n        $Group{\"Arch1\"} = $Attr->{\"Arch\"};\n        \n        if(defined $TargetVersion{1}) {\n            $Group{\"V1\"} = $TargetVersion{1};\n        }\n    }\n    else\n    {\n        if($Descriptor{1}=~/\\.(\\w+)\\Z/)\n        {\n            if($1 ne \"xml\") {\n                exitStatus(\"Error\", \"unknown format \\\"$1\\\"\");\n            }\n        }\n        readDescriptor(1, $Descriptor{1});\n    }\n    \n    if($CompareDirs and $Fmt1 eq \"DIR\")\n    {\n        registerPackage($Descriptor{2}, 2);\n        $Group{\"Name2\"} = getFilename($Descriptor{2});\n        if($TargetVersion{2}) {\n            $Group{\"V2\"} = $TargetVersion{2};\n        }\n        else {\n            $Group{\"V2\"} = \"Y\";\n        }\n    }\n    elsif($Fmt2=~/\\A(RPM|SRPM|DEB|ARCHIVE)\\Z/)\n    {\n        my $Attr = registerPackage($Descriptor{2}, 2, $Ph2);\n        $Group{\"Name2\"} = $Attr->{\"Name\"};\n        $Group{\"V2\"} = $Attr->{\"Version\"};\n        $Group{\"Arch2\"} = $Attr->{\"Arch\"};\n        \n        if(defined $TargetVersion{2}) {\n            $Group{\"V2\"} = $TargetVersion{2};\n        }\n    }\n    else\n    {\n        if($Descriptor{2}=~/\\.(\\w+)\\Z/)\n        {\n            if($1 ne \"xml\") {\n                exitStatus(\"Error\", \"unknown format \\\"$1\\\"\");\n            }\n        }\n        readDescriptor(2, $Descriptor{2});\n    }\n    if($Group{\"Count1\"}>1\n    or $Group{\"Count2\"}>1) {\n        $CheckMode = \"Group\";\n    }\n    \n    if($CompareDirs)\n    {\n        if($TargetName)\n        {\n            $Group{\"Name\"} = $TargetName;\n        }\n    }\n    else\n    {\n        $Group{\"Name\"} = $Group{\"Name1\"};\n        if($Group{\"Name1\"} ne $Group{\"Name2\"})\n        {\n            if($CheckMode eq \"Group\") {\n                printMsg(\"WARNING\", \"different group names in descriptors (\\\"\".$Group{\"Name1\"}.\"\\\" and \\\"\".$Group{\"Name2\"}.\"\\\")\");\n            }\n            else {\n                printMsg(\"WARNING\", \"different package names (\\\"\".$Group{\"Name1\"}.\"\\\" and \\\"\".$Group{\"Name2\"}.\"\\\")\");\n            }\n        }\n    }\n    if($Group{\"Count1\"} ne $Group{\"Count2\"}) {\n        printMsg(\"WARNING\", \"different number of packages in descriptors\");\n    }\n    if(defined $Group{\"Arch1\"} and defined $Group{\"Arch2\"})\n    {\n        $Group{\"Arch\"} = $Group{\"Arch1\"};\n        if($Group{\"Arch1\"} ne $Group{\"Arch2\"}) {\n            printMsg(\"WARNING\", \"different architectures of packages (\\\"\".$Group{\"Arch1\"}.\"\\\" and \\\"\".$Group{\"Arch2\"}.\"\\\")\");\n        }\n    }\n    if(defined $Group{\"Format\"}{\"DEB\"}\n    and defined $Group{\"Format\"}{\"RPM\"}) {\n        printMsg(\"WARNING\", \"incompatible package formats: RPM and DEB\");\n    }\n    if($OutputReportPath)\n    { # user-defined path\n        $REPORT_PATH = $OutputReportPath;\n        $REPORT_DIR = getDirname($REPORT_PATH);\n        if(not $REPORT_DIR) {\n            $REPORT_DIR = \".\";\n        }\n    }\n    else\n    {\n        if($CompareDirs and not $TargetName)\n        {\n            $REPORT_DIR = \"pkgdiff_reports/\".$Group{\"Name1\"}.\"_to_\".$Group{\"Name2\"};\n        }\n        else\n        {\n            $REPORT_DIR = \"pkgdiff_reports/\".$Group{\"Name\"}.\"/\".$Group{\"V1\"}.\"_to_\".$Group{\"V2\"};\n        }\n        $REPORT_PATH = $REPORT_DIR.\"/changes_report.html\";\n        if(-d $REPORT_DIR)\n        {\n            foreach my $E (\"info-diffs\", \"diffs\", \"details\") {\n                rmtree($REPORT_DIR.\"/\".$E);\n            }\n        }\n    }\n    \n    if($CompareDirs) {\n        printMsg(\"INFO\", \"Comparing directories ...\");\n    }\n    else {\n        printMsg(\"INFO\", \"Comparing packages ...\");\n    }\n    \n    detectChanges();\n    createReport($REPORT_PATH);\n    \n    foreach my $E (\"info-diffs\", \"diffs\", \"details\")\n    {\n        if(not listDir($REPORT_DIR.\"/\".$E)) {\n            rmtree($REPORT_DIR.\"/\".$E);\n        }\n    }\n    \n    if($ExtraInfo) {\n        writeExtraInfo();\n    }\n    \n    if($CustomTmpDir) {\n        cleanTmp();\n    }\n    \n    exit($ERROR_CODE{$RESULT{\"status\"}});\n}\n\nscenario();\n"
  }
]