Full Code of lvc/pkgdiff for AI

master 56af1b018404 cached
14 files
245.9 KB
73.9k tokens
2 symbols
1 requests
Download .txt
Showing preview only (254K chars total). Download the full file or copy to clipboard to get everything.
Repository: lvc/pkgdiff
Branch: master
Commit: 56af1b018404
Files: 14
Total size: 245.9 KB

Directory structure:
gitextract_un2554x0/

├── .github/
│   └── FUNDING.yml
├── INSTALL
├── LICENSE
├── Makefile
├── Makefile.pl
├── README.md
├── doc/
│   └── index.html
├── modules/
│   ├── FileType.xml
│   └── Internals/
│       ├── Scripts/
│       │   └── Sort.js
│       ├── Styles/
│       │   ├── Index.css
│       │   └── View.css
│       └── Tools/
│           ├── java-dump.sh
│           └── rfcdiff-1.41-CUSTOM.sh
└── pkgdiff.pl

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms

patreon: LINUXABI
custom: https://abi-laboratory.pro/?view=donate


================================================
FILE: INSTALL
================================================

Copyright (C) 2012-2025 Andrey Ponomarenko's ABI Laboratory
All rights reserved.


RELEASE INFORMATION

Project:           Package Changes Analyzer (pkgdiff)
Version:           1.8
Date:              2025-01-11


This file explains how to install and setup environment
for the tool in your computer.


Content:

   1. Requirements for Linux and FreeBSD
   2. Requirements for Mac OS X
   3. Configure and Install
   4. Usage


1. REQUIREMENTS FOR LINUX AND FREEBSD
=====================================

   1. Perl 5 (5.8 or newer)
   2. GNU Diff
   3. GNU Wdiff
   4. GNU Awk
   5. GNU Binutils (readelf)
   6. Perl-File-LibMagic

1.1 Analysis of RPM packages

   RPM (rpm, rpm2cpio)

1.2 Analysis of DEB packages

   DPKG (dpkg, dpkg-deb)

1.3 Suggestions

   1. ABI Compliance Checker (1.99.1 or newer)
   2. ABI Dumper (0.97 or newer)



2. REQUIREMENTS FOR MAC OS X
============================

   1. Perl 5 (5.8 or newer)
   2. GNU Diff
   3. GNU Wdiff
   4. GNU Awk
   5. Xcode (otool)

2.1 Suggestions

   1. ABI Compliance Checker (1.99.1 or newer)
   2. ABI Dumper (0.97 or newer)



3. CONFIGURE AND INSTALL
========================

   This command will install the pkgdiff program into the
   PREFIX/bin system directory and private modules into the PREFIX/share:

     sudo make install prefix=PREFIX [/usr, /usr/local, ...]

3.1 Remove

     sudo make uninstall prefix=PREFIX



4. USAGE
========

   Compare two packages:

     pkgdiff PKG1 PKG2
     
   For advanced usage, see output of --help option



Enjoy!


================================================
FILE: LICENSE
================================================
            GNU GENERAL PUBLIC LICENSE
               Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

            GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

             END OF TERMS AND CONDITIONS

        How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

================================================
FILE: Makefile
================================================
prefix ?= /usr

.PHONY: install
install:
	perl Makefile.pl -install -prefix "$(prefix)"

uninstall:
	perl Makefile.pl -remove -prefix "$(prefix)"


================================================
FILE: Makefile.pl
================================================
#!/usr/bin/perl
###########################################################################
# Makefile for PkgDiff
# Install/remove the tool for GNU/Linux, FreeBSD and Mac OS X
#
# Copyright (C) 2012-2015 Andrey Ponomarenko's ABI Laboratory
#
# Written by Andrey Ponomarenko
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
###########################################################################
use Getopt::Long;
Getopt::Long::Configure ("posix_default", "no_ignore_case");
use File::Path qw(mkpath rmtree);
use File::Copy qw(copy);
use File::Basename qw(dirname);
use Cwd qw(abs_path);
use File::Find;
use strict;

my $TOOL_SNAME = "pkgdiff";
my $ARCHIVE_DIR = abs_path(dirname($0));

my $HELP_MSG = "
NAME:
  Makefile for pkgdiff

DESCRIPTION:
  Install $TOOL_SNAME command and private modules.

USAGE:
  sudo perl $0 -install -prefix /usr
  sudo perl $0 -remove -prefix /usr

OPTIONS:
  -h|-help
      Print this help.

  --prefix=PREFIX
      Install files in PREFIX [/usr].

  -install
      Command to install the tool.

  -remove
      Command to remove the tool.

EXTRA OPTIONS:
  --destdir=DESTDIR
      This option is for maintainers to build
      RPM or DEB packages inside the build root.
      The environment variable DESTDIR is also
      supported.
\n";

if(not @ARGV) {
    print $HELP_MSG;
    exit(0);
}

my ($PREFIX, $DESTDIR, $Help, $Install, $Remove);

GetOptions(
    "h|help!" => \$Help,
    "prefix=s" => \$PREFIX,
    "destdir=s" => \$DESTDIR,
    "install!" => \$Install,
    "remove!" => \$Remove
) or exit(1);

sub scenario()
{
    if($Help)
    {
        print $HELP_MSG;
        exit(0);
    }
    if(not $Install and not $Remove)
    {
        print STDERR "ERROR: command is not selected (-install or -remove)\n";
        exit(1);
    }
    
    if($Install)
    { # remove old version first
        $Remove = 1;
    }
    
    if($PREFIX ne "/") {
        $PREFIX=~s/[\/]+\Z//g;
    }
    if(not $PREFIX)
    { # default prefix
        $PREFIX = "/usr";
    }
    if(my $Var = $ENV{"DESTDIR"})
    {
        print "Using DESTDIR environment variable\n";
        $DESTDIR = $Var;
    }
    if($DESTDIR)
    {
        if($DESTDIR ne "/") {
            $DESTDIR=~s/[\/]+\Z//g;
        }
        if($DESTDIR!~/\A\//)
        {
            print STDERR "ERROR: destdir is not absolute path\n";
            exit(1);
        }
        if(not -d $DESTDIR)
        {
            print STDERR "ERROR: you should create destdir directory first\n";
            exit(1);
        }
        $PREFIX = $DESTDIR.$PREFIX;
        if(not -d $PREFIX)
        {
            print STDERR "ERROR: you should create installation directory first (destdir + prefix):\n  mkdir -p $PREFIX\n";
            exit(1);
        }
    }
    else
    {
        if($PREFIX!~/\A\//)
        {
            print STDERR "ERROR: prefix is not absolute path\n";
            exit(1);
        }
        if(not -d $PREFIX)
        {
            print STDERR "ERROR: you should create prefix directory first\n";
            exit(1);
        }
    }
    
    print "INSTALL PREFIX: $PREFIX\n";
    
    # paths
    my $EXE_PATH = "$PREFIX/bin";
    my $MODULES_PATH = "$PREFIX/share/$TOOL_SNAME";
    my $REL_PATH = "../share/$TOOL_SNAME";
    
    if(not -w $PREFIX)
    {
        print STDERR "ERROR: you should be root\n";
        exit(1);
    }
    if($Remove)
    {
        if(-e $EXE_PATH."/".$TOOL_SNAME)
        { # remove executable
            print "-- Removing $EXE_PATH/$TOOL_SNAME\n";
            unlink($EXE_PATH."/".$TOOL_SNAME);
        }
        elsif(not $Install) {
            print "The tool is not installed\n";
        }
        
        if(-d $MODULES_PATH)
        { # remove modules
            print "-- Removing $MODULES_PATH\n";
            rmtree($MODULES_PATH);
        }
        elsif(not $Install) {
            print "The modules of the tool are not installed\n";
        }
    }
    if($Install)
    {
        # configure
        my $Content = readFile($ARCHIVE_DIR."/".$TOOL_SNAME.".pl");
        if($DESTDIR) { # relative path
            $Content=~s/MODULES_INSTALL_PATH/$REL_PATH/;
        }
        else { # absolute path
            $Content=~s/MODULES_INSTALL_PATH/$MODULES_PATH/;
        }
        
        # copy executable
        print "-- Installing $EXE_PATH/$TOOL_SNAME\n";
        mkpath($EXE_PATH);
        writeFile($EXE_PATH."/".$TOOL_SNAME, $Content);
        chmod(0755, $EXE_PATH."/".$TOOL_SNAME);
        
        # copy modules
        if(-d $ARCHIVE_DIR."/modules")
        {
            print "-- Installing $MODULES_PATH\n";
            mkpath($MODULES_PATH);
            copyDir($ARCHIVE_DIR."/modules", $MODULES_PATH);
            
            my $TOOLS_PATH = $MODULES_PATH."/modules/Internals/Tools";
            my @Tools = listDir($TOOLS_PATH);
            foreach my $Tool (@Tools) {
                chmod(0755, $TOOLS_PATH."/".$Tool);
            }
        }
        
        # check PATH
        if($ENV{"PATH"}!~/(\A|:)\Q$EXE_PATH\E[\/]?(\Z|:)/) {
            print "WARNING: your PATH variable doesn't include \'$EXE_PATH\'\n";
        }
    }
    exit(0);
}

sub listDir($)
{
    my $Path = $_[0];
    return () if(not $Path or not -d $Path);
    opendir(my $DH, $Path);
    return () if(not $DH);
    my @Contents = grep { $_ ne "." && $_ ne ".." } readdir($DH);
    return @Contents;
}

sub copyDir($$)
{
    my ($From, $To) = @_;
    my %Files;
    find(\&wanted, $From);
    sub wanted {
        $Files{$File::Find::dir."/$_"} = 1 if($_ ne ".");
    }
    foreach my $Path (sort keys(%Files))
    {
        my $Inst = $Path;
        $Inst=~s/\A\Q$ARCHIVE_DIR\E/$To/;
        if(-d $Path)
        { # directories
            mkpath($Inst);
        }
        else
        { # files
            mkpath(dirname($Inst));
            copy($Path, $Inst);
        }
    }
}

sub readFile($)
{
    my $Path = $_[0];
    return "" if(not $Path or not -f $Path);
    open(FILE, $Path) || die ("can't open file \'$Path\': $!\n");
    local $/ = undef;
    my $Content = <FILE>;
    close(FILE);
    return $Content;
}

sub writeFile($$)
{
    my ($Path, $Content) = @_;
    return if(not $Path);
    open(FILE, ">".$Path) || die ("can't open file \'$Path\': $!\n");
    print FILE $Content;
    close(FILE);
}

scenario();


================================================
FILE: README.md
================================================
PkgDiff 1.8
===========

Package Changes Analyzer (pkgdiff) — a tool for visualizing changes in Linux software packages (RPM, DEB, TAR.GZ, etc).

Contents
--------

1. [ About   ](#about)
2. [ Install ](#install)
3. [ Usage   ](#usage)

About
-----

The 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).

Sample report: https://abi-laboratory.pro/tracker/package_diff/libssh/0.6.5/0.7.0/report.html

The tool is developed by Andrey Ponomarenko.

Install
-------

    sudo make install prefix=/usr

###### Requires

* Perl 5
* GNU Diff
* GNU Wdiff
* GNU Awk
* GNU Binutils
* Perl-File-LibMagic

###### Suggests

* ABI Compliance Checker 1.99.1 or newer: https://github.com/lvc/abi-compliance-checker/
* ABI Dumper 0.97 or newer: https://github.com/lvc/abi-dumper

Usage
-----

    pkgdiff PKG1 PKG2 [options]

###### Example

    pkgdiff libssh-0.6.5.tar.xz libssh-0.7.0.tar.xz

###### Compare directories

    pkgdiff -d DIR1/ DIR2/ [options]

###### Useful options

| Option              | Meaning                                      |
|---------------------|----------------------------------------------|
| -c/-hide-unchanged  | Don't show unchanged files in the report     |
| -list-added-removed | Show content of added and removed text files |
| -skip-pattern REGEX | Don't check files matching REGEX             |
| -tmp-dir DIR        | Use custom temp directory                    |
| -d/-directories     | Compare directories instead of packages      |

###### Adv. usage

For advanced usage, see output of -help option.


================================================
FILE: doc/index.html
================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="keywords" content="pkgdiff, rpm, deb, diff, changes" />
  <meta name="description" content="A tool for visualizing changes in Linux software packages" />
  <title>pkgdiff - Package Changes Analyzer</title>

  <style type="text/css">
    body {
      margin-top: 1.0em;
      background-color: #deeef7;
      font-family: Helvetica, Arial, FreeSans, san-serif;
      color: #000000;
    }
    #container {
      margin: 0 auto;
      width: 700px;
    }
    h1 { font-size: 3.8em; color: #211108; margin-bottom: 3px;margin-top:0px;padding-top:0px;}
    h1 .small { font-size: 0.4em; }
    h1 a { text-decoration: none }
    h2 { font-size: 1.5em; color: #211108; }
    h3 { text-align: center; color: #211108; }
    a { color: #211108; }
    .description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
    .download { float: right; }
    pre { background: #000; color: #fff; padding: 15px;}
    hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
    .footer { text-align:center; padding-top:30px; font-style: italic; }
  </style>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-19501755-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>

<body>
  <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>

  <div id="container">

    <div class="download">
      <a href="https://github.com/lvc/pkgdiff/zipball/master">
        <img style="border: 0;" width="90" src="https://github.com/images/modules/download/zip.png" alt="" /></a>
      <a href="https://github.com/lvc/pkgdiff/tarball/master">
        <img style="border: 0;" width="90" src="https://github.com/images/modules/download/tar.png" alt="" /></a>
    </div>
   
    <h1><a href="https://github.com/lvc/pkgdiff">pkgdiff</a></h1>

    <div class="description">
      A tool for visualizing changes in Linux software packages
    </div>

    
      <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>
      
      <p/>
      The tool is developed by Andrey Ponomarenko: <a href='https://abi-laboratory.pro/'>https://abi-laboratory.pro/</a>

<table style='border:1px solid grey;'><tr><td>
<div>Table of Contents</div>
<ul>
<li><a href="#Downloads" rel="nofollow">Downloads</a></li>
<li><a href="#License" rel="nofollow">License</a></li>
<li><a href="#Supported_Platforms" rel="nofollow">Supported Platforms</a></li>
<li><a href="#Dependencies" rel="nofollow">Dependencies</a></li>
<li><a href="#Installation" rel="nofollow">Installation</a></li>
<li><a href="#Usage" rel="nofollow">Usage</a></li>
<li><a href="#Examples" rel="nofollow">Examples</a></li>
<li><a href="#Adv_Usage" rel="nofollow">Adv. Usage</a></li>
<li><a href="#Adv_Examples" rel="nofollow">Adv. Examples</a></li>
<li><a href="#Bugs" rel="nofollow">Bugs</a></li>
<li><a href="#Maintainers" rel="nofollow">Maintainers</a></li>
<li><a href="#ChangeLog" rel="nofollow">Changes</a></li>
</ul>
</td></tr></table>

<a name="Downloads"></a>
<h2>Downloads</h2>
<p>All releases can be downloaded from <a href="https://github.com/lvc/pkgdiff/releases">this page</a>.</p>

<p>Latest release: <a href="https://github.com/lvc/pkgdiff/archive/1.7.2.tar.gz">pkgdiff-1.7.2.tar.gz</a></p>

<p>Read-only access to the latest development version:</p>

<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;git clone git://github.com/lvc/pkgdiff&nbsp;</code>

<a name="License"></a>
<h2>License</h2>
<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>

<a name="Supported_Platforms"></a>
<h2>Supported Platforms</h2>
GNU/Linux, FreeBSD, Mac OS X
    
<a name="Dependencies"></a>
<h2>Dependencies</h2>
Requires:
<ul>
<li>
  <a href="http://www.perl.org/" rel="nofollow">Perl 5</a> (5.8 or newer)
</li>
<li>
  <a href="http://www.gnu.org/software/diffutils/" rel="nofollow">GNU Diff</a>
</li>
<li>
  <a href="http://www.gnu.org/software/wdiff/" rel="nofollow">GNU Wdiff</a>
</li>
<li>
  <a href="http://www.gnu.org/software/gawk/" rel="nofollow">GNU Awk</a>
</li>
<li>
  <a href="http://www.gnu.org/software/binutils/" rel="nofollow">GNU Binutils</a> (readelf)
</li>
<li>
  <a href="http://rpm.org/" rel="nofollow">RPM</a> (rpm2cpio, rpm) for analysis of RPM packages
</li>
<li>
  <a href="http://packages.debian.org/squeeze/dpkg" rel="nofollow">DPKG</a> (dpkg-deb, dpkg) for analysis of DEB packages
</li>
</ul>

Suggests:
<ul>
<li>
  <a href="https://github.com/lvc/abi-compliance-checker/">ABI Compliance Checker</a> (1.99.1 or newer)
</li>
<li>
  <a href="https://github.com/lvc/abi-dumper/">ABI Dumper</a> (0.97 or newer)
</li>
</ul>
    
<a name="Installation"></a>
<h2>Installation</h2>
<p>The tool is <b>ready-to-use</b> after extracting the archive.</p>

<p>You can also use a <b>Makefile</b> to install the tool into the system:</p>
<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;sudo make install prefix=PREFIX [/usr, /usr/local]&nbsp;</code>
<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>

<a name="Usage"></a>
<h2>Usage</h2>
<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;pkgdiff PKG1 PKG2&nbsp;</code>
<p>The HTML report will be generated to:</p>

<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>

<a name="Examples"></a>
<h2>Examples</h2>
<p>Compare 0.4.1 and 0.8.1 versions of libqb SRPM-packages:</p>
<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>
<p>The HTML report will be generated to:</p>
<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>

<br/><br/>
<p>Compare 0.10.23 and 0.10.32 versions of gstreamer TXZ-packages:</p>
<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>
<p>The HTML report will be generated to:</p>
<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>

<br/><br/>
<p>Compare 0.3.4 and 0.4.0 versions of libssh TAR.GZ-packages:</p>
<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>
<p>The HTML report will be generated to:</p>
<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>

<br/><br/>
<p>Compare 1.10.2 and 1.12.2 versions of cairo DEB-packages:</p>
<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>
<p>The HTML report will be generated to:</p>
<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>

<br/><br/>
<p>Compare 2.24.1 and 2.28.8 versions of glib RPM-packages:</p>
<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>
<p>The HTML report will be generated to:</p>
<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>

<a name="Adv_Usage"></a>
<h2>Adv. Usage</h2>
<p>For advanced usage, see output of --help option:</p>
<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;pkgdiff --help&nbsp;</code>
<p>If you need to analyze a group of packages then you can create an XML-descriptor of this group (OLD.xml file):</p>

<div style='padding-left:20px;border:1px solid black;width:70%;'>
  &lt;version&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;2.24.1<br/>
  &lt;/version&gt;<br/><br/>

  &lt;group&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libglib<br/>
  &lt;/group&gt;<br/><br/>

  &lt;packages&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libglib2.0-devel-2.24.1-1mdv2010.1.i586.rpm<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libglib2.0_0-2.24.1-1mdv2010.1.i586.rpm<br/>
  &lt;/packages&gt;<br/>
</div>

<p>And then pass XML-descriptors of old and new versions of a group to the tool:</p>

<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;pkgdiff OLD.xml NEW.xml&nbsp;</code>

<p>The HTML report will be generated to:</p>

<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>

<a name="Adv_Examples"></a>
<h2>Adv. Examples</h2>
<p>Compare 2.3.12 and 2.4.5 versions of libfreetype6 group of RPM-packages:</p>
<code style="border: dashed 1px gray; background-color: #f0f0f0;">&nbsp;pkgdiff 2.3.12.xml 2.4.5.xml&nbsp;</code>

<p>File 2.3.12.xml:</p>
<div style='padding-left:20px;border:1px solid black;width:70%;'>
  &lt;version&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;2.3.12<br/>
  &lt;/version&gt;<br/><br/>

  &lt;group&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6<br/>
  &lt;/group&gt;<br/><br/>

  &lt;packages&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-2.3.12-1mdv2010.1.i586.rpm<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-devel-2.3.12-1mdv2010.1.i586.rpm<br/>
  &lt;/packages&gt;<br/>
</div>

<p>File 2.4.5.xml:</p>
<div style='padding-left:20px;border:1px solid black;width:70%;'>
  &lt;version&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;2.4.5<br/>
  &lt;/version&gt;<br/><br/>

  &lt;group&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6<br/>
  &lt;/group&gt;<br/><br/>

  &lt;packages&gt;<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-2.4.5-2-mdv2011.0.i586.rpm<br/>
      &nbsp;&nbsp;&nbsp;&nbsp;libfreetype6-devel-2.4.5-2-mdv2011.0.i586.rpm<br/>
  &lt;/packages&gt;<br/>
</div>

<p>The HTML report will be generated to:</p>
<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>

<a name="Bugs"></a>
<h2>Bugs</h2>
<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>

<a name="Maintainers"></a>
<h2>Maintainers</h2>
The tool is developed by <a href="https://abi-laboratory.pro/" rel="nofollow">Andrey Ponomarenko</a>.

<a name="ChangeLog"></a>
<h2>Changes</h2>

<b>Version 1.8 (January 28, 2017)</b><br/>
<b>Bug Fixes</b>
<ul>
    <li>
        Fixed -d option to compare large directories
    </li>
    <li>
        Added more file classes
    </li>
    <li>
        5% performance improvement
    </li>
    <li>
        Omit *.N suffix when determining the file format
    </li>
    <li>
        Do not print warning about missed wdiff into the report
    </li>
    <li>
        Increased default width of the report to 80 chars
    </li>
</ul>
<br/>

<b>Version 1.7.2 (March 18, 2016)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Ability to download plain-text added/removed patches from the report
    </li>
</ul>
<b>Bug Fixes</b>
<ul>
    <li>
        Do not show time stamp in the report
    </li>
    <li>
        Fixed removal of tmp directory in the rfcdiff-1.41-CUSTOM.sh
    </li>
</ul>
<br/>

<b>Version 1.7.1 (December 11, 2015)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Added -skip-pattern option: skip checking of paths within archives matching a regex
    </li>
</ul>
<b>Bug Fixes</b>
<ul>
    <li>
        Fixed incompatibility with the latest versions of the ABICC tool
    </li>
    <li>
        Fixed comparison of the RPM/Deb packages info
    </li>
</ul>
<br/>

<b>Version 1.7.0 (October 18, 2015)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Added -d option: compare directories instead of packages
    </li>
    <li>
        Added -list-added-removed option: show content of added/removed text files
    </li>
    <li>
        Added -vnum1 and -vnum2 options: set version numbers of input packages
    </li>
    <li>
        Added -title option: set name of the package in the title of the report
    </li>
    <li>
        Added -skip-subarchives option: skip checking of archives inside packages
    </li>
</ul>
<br/>

<b>Version 1.6.4 (September 08, 2015)</b><br/>
<b>Bug Fixes</b>
<ul>
    <li>
        Fixed style of the report
    </li>
    <li>
        Fixed install permissions
    </li>
    <li>
        Fixed errors when comparing man pages
    </li>
    <li>
        Added check for wdiff
    </li>
    <li>
        Simplified Makefile
    </li>
</ul>

<br/>

<b>Version 1.6.3 (November 05, 2014)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Added -hide-unchanged option: don't show unchanged files in the report
    </li>
    <li>
        Show change rate in the extra info files.xml (moved, changed, renamed)
    </li>
    <li>
        Check if we can remove a common prefix from files of both packages
    </li>
    <li>
        Encoding of diff reports has been changed to utf-8
    </li>
</ul>
<b>Bug Fixes</b>
<ul>
    <li>
        Fixed a problem with spaces in package name
    </li>
    <li>
        Added -o option to unzip command
    </li>
    <li>
        Fixed -tmp-dir option
    </li>
</ul>

<br/>

<b>Version 1.6 (June 07, 2013)</b><br/>
<b>New Features</b>
<ul>
    <li>
        ABI compatibility check for shared objects and kernel modules containing DWARF debugging information (in <i>-details</i> mode)
    </li>
    <li>
        ABI status section in the report for debuginfo-packages
    </li>
    <li>
        Suggests ABI Compliance Checker 1.99.1
    </li>
    <li>
        Suggests ABI Dumper 0.97
    </li>
</ul>

<br/>

<b>Version 1.5 (April 04, 2013)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Added -extra-info option to dump extra analysis information
    </li>
    <li>
        Improved identification of moved files
    </li>
    <li>
        Classifying files by magic bytes
    </li>
    <li>
        Compare public symbols in shared objects before detailed comparison
    </li>
    <li>
        Added statistics comment line in the report
    </li>
    <li>
        Support for more file types
    </li>
</ul>
<b>Bug Fixes</b>
<ul>
    <li>
        Corrected Makefile
    </li>
    <li>
        Corrected parser of package version
    </li>
</ul>

<br/>

<b>Version 1.4.1 (December 14, 2012)</b><br/>
<b>Bug Fixes</b>
<ul>
    <li>
        Corrected parser of package version
    </li>
    <li>
        Opening file diffs in a separate window
    </li>
</ul>

<br/>

<b>Version 1.4 (October 25, 2012)</b><br/>
<b>New Features</b>
<ul>
    <li>
        Sorting by status, delta and file name in the report
    </li>
    <li>
        New -open option to open report in the default browser
    </li>
    <li>
        Printing of estimated change rate to the console
    </li>
    <li>
        Simplified usage: pkgdiff PKG1 PKG2
    </li>
    <li>
        Support for Mac OS X
    </li>
    <li>
        Support for more file formats
    </li>
</ul>

    <div class="footer">
      get the source code on GitHub : <a href="https://github.com/lvc/pkgdiff">lvc/pkgdiff</a>
    </div>
    <div style="height:350px;"></div>

  </div>
</body>
</html>


================================================
FILE: modules/FileType.xml
================================================
<files>

<type>
    <id>
        HEADER
    </id>
    <summary>
        Header file
    </summary>
    <extensions>
        h, hh, H, hp, hxx, hpp, HPP, h++, tcc
    </extensions>
    <weight>
        100
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SHARED_OBJECT
    </id>
    <summary>
        Shared library
    </summary>
    <extensions>
        so
    </extensions>
    <weight>
        90
    </weight>
</type>

<type>
    <id>
        KERNEL_MODULE
    </id>
    <summary>
        Kernel module
    </summary>
    <extensions>
        ko
    </extensions>
    <weight>
        85
    </weight>
</type>

<type>
    <id>
        DEBUG_INFO
    </id>
    <summary>
        Debug info file
    </summary>
    <extensions>
        debug
    </extensions>
    <weight>
        80
    </weight>
</type>

<type>
    <id>
        DLL
    </id>
    <summary>
        DLL library
    </summary>
    <extensions>
        dll
    </extensions>
    <weight>
        85
    </weight>
</type>

<type>
    <id>
        SHARED_LIBRARY
    </id>
    <summary>
        Dynamic library
    </summary>
    <extensions>
        dylib
    </extensions>
    <weight>
        85
    </weight>
</type>

<type>
    <id>
        SPEC
    </id>
    <summary>
        Spec file
    </summary>
    <extensions>
        spec
    </extensions>
    <weight>
        90
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        C_SOURCE
    </id>
    <summary>
        C program
    </summary>
    <extensions>
        c, i
    </extensions>
    <weight>
        90
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PATCH
    </id>
    <summary>
        Patch
    </summary>
    <extensions>
        patch, diff, diffs
    </extensions>
    <terms>
        diff output
    </terms>
    <weight>
        80
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        STATIC_LIBRARY
    </id>
    <summary>
        Static library
    </summary>
    <extensions>
        a
    </extensions>
    <weight>
        80
    </weight>
</type>

<type>
    <id>
        CPP_SOURCE
    </id>
    <summary>
        C++ program
    </summary>
    <extensions>
        cc, cp, cxx, cpp, CPP, c++, C, ii
    </extensions>
    <weight>
        90
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ADA
    </id>
    <summary>
        Ada program
    </summary>
    <extensions>
        ads, adb
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        FORTRAN
    </id>
    <summary>
        Fortran program
    </summary>
    <extensions>
        f, for, ftn
        F, FOR, fpp, FPP, FTN
        f90, f95. f03, f08,
        F90, F95, F03, F08
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SYMBOL
    </id>
    <summary>
        Symbols file
    </summary>
    <extensions>
        sym, syms, fncs
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LIBTOOL
    </id>
    <summary>
        Libtool file
    </summary>
    <extensions>
        la, lo, plo
    </extensions>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        MANPAGE
    </id>
    <summary>
        Man page
    </summary>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        DOCBOOK
    </id>
    <summary>
        DocBook document
    </summary>
    <extensions>
        docbook
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        NVDL
    </id>
    <summary>
        NVDL script
    </summary>
    <extensions>
        nvdl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        RSS
    </id>
    <summary>
        RSS file
    </summary>
    <extensions>
        rss
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MMP
    </id>
    <summary>
        Symbian Project file
    </summary>
    <extensions>
        mmp
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        BINARY_TERRAIN
    </id>
    <summary>
        Binary Terrain file
    </summary>
    <extensions>
        bt
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        X3D
    </id>
    <summary>
        X3D Image
    </summary>
    <extensions>
        x3d, x3dv
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        S_EXPRESSION_FILE
    </id>
    <summary>
        S-Expression file
    </summary>
    <extensions>
        sexpr
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LOG_FILE
    </id>
    <summary>
        Log file
    </summary>
    <names>
        xorg.log.1
    </names>
    <extensions>
        log, log.1
    </extensions>
    <dirs>
        logs, log
    </dirs>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ARGUMENT_FILE
    </id>
    <summary>
        Argument file
    </summary>
    <extensions>
        arg, args, argv
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ML_PROGRAM
    </id>
    <summary>
        ML program
    </summary>
    <extensions>
        ml
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        AUGEAS_FILE
    </id>
    <summary>
        Augeas file
    </summary>
    <extensions>
        aug
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        VMWARE_SCRIPT
    </id>
    <summary>
        VMware Configuration file
    </summary>
    <extensions>
        vmx
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        STAP_SCRIPT
    </id>
    <summary>
        SystemTap script
    </summary>
    <extensions>
        stp
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PPD_FILE
    </id>
    <summary>
        PPD file
    </summary>
    <extensions>
        ppd
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LDAP
    </id>
    <summary>
        LDAP Data file
    </summary>
    <extensions>
        ldif
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ESRI_SHAPEFILE
    </id>
    <summary>
        ESRI Shape file
    </summary>
    <extensions>
        shp, shx
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        DBASE_DATABASE
    </id>
    <summary>
        dBASE Database file
    </summary>
    <extensions>
        dbf
    </extensions>
    <terms>
        DBase 3 data
    </terms>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        DJVU
    </id>
    <summary>
        DjVu document
    </summary>
    <extensions>
        djvu, djv
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        XPT
    </id>
    <summary>
        XPConnect Typelib file
    </summary>
    <extensions>
        xpt
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        ELF_BINARY
    </id>
    <summary>
        ELF Binary file
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        TDF
    </id>
    <summary>
        TDF file
    </summary>
    <extensions>
        tdf
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MESSAGE_FILE
    </id>
    <summary>
        Message file
    </summary>
    <extensions>
        eml, msg
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XINDY
    </id>
    <summary>
        Xindy file
    </summary>
    <extensions>
        xdy
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GNAT_PROJECT
    </id>
    <summary>
        GNAT Project file
    </summary>
    <extensions>
        gpr
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        BIBTEX
    </id>
    <summary>
        BibTeX document
    </summary>
    <extensions>
        bst, bbl, bib, csf
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        INCLUDE
    </id>
    <summary>
        Include file
    </summary>
    <extensions>
        inc, inl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LANGUAGE_DATA
    </id>
    <summary>
        Language Data file
    </summary>
    <extensions>
        lng
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        XIB
    </id>
    <summary>
        Interface Builder file
    </summary>
    <extensions>
        xib, nib
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MDMP
    </id>
    <summary>
        Memory Dump file
    </summary>
    <extensions>
        dmp, mdmp
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        REGISTRY
    </id>
    <summary>
        Registry file
    </summary>
    <extensions>
        rgs, reg
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        RPC
    </id>
    <summary>
        RPC file
    </summary>
    <extensions>
        srpc, rpc, x
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        BINHEX
    </id>
    <summary>
        BinHex Encoded file
    </summary>
    <extensions>
        hqx
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        PROTOBUF
    </id>
    <summary>
        Protocol Buffer file
    </summary>
    <extensions>
        proto
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        OPTIONS
    </id>
    <summary>
        Options file
    </summary>
    <extensions>
        opt
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SCONS
    </id>
    <summary>
        SCons file
    </summary>
    <names>
        SConstruct, SConscript
    </names>
    <extensions>
        scons
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MD5
    </id>
    <summary>
        MD5 Checksum file
    </summary>
    <extensions>
        md5
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SIGNATURE
    </id>
    <summary>
        Signature file
    </summary>
    <extensions>
        sig
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        OPERA_MAILBOX
    </id>
    <summary>
        Opera Mailbox file
    </summary>
    <extensions>
        mbs
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        OPERA_BOOKMARK
    </id>
    <summary>
        Opera Bookmark file
    </summary>
    <extensions>
        adr
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        QT_UI
    </id>
    <summary>
        Qt UI file
    </summary>
    <extensions>
        ui
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_SS
    </id>
    <summary>
        Qt style sheet
    </summary>
    <extensions>
        qss
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_MESSAGE
    </id>
    <summary>
        Qt Message file
    </summary>
    <extensions>
        qm
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        QT_HELP
    </id>
    <summary>
        Qt Help file
    </summary>
    <extensions>
        qhp, qch, qhc, qhcp
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        OBJECTIVE_C
    </id>
    <summary>
        Objective-C program
    </summary>
    <extensions>
        m, mi
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        OBJECTIVE_CPP
    </id>
    <summary>
        Objective-C++ program
    </summary>
    <extensions>
        mm, mii, M
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SGML
    </id>
    <summary>
        SGML document
    </summary>
    <extensions>
        sgml, sgm
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_PROJECT
    </id>
    <summary>
        Qt Project file
    </summary>
    <extensions>
        pro, pri, prf
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        FSH
    </id>
    <summary>
        OpenGL FSH file
    </summary>
    <extensions>
        fsh
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GLSL
    </id>
    <summary>
        GLSL Shader file
    </summary>
    <extensions>
        glsl, glslf, glslv, vert, frag
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XCODE
    </id>
    <summary>
        Xcode file
    </summary>
    <extensions>
        xcconfig, pbxproj, xcodeproj, nib, pbxbtree, pbxuser
        xcworkspace, xcsnapshots, xcode
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        PROPERTY_LIST
    </id>
    <summary>
        Property list
    </summary>
    <extensions>
        plist
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        POLICY_FILE
    </id>
    <summary>
        Policy file
    </summary>
    <extensions>
        policy, Policy
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JAVA_ASSEMBLER
    </id>
    <summary>
        Java assembler program
    </summary>
    <extensions>
        jasm, jsasm
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PROPERTY_FILE
    </id>
    <summary>
        Property file
    </summary>
    <extensions>
        prp, pty, props, properties
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SWG_FILE
    </id>
    <summary>
        SWG file
    </summary>
    <extensions>
        swg
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        INITIALIZATION
    </id>
    <summary>
        Initialization file
    </summary>
    <extensions>
        ini
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MANIFEST
    </id>
    <summary>
        Manifest file
    </summary>
    <names>
        manifest, MANIFEST
    </names>
    <extensions>
        manifest, mf, MF, nmf, mn
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        RESOURCE
    </id>
    <summary>
        Resource file
    </summary>
    <extensions>
        res, rc, resource, mc, grd, rsrc, rc2
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XTB
    </id>
    <summary>
        XTB data file
    </summary>
    <extensions>
        xtb
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        MOLECULE_SPEC
    </id>
    <summary>
        Molecule spec file
    </summary>
    <extensions>
        xyz
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_RESOURCE
    </id>
    <summary>
        Qt Resource file
    </summary>
    <extensions>
        qrc
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_DOC
    </id>
    <summary>
        Qt Doc file
    </summary>
    <extensions>
        qdoc, qdocconf, qdocinc
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XBEL
    </id>
    <summary>
        XBEL bookmark
    </summary>
    <extensions>
        xbel
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        IDL
    </id>
    <summary>
        IDL file
    </summary>
    <extensions>
        idl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QML
    </id>
    <summary>
        QML file
    </summary>
    <extensions>
        qml, qs
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XML
    </id>
    <summary>
        XML document
    </summary>
    <extensions>
        xml
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        WML
    </id>
    <summary>
        WML document
    </summary>
    <extensions>
        wml
    </extensions>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        MAKEFILE
    </id>
    <summary>
        Makefile
    </summary>
    <extensions>
        mk, make, makefile, Makefile, nmake, kmk, mak
    </extensions>
    <names>
        Makefile, GNUmakefile, Imakefile, Makeconfig, Makerules
    </names>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JAVA_MAKEFILE
    </id>
    <summary>
        Java Makefile
    </summary>
    <extensions>
        jmk, gmk
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        UCM
    </id>
    <summary>
        UCM file
    </summary>
    <description>
        Unicode Character Mapping
    </description>
    <extensions>
        ucm
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CHARMAP
    </id>
    <summary>
        Charmap file
    </summary>
    <extensions>
        cm
    </extensions>
    <dirs>
        charmaps
    </dirs>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ABI_LIST
    </id>
    <summary>
        ABI list
    </summary>
    <extensions>
        abilist
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LOCALE_DATA
    </id>
    <summary>
        Localization data
    </summary>
    <dirs>
        iconvdata, localedata, locales
    </dirs>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        TIMEZONE_DATA
    </id>
    <summary>
        Timezone data
    </summary>
    <dirs>
        timezone
    </dirs>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CONFIGURE_SCRIPT
    </id>
    <summary>
        Configure script
    </summary>
    <names>
        configure, preconfigure
    </names>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        VERSIONING
    </id>
    <summary>
        Version file
    </summary>
    <names>
        Version, Versions
    </names>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GYP
    </id>
    <summary>
        GYP file
    </summary>
    <extensions>
        gyp, gypi
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PKGCONFIG
    </id>
    <summary>
        Pkg-config file
    </summary>
    <extensions>
        pc
    </extensions>
    <weight>
        50
    </weight>
    <anchor>
        PkgConfigFiles
    </anchor>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        OOO
    </id>
    <summary>
        OpenOffice document
    </summary>
    <extensions>
        sxd, sxi, sxm, smf, sds, odf, odp, otp, odg
        odb, otg, odt, ott, sda, sdc, ods, ots
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        QT_QPH
    </id>
    <summary>
        Qt Translation file
    </summary>
    <extensions>
        qph
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QT_MS_TS
    </id>
    <summary>
        Qt Translation or MS TypeScript file
    </summary>
    <extensions>
        ts
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DOT
    </id>
    <summary>
        DOT Graph file
    </summary>
    <extensions>
        dot
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DESKTOP
    </id>
    <summary>
        Desktop file
    </summary>
    <extensions>
        desktop
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MS_VISUAL_STUDIO
    </id>
    <summary>
        MS Visual Studio file
    </summary>
    <extensions>
        vcxproj, vcproj, vcprojin, vcxproj.filters, vcxproj.filtersin
        sln, vc9, resx, vc6, vcwin32, dsw, dsp, csproj, vsprops, xsx
        cbproj, vbp, vbproj, vcp, vcw, vbg, vbz, vdp, vdproj, vc4, frm
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        WINDOWS
    </id>
    <summary>
        MS Windows file
    </summary>
    <extensions>
        clp, clg, hme, msi, msu, chm, hlp, wmf, emf
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        CSV_FILE
    </id>
    <summary>
        CSV file
    </summary>
    <extensions>
        csv
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        COMMAND
    </id>
    <summary>
        Command file
    </summary>
    <extensions>
        cmd, com, COM
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        WIX
    </id>
    <summary>
        WiX Installer file
    </summary>
    <extensions>
        wxi, wxs
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        STRINGS
    </id>
    <summary>
        Text Strings file
    </summary>
    <extensions>
        strings
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        OVF
    </id>
    <summary>
        OVF file
    </summary>
    <extensions>
        ovf
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        DISK_IMAGE
    </id>
    <summary>
        Disk Image file
    </summary>
    <extensions>
        vdi, vmdk, vhd, iso, vco
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        VIRTUAL_BOX
    </id>
    <summary>
        VirtualBox file
    </summary>
    <extensions>
        vbox
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MMC
    </id>
    <summary>
        Windows MMC file
    </summary>
    <extensions>
        msc
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        VISUAL_BASIC
    </id>
    <summary>
        Visual Basic program
    </summary>
    <extensions>
        vbs, vb, vbx
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LEX
    </id>
    <summary>
        Lex program
    </summary>
    <extensions>
        l
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        YACC
    </id>
    <summary>
        Yacc program
    </summary>
    <extensions>
        y
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LISP
    </id>
    <summary>
        Lisp program
    </summary>
    <extensions>
        lsp, lisp, el
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SEED7_INCLUDE
    </id>
    <summary>
        Seed7 include/library
    </summary>
    <extensions>
        s7i
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SEED7_PROGRAM
    </id>
    <summary>
        Seed7 program
    </summary>
    <extensions>
        sd7
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        HASKELL_SOURCE
    </id>
    <summary>
        Haskell program
    </summary>
    <extensions>
        hs
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        HASKELL_CABAL
    </id>
    <summary>
        Haskell metadata
    </summary>
    <extensions>
        cabal
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        RUST
    </id>
    <summary>
        Rust program
    </summary>
    <extensions>
        rs
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PASCAL
    </id>
    <summary>
        Pascal program
    </summary>
    <extensions>
        pas
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DOS_BATCH
    </id>
    <summary>
        DOS Batch file
    </summary>
    <extensions>
        bat
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        POSTSCRIPT
    </id>
    <summary>
        PostScript file
    </summary>
    <extensions>
        ps, eps, pfa
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        JAVASCRIPT
    </id>
    <summary>
        JavaScript file
    </summary>
    <extensions>
        js, sjs, jsm
    </extensions>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        COFFEESCRIPT
    </id>
    <summary>
        CoffeeScript file
    </summary>
    <extensions>
        coffee
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        NSIS
    </id>
    <summary>
        NSIS script
    </summary>
    <extensions>
        nsi, nsh
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PARAM
    </id>
    <summary>
        Parameter file
    </summary>
    <extensions>
        prm, par, ff
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DOXYGEN
    </id>
    <summary>
        Doxygen file
    </summary>
    <extensions>
        dox, doxy, doxyfile, doxygen
    </extensions>
    <names>
        Doxyfile, Doxyfile.in
    </names>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        QML_PROJECT
    </id>
    <summary>
        QML Project file
    </summary>
    <extensions>
        qmlproject
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CMAKE
    </id>
    <summary>
        CMake file
    </summary>
    <extensions>
        cmake, cmakein
    </extensions>
    <names>
        CMakeLists.txt
    </names>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        EXE
    </id>
    <summary>
        Executable file
    </summary>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        PE_BINARY
    </id>
    <summary>
        PE Binary file
    </summary>
    <weight>
        45
    </weight>
    <terms>
        PE32, PE64, MS-DOS executable
    </terms>
</type>

<type>
    <id>
        AUTOMAKE
    </id>
    <summary>
        Automake file
    </summary>
    <extensions>
        am, ac
    </extensions>
    <names>
        Makefile.am, Makefile.ac
    </names>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        IPDL
    </id>
    <summary>
        IPDL file
    </summary>
    <extensions>
        ipdl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XPI
    </id>
    <summary>
        XPI file
    </summary>
    <extensions>
        xpi
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        CERTIFICATE
    </id>
    <summary>
        Certificate file
    </summary>
    <extensions>
        ca, crt, cert, crl, cer, pem
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        ICC
    </id>
    <summary>
        ICC profile
    </summary>
    <extensions>
        icc, icm, pf
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        CGI
    </id>
    <summary>
        CGI script
    </summary>
    <extensions>
        cgi
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XUL
    </id>
    <summary>
        XML UI file
    </summary>
    <extensions>
        xul
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XBL
    </id>
    <summary>
        XBL file
    </summary>
    <extensions>
        xbl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XSL
    </id>
    <summary>
        XML style sheet
    </summary>
    <extensions>
        xsl
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XSD
    </id>
    <summary>
        XML schema definition
    </summary>
    <extensions>
        xsd
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XSLT
    </id>
    <summary>
        XSL transformation file
    </summary>
    <extensions>
        xslt
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DTD
    </id>
    <summary>
        DTD file
    </summary>
    <extensions>
        dtd
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ENTITY_FILE
    </id>
    <summary>
        Entity file
    </summary>
    <extensions>
        ent
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        XML_RNG
    </id>
    <summary>
        RNG file
    </summary>
    <extensions>
        rng
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        RDF
    </id>
    <summary>
        RDF file
    </summary>
    <extensions>
        rdf
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SQLITE
    </id>
    <summary>
        QSLite database
    </summary>
    <extensions>
        sqlite
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        BERKELEY_DB
    </id>
    <summary>
        Berkeley database
    </summary>
    <extensions>
        db
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        GPERF
    </id>
    <summary>
        GNU Gperf file
    </summary>
    <extensions>
        gperf
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        YAML
    </id>
    <summary>
        YAML file
    </summary>
    <extensions>
        yml, yaml, yml2
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        TCL
    </id>
    <summary>
        Tcl program
    </summary>
    <extensions>
        tcl
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PYTHON
    </id>
    <summary>
        Python program
    </summary>
    <extensions>
        py
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PYTHON_COMPILED
    </id>
    <summary>
        Python compiled program
    </summary>
    <bytes>
        d1f20d0a
    </bytes>
    <extensions>
        pyc, pyo
    </extensions>
    <weight>
        60
    </weight>
</type>

<type>
    <id>
        SED
    </id>
    <summary>
        Sed program
    </summary>
    <extensions>
        sed
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        FONT
    </id>
    <summary>
        Font file
    </summary>
    <extensions>
        bdf, ttf, TTF, ttc, pfb, qpf, qpf2, otf, eot
        woff, fnt, bfc, afm, xafm, tfm, vf, ofm, sfd
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        BINARY_DTD
    </id>
    <summary>
        Binary DTD file
    </summary>
    <extensions>
        bdtd
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        ENCODING
    </id>
    <summary>
        Encoding file
    </summary>
    <extensions>
        enc, utf
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        GO
    </id>
    <summary>
        Go program
    </summary>
    <extensions>
        go
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        IBY
    </id>
    <summary>
        ROM Image file
    </summary>
    <extensions>
        iby
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JAVA
    </id>
    <summary>
        Java program
    </summary>
    <extensions>
        java, jsp, jj, sjava, java.template
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CS
    </id>
    <summary>
        C# program
    </summary>
    <extensions>
        cs
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SCALA
    </id>
    <summary>
        Scala program
    </summary>
    <extensions>
        scl
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SHELL
    </id>
    <summary>
        Shell program
    </summary>
    <extensions>
        sh, SH, csh, ksh, bash, tcsh, zsh
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ASSEMBLER
    </id>
    <summary>
        Assembler program
    </summary>
    <extensions>
        asm, s, S, sx, il
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PERL_TEST
    </id>
    <summary>
        Perl test program
    </summary>
    <extensions>
        t
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PERL
    </id>
    <summary>
        Perl program
    </summary>
    <extensions>
        pl, PL, plx, e2x, ph
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LUA
    </id>
    <summary>
        Lua program
    </summary>
    <extensions>
        lua
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        AWK
    </id>
    <summary>
        Awk program
    </summary>
    <extensions>
        awk
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PYTHON_EGG
    </id>
    <summary>
        Python egg
    </summary>
    <extensions>
        egg
    </extensions>
    <title>
        Python Eggs
    </title>
    <weight>
        60
    </weight>
</type>

<type>
    <id>
        RUBY
    </id>
    <summary>
        Ruby program
    </summary>
    <extensions>
        rb
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PHP
    </id>
    <summary>
        PHP program
    </summary>
    <extensions>
        php, phpt
    </extensions>
    <weight>
        60
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        VIM
    </id>
    <summary>
        Vim Settings file
    </summary>
    <extensions>
        vim
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        SQL
    </id>
    <summary>
        SQL file
    </summary>
    <extensions>
        sql
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SHELL_ARCHIVE
    </id>
    <summary>
        Shell archive
    </summary>
    <extensions>
        shar
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        WEB_SOURCE
    </id>
    <summary>
        WEB Source file
    </summary>
    <extensions>
        web, w
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GETTEXT
    </id>
    <summary>
        Gettext file
    </summary>
    <extensions>
        po, pot
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GETTEXT_MO
    </id>
    <summary>
        Gettext object
    </summary>
    <extensions>
        gmo, mo
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        GPG
    </id>
    <summary>
        GNU GPG file
    </summary>
    <extensions>
        gpg
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        RTF
    </id>
    <summary>
        RTF file
    </summary>
    <extensions>
        rtf
    </extensions>
    <terms>
        Rich Text
    </terms>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        RST
    </id>
    <summary>
        RST file
    </summary>
    <extensions>
        rst
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        VRML
    </id>
    <summary>
        VRML file
    </summary>
    <extensions>
        wrl, vrml
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        IV
    </id>
    <summary>
        Scene graph file
    </summary>
    <extensions>
        iv
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        MATLAB
    </id>
    <summary>
        MATLAB file
    </summary>
    <extensions>
        mat
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        TEX_DOCUMENT
    </id>
    <summary>
        TeX document
    </summary>
    <extensions>
        latex, tex, sty
    </extensions>
    <terms>
        LaTeX
    </terms>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        DVI
    </id>
    <summary>
        DVI file
    </summary>
    <extensions>
        dvi, xdv
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        XQ
    </id>
    <summary>
        XQuery file
    </summary>
    <extensions>
        xq
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JAVA_CLASS
    </id>
    <summary>
        Java class
    </summary>
    <extensions>
        class
    </extensions>
    <weight>
        60
    </weight>
</type>

<type>
    <id>
        PERL_MODULE
    </id>
    <summary>
        Perl module
    </summary>
    <extensions>
        pm
    </extensions>
    <weight>
        70
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PERL_XS
    </id>
    <summary>
        Perl XS file
    </summary>
    <extensions>
        xs
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JSON
    </id>
    <summary>
        JSON file
    </summary>
    <extensions>
        json
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        POD
    </id>
    <summary>
        POD document
    </summary>
    <extensions>
        pod
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SKIN
    </id>
    <summary>
        Skin file
    </summary>
    <extensions>
        skin
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        COMPILED_OBJECT
    </id>
    <summary>
        Compiled object
    </summary>
    <extensions>
        o, obj
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        MACRO
    </id>
    <summary>
        Macro file
    </summary>
    <extensions>
        mac
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        INFODOC
    </id>
    <summary>
        Info document
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        GNU_LD_SCRIPT
    </id>
    <summary>
        GNU LD script
    </summary>
    <extensions>
        ld, lds
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DEF
    </id>
    <summary>
        Module-Definition file
    </summary>
    <extensions>
        def
    </extensions>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GIT
    </id>
    <summary>
        Git file
    </summary>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CVS
    </id>
    <summary>
        CVS file
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        SVN
    </id>
    <summary>
        Subversion file
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        HG
    </id>
    <summary>
        Mercurial file
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        BZR
    </id>
    <summary>
        Bazaar file
    </summary>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        TEXINFO
    </id>
    <summary>
        Texinfo file
    </summary>
    <extensions>
        texi, texinfo
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        MS_OFFICE
    </id>
    <summary>
        MS office document
    </summary>
    <extensions>
        doc, docx, xl, xls, xlsb, xlsx, tsv, dex
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        CSS
    </id>
    <summary>
        CSS style sheet
    </summary>
    <extensions>
        css
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
    <anchor>
        CSS
    </anchor>
</type>

<type>
    <id>
        SCSS
    </id>
    <summary>
        Sass CSS style sheet
    </summary>
    <extensions>
        scss
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        DATA
    </id>
    <summary>
        Data file
    </summary>
    <extensions>
        data, dat, out, stdout, stdin, tbl, input, exp, ex
    </extensions>
    <weight>
        30
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        M4
    </id>
    <summary>
        M4 macro file
    </summary>
    <extensions>
        m4
    </extensions>
    <weight>
        50
    </weight>
    <anchor>
        M4
    </anchor>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SYMLINK
    </id>
    <summary>
        Symbolic link
    </summary>
    <weight>
        50
    </weight>
</type>

<type>
    <id>
        HTML
    </id>
    <summary>
        HTML page
    </summary>
    <extensions>
        html, htm, xhtml, dhtml, shtml, shtm
    </extensions>
    <weight>
        40
    </weight>
    <anchor>
        HTML
    </anchor>
</type>

<type>
    <id>
        PRECOMPILED_HEADER
    </id>
    <summary>
        Precompiled header
    </summary>
    <extensions>
        gch, pch
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        PACKAGE
    </id>
    <summary>
        Package file
    </summary>
    <extensions>
        pkg
    </extensions>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        PACKAGE_INFO
    </id>
    <summary>
        Package Info file
    </summary>
    <names>
        PkgInfo
    </names>
    <extensions>
        pkginfo
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        JAM_FILE
    </id>
    <summary>
        Jam file
    </summary>
    <names>
        Jamfile, Jamrules
    </names>
    <extensions>
        jam
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        LIST_FILE
    </id>
    <summary>
        Data List
    </summary>
    <extensions>
        list, lst
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        GLADE
    </id>
    <summary>
        Glade interface
    </summary>
    <extensions>
        glade
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        CACHE
    </id>
    <summary>
        Cache file
    </summary>
    <extensions>
        cache
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        HIDDEN
    </id>
    <summary>
        Hidden file
    </summary>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        BACKUP
    </id>
    <summary>
        Backup file
    </summary>
    <extensions>
        bak
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        SERVICE
    </id>
    <summary>
        Service file
    </summary>
    <extensions>
        service
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        YUM_DB
    </id>
    <summary>
        Yum DB file
    </summary>
    <dirs>
        yumdb
    </dirs>
    <weight>
        40
    </weight>
</type>

<type>
    <id>
        FIRMWARE
    </id>
    <summary>
        Firmware file
    </summary>
    <extensions>
        fw
    </extensions>
    <weight>
        40
    </weight>
    <format>
        Binary
    </format>
</type>

<type>
    <id>
        CONFIGURATION
    </id>
    <summary>
        Configuration file
    </summary>
    <extensions>
        conf, config, cfg, cnf, inf, INF, sysconf, sysconfig, rules
    </extensions>
    <names>
        Config, config
    </names>
    <weight>
        50
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        PDF
    </id>
    <summary>
        PDF file
    </summary>
    <extensions>
        pdf
    </extensions>
    <weight>
        30
    </weight>
</type>

<type>
    <id>
        X_PIXMAP
    </id>
    <summary>
        X Pixmap file
    </summary>
    <extensions>
        xpm, xbm
    </extensions>
    <weight>
        30
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        IMAGE
    </id>
    <summary>
        Image file
    </summary>
    <extensions>
        png, jpg, jpeg, exif, raw, bmp, pbm, webp, spp, tga
        img, gif, tiff, xcf, cur, svgz, cct, jp2, jpx
        ppm, tif, yuv, jps, mng, pcx, blend
    </extensions>
    <weight>
        30
    </weight>
</type>

<type>
    <id>
        VECTOR_IMAGE
    </id>
    <summary>
        Vector Image file
    </summary>
    <extensions>
        svg, emf, dia, asy, fig, cdr, cvx, fxg, hpl, vsd
    </extensions>
    <weight>
        30
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        AUDIO
    </id>
    <summary>
        Audio file
    </summary>
    <extensions>
        wav, aiff, flac, aac, mpc, ogg, wma, sf2, aa, ac3
        m3u, midi, wave, wax, wow, mp1, mp2, mp3, mpa, mpga
        mpu, oga, omg, omx, omf, pcast, pls, acm, afc, mid
        dls, flw, amr
    </extensions>
    <weight>
        30
    </weight>
</type>

<type>
    <id>
        VIDEO
    </id>
    <summary>
        Video file
    </summary>
    <extensions>
        swf, flv, mng, avi, 3gp, divx, ogv, movie, mov, swf, wmv, xvid
        mp4, mpeg, mjpeg, mjp, mpeg4, mpg, mpg2, mpv, mpv2, webm
    </extensions>
    <weight>
        30
    </weight>
</type>

<type>
    <id>
        ICON
    </id>
    <summary>
        Icon
    </summary>
    <extensions>
        ico, icon, ICO, icns
    </extensions>
    <weight>
        30
    </weight>
</type>

<type>
    <id>
        RPM
    </id>
    <summary>
        RPM package
    </summary>
    <extensions>
        rpm
    </extensions>
    <weight>
        20
    </weight>
</type>

<type>
    <id>
        SRPM
    </id>
    <summary>
        SRPM package
    </summary>
    <extensions>
        src.rpm, srpm
    </extensions>
    <weight>
        20
    </weight>
</type>

<type>
    <id>
        DEB
    </id>
    <summary>
        Deb package
    </summary>
    <extensions>
        deb
    </extensions>
    <weight>
        20
    </weight>
</type>

<type>
    <id>
        DIR
    </id>
    <summary>
        Directory
    </summary>
    <weight>
        20
    </weight>
</type>

<type>
    <id>
        TEXT
    </id>
    <summary>
        Text file
    </summary>
    <extensions>
        txt, TXT
    </extensions>
    <weight>
        10
    </weight>
    <format>
        Text
    </format>
</type>

<type>
    <id>
        ARCHIVE
    </id>
    <summary>
        Archive
    </summary>
    <extensions>
        tar.gz, tgz, tar.Z, taz, tar.xz, txz
        tar.bz2, tbz2, tbz, tb2, tar.lzma, tlzma
        tar.lz, tlz, zip, zae, tar, lzma, gz
        jar, war, ear, xz, 7z, rar, sfx, ace
        bz, bz2, zipx, apk
    </extensions>
    <weight>
        10
    </weight>
</type>

<type>
    <id>
        INFORM
    </id>
    <summary>
        Information file
    </summary>
    <names>
        PATCHING, ANNOUNCE, FAQ, HACKING, BUGS, CONFORMANCE
        TRADEMARK, THANKYOU, PACKAGERS, DEBUG, HOWTO, MAINTAINERS
        TODO, NOTES, AUTHORS, THANKS, IDEAS, HOWTO.DEBUG, DESIGN
        PKG-INFO, CREDITS, HISTORY, INSTALL, INDEX, RELEASE
        CONTRIB, NOTE, INSTALLATION, NEW, DEPS, LEGAL.NOTICE
    </names>
    <inames>
        CONTRIBUTORS.txt, BUILDING.txt, Install.txt, BLACKLIST.txt
        WISHLIST.TXT, HOWTO.txt
    </inames>
    <extensions>
        install, INSTALL
    </extensions>
    <weight>
        10
    </weight>
</type>

<type>
    <id>
        CHANGELOG
    </id>
    <summary>
        Change log
    </summary>
    <names>
        CHANGES, ChangeLog, NEWS, HISTORY
    </names>
    <inames>
        Release_notes.txt, RELEASE.txt, CHANGES.txt
    </inames>
    <weight>
        10
    </weight>
</type>

<type>
    <id>
        README
    </id>
    <summary>
        Readme file
    </summary>
    <names>
        README
    </names>
    <inames>
        Readme.txt, README.Debian
    </inames>
    <iextensions>
        readme.txt, README
    </iextensions>
    <weight>
        10
    </weight>
</type>

<type>
    <id>
        LICENSE
    </id>
    <summary>
        License
    </summary>
    <names>
        LGPL-2, LGPL-3, LICENSE, COPYING, COPYING3
        COPYING3.LIB, COPYING.LIB, LGPL, COPYING.LESSER
        LICENSE.LESSER, LICENSE-MPL
    </names>
    <inames>
        LGPL.txt, COPYING.txt, COPYRIGHT, License.txt, COPYING.GPLv2
        APACHE.license, LGPL.license, COPYING.readme, COPYING.GPLv3
        COPYING.LGPL, LICENSING.txt, COPYING.LGPLv2.1, GPL.txt
        GPL-LICENSE.txt, MIT-LICENSE.txt, COPYING.MPL, MPL-1.1.txt
    </inames>
    <iextensions>
        license, licence
    </iextensions>
    <weight>
        10
    </weight>
</type>

<type>
    <id>
        OTHER
    </id>
    <summary>
        Other
    </summary>
    <title>
        Other Files
    </title>
    <weight>
        0
    </weight>
</type>

</files>


================================================
FILE: modules/Internals/Scripts/Sort.js
================================================
function sort(el, status)
{ 
    var col_sort = el.innerHTML;
    var tr = el.parentNode;
    var table = tr.parentNode;
    var td, col_sort_num;
    for (var i=0; (td = tr.getElementsByTagName('th').item(i)); i++)
    {
        if(td.innerHTML == col_sort)
        {
            col_sort_num = i;
            if(td.prevsort == 'y') {
                el.up = Number(!el.up);
            }
            else if(td.prevsort == 'n') {
                td.prevsort = 'y';
                el.up = 0;
            }
            else
            {
                if(col_sort_num==0)
                { // already sorted
                    td.prevsort = 'n';
                    el.up = 1;
                }
                else if(col_sort_num==2)
                { // delta
                    td.prevsort = 'n';
                    el.up = 1;
                }
                else
                {
                    td.prevsort = 'y';
                    el.up = 0;
                }
            }
        }
        else
        {
            if(td.prevsort == 'y') {
                td.prevsort = 'n';
            }
        }
    }
    
    var a = new Array();
    for(var i=1; i < table.rows.length; i++)
    {
        var cols = table.rows[i].getElementsByTagName('td');
        if(cols.item(status)==null)
        { // double status
            a[i-2][2] = table.rows[i];
        }
        else
        {
            a[i-1] = new Array();
            var indent = cols.item(col_sort_num).innerHTML;
            if(indent=='') indent='0';
            if(indent.substr(indent.length-1, 1)=="%")
            { // delta
                indent = indent.substr(0, indent.length-1)*100;
            }
            a[i-1][0] = indent;
            a[i-1][1] = table.rows[i];
            a[i-1][2] = null;
        }
    }
    
    // sort table
    a.sort(sort_array);
    if(el.up) a.reverse();
    
    // draw table
    for(var i in a)
    {
        table.appendChild(a[i][1]);
        if(a[i][2]!=null) {
            table.appendChild(a[i][2]);
        }
    }
}

function sort_array(a,b)
{
    if(a[0] == b[0]) return 0;
    if(a[0] > b[0]) return 1;
    return -1;
}

================================================
FILE: modules/Internals/Styles/Index.css
================================================
@font-face {
    font-family:"Open Sans";
    src:url("../fonts/OpenSans.ttf") format("truetype");
}

@font-face {
    font-family:"VeraMono";
    src:url("../fonts/VeraMono.ttf") format("truetype");
}

body {
    font-family:'Open Sans', Arial, sans-serif;
    background-color:White;
    color:Black;
}
hr {
    color:#ececec;
    background-color:#ececec;
    height:3px;
    border:0;
}
h1 {
    font-size:1.625em;
    text-decoration:underline;
}
h2 {
    font-size:1.25em;
    white-space:nowrap;
    text-decoration:underline;
}
table.summary {
    border-collapse:collapse;
    border:1px solid Gray;
}
table.summary td, table.summary th {
    border:1px solid Gray;
    white-space:nowrap;
}
table.summary th {
    background-color:#EEEEEE;
    font-weight:bold;
    text-align:left;
    padding: 3px;
}
table.summary td {
    text-align:right;
    padding: 3px 5px 3px 5px;
    font-family:'VeraMono', Consolas, 'DejaVu Sans Mono', 'Droid Sans Mono', Monaco, Monospace;
}
table.summary td.left {
    text-align:left;
}
table.summary th.left {
    text-align:left;
    font-weight:100;
}
table.summary td.f_path {
    white-space:normal;
    word-wrap:break-word;
    max-width:57em;
}
table.summary td.value {
    padding-left:10px;
}
table.highlight tr:hover {
    background-color:#E0E0E0;
}
td.passed, tr.passed {
    background-color:#CCFFCC;
}
td.warning, tr.warning {
    background-color:#F4F4AF;
}
td.renamed, tr.renamed {
    background-color:#FFDAA3;
}
td.moved, tr.moved {
    background-color:#FFDAA3;
}
td.failed, tr.failed {
    background-color:#FFC3CE;
}
td.new, tr.new {
    background-color:#C6DEFF;
}
a.default {
    color:#336699;
}
div.p_list {
    padding-left:10px;
    color:#333333;
    font-size:0.94em;
}
.top_ref {
    font-size:0.69em;
}
.footer {
    font-size:1.2em;
    margin-top:23px;
}


================================================
FILE: modules/Internals/Styles/View.css
================================================
body {
    margin:0.4em;
}

.view {
    cursor:text;
    /*margin-top:7px;*/
    font-family:Consolas, 'DejaVu Sans Mono', 'Droid Sans Mono', Monaco, Monospace;
    background-color:White;
    word-wrap:break-word;
    background-color: #FFF;
    max-width:100em;
    display: inline-block;
    text-align:left;
    white-space:pre-wrap;
}

.header, .plain {
    background-color:Orange;
    text-align:center;
    font-weight:bold;
    padding-left:1em;
    padding-right:1em;
}

.plain {
    background-color:#BFEFFF;
    width:0px;
}

.add {
    background-color:#C6DEFF;
}

.rm {
    background-color:#FFCCCC;
}


================================================
FILE: modules/Internals/Tools/java-dump.sh
================================================
#!/bin/bash

function decompile {
    # Decompile class and include private members. In preparation for the
    # hashing below, strip references on the form #[0-9]+.
    javap -c -p "$1" \
        | sed '/^Compiled from /d' \
        | sed '/^[ ]*}[ ]*$/d' \
        | sed 's/[ ]\(#[1-9][0-9]*\)[ ,]/ /' \
        | sed 's/[ ]\([0-9]*[:]\)//' \
        | sed 's/[ ][ ]*/ /g' \
        | sed '/Code:$/,/^$/s/^[ ]*\([^ ]\)/    \1/g' \
        | sed '/Code:$/d' \
        | sed 's/ *{$//'
}

function hash_bodies {
    # Generate hashes of the instructions making up the method bodies; Yields
    # more concise summaries.
    awk '/^[  ]{0,3}[^ ]/{if (x)print x"\n";x="";}{x=(!x)?$0"\n--":x" "$0;}END{print x;}' \
        | sed '/^--[ ]*$/d' \
        | awk "{ if(/^--/) system(\"printf '    '; (echo '\"\$0\"' | shasum --algorithm 256)\"); else print }" \
        | sed 's/[ ][ ]*-$//'
}

if [[ "$1" == "-s" ]]; then
    shift 1
    decompile "$1" | hash_bodies
else
    javap -c -s -p -verbose "$1"
fi


================================================
FILE: modules/Internals/Tools/rfcdiff-1.41-CUSTOM.sh
================================================
#!/bin/bash
#
# Synopsis:
#	Show changes between 2 internet-drafts using changebars or html
#	side-by-side diff.
#	
# Usage:
#	rfcdiff [options] file1 file2
#	
#	rfcdiff takes two RFCs or Internet-Drafts in text form as input, and
#	produces output which indicates the differences found in one of various
#	forms, controlled by the options listed below. In all cases, page
#	headers and page footers are stripped before looking for changes.
#	
#	--html		Produce side-by-side .html diff (default)
#	
#	--chbars	Produce changebar marked .txt output
#	
#	--diff		Produce a regular diff output
#	
#	--wdiff		Produce paged wdiff output
#	
#	--hwdiff	Produce html-wrapped coloured wdiff output
#	
#	--oldcolour COLOURNAME	Colour for new file in hwdiff (default is "green")
#	--oldcolor COLORNAME	Color for old file in hwdiff (default is "red")
#
#	--newcolour COLOURNAME	Colour for new file in hwdiff (default is "green")
#	--newcolor COLORNAME	Color for new file in hwdiff (default is "green")
#
#	--larger        Make difference text in hwdiff slightly larger
#	
#	--keep		Don't delete temporary workfiles
#	
#	--version	Show version
#	
#	--help		Show this help
#	
#	--info "Synopsis|Usage|Copyright|Description|Log"
#			Show various info
#	
#	--width	N	Set a maximum width of N characters for the
#			display of each half of the old/new html diff
#	
#	--linenum	Show linenumbers for each line, not only at the
#			start of each change section
#	
#	--body		Strip document preamble (title, boilerplate and
#			table of contents) and postamble (Intellectual
#			Property Statement, Disclaimer etc)
#	
#	--nostrip	Don't strip headers and footers (or body)
#	
#	--ab-diff	Before/After diff, suitable for rfc-editor
#	--abdiff
#	
#	--stdout	Send output to stdout instead to a file
#	
#       --tmpdiff       Path to intermediate diff file
#
#       --prelines N    Set value for diff -U option
#
#       --minimal       Set value for diff -d option
#
#       --ignore-space-change
#                       Ignore changes in the amount of white space.
#
#       --ignore-all-space
#                       Ignore all white space.
#
#       --ignore-blank-lines
#                       Ignore changes whose lines are all blank.
#       
#
# Copyright:
#	-----------------------------------------------------------------
#	
#	Copyright 2002 Henrik Levkowetz
#	
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2 of the License, or
#	(at your option) any later version.
#	
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.
#	
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, write to the Free Software
#	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
#	-----------------------------------------------------------------
#
# Description:
#
#	The purpose of this program is to compare two versions of an
#	internet-draft, and as output produce a diff in one of several
#	formats:
#	
#		- side-by-side html diff
#		- paged wdiff output in a text terminal
#		- a text file with changebars in the left margin
#		- a simple unified diff output
#	
#	In all cases, internet-draft headers and footers are stripped before
#	generating the diff, to produce a cleaner diff.
#	
#	It is called as
#	
#		rfcdiff first-file second-file
#	
#	The latest version is available from
#		http://tools.ietf.org/tools/rfcdiff/
#

export version="1.41"
export prelines="10"
export basename=$(basename $0)
export workdir=`mktemp -d -t rfcdiff.XXXXXXXX`
export pagecache1="$workdir/pagecache1"
export pagecache2="$workdir/pagecache2"

# ----------------------------------------------------------------------
# Utility to find an executable
# ----------------------------------------------------------------------
lookfor() {
    for b in "$@"; do
	found=$(which "$b" 2>/dev/null)
	if [ -n "$found" ]; then
	    if [ -x "$found" ]; then
		echo "$found"
		return
	    fi
	fi
    done
}

AWK=awk

# ----------------------------------------------------------------------
# Strip headers footers and formfeeds from infile to stdout
# ----------------------------------------------------------------------
strip() {
  $AWK '
				{ gsub(/\r/, ""); }
				{ gsub(/[ \t]+$/, ""); }
				{ pagelength++; }
/\[?[Pp]age [0-9ivx]+\]?[ \t\f]*$/	{
				    match($0, /[Pp]age [0-9ivx]+/);
				    num = substr($0, RSTART+5, RLENGTH-5);
				    print num, outline > ENVIRON["pagecache" ENVIRON["which"]]
				    pagelength = 0;
				}
/\f/				{ newpage=1;
				  pagelength=1;
				}
/\f$/				{
				    # a form feed followed by a \n does not contribute to the
				    # line count.  (But a \f followed by something else does.)
				    pagelength--;
				}
/\f/				{ next; }
/\[?[Pp]age [0-9ivx]+\]?[ \t\f]*$/		{ preindent = indent; next; }

/^ *Internet.Draft.+[12][0-9][0-9][0-9] *$/ && (FNR > 15)	{ newpage=1; next; }
/^ *INTERNET.DRAFT.+[12][0-9][0-9][0-9] *$/ && (FNR > 15)	{ newpage=1; next; }
/^ *Draft.+(  +)[12][0-9][0-9][0-9] *$/	    && (FNR > 15)	{ newpage=1; next; }
/^RFC[ -]?[0-9]+.*(  +).* [12][0-9][0-9][0-9]$/ && (FNR > 15)	{ newpage=1; next; }
/^draft-[-a-z0-9_.]+.*[0-9][0-9][0-9][0-9]$/ && (FNR > 15)	{ newpage=1; next; }
/(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; }
newpage && $0 ~ /^ *draft-[-a-z0-9_.]+ *$/ { newpage=1; next; }

/^[ \t]+\[/			{ sentence=1; }
/[^ \t]/			{
				   indent = match($0, /[^ ]/);
				   if (indent < preindent) {
				      sentence = 1;
				   }
				   if (newpage) {
				      if (sentence) {
					 outline++; print "";
				      }
				   } else {
				      if (haveblank) {
					  outline++; print "";
				      }
				   }
				   haveblank=0;
				   sentence=0;
				   newpage=0;

				   line = $0;
				   sub(/^ *\t/, "        ", line);
				   thiscolumn = match(line, /[^ ]/);
				}
/[.:][ \t]*$/			{ sentence=1; }
/\(http:\/\/trustee\.ietf\.org\/license-info\)\./ { sentence=0; }
/^[ \t]*$/			{ haveblank=1; next; }
				{ outline++; print; }
' "$1"
}


# ----------------------------------------------------------------------
# Strip preamble (title, boilerplate and table of contents) and
# postamble (Intellectual Property Statement, Disclaimer etc)
# ----------------------------------------------------------------------
bodystrip() {
    $AWK '
    /^[ \t]*Acknowledgment/		{ inbody = 0; }
    /^(Full )*Copyright Statement$/	{ inbody = 0; }
    /^[ \t]*Disclaimer of Validid/	{ inbody = 0; }
    /^[ \t]*Intellectual Property/	{ inbody = 0; }
    /^Abstract$/			{ inbody = 0; }
    /^Table of Contents$/		{ inbody = 0; }
    /^1.[ \t]*Introduction$/	{ inbody = 1; }

    inbody			{ print; }
    ' "$1"
}


# ----------------------------------------------------------------------
# From two words, find common prefix and differing part, join descriptively
# ----------------------------------------------------------------------
worddiff() {
   $AWK '
BEGIN	{
		w1 = ARGV[1]
		w2 = ARGV[2]
		format = ARGV[3]

		do {
			if (substr(w1,1,1) == substr(w2,1,1)) {
				w1 = substr(w1,2)
				w2 = substr(w2,2)
			} else {
				break;
			}
			prefixlen++;
		} while (length(w1) && length(w2))

		prefix = substr(ARGV[1],1,prefixlen);

		do {
			l1 = length(w1);
			l2 = length(w2);
			if (substr(w1,l1,1) == substr(w2,l2,1)) {
				w1 = substr(w1,1,l1-1)
				w2 = substr(w2,1,l2-1)
			} else {
				break;
			}
		} while (l1 && l2)

		suffix = substr(ARGV[1], prefixlen+length(w1))

		printf format, prefix, w1, w2, suffix;
	}
' "$1" "$2" "$3"
}

# ----------------------------------------------------------------------
# Generate a html page with side-by-side diff from a unified diff
# ----------------------------------------------------------------------
htmldiff() {
   $AWK '
BEGIN	{
           FS = "[ \t,]";

	   # Read pagecache1
	   maxpage[1] = 1
	   pageend[1,0] = 2;
	   while ( getline < ENVIRON["pagecache1"] > 0) {
	      pageend[1,$1] = $2;
	      if ($1+0 > maxpage[1]) maxpage[1] = $1+0;
	   }

	   # Read pagecache2
	   maxpage[2] = 1
	   pageend[2,0] = 2;
	   while ( getline < ENVIRON["pagecache2"] > 0) {
	      pageend[2,$1] = $2;
	      if ($1+0 > maxpage[2]) maxpage[2] = $1+0;
	   }

	   wdiff = ENVIRON["wdiffbin"]
	   base1 = ENVIRON["base1"]
	   base2 = ENVIRON["base2"]
	   optwidth = ENVIRON["optwidth"]
	   optnums =  ENVIRON["optnums"]
	   optlinks = ENVIRON["optlinks"]
	   header(base1, base2)

	   difflines1 = 0
	   difflines2 = 0
	}

function header(file1, file2) {
   url1 = file1;
   url2 = file2;
   if (optlinks) {
      if (file1 ~ /^draft-/) { url1 = sprintf("<a href=\"/html/%s\" style=\"color:#008\">%s</a>", file1, file1); }
      if (file1 ~ /^draft-/) { prev = sprintf("<a href=\"/rfcdiff?url2=%s\" style=\"color:#008; text-decoration:none;\">&lt;</a>", file1); }
      if (file2 ~ /^draft-/) { url2 = sprintf("<a href=\"/html/%s\" style=\"color:#008\">%s</a>", file2, file2); }
      if (file2 ~ /^draft-/) { nxt  = sprintf("<a href=\"/rfcdiff?url1=%s\" style=\"color:#008; text-decoration:none;\">&gt;</a>", file2) }
   }   
   printf "" \
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n" \
"<!-- <!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional\" > -->\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 http-equiv=\"Content-Style-Type\" content=\"text/css\" /> \n" \
"  <title>Diff: %s - %s</title> \n" \
"  <style type=\"text/css\"> \n" \
"    body    { font-family: Arial, sans-serif; margin: 0.4ex; margin-right: auto; } \n" \
"    table   { width: 100%; } \n" \
"    tr      { } \n" \
"    td      { white-space: pre; font-family: Consolas, \"DejaVu Sans Mono\", \"Droid Sans Mono\", Monaco, Monospace; vertical-align: top;} \n" \
"    th      { font-size: 0.86em; } \n" \
"    .small  { font-size: 0.6em; font-style: italic; font-family: Verdana, Helvetica, sans-serif; } \n" \
"    .left   { background-color: #EEE; } \n" \
"    .right  { background-color: #FFF; } \n" \
"    .diff   { background-color: #CCF; } \n" \
"    .lblock { background-color: #BFB; } \n" \
"    .rblock { background-color: #FF8; } \n" \
"    .insert { background-color: #8FF; } \n" \
"    .delete { background-color: #ACF; } \n" \
"    .void   { background-color: #FFB; } \n" \
"    .cont   { background-color: #EEE; } \n" \
"    .linebr { background-color: #AAA; } \n" \
"    .lineno { color: red; background-color: #FFF; font-size: 0.7em; text-align: right; padding: 0 2px; } \n" \
"    .elipsis{ background-color: #AAA; } \n" \
"    .left .cont { background-color: #DDD; } \n" \
"    .right .cont { background-color: #EEE; } \n" \
"    .lblock .cont { background-color: #9D9; } \n" \
"    .rblock .cont { background-color: #DD6; } \n" \
"    .insert .cont { background-color: #0DD; } \n" \
"    .delete .cont { background-color: #8AD; } \n" \
"    .stats, .stats td, .stats th { background-color: #EEE; padding: 2px 0; } \n" \
"  </style> \n" \
"</head> \n" \
"<body > \n" \
"  <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> \n" \
"  <tr bgcolor=\"orange\"><th></th><th>%s&nbsp;%s&nbsp;</th><th> </th><th>&nbsp;%s&nbsp;%s</th><th></th></tr> \n" \
"", file1, file2, prev, url1, url2, nxt;
}

function worddiff(w1, w2) {
   prefixlen = 0;
   word1 = w1;
   do {
      if (substr(w1,1,1) == substr(w2,1,1)) {
	 w1 = substr(w1,2);
	 w2 = substr(w2,2);
      } else {
	 break;
      }
      prefixlen++;
   } while (length(w1) && length(w2));

   prefix = substr(word1,1,prefixlen);

   do {
      l1 = length(w1);
      l2 = length(w2);
      if (substr(w1,l1,1) == substr(w2,l2,1)) {
	 w1 = substr(w1,1,l1-1);
	 w2 = substr(w2,1,l2-1);
      } else {
	 break;
      }
   } while (l1 && l2);

   suffix = substr(word1, prefixlen+length(w1)+1);

   wordpart[0] = prefix;
   wordpart[1] = w1;
   wordpart[2] = w2;
   wordpart[3] = suffix;
}

function numdisplay(which, line) {
    if (optnums && (line != prevline[which])) {
	prevline[which] = line;
	return line-1;
    }
    return "";
}

function fixesc(line) {
#    Making this a no-op for now -- the change in line-breaking
#    "<br><span...>" => "\n" should make this less necessary.
#    line = gensub(/&(<[^>]*>)/, "\\1\\&", "g", line);

#   We still have to handle cases where we have a broken up "&lt;" / "&gt;"
    gsub(/&l<\/span>t;/, "\\&lt;</span>", line);
    gsub(/&g<\/span>t;/, "\\&gt;</span>", line);

    gsub(/&<span class="delete">amp;/, "<span class=\"delete\">\\&", line)
    gsub(/&<span class="insert">amp;/, "<span class=\"insert\">\\&", line)

    gsub(/&<span class="delete">lt;/, "<span class=\"delete\">\\&lt;", line);
    gsub(/&<span class="delete">gt;/, "<span class=\"delete\">\\&gt;", line);
    gsub(/&<span class="insert">lt;/, "<span class=\"insert\">\\&lt;", line);
    gsub(/&<span class="insert">gt;/, "<span class=\"insert\">\\&gt;", line);

    gsub(/&<span class="delete">l<\/span>t;/, "<span class=\"delete\">\\&lt;</span>", line);
    gsub(/&<span class="delete">g<\/span>t;/, "<span class=\"delete\">\\&gt;</span>", line);
    gsub(/&<span class="insert">l<\/span>t;/, "<span class=\"insert\">\\&lt;</span>", line);
    gsub(/&<span class="insert">g<\/span>t;/, "<span class=\"insert\">\\&gt;</span>", line);


    return line;
}

function chunkdiff(chunk) {
   if (difflines1 == 0 && difflines2 == 0) return;

   chunkfile1= sprintf("1/chunk%04d", chunk);
   chunkfile2= sprintf("2/chunk%04d", chunk);
   printf "" > chunkfile1;
   printf "" > chunkfile2;
   for (l = 0; l < difflines1; l++) { print stack1[l] >> chunkfile1; }
   for (l = 0; l < difflines2; l++) { print stack2[l] >> chunkfile2; }
   close(chunkfile1);
   close(chunkfile2);

   cmd1 = sprintf("%s -n -2 -w \"<span class=\\\"delete\\\">\"  -x \"</span>\" %s %s", wdiff, chunkfile1, chunkfile2);
   cmd2 = sprintf("%s -n -1 -y \"<span class=\\\"insert\\\">\"  -z \"</span>\" %s %s", wdiff, chunkfile1, chunkfile2);

   l=0; while (cmd1 | getline > 0) { stack1[l] = fixesc($0); l++; }
   difflines1 = l;
   l=0; while (cmd2 | getline > 0) { stack2[l] = fixesc($0); l++; }
   difflines2 = l;

   close(cmd1);
   close(cmd2);
}

function flush() {
   if (difflines1 || difflines2) {
      difftag++;
      multiline = (difflines1 > 1) || (difflines2 > 1);
      if (multiline && (wdiff != "")) chunkdiff(difftag);

      printf "      <tr><td><a name=\"diff%04d\" /></td></tr>\n", difftag;
      for (l = 0; l < difflines1 || l < difflines2; l++) {
	 if (l in stack1) {
	    line1 = stack1[l];
	    delete stack1[l];
	    linenum1++
	    if (line1 == "")
	       if (optwidth > 0) {
		   line1 = substr("                                                                                                                                                                ",0,optwidth);
	       } else {
		   line1 = "                                                                         ";
	       }
	 } else {
	    line1 = "";
	 }
	 if (l in stack2) {
	    line2 = stack2[l];
	    delete stack2[l];
	    linenum2++;
	    if (line2 == "")
	       if (optwidth > 0) {
		   line2 = substr("                                                                                                                                                                ",0,optwidth);
	       } else {
		   line2 = "                                                                         ";
	       }
	 } else {
	    line2 = "";
	 }

	 if (!multiline || (wdiff == "")) {
	    worddiff(line1, line2);
	    line1 = fixesc(sprintf("%s<span class=\"delete\">%s</span>%s", wordpart[0], wordpart[1], wordpart[3]));
	    line2 = fixesc(sprintf("%s<span class=\"insert\">%s</span>%s", wordpart[0], wordpart[2], wordpart[3]));
	    # Clean up; remove empty spans
	    sub(/<span class="delete"><\/span>/,"", line1);
	    sub(/<span class="insert"><\/span>/,"", line2);
	 }
	 left  = sprintf("<td class=\"lineno\" valign=\"top\">%s</td><td class=\"lblock\">%s</td>", numdisplay(1, linenum1), line1);
	 right = sprintf("<td class=\"rblock\">%s</td><td class=\"lineno\" valign=\"top\">%s</td>", line2, numdisplay(2, linenum2));
	 printf "      <tr>%s<td> </td>%s</tr>\n", left, right;
      }
   }
}

function getpage(which, line) {
    line = line + ENVIRON["prelines"];
    page = "?";
    for (p=1; p <= maxpage[which]; p++) {
	if (pageend[which,p] == 0) continue;
	if (line <= pageend[which,p]) {
	    page = p;
	    break;
	}
    }
    return page;
}

function getpageline(which, line, page) {
    if (page == "?") {
	return line + ENVIRON["prelines"];
    } else {
	if (pageend[which,page-1]+0 != 0) {
	    return line + ENVIRON["prelines"] - pageend[which,page-1] + 3; # numbers of header lines stripped
	} else {
	    return "?";
	}
    }
}

function htmlesc(line) {
    gsub("&", "\\&amp;", line);
    gsub("<", "\\&lt;", line);
    gsub(">", "\\&gt;", line);
    return line;
}

function expandtabs(line) {
    spaces = "        ";
    while (pos = index(line, "\t")) {
	sub("\t", substr(spaces, 0, (8-pos%8)), line);
    }
    return line;
}

function maybebreakline(line,    width) {
    width = optwidth;
    new = "";
    if (width > 0) {
	line = expandtabs(line);
	while (length(line) > width) {
	    new = new htmlesc(substr(line, 1, width)) "\n";
	    line = substr(line, width+1);
	}
    }
    line = new htmlesc(line) ;
    return line;
}

/^@@/	{
	   linenum1 = 0 - $2;
	   linenum2 = 0 + $4;
	   diffnum ++;
	   if (linenum1 > 1) {
	      printf "      <tr><td class=\"lineno\"></td><td class=\"left\"></td><td> </td><td class=\"right\"></td><td class=\"lineno\"></td></tr>\n";
	      page1 = getpage(1,linenum1);
	      page2 = getpage(2,linenum2);
	      if (page1 == "?") {
		 posinfo1 = sprintf("<a name=\"part-l%s\" /><small>skipping to change at</small><em> line %s</em>", diffnum, getpageline(1, linenum1, page1));
	      } else {
		 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));
	      }

	      if (page2 == "?") {
		 posinfo2 = sprintf("<a name=\"part-r%s\" /><small>skipping to change at</small><em> line %s</em>", diffnum, getpageline(2, linenum2, page2));
	      } else {
		 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));
	      }

	      printf "      <tr bgcolor=\"#c0c0c0\" ><td></td><th>%s</th><th> </th><th>%s</th><td></td></tr>\n", posinfo1, posinfo2;
	   }
	}

/^---/	{  next; }
/^[+][+][+]/	{  next; }
/^[ ]/	{
	   line = substr($0, 2);
	   line = maybebreakline(line);

	   flush();
	   linenum1++;
	   linenum2++;
	   printf "      <tr><td class=\"lineno\" valign=\"top\">%s</td><td class=\"left\">%s</td><td> </td>", numdisplay(1, linenum1), line;
	   printf "<td class=\"right\">%s</td><td class=\"lineno\" valign=\"top\">%s</td></tr>\n", line, numdisplay(2, linenum2);
	   diffcount1 += difflines1
	   difflines1 = 0
	   diffcount2 += difflines2
	   difflines2 = 0
	}
/^-/	{
	   line = substr($0, 2);
	   line = maybebreakline(line);

	   stack1[difflines1] = line;
	   difflines1++;
	}
/^[+]/	{
	   line = substr($0, 2);
	   line = maybebreakline(line);

	   stack2[difflines2] = line;
	   difflines2++;
	}

END	{
	   flush();
	   printf("\n" \
"     <tr><td></td><td class=\"left\"></td><td> </td><td class=\"right\"></td><td></td></tr>\n" \
"     <tr bgcolor=\"#c0c0c0\"><th colspan=\"5\" align=\"center\"><a name=\"end\">&nbsp;%s. %s change block(s).&nbsp;</a></th></tr>\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" \
"     <tr><td colspan=\"5\" align=\"center\" class=\"small\"><br/>This html diff was produced by rfcdiff %s</td></tr>\n" \
"   </table>\n" \
"   </body>\n" \
"   </html>\n", diffnum?"End of changes":"No changes", difftag, diffcount1, diffcount2, ENVIRON["version"]);
	}
' "$1"
}

# ----------------------------------------------------------------------
# Generate before/after text output from a context diff
# ----------------------------------------------------------------------
abdiff() {
$AWK '
BEGIN	{
	   # Read pagecache1
	   maxpage[1] = 1
	   pageend[1,0] = 2;
	   while ( getline < ENVIRON["pagecache1"] > 0) {
	      pageend[1,$1] = $2;
	      if ($1+0 > maxpage[1]) maxpage[1] = $1+0;
	   }

	   # Read pagecache2
	   maxpage[2] = 1
	   pageend[2,0] = 2;
	   while ( getline < ENVIRON["pagecache2"] > 0) {
	      pageend[2,$1] = $2;
	      if ($1+0 > maxpage[2]) maxpage[2] = $1+0;
	   }

	   base1 = ENVIRON["base1"]
	   base2 = ENVIRON["base2"]

	   section = "INTRODUCTION";
	   para = 0;

	}
/^\+\+/ {
	   next;
	}
/^\-\-/ {
	   next;
	}
/^ Appendix ./	{
	   section = $1 " " $2;
	   para = 0;
	}
/^  ? ? ?[0-9]+(\.[0-9]+)*\.? /	{
	   section = "Section " $1;
	   para = 0;
	}
/^ ?$/	{
	   if (inpara) {
	      printf "\n%s, paragraph %s:\n", section, para;
	      print "OLD:\n"
	      print oldpara
	      print "NEW:\n"
	      print newpara
	   }
	   oldpara = "";
	   newpara = "";
	   para ++;
	   inpara = 0
	}
/^ ./	{
	   oldpara = oldpara $0 "\n"
	   newpara = newpara $0 "\n"
	}
/^\-/	{
	   sub(/^./, " ");
	   oldpara = oldpara $0 "\n"
	   inpara++;
	}
/^\+/	{
	   sub(/^./, " ");
	   newpara = newpara $0 "\n"
	   inpara++;
	}
END	{
	   if (inpara) {
	      printf "\n%s, paragraph %s:\n", section, para;
	      print "OLD:\n"
	      print oldpara
	      print "NEW:\n"
	      print newpara
	   }	
	}
'
}


# ----------------------------------------------------------------------
# Utility to extract keyword info
# ----------------------------------------------------------------------
extract() {
    $AWK -v keyword="$1" '
	BEGIN {
	    # print "Keyword", keyword;
	}
	/^# [A-Z]/ {
	    # print "New key", $2;
	    if ($2 == keyword ":" ) { output=1; } else { output=0; }
	    # print "Output", output;
	}
	/^#\t/	{
	    # print "Content", output, $0;
	    if ( output ) {
		sub(/^#/,"");
		print;
	    }
	}
	{
	    next;
	}

    ' "$2"
}


# ----------------------------------------------------------------------
# Utility for error exit
# ----------------------------------------------------------------------
die() {
   echo $*;
   exit 1;
}

# ----------------------------------------------------------------------
# Process options
# ----------------------------------------------------------------------

# Default values
opthtml=1; optdiff=0; optchbars=0; optwdiff=0; optnowdiff=0;
optkeep=0; optinfo=0; optwidth=0;  optnums=0;  optbody=0; optabdiff=0;
optstrip=1; opthwdiff=0; optlinks=0;
optoldcolour="red"; optnewcolour="green"; optlarger=""
optstdout=0;
opttmpdiff=0; tmpdiff=$workdir/diff;

while [ $# -gt 0 ]; do
   case "$1" in
      --html)   opthtml=1; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=0;;
      --diff)   opthtml=0; optdiff=1; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=0;;
      --chbars) opthtml=0; optdiff=0; optchbars=1; optwdiff=0; opthwdiff=0; optabdiff=0;;
      --wdiff)  opthtml=0; optdiff=0; optchbars=0; optwdiff=1; opthwdiff=0; optabdiff=0;;
      --hwdiff) opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=1; optabdiff=0;;
      --changes)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;
      --abdiff)	opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;
      --ab-diff)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;
      --rfc-editor-diff)opthtml=0; optdiff=0; optchbars=0; optwdiff=0; opthwdiff=0; optabdiff=1;;
      --version)echo -e "$basename\t$version"; exit 0;;
      --nowdiff)optnowdiff=1;;
      --keep)	optkeep=1;;
      --info)	optinfo=1; keyword=$2; shift;;
      --help)	optinfo=1; keyword="Usage";;
      --width)	optwidth=$2; shift;;
      --oldcolor)     optoldcolour=$2; shift;;
      --oldcolour)    optoldcolour=$2; shift;;
      --newcolor)     optnewcolour=$2; shift;;
      --newcolour)    optnewcolour=$2; shift;;
      --larger)       optlarger='size="+1"';;
      --linenum)optnums=1;;
      --body)	optbody=1;;
      --nostrip)optstrip=0; optbody=0;;
      --stdout) optstdout=1;;
      --links)  optlinks=1;;
      --ignore-space-change) optnospacechange=1;;
      --ignore-all-space) optignorewhite=1;;
      --ignore-blank-lines) optignoreblank=1;;
      --wdiff-args) optwdiffargs=$2; shift;;
      --tmpdiff) opttmpdiff=1; tmpdiff=$2; shift;;
      --prelines)  export prelines=$2; shift;;
      --minimal) optminimal=1;;
      --)	shift; break;;

      -v) echo "$basename $version"; exit 0;;
      -*) echo "Unrecognized option: $1";
	  exit 1;;
      *)  break;;
   esac
   shift
done

export optwidth
export optnums
export optlinks

# ----------------------------------------------------------------------
# Determine output file name. Maybe output usage and exit.
# ----------------------------------------------------------------------
#set -x

if [ $optinfo -gt 0 ]; then
   extract $keyword $0
   exit
fi
if [ $# -ge 2 ]; then
   if [ "$1" = "$2" ]; then
      echo "The files are the same file"
      exit
   fi
   export base1=$(basename "$1")
   export base2=$(basename "$2")
   outbase=$(worddiff "$base2" "$base1" "%s%s-from-%s")
else
   extract Usage $0
   exit 1
fi


# ----------------------------------------------------------------------
# create working directory.
# ----------------------------------------------------------------------
mkdir $workdir/1 || die "$0: Error: Failed to create temporary directory '$workdir/1'."
mkdir $workdir/2 || die "$0: Error: Failed to create temporary directory '$workdir/2'."

# ----------------------------------------------------------------------
# Copy files to a work directory
# ----------------------------------------------------------------------
cp "$1" $workdir/1/"$base1"
cp "$2" $workdir/2/"$base2"


# ----------------------------------------------------------------------
# Maybe strip headers/footers from both files
# ----------------------------------------------------------------------

if [ $optstrip -gt 0 ]; then
   export which=1
   strip $workdir/1/"$base1" > $workdir/1/"$base1".stripped
   mv -f $workdir/1/"$base1".stripped $workdir/1/"$base1"
   export which=2
   strip $workdir/2/"$base2" > $workdir/2/"$base2".stripped
   mv -f $workdir/2/"$base2".stripped $workdir/2/"$base2"
fi

# ----------------------------------------------------------------------
# Maybe do html quoting
# ----------------------------------------------------------------------

if [ $opthwdiff -gt 0 ]; then
   sed -e 's/&/&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' $workdir/1/"$base1" > $workdir/1/"$base1".quoted
   mv -f $workdir/1/"$base1".quoted $workdir/1/"$base1"
   sed -e 's/&/&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g' $workdir/2/"$base2" > $workdir/2/"$base2".quoted
   mv -f $workdir/2/"$base2".quoted $workdir/2/"$base2"
fi

# ----------------------------------------------------------------------
# Maybe strip preamble (title, boilerplate and table of contents) and
# postamble (Intellectual Property Statement, Disclaimer etc)
# ----------------------------------------------------------------------
if [ $optbody -gt 0 ]; then
   bodystrip $workdir/1/"$base1" > $workdir/1/"$base1".stripped
   mv $workdir/1/"$base1".stripped $workdir/1/"$base1"
   bodystrip $workdir/2/"$base2" > $workdir/2/"$base2".stripped
   mv $workdir/2/"$base2".stripped $workdir/2/"$base2"
fi

# ----------------------------------------------------------------------
# Get output file name
# ----------------------------------------------------------------------
if [ "$3" ]; then
  outfile="$3"
else
    if [ $opthtml -gt 0 ]; then
      outfile=./"$outbase".diff.html
    fi
    if [ $optchbars -gt 0 ]; then
      outfile=./"$outbase".chbar
    fi
    if [ $optdiff -gt 0 ]; then
      outfile=./"$outbase".diff
    fi
    if [ $optabdiff -gt 0 ]; then
      outfile=./"$outbase".changes
    fi
    if [ $opthwdiff -gt 0 ]; then
      outfile=./"$outbase".wdiff.html
    fi
fi
if [ "$outfile" ]; then
   tempout=./$(basename "$outfile")
fi

# ----------------------------------------------------------------------
# Check if we can use wdiff for block diffs
# ----------------------------------------------------------------------
if [ $optnowdiff -eq 0 ]; then
   wdiffbin=$(lookfor wdiff)
   export wdiffbin
fi

# ----------------------------------------------------------------------
# Do diff
# ----------------------------------------------------------------------

origdir=$PWD
cd $workdir
if cmp 1/"$base1" 2/"$base2" >/dev/null; then
   echo ""
   echo "The files are identical."
fi

if [ $opthtml -gt 0 ]; then
   diff ${optignoreblank:+-B} ${optminimal:+-d} ${optnospacechange:+-b} ${optignorewhite:+-w} -U $prelines 1/"$base1" 2/"$base2" | tee $tmpdiff | htmldiff > "$tempout"
fi
if [ $optchbars -gt 0 ]; then
   diff -Bwd -U 10000 1/"$base1" 2/"$base2" | tee $tmpdiff | grep -v "^-" | tail -n +3 | sed 's/^+/|/' > "$tempout"
fi
if [ $optdiff -gt 0 ]; then
   diff -Bwd -U $prelines 1/"$base1" 2/"$base2" | tee $tmpdiff > "$tempout"
fi
if [ $optabdiff -gt 0 ]; then
   diff -wd -U 1000 1/"$base1" 2/"$base2" | tee $tmpdiff | abdiff
fi
if [ $optwdiff -gt 0 ]; then
   wdiff -a $optwdiffargs 1/"$base1" 2/"$base2"
fi
if [ $opthwdiff -gt 0 ]; then
    echo "<html><head><title>wdiff "$base1" "$base2"</title></head><body>"	>  "$tempout"
    echo "<pre>"								>> "$tempout"
    wdiff -w "<strike><font color='$optoldcolour' $optlarger>" -x "</font></strike>"	\
          -y "<strong><font color='$optnewcolour' $optlarger>" -z "</font></strong>"	\
	  1/"$base1" 2/"$base2"							>> "$tempout"
    echo "</pre>"								>> "$tempout"
    echo "</body></html>"							>> "$tempout"
fi

if [ $optstdout -gt 0 ]; then
  cat "$tempout"
  rm  "$tempout"
else
  cd "$origdir"; if [ -f $workdir/"$tempout" ]; then mv $workdir/"$tempout" "$outfile"; fi
fi

if [ $optkeep -eq 0 ]; then
   if [ -f $pagecache1 ]; then rm $pagecache1; fi
   if [ -f $pagecache2 ]; then rm $pagecache2; fi
   rm -fr $workdir/1
   rm -fr $workdir/2
   if [ -f $tmpdiff ]; then
      if [ $opttmpdiff -eq 0 ]; then
          rm $tmpdiff
      fi
   fi
   rm -f $workdir/$tmpdiff
   rmdir $workdir
else
   cd /tmp
   tar czf $basename-$$.tgz $basename-$$
   echo "
   Temporary workfiles have been left in $workdir/, and packed up in $workdir.tgz"
fi



================================================
FILE: pkgdiff.pl
================================================
#!/usr/bin/perl
###########################################################################
# PkgDiff - Package Changes Analyzer 1.8
# A tool for visualizing changes in Linux software packages
#
# Copyright (C) 2012-2025 Andrey Ponomarenko's ABI Laboratory
#
# Written by Andrey Ponomarenko
#
# PLATFORMS
# =========
#  GNU/Linux, FreeBSD, Mac OS X
#
# PACKAGE FORMATS
# ===============
#  RPM, DEB, TAR.GZ, JAR, etc.
#
# REQUIREMENTS
# ============
#  Perl 5 (5.8 or newer)
#  GNU Diff
#  GNU Wdiff
#  GNU Awk
#  GNU Binutils (readelf)
#  Perl-File-LibMagic
#  RPM (rpm, rpmbuild, rpm2cpio) for analysis of RPM-packages
#  DPKG (dpkg, dpkg-deb) for analysis of DEB-packages
#
# SUGGESTIONS
# ===========
#  ABI Compliance Checker (1.99.1 or newer)
#  ABI Dumper (0.97 or newer)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
###########################################################################
use strict;
use Getopt::Long;
Getopt::Long::Configure ("posix_default", "no_ignore_case", "permute");
use File::Path qw(mkpath rmtree);
use File::Temp qw(tempdir);
use File::Copy qw(move copy);
use File::Compare;
use Cwd qw(abs_path cwd);
use Config;
use Fcntl;

my $TOOL_VERSION = "1.8";
my $ORIG_DIR = cwd();

# Internal modules
my $MODULES_DIR = getModules();
push(@INC, getDirname($MODULES_DIR));

my $DIFF = $MODULES_DIR."/Internals/Tools/rfcdiff-1.41-CUSTOM.sh";
my $JAVA_DUMP = $MODULES_DIR."/Internals/Tools/java-dump.sh";
my $ACC = "abi-compliance-checker";
my $ACC_VER = "1.99.1";
my $ABI_DUMPER = "abi-dumper";
my $ABI_DUMPER_VER = "0.97";

my ($Help, $ShowVersion, $DumpVersion, $GenerateTemplate, %Descriptor,
$CheckUsage, $PackageManager, $OutputReportPath, $ShowDetails, $Debug,
$SizeLimit, $QuickMode, $DiffWidth, $DiffLines, $Minimal, $NoWdiff,
$IgnoreSpaceChange, $IgnoreAllSpace, $IgnoreBlankLines, $ExtraInfo,
$CustomTmpDir, $HideUnchanged, $TargetName, $TargetTitle, %TargetVersion,
$CompareDirs, $ListAddedRemoved, $SkipSubArchives, $LinksTarget,
$SkipPattern, $AllText, $CheckByteCode, $FullMethodDiffs, $TrackUnchanged,
$MoveStyles);

my $CmdName = getFilename($0);

my %ERROR_CODE = (
    # Unchanged verdict
    "Unchanged"=>0,
    # Changed verdict
    "Changed"=>1,
    # Undifferentiated error code
    "Error"=>2,
    # System command is not found
    "Not_Found"=>3,
    # Cannot access input files
    "Access_Error"=>4,
    # Cannot find a module
    "Module_Error"=>9
);

my $HomePage = "https://github.com/lvc/pkgdiff";

my $ShortUsage = "Package Changes Analyzer (PkgDiff) $TOOL_VERSION
A tool for visualizing changes in Linux software packages
Copyright (C) 2022 Andrey Ponomarenko's ABI Laboratory
License: GNU GPL

Usage: $CmdName PKG1 PKG2 [options]
Example: $CmdName OLD.rpm NEW.rpm

More info: $CmdName --help\n";

if($#ARGV==-1)
{
    printMsg("INFO", $ShortUsage);
    exit(0);
}

GetOptions("h|help!" => \$Help,
  "v|version!" => \$ShowVersion,
  "dumpversion!" => \$DumpVersion,
# arguments
  "old=s" => \$Descriptor{1},
  "new=s" => \$Descriptor{2},
# options
  "check-usage!" => \$CheckUsage,
  "pkg-manager=s" => \$PackageManager,
  "template!" => \$GenerateTemplate,
  "report-path=s" => \$OutputReportPath,
  "details!" => \$ShowDetails,
  "size-limit=s" => \$SizeLimit,
  "width=s" => \$DiffWidth,
  "prelines=s" => \$DiffLines,
  "ignore-space-change" => \$IgnoreSpaceChange,
  "ignore-all-space" => \$IgnoreAllSpace,
  "ignore-blank-lines" => \$IgnoreBlankLines,
  "quick!" => \$QuickMode,
  "minimal!" => \$Minimal,
  "no-wdiff!" => \$NoWdiff,
  "extra-info=s" => \$ExtraInfo,
  "tmp-dir=s" => \$CustomTmpDir,
  "c|hide-unchanged!" => \$HideUnchanged,
  "debug!" => \$Debug,
  "v1|vnum1=s" => \$TargetVersion{1},
  "v2|vnum2=s" => \$TargetVersion{2},
  "name=s" => \$TargetName,
  "title=s" => \$TargetTitle,
  "d|directories!" => \$CompareDirs,
  "list-added-removed!" => \$ListAddedRemoved,
  "skip-subarchives!" => \$SkipSubArchives,
  "skip-pattern=s" => \$SkipPattern,
  "all-text!" => \$AllText,
  "links-target=s" => \$LinksTarget,
  "check-byte-code!" => \$CheckByteCode,
  "full-method-diffs!" => \$FullMethodDiffs,
  "track-unchanged!" => \$TrackUnchanged,
  "move-styles=s" => \$MoveStyles
) or errMsg();

my $TMP_DIR = undef;

if($CustomTmpDir)
{
    printMsg("INFO", "using custom temp directory: $CustomTmpDir");
    $TMP_DIR = abs_path($CustomTmpDir);
    mkpath($TMP_DIR);
    cleanTmp();
}
else {
    $TMP_DIR = tempdir(CLEANUP=>1);
}

sub cleanTmp()
{
    foreach my $E ("null", "error",
    "unpack", "output", "fmt",
    "content1", "content2",
    "xcontent1", "xcontent2")
    {
        if(-f $TMP_DIR."/".$E) {
            unlink($TMP_DIR."/".$E);
        }
        elsif(-d $TMP_DIR."/".$E) {
            rmtree($TMP_DIR."/".$E);
        }
    }
}

if(@ARGV)
{
    if($#ARGV==1)
    { # pkgdiff OLD.pkg NEW.pkg
        $Descriptor{1} = $ARGV[0];
        $Descriptor{2} = $ARGV[1];
    }
    else {
        errMsg();
    }
}

sub errMsg()
{
    printMsg("INFO", "\n".$ShortUsage);
    exit($ERROR_CODE{"Error"});
}

my $HelpMessage="
NAME:
  Package Changes Analyzer
  A tool for visualizing changes in Linux software packages

DESCRIPTION:
  Package Changes Analyzer (PkgDiff) is a tool for visualizing
  changes in Linux software packages (RPM, DEB, TAR.GZ, etc).
  
  The tool can compare directories as well (with the help of
  the -d option).

  The tool is intended for Linux maintainers who are interested
  in ensuring compatibility of old and new versions of packages.

  This tool is free software: you can redistribute it and/or
  modify it under the terms of the GNU GPL.

USAGE:
  $CmdName PKG1 PKG2 [options]
  $CmdName -d DIR1/ DIR2/ [options]

EXAMPLES:
  $CmdName OLD.rpm NEW.rpm
  $CmdName OLD.deb NEW.deb
  $CmdName OLD.tar.gz NEW.tar.gz

ARGUMENTS:
   PKG1
      Path to the old version of a package (RPM, DEB, TAR.GZ, etc).
      
      If you need to analyze a group of packages then you can
      pass an XML-descriptor of this group (VERSION.xml file):

          <version>
            /* Group version */
          </version>

          <group>
            /* Group name */
          </group>
        
          <packages>
            /path1/to/package(s)
            /path2/to/package(s)
            ...
          </packages>

   PKG2
      Path to the new version of a package (RPM, DEB, TAR.GZ, etc).

INFORMATION OPTIONS:
  -h|-help
      Print this help.

  -v|-version
      Print version information.

  -dumpversion
      Print the tool version ($TOOL_VERSION) and don't do anything else.

GENERAL OPTIONS:
  -report-path PATH
      Path to the report.
      Default:
        pkgdiff_reports/<pkg>/<v1>_to_<v2>/changes_report.html

  -details
      Try to create detailed reports.

  -size-limit SIZE
      Don't analyze files larger than SIZE in kilobytes.

  -width WIDTH
      Width of the Visual Diff.
      Default: 80

  -prelines NUM
      Size of the context in the Visual Diff.
      Default: 10

  -ignore-space-change
      Ignore changes in the amount of white space.

  -ignore-all-space
      Ignore all white space.

  -ignore-blank-lines
      Ignore changes whose lines are all blank.

  -quick
      Quick mode without creating of Visual Diffs for files.

  -minimal
      Try to find a smaller set of changes.
  
  -no-wdiff
      Do not use GNU Wdiff for analysis of changes.
      This may be two times faster, but produces lower
      quality reports.

OTHER OPTIONS:
  -check-usage
      Check if package content is used by other
      packages in the repository.

  -pkg-manager NAME
      Specify package management tool.
      Supported:
        urpm - Mandriva URPM

  -template
      Create XML-descriptor template ./VERSION.xml
      
  -extra-info DIR
      Dump extra info to DIR.
      
  -tmp-dir DIR
      Use custom temp directory.
  
  -c|-hide-unchanged
      Don't show unchanged files in the report.

  -debug
      Show debug info.
  
  -name NAME
      Set name of the package to NAME.
  
  -title TITLE
      Set name of the package in the title of the report to TITLE.
  
  -vnum1 NUM
      Set version number of the old package to NUM.
  
  -vnum2 NUM
      Set version number of the new package to NUM.
  
  -links-target TARGET
      Set target attribute for links in the report:
        _self (default)
        _blank
  
  -list-added-removed
      Show content of added and removed text files.
  
  -skip-subarchives
      Skip checking of archives inside the input packages.
  
  -skip-pattern REGEX
      Don't check files matching REGEX.
  
  -d|-directories
      Compare directories instead of packages.
  
  -all-text
      Treat all files in the archive as text files.

  -check-byte-code
      When comparing Java classes, also check for byte code changes.

  -full-method-diffs
      Perform a full diff of method bodies when -check-byte-code is specified.

  -track-unchanged
      Track unchanged files in extra info.

REPORT:
    Report will be generated to:
        pkgdiff_reports/<pkg>/<v1>_to_<v2>/changes_report.html

EXIT CODES:
    0 - Unchanged. The tool has run without any errors.
    non-zero - Changed or the tool has run with errors.

MORE INFORMATION:
    ".$HomePage."\n";

sub helpMsg() {
    printMsg("INFO", $HelpMessage."\n");
}

my $DescriptorTemplate = "
<?xml version=\"1.0\" encoding=\"utf-8\"?>
<descriptor>

/* Primary sections */

<version>
    /* Version of a group of packages */
</version>

<group>
    /* Name of a group of packages */
</group>

<packages>
    /* The list of paths to packages and/or
       directories with packages, one per line */
</packages>

<skip_files>
    /* The list of files that should
       not be analyzed, one per line */
</skip_files>

</descriptor>";

# Settings
my $RENAME_FILE_MATCH = 0.25; # 0.55
my $RENAME_CONTENT_MATCH = 0.85;
my $MOVE_CONTENT_MATCH = 0.90;
my $MOVE_DEPTH = 4;
my $DEFAULT_WIDTH = 80;
my $DIFF_PRE_LINES = 10;
my $EXACT_DIFF_SIZE = 256*1024;
my $EXACT_DIFF_RATE = 0.1;

my $USE_LIBMAGIC = 0;

my %Group = (
    "Count1"=>0,
    "Count2"=>0
);

my %FormatInfo = ();
my %FileFormat = ();

my %TermFormat = ();
my %DirFormat = ();
my %BytesFormat = ();

# Cache
my %Cache;

# Modes
my $CheckMode = "Single";

# Packages
my %TargetPackages;
my %PackageFiles;
my %PathName;
my %FileChanges;
my %PackageInfo;
my %InfoChanges;
my %PackageUsage;
my %TotalUsage;
my %RemovePrefix;

# Deps
my %PackageDeps;
my %TotalDeps;
my %DepChanges;

# Files
my %AddedFiles;
my %RemovedFiles;
my %ChangedFiles;
my %UnchangedFiles;
my %StableFiles;
my %RenamedFiles;
my %RenamedFiles_R;
my %MovedFiles;
my %MovedFiles_R;
my %ChangeRate;

my %SkipFiles;

# Symbols
my %AddedSymbols;
my %RemovedSymbols;

# Report
my $REPORT_PATH;
my $REPORT_DIR;
my %RESULT;
my $STAT_LINE;

# ABI
my %ABI_Change;

# Other
my %ArchiveFormats = (
    "TAR.GZ"   => ["tar.gz", "tgz",
                   "tar.Z", "taz"],

    "TAR.XZ"   => ["tar.xz", "txz"],

    "TAR.BZ2"  => ["tar.bz2", "tbz2",
                   "tbz", "tb2"],

    "TAR.LZMA" => ["tar.lzma",
                   "tlzma"],

    "TAR.LZ"   => ["tar.lz", "tlz"],

    "ZIP"      => ["zip", "zae"],
    "TAR"      => ["tar"],
    "LZMA"     => ["lzma"],
    "GZ"       => ["gz"],
    "XZ"       => ["xz"],

    "JAR"      => ["jar", "war",
                   "ear", "aar"],
    "APK"      => ["apk"]
);

my $ARCHIVE_EXT = getArchivePattern();

sub getModules()
{
    my $TOOL_DIR = getDirname($0);
    if(not $TOOL_DIR) {
        $TOOL_DIR = ".";
    }
    my @SEARCH_DIRS = (
        # tool's directory
        abs_path($TOOL_DIR),
        # relative path to modules
        abs_path($TOOL_DIR)."/../share/pkgdiff",
        # system directory
        'MODULES_INSTALL_PATH'
    );
    foreach my $DIR (@SEARCH_DIRS)
    {
        if($DIR!~/\A\//)
        { # relative path
            $DIR = abs_path($TOOL_DIR)."/".$DIR;
        }
        if(-d $DIR."/modules") {
            return $DIR."/modules";
        }
    }
    exitStatus("Module_Error", "can't find modules");
}

sub readModule($$)
{
    my ($Module, $Name) = @_;
    my $Path = getModulePath($Module, $Name);
    if(not -f $Path) {
        exitStatus("Module_Error", "can't access \'$Path\'");
    }
    return readFile($Path);
}

sub getModulePath($$)
{
    my ($Module, $Name) = @_;
    return $MODULES_DIR."/Internals/$Module/".$Name;
}

sub readBytes($)
{ # ELF: 7f454c46
    sysopen(FILE, $_[0], O_RDONLY);
    sysread(FILE, my $Header, 4);
    close(FILE);
    my @Bytes = map { sprintf('%02x', ord($_)) } split (//, $Header);
    return join("", @Bytes);
}

sub readSymbols($)
{
    my $Path = $_[0];
    
    my %Symbols = ();
    
    open(LIB, "readelf -WhlSsdA \"$Path\" 2>\"$TMP_DIR/null\" |");
    my $symtab = undef; # indicates that we are processing 'symtab' section of 'readelf' output
    while(<LIB>)
    {
        if(defined $symtab)
        { # do nothing with symtab
            if(index($_, "'.dynsym'")!=-1)
            { # dynamic table
                $symtab = undef;
            }
        }
        elsif(index($_, "'.symtab'")!=-1)
        { # symbol table
            $symtab = 1;
        }
        elsif(my @Info = readline_ELF($_))
        {
            my ($Bind, $Ndx, $Symbol) = ($Info[3], $Info[5], $Info[6]);
            if($Ndx ne "UND"
            and $Bind ne "WEAK")
            { # only imported symbols
                $Symbols{$Symbol} = 1;
            }
        }
    }
    close(LIB);
    
    return %Symbols;
}

my %ELF_BIND = map {$_=>1} (
    "WEAK",
    "GLOBAL"
);

my %ELF_TYPE = map {$_=>1} (
    "FUNC",
    "IFUNC",
    "OBJECT",
    "COMMON"
);

my %ELF_VIS = map {$_=>1} (
    "DEFAULT",
    "PROTECTED"
);

sub readline_ELF($)
{ # read the line of 'readelf' output corresponding to the symbol
    my @Info = split(/\s+/, $_[0]);
    #  Num:   Value      Size Type   Bind   Vis       Ndx  Name
    #  3629:  000b09c0   32   FUNC   GLOBAL DEFAULT   13   _ZNSt12__basic_fileIcED1Ev@@GLIBCXX_3.4
    shift(@Info); # spaces
    shift(@Info); # num
    if($#Info!=6)
    { # other lines
        return ();
    }
    return () if(not defined $ELF_TYPE{$Info[2]});
    return () if(not defined $ELF_BIND{$Info[3]});
    return () if(not defined $ELF_VIS{$Info[4]});
    if($Info[5] eq "ABS" and $Info[0]=~/\A0+\Z/)
    { # 1272: 00000000     0 OBJECT  GLOBAL DEFAULT  ABS CXXABI_1.3
        return ();
    }
    if(index($Info[2], "0x") == 0)
    { # size == 0x3d158
        $Info[2] = hex($Info[2]);
    }
    return @Info;
}

sub compareSymbols($$)
{
    my ($P1, $P2) = @_;
    
    my %Symbols1 = readSymbols($P1);
    my %Symbols2 = readSymbols($P2);
    
    my $Changed = 0;
    
    foreach my $Symbol (keys(%Symbols1))
    {
        if(not defined $Symbols2{$Symbol})
        {
            $Changed = 1;
            if(defined $AddedSymbols{$Symbol})
            { # moved
                delete($AddedSymbols{$Symbol});
            }
            else
            { # removed
                $RemovedSymbols{$Symbol} = 1;
            }
        }
    }
    
    foreach my $Symbol (keys(%Symbols2))
    {
        if(not defined $Symbols1{$Symbol})
        {
            $Changed = 1;
            if(defined $RemovedSymbols{$Symbol})
            { # moved
                delete($RemovedSymbols{$Symbol})
            }
            else
            { # added
                $AddedSymbols{$Symbol} = 1;
            }
        }
    }
    
    return $Changed;
}

sub compareFiles($$$$)
{
    my ($P1, $P2, $N1, $N2) = @_;
    if(not -f $P1
    or not -f $P2)
    {
        if(not -l $P1)
        { # broken symlinks
            return (0, "", "", 0, {});
        }
    }
    my $Format = getFormat($P1);
    if($Format ne getFormat($P2)) {
        return (0, "", "", 0, {});
    }
    if(getSize($P1) == getSize($P2))
    { # equal size
        if(compare($P1, $P2)==0)
        { # equal content
            return (-1, "", "", 0, {});
        }
    }
    if($QuickMode)
    { # --quick
        return (3, "", "", 1, {});
    }
    if(skipFileCompare($P1, 1))
    { # <skip_files>
        return (2, "", "", 1, {});
    }
    if(defined $SizeLimit)
    {
        if(getSize($P1) > $SizeLimit*1024
        or getSize($P2) > $SizeLimit*1024)
        {
            return (2, "", "", 1, {});
        }
    }
    my ($Changed, $DLink, $RLink, $Rate, $Adv) = (0, "", "", 0, {});
    
    if(not $ShowDetails)
    {
        if($Format eq "SHARED_OBJECT"
        or $Format eq "KERNEL_MODULE"
        or $Format eq "DEBUG_INFO")
        {
            if(not compareSymbols($P1, $P2))
            { # equal sets of symbols
                return (0, "", "", 0, {});
            }
        }
    }
    
    if(defined $FormatInfo{$Format}{"Format"}
    and $FormatInfo{$Format}{"Format"} eq "Text") {
        ($DLink, $Rate) = diffFiles($P1, $P2, getRPath("diffs", $N1));
    }
    elsif($Format eq "LICENSE"
    or $Format eq "CHANGELOG"
    or $Format eq "README"
    or $Format eq "INFORM")
    {
        if($P1=~/\.($ARCHIVE_EXT)\Z/i)
        { # changelog.Debian.gz
            my $Page1 = showFile($P1, "ARCHIVE", 1);
            my $Page2 = showFile($P2, "ARCHIVE", 2);
            ($DLink, $Rate) = diffFiles($Page1, $Page2, getRPath("diffs", $N1));
            
            # clean space
            unlink($Page1);
            unlink($Page2);
        }
        else
        { 
            ($DLink, $Rate) = diffFiles($P1, $P2, getRPath("diffs", $N1));
        }
    }
    elsif($Format eq "SHARED_OBJECT"
    or $Format eq "KERNEL_MODULE"
    or $Format eq "DEBUG_INFO"
    or $Format eq "STATIC_LIBRARY"
    or $Format eq "COMPILED_OBJECT"
    or $Format eq "SHARED_LIBRARY"
    or $Format eq "EXE"
    or $Format eq "MANPAGE"
    or $Format eq "INFODOC"
    or $Format eq "SYMLINK"
    or $Format eq "JAVA_CLASS"
    or $Format eq "JAVASCRIPT"
    or $Format eq "GETTEXT_MO")
    {
        my $Page1 = showFile($P1, $Format, 1);
        my $Page2 = showFile($P2, $Format, 2);
        if($Format eq "SYMLINK")
        {
            if(readFile($Page1) eq readFile($Page2))
            {
                # clean space
                unlink($Page1);
                unlink($Page2);
                
                return (0, "", "", 0, {});
            }
        }
        ($DLink, $Rate) = diffFiles($Page1, $Page2, getRPath("diffs", $N1));
        
        # clean space
        unlink($Page1);
        unlink($Page2);
    }
    else
    {
        $Changed = 1;
        $Rate = checkDiff($P1, $P2);
    }
    
    if($DLink or $Changed)
    {
        if($ShowDetails)
        { # --details
            if($ACC and $ABI_DUMPER)
            {
                if($Format eq "SHARED_OBJECT"
                or $Format eq "KERNEL_MODULE"
                or $Format eq "DEBUG_INFO"
                or $Format eq "STATIC_LIBRARY") {
                    ($RLink, $Adv) = compareABIs($P1, $P2, $N1, $N2, getRPath("details", $N1));
                }
            }
        }
        $DLink=~s/\A\Q$REPORT_DIR\E\///;
        $RLink=~s/\A\Q$REPORT_DIR\E\///;
        return (1, $DLink, $RLink, $Rate, $Adv);
    }
    
    return (0, "", "", 0, {});
}

sub hexDump($)
{
    my $Path = $_[0];
    my ($Hex, $Byte) = ();
    open(FILE, "<", $Path);
    while(my $Size = read(FILE, $Byte, 16*1024))
    {
        foreach my $Pos (0 .. $Size-1) {
            $Hex .= sprintf('%02x', ord(substr($Byte, $Pos, 1)))."\n";
        }
    }
    close(FILE);
    return $Hex;
}

sub checkDiff($$)
{
    my ($P1, $P2) = @_;
    my $Size1 = getSize($P1);
    if(not $Size1)
    { # empty
        return 1;
    }
    my $Size2 = getSize($P2);
    my $Rate = abs($Size1 - $Size2)/$Size1;
    my $AvgSize = ($Size1 + $Size2)/2;
    if($AvgSize<$EXACT_DIFF_SIZE
    and $Rate<$EXACT_DIFF_RATE)
    {
        my $TmpFile = $TMP_DIR."/null";
        if(-T $P1)
        { # Text
            my $TDiff = $TMP_DIR."/txtdiff";
            qx/diff -Bw \"$P1\" \"$P2\" >$TDiff 2>$TmpFile/;
            $Rate = getRate($P1, $P2, $TDiff);
            unlink($TDiff);
        }
        else
        { # Binary
            my $TDiff = $TMP_DIR."/txtdiff";
            my $T1 = $TMP_DIR."/tmp1.txt";
            my $T2 = $TMP_DIR."/tmp2.txt";
            writeFile($T1, hexDump($P1));
            writeFile($T2, hexDump($P2));
            qx/diff -Bw \"$T1\" \"$T2\" >$TDiff 2>$TmpFile/;
            unlink($T1);
            unlink($T2);
            $Rate = getRate($P1, $P2, $TDiff);
            unlink($TDiff);
        }
    }
    if($Rate>1) {
        $Rate=1;
    }
    return $Rate;
}

sub showFile($$$)
{
    my ($Path, $Format, $Version) = @_;
    my ($Dir, $Name) = sepPath($Path);
    
    my $Cmd = undef;
    
    if($Format eq "MANPAGE")
    {
        $Name=~s/\.(gz|bz2|xz)\Z//;
        $Cmd = "man \"$Path\" 2>&1|col -bfx";
    }
    elsif($Format eq "INFODOC")
    {
        $Name=~s/\.(gz|bz2|xz)\Z//;
        $Path=~s/\.(gz|bz2|xz)\Z//;
        $Cmd = "info \"$Path\"";
    }
    elsif($Format eq "ARCHIVE")
    {
        my $Unpack = $TMP_DIR."/unpack/";
        rmtree($Unpack);
        unpackArchive($Path, $Unpack);
        my @Contents = listDir($Unpack);
        if($#Contents==0) {
            $Cmd = "cat \"$Unpack/".$Contents[0]."\"";
        }
        else {
            return undef;
        }
    }
    elsif($Format eq "SHARED_OBJECT"
    or $Format eq "KERNEL_MODULE"
    or $Format eq "DEBUG_INFO"
    or $Format eq "EXE"
    or $Format eq "COMPILED_OBJECT"
    or $Format eq "STATIC_LIBRARY")
    {
        $Cmd = "readelf -Wa \"$Path\"";
    }
    elsif($Format eq "SHARED_LIBRARY")
    {
        $Cmd = "otool -TVL \"$Path\"";
    }
    elsif($Format eq "SYMLINK")
    {
        $Cmd = "file -b \"$Path\"";
    }
    elsif($Format eq "JAVA_CLASS")
    {
        if(not checkCmd("javap")) {
            return undef;
        }
        $Name=~s/\.class\Z//;
        $Name=~s/\$/./;
        $Path = $Name;
        if ($CheckByteCode) {
            if ($FullMethodDiffs) {
                $Cmd = "$JAVA_DUMP \"$Path\"";
            } else {
                $Cmd = "$JAVA_DUMP -s \"$Path\"";
            }
        } else {
            $Cmd = "javap \"$Path\""; # -c -private -verbose
        }
        chdir($Dir);
    }
    elsif($Format eq "JAVASCRIPT")
    {
        if(not checkCmd("js-beautify")) {
            return undef;
        }
        $Cmd = "js-beautify \"$Path\"";
    }
    elsif($Format eq "GETTEXT_MO")
    {
        if(not checkCmd("msgunfmt")) {
            return undef;
        }
        $Cmd = "msgunfmt \"$Path\"";
    }
    else
    { # error
        return undef;
    }
    
    my $SPath = $TMP_DIR."/fmt/".$Format."/".$Version."/".$Name;
    mkpath(getDirname($SPath));
    
    my $TmpFile = $TMP_DIR."/null";
    qx/$Cmd >"$SPath" 2>$TmpFile/;
    
    if($Format eq "JAVA_CLASS") {
        chdir($ORIG_DIR);
    }
    
    if($Format eq "SHARED_OBJECT"
    or $Format eq "KERNEL_MODULE"
    or $Format eq "DEBUG_INFO"
    or $Format eq "EXE"
    or $Format eq "COMPILED_OBJECT"
    or $Format eq "STATIC_LIBRARY")
    {
        my $Content = readFile($SPath);
        # 00bf608c  00000008 R_386_RELATIVE
        # 00bf608c  00000008 R_386_NONE
        $Content=~s/[0-9a-f]{8}\s+[0-9a-f]{8}\s+R_386_(RELATIVE|NONE)\s*//g;
        # 0000000000210028  0000000000000008 R_X86_64_RELATIVE 0000000000210028
        $Content=~s/[0-9a-f]{16}\s+[0-9a-f]{16}\s+R_X86_64_RELATIVE\s+[0-9a-f]{16}\s*//g;
        # 00be77ec  0001d507 R_386_JUMP_SLOT        00000000   dlclose
        # 0000000000210348  0000001800000007 R_X86_64_JUMP_SLOT     0000000000000000 mq_receive + 0
        $Content=~s/\n([0-9a-f]{8}|[0-9a-f]{16})\s+([0-9a-f]{8}|[0-9a-f]{16}) /\nXXX YYY /g;
        $Content=~s/    [0-9a-f]{16} / ZZZ /g;
        # 563: 00000000     0 FUNC    GLOBAL DEFAULT  UND FT_New_Face
        # 17: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND sem_trywait@GLIBC_2.2.5 (2)
        $Content=~s/\n\s*\d+:(\s+[0-9a-f]{8}|\s+[0-9a-f]{16})\s+\d+\s+/\nN: XXX W /g;
        $Content=~s/\Q$Dir\E\///g;
        # Build ID: 88a916b3973e1a27b027706385af41c553a94061
        $Content=~s/\s+Build ID: \w+\s+//g;
        writeFile($SPath, uniqStr($Content));
    }
    
    return $SPath;
}

sub uniqStr($)
{
    my $Str = $_[0];
    my ($Prev, $Res) = ("", "");
    foreach my $Line (split(/\n/, $Str))
    {
        if($Line ne $Prev)
        {
            $Prev = $Line;
            $Res .= $Line."\n";
        }
    }
    return $Res;
}

sub getRPath($$)
{
    my ($Prefix, $N) = @_;
    $N=~s/\A\///g;
    my $RelPath = $Prefix."/".$N."-diff.html";
    my $Path = $REPORT_DIR."/".$RelPath;
    return $Path;
}

sub compareABIs($$$$$)
{
    my ($P1, $P2, $N1, $N2, $Path) = @_;
    
    my $Sect = `readelf -S \"$P1\" 2>\"$TMP_DIR/error\"`;
    my $Name = getFilename($P1);
    
    if($Sect!~/\.debug_info/)
    { # No DWARF info
        printMsg("WARNING", "No debug info in ".$Name);
        return ("", {});
    }
    
    mkpath(getDirname($Path));
    my $Adv = {};
    
    $Name=~s/\.debug\Z//;
    printMsg("INFO", "Compare ABIs of ".$Name." (".showNumber(getSize($P1)/1048576)."M) ...");
    
    $N1=~s/\A\///;
    $N2=~s/\A\///;
    
    my $Cmd = undef;
    my $Ret = undef;
    
    my $D1 = $REPORT_DIR."/abi_dumps/".$Group{"V1"}."/".$N1."-ABI.dump";
    my $D2 = $REPORT_DIR."/abi_dumps/".$Group{"V2"}."/".$N2."-ABI.dump";
    
    $Adv->{"ABIDump"}{1} = $D1;
    $Adv->{"ABIDump"}{2} = $D2;
    
    $Adv->{"ABIDump"}{1}=~s/\A\Q$REPORT_DIR\E\///;
    $Adv->{"ABIDump"}{2}=~s/\A\Q$REPORT_DIR\E\///;
    
    $Cmd = $ABI_DUMPER." \"$P1\" -lver \"".$Group{"V1"}."\" -o \"$D1\" -sort";
    if($Debug)
    {
        $Cmd .= " -extra-info \"$TMP_DIR/extra-info\"";
        printMsg("INFO", "Running $Cmd");
    }
    system($Cmd." >\"$TMP_DIR/output\"");
    $Ret = $?>>8;
    if($Ret!=0)
    { # error
        printMsg("ERROR", "Failed to run ABI Dumper ($Ret)");
        return ("", {});
    }
    
    if($Debug)
    {
        my $DP = $REPORT_DIR."/dwarf_dumps/".$Group{"V1"}."/".$N1."-DWARF.dump";
        mkpath(getDirname($DP));
        move("$TMP_DIR/extra-info/debug_info", $DP);
        
        $Adv->{"DWARFDump"}{1} = $DP;
        $Adv->{"DWARFDump"}{1}=~s/\A\Q$REPORT_DIR\E\///;
    }
    
    $Cmd = $ABI_DUMPER." \"$P2\" -lver \"".$Group{"V2"}."\" -o \"$D2\" -sort";
    if($Debug)
    {
        $Cmd .= " -extra-info \"$TMP_DIR/extra-info\"";
        printMsg("INFO", "Running $Cmd");
    }
    system($Cmd." >\"$TMP_DIR/output\"");
    $Ret = $?>>8;
    if($Ret!=0)
    { # error
        printMsg("ERROR", "Failed to run ABI Dumper ($Ret)");
        return ("", {});
    }
    
    if($Debug)
    {
        my $DP = $REPORT_DIR."/dwarf_dumps/".$Group{"V2"}."/".$N2."-DWARF.dump";
        mkpath(getDirname($DP));
        move("$TMP_DIR/extra-info/debug_info", $DP);
        
        $Adv->{"DWARFDump"}{2} = $DP;
        $Adv->{"DWARFDump"}{2}=~s/\A\Q$REPORT_DIR\E\///;
    }
    
    # clean space
    rmtree("$TMP_DIR/extra-info");
    
    $Cmd = $ACC." -d1 \"$D1\" -d2 \"$D2\"";
    
    $Cmd .= " -l \"".$Name."\"";
    
    $Cmd .= " --report-path=\"$Path\"";
    $Cmd .= " -quiet";
    
    if($Debug) {
        printMsg("INFO", "Running $Cmd");
    }
    system($Cmd);
    $Ret = $?>>8;
    if($Ret!=0 and $Ret!=1)
    { # error
        printMsg("ERROR", "Failed to run ABI Compliance Checker ($Ret)");
        return ("", {});
    }
    
    my ($Bin, $Src) = (0, 0);
    if(my $Meta = readFilePart($Path, 2))
    {
        my @Info = split(/\n/, $Meta);
        if($Info[0]=~/affected:([\d\.]+)/) {
            $Bin = $1;
        }
        if($Info[1]=~/affected:([\d\.]+)/) {
            $Src = $1;
        }
    }
    
    $ABI_Change{"Bin"} += $Bin;
    $ABI_Change{"Src"} += $Src;
    $ABI_Change{"Total"} += 1;
    
    return ($Path, $Adv);
}

sub checkModule($)
{
    foreach my $P (@INC)
    {
        if(-e $P."/".$_[0])
        {
            return 1;
        }
    }
    
    return 0;
}

sub getSize($)
{
    my $Path = $_[0];
    if(not $Path) {
        return 0;
    }
    if($Cache{"getSize"}{$Path}) {
        return $Cache{"getSize"}{$Path};
    }
    if(-l $Path)
    { # symlinks
        return ($Cache{"getSize"}{$Path} = length(getType($Path)));
    }
    return ($Cache{"getSize"}{$Path} = -s $Path);
}

sub diffFiles($$$)
{
    my ($P1, $P2, $Path) = @_;
    
    if(not $P1 or not $P2) {
        return ();
    }
    
    mkpath(getDirname($Path));
    
    my $TmpPath = $TMP_DIR."/diff";
    unlink($TmpPath);
    
    my $Cmd = "sh $DIFF --width $DiffWidth --stdout";
    $Cmd .= " --tmpdiff \"$TmpPath\" --prelines $DiffLines";
    
    if($IgnoreSpaceChange) {
        $Cmd .= " --ignore-space-change";
    }
    if($IgnoreAllSpace) {
        $Cmd .= " --ignore-all-space";
    }
    if($IgnoreBlankLines) {
        $Cmd .= " --ignore-blank-lines";
    }
    if($Minimal)
    { # diff --minimal
        $Cmd .= " --minimal";
    }
    if($NoWdiff) {
        $Cmd .= " --nowdiff";
    }
    
    $Cmd .= " \"".$P1."\" \"".$P2."\" >\"".$Path."\" 2>$TMP_DIR/null";
    $Cmd=~s/\$/\\\$/g;
    
    qx/$Cmd/;
    
    if(getSize($Path)<3500)
    { # may be identical
        if(readFilePart($Path, 2)=~/The files are identical/i)
        {
            unlink($Path);
            return ();
        }
    }
    
    if(getSize($Path)<3100)
    { # may be identical or non-text
        if(index(readFile($Path), "No changes")!=-1)
        {
            unlink($Path);
            return ();
        }
    }
    
    my $Rate = getRate($P1, $P2, $TmpPath);
    
    # clean space
    unlink($TmpPath);
    
    return ($Path, $Rate);
}

sub getRate($$$)
{
    my ($P1, $P2, $PatchPath) = @_;
    
    my $Size1 = getSize($P1);
    if(not $Size1) {
        return 1;
    }
    
    my $Size2 = getSize($P2);
    
    my $Rate = 1;
    # count removed/changed bytes
    my $Patch = readFile($PatchPath);
    $Patch=~s/(\A|\n)([^\-]|[\+]{3}|[\-]{3}).*//g;
    $Rate = length($Patch);
    # count added bytes
    if($Size2>$Size1) {
        $Rate += $Size2-$Size1;
    }
    $Rate /= $Size1;
    if($Rate>1) {
        $Rate=1;
    }
    return $Rate;
}

sub readFilePart($$)
{
    my ($Path, $Num) = @_;
    
    open (FILE, $Path);
    my $Lines = "";
    foreach (1 ... $Num) {
        $Lines .= <FILE>;
    }
    close(FILE);
    
    return $Lines;
}

sub getType($)
{
    my $Path = $_[0];
    
    if($Cache{"getType"}{$Path}) {
        return $Cache{"getType"}{$Path};
    }
    
    if($USE_LIBMAGIC)
    {
        my $Magic = File::LibMagic->new();
        return ($Cache{"getType"}{$Path} = $Magic->describe_filename($Path));
    }
    
    return ($Cache{"getType"}{$Path} = qx/file -b \"$Path\"/);
}

sub isRenamed($$$)
{
    my ($P1, $P2, $Match) = @_;
    my ($D1, $N1) = sepPath($P1);
    my ($D2, $N2) = sepPath($P2);
    if($D1 ne $D2) {
        return 0;
    }
    if($N1 eq $N2) {
        return 0;
    }
    my $L1 = length($N1);
    my $L2 = length($N2);
    if($L1<=8)
    { # too short names
        if($N1=~/\.(\w+)\Z/)
        { # with equal extensions
            my $E = $1;
            if($N2=~s/\.\Q$E\E\Z//g)
            { # compare without extensions
                $N1=~s/\.\Q$E\E\Z//g;
            }
        }
    }
    my $HL = ($L1+$L2)*$RENAME_FILE_MATCH/$Match;
    return (getBaseLen($N1, $N2)>=$HL);
}

sub minNum($$)
{
    if($_[0]<$_[1]) {
        return $_[0];
    }
    
    return $_[1];
}

sub getDepth($) {
    return ($_[0]=~tr![\/]!!);
}

sub getBaseLen($$)
{
    my ($Str1, $Str2) = @_;
    
    if(defined $Cache{"getBaseLen"}{$Str1}{$Str2}) {
        return $Cache{"getBaseLen"}{$Str1}{$Str2};
    }
    
    if($Str1 eq $Str2) {
        return length($Str1);
    }
    
    my $BLen = 0;
    my $Len1 = length($Str1);
    my $Len2 = length($Str2);
    my $Min = minNum($Len1, $Len2) - 1;
    
    foreach my $Pos (0 .. $Min)
    {
        my $S1 = substr($Str1, $Pos, 1);
        my $S2 = substr($Str2, $Pos, 1);
        if($S1 eq $S2) {
            $BLen+=1;
        }
        else {
            last;
        }
    }
    
    foreach my $Pos (0 .. $Min)
    {
        my $S1 = substr($Str1, $Len1-$Pos-1, 1);
        my $S2 = substr($Str2, $Len2-$Pos-1, 1);
        if($S1 eq $S2) {
            $BLen+=1;
        }
        else {
            last;
        }
    }
    
    return ($Cache{"getBaseLen"}{$Str1}{$Str2}=$BLen);
}

sub isMoved($$)
{
    my ($P1, $P2) = @_;
    my ($D1, $N1) = sepPath($P1);
    my ($D2, $N2) = sepPath($P2);
    if($N1 eq $N2
    and $D1 ne $D2) {
        return 1;
    }
    return 0;
}

sub writeExtraInfo()
{
    my $FILES = "";
    
    $FILES .= "<rate>\n    ".$RESULT{"affected"}."\n</rate>\n\n";
    
    if(my @Added = sort {lc($a) cmp lc($b)} keys(%AddedFiles)) {
        $FILES .= "<added>\n    ".join("\n    ", @Added)."\n</added>\n\n";
    }
    if(my @Removed = sort {lc($a) cmp lc($b)} keys(%RemovedFiles)) {
        $FILES .= "<removed>\n    ".join("\n    ", @Removed)."\n</removed>\n\n";
    }
    if(my @Moved = sort {lc($a) cmp lc($b)} keys(%MovedFiles))
    {
        $FILES .= "<moved>\n";
        foreach (@Moved) {
            $FILES .= "    ".$_.";".$MovedFiles{$_}.";".showNumber($ChangeRate{$_}*100)."\n";
        }
        $FILES .= "</moved>\n\n";
    }
    if(my @Renamed = sort {lc($a) cmp lc($b)} keys(%RenamedFiles))
    {
        $FILES .= "<renamed>\n";
        foreach (@Renamed) {
            $FILES .= "    ".$_.";".$RenamedFiles{$_}.";".showNumber($ChangeRate{$_}*100)."\n";
        }
        $FILES .= "</renamed>\n\n";
    }
    if(my @Changed = sort {lc($a) cmp lc($b)} keys(%ChangedFiles))
    {
        foreach (0 .. $#Changed) {
            $Changed[$_] .= ";".showNumber($ChangeRate{$Changed[$_]}*100);
        }
        
        $FILES .= "<changed>\n    ".join("\n    ", @Changed)."\n</changed>\n\n";
    }
    if ($TrackUnchanged) {
        if(my @Unchanged = sort {lc($a) cmp lc($b)} keys(%UnchangedFiles))
        {
            $FILES .= "<unchanged>\n    ".join("\n    ", @Unchanged)."\n</unchanged>\n\n";
        }
    }
    writeFile($ExtraInfo."/files.xml", $FILES);
    
    my $SYMBOLS = "";
    if(my @AddedSymbols = sort {lc($a) cmp lc($b)} keys(%AddedSymbols)) {
        $SYMBOLS .= "<added>\n    ".join("\n    ", @AddedSymbols)."\n</added>\n\n";
    }
    if(my @RemovedSymbols = sort {lc($a) cmp lc($b)} keys(%RemovedSymbols)) {
        $SYMBOLS .= "<removed>\n    ".join("\n    ", @RemovedSymbols)."\n</removed>\n\n";
    }
    writeFile($ExtraInfo."/symbols.xml", $SYMBOLS);
}

sub skipFile($)
{
    my $Name = $_[0];
    
    if(defined $SkipPattern)
    {
        if($Name=~/($SkipPattern)/)
        {
            printMsg("INFO", "skipping (pattern match) ".$Name);
            return 1;
        }
    }
    
    return 0;
}

sub detectChanges()
{
    foreach my $E ("info-diffs", "diffs") {
        mkpath($REPORT_DIR."/".$E);
    }

    if($ShowDetails) {
        mkpath($REPORT_DIR."/details");
    }
    
    foreach my $Format (keys(%FormatInfo))
    {
        %{$FileChanges{$Format}} = (
            "Total"=>0,
            "Added"=>0,
            "Removed"=>0,
            "Changed"=>0,
            "Size"=>0,
            "SizeDelta"=>0
        );
    }
    
    my (%AddedByDir, %RemovedByDir, %AddedByName,
    %RemovedByName, %AddedByPrefix, %RemovedByPrefix) = ();
    
    foreach my $Name (sort keys(%{$PackageFiles{1}}))
    { # checking old files
        my $Format = getFormat($PackageFiles{1}{$Name});
        if(not defined $PackageFiles{2}{$Name})
        { # removed files
            $RemovedFiles{$Name} = 1;
            $RemovedByDir{getDirname($Name)}{$Name} = 1;
            $RemovedByName{getFilename($Name)}{$Name} = 1;
            foreach (getPrefixes($Name, $MOVE_DEPTH)) {
                $RemovedByPrefix{$_}{$Name} = 1;
            }
        }
        else {
            $StableFiles{$Name} = 1;
        }
    }
    
    foreach my $Name (keys(%{$PackageFiles{2}}))
    { # checking new files
        my $Format = getFormat($PackageFiles{2}{$Name});
        if(not defined $PackageFiles{1}{$Name})
        { # added files
            $AddedFiles{$Name} = 1;
            $AddedByDir{getDirname($Name)}{$Name} = 1;
            $AddedByName{getFilename($Name)}{$Name} = 1;
            foreach (getPrefixes($Name, $MOVE_DEPTH)) {
                $AddedByPrefix{$_}{$Name} = 1;
            }
        }
    }
    
    foreach my $Name (sort keys(%RemovedFiles))
    { # checking removed files
        my $Path = $PackageFiles{1}{$Name};
        my $Format = getFormat($Path);
        $FileChanges{$Format}{"Total"} += 1;
        $FileChanges{$Format}{"Removed"} += 1;
        if(my $Size = getSize($Path))
        {
            $FileChanges{$Format}{"SizeDelta"} += $Size;
            $FileChanges{$Format}{"Size"} += $Size;
        }
        $FileChanges{$Format}{"Details"}{$Name}{"Status"} = "removed";
    }
    
    foreach my $Name (sort {getDepth($b)<=>getDepth($a)} sort keys(%RemovedFiles))
    { # checking moved files
        my $Format = getFormat($PackageFiles{1}{$Name});
        
        my $FileName = getFilename($Name);
        my @Removed = keys(%{$RemovedByName{$FileName}});
        my @Added = keys(%{$AddedByName{$FileName}});
        
        my @Removed = grep {not defined $MovedFiles{$_}} @Removed;
        my @Added = grep {not defined $MovedFiles_R{$_}} @Added;
        
        if($#Added!=0 or $#Removed!=0)
        {
            my $Found = 0;
            foreach my $Prefix (getPrefixes($Name, $MOVE_DEPTH))
            {
                my @RemovedPrefix = keys(%{$RemovedByPrefix{$Prefix}});
                my @AddedPrefix = keys(%{$AddedByPrefix{$Prefix}});
                
                my @RemovedPrefix = grep {not defined $MovedFiles{$_}} @RemovedPrefix;
                my @AddedPrefix = grep {not defined $MovedFiles_R{$_}} @AddedPrefix;
                
                if($#AddedPrefix==0 and $#RemovedPrefix==0)
                {
                    @Added = @AddedPrefix;
                    $Found = 1;
                }
                
            }
            if(not $Found) {
                next;
            }
        }
        
        foreach my $File (@Added)
        {
            if($Format ne getFormat($PackageFiles{2}{$File}))
            { # different formats
                next;
            }
            if(defined $MovedFiles_R{$File}) {
                next;
            }
            if(isMoved($Name, $File))
            {
                $MovedFiles{$Name} = $File;
                $MovedFiles_R{$File} = $Name;
                last;
            }
        }
    }
    
    foreach my $Name (sort keys(%RemovedFiles))
    { # checking renamed files
        if(defined $MovedFiles{$Name})
        { # moved
            next;
        }
        my $Format = getFormat($PackageFiles{1}{$Name});
        my @Removed = keys(%{$RemovedByDir{getDirname($Name)}});
        my @Added = keys(%{$AddedByDir{getDirname($Name)}});
        my $Match = 2;
        if($#Removed==0 and $#Added==0) {
            $Match *= 2;
        }
        my $FName = getFilename($Name);
        my $Len = length($FName);
        foreach my $File (sort {getBaseLen($FName, getFilename($b)) <=> getBaseLen($FName, getFilename($a))}
        sort { abs(length(getFilename($a))-$Len) <=> abs(length(getFilename($b))-$Len) } @Added)
        {
            if($Format ne getFormat($PackageFiles{2}{$File}))
            { # different formats
                next;
            }
            if(defined $RenamedFiles_R{$File}
            or defined $MovedFiles_R{$File})
            { # renamed or moved
                next;
            }
            if(isRenamed($Name, $File, $Match))
            {
                $RenamedFiles{$Name} = $File;
                $RenamedFiles_R{$File} = $Name;
                last;
            }
        }
    }
    
    foreach my $Name (sort (keys(%StableFiles), keys(%RenamedFiles), keys(%MovedFiles)))
    { # checking files
        my $Path = $PackageFiles{1}{$Name};
        my $Size = getSize($Path);
        if($Debug) {
            printMsg("INFO", $Name);
        }
        my ($NewPath, $NewName) = ($PackageFiles{2}{$Name}, $Name);
        my $Format = getFormat($Path);
        if($StableFiles{$Name})
        { # stable files
            $FileChanges{$Format}{"Total"} += 1;
            $FileChanges{$Format}{"Size"} += $Size;
        }
        elsif($NewName = $RenamedFiles{$Name})
        { # renamed files
            $NewPath = $PackageFiles{2}{$NewName};
        }
        elsif($NewName = $MovedFiles{$Name})
        { # moved files
            $NewPath = $PackageFiles{2}{$NewName};
        }
        
        my ($Changed, $DLink, $RLink, $Rate, $Adv) = compareFiles($Path, $NewPath, $Name, $NewName);
        my %Details = %{$Adv};
        
        if($Changed==1 or $Changed==3)
        {
            if($NewName eq $Name)
            { # renamed and moved files should
              # not be shown in the summary
                $FileChanges{$Format}{"Changed"} += 1;
                $FileChanges{$Format}{"Rate"} += $Rate;
                $FileChanges{$Format}{"SizeDelta"} += $Size*$Rate;
            }
            $Details{"Status"} = "changed";
            if($Changed==1)
            {
                $Details{"Rate"} = $Rate;
                $Details{"Diff"} = $DLink;
                $Details{"Report"} = $RLink;
                $ChangeRate{$Name} = $Rate;
            }
            
            $ChangedFiles{$Name} = 1;
        }
        elsif($Changed==2)
        {
            $Details{"Status"} = "changed";
            $Details{"Skipped"} = 1;
        }
        elsif($Changed==-1)
        {
            $Details{"Status"} = "unchanged";
            $Details{"Empty"} = 1;
            $Details{"Rate"} = 0;
            $UnchangedFiles{$Name} = 1;
        }
        else
        {
            $Details{"Status"} = "unchanged";
            $Details{"Rate"} = 0;
            $UnchangedFiles{$Name} = 1;
        }
        if($NewName = $RenamedFiles{$Name})
        { # renamed files
            if($Rate<$RENAME_CONTENT_MATCH) {
                $Details{"Status"} = "renamed";
            }
            else
            {
                %Details = (
                    "Status"=>"removed"
                );
                delete($RenamedFiles_R{$RenamedFiles{$Name}});
                delete($RenamedFiles{$Name});
                delete($ChangedFiles{$Name});
                unlink($REPORT_DIR."/".$DLink);
            }
        }
        elsif($NewName = $MovedFiles{$Name})
        { # moved files
            if($Rate<$MOVE_CONTENT_MATCH) {
                $Details{"Status"} = "moved";
            }
            else
            {
                %Details = (
                    "Status"=>"removed"
                );
                delete($MovedFiles_R{$MovedFiles{$Name}});
                delete($MovedFiles{$Name});
                delete($ChangedFiles{$Name});
                unlink($REPORT_DIR."/".$DLink);
            }
        }
        %{$FileChanges{$Format}{"Details"}{$Name}} = %Details;
    }
    
    foreach my $Name (keys(%AddedFiles))
    { # checking added files
        my $Path = $PackageFiles{2}{$Name};
        my $Format = getFormat($Path);
        $FileChanges{$Format}{"Total"} += 1;
        $FileChanges{$Format}{"Added"} += 1;
        if(my $Size = getSize($Path))
        {
            $FileChanges{$Format}{"SizeDelta"} += $Size;
            $FileChanges{$Format}{"Size"} += $Size;
        }
        $FileChanges{$Format}{"Details"}{$Name}{"Status"} = "added";
    }

    # Deps
    foreach my $Kind (keys(%{$PackageDeps{1}}))
    { # removed/changed deps
        %{$DepChanges{$Kind}} = (
            "Added"=>0,
            "Removed"=>0,
            "Changed"=>0,
            "Total"=>0,
            "Size"=>0,
            "SizeDelta"=>0
        );
        
        foreach my $Name (keys(%{$PackageDeps{1}{$Kind}}))
        {
            my $Size = length($Name);
            $DepChanges{$Kind}{"Total"} += 1;
            $DepChanges{$Kind}{"Size"} += $Size;
            
            if(not defined($PackageDeps{2}{$Kind})
            or not defined($PackageDeps{2}{$Kind}{$Name}))
            { # removed deps
                $DepChanges{$Kind}{"Details"}{$Name}{"Status"} = "removed";
                $DepChanges{$Kind}{"Removed"} += 1;
                $DepChanges{$Kind}{"SizeDelta"} += $Size;
                next;
            }
            
            my %Info1 = %{$PackageDeps{1}{$Kind}{$Name}};
            my %Info2 = %{$PackageDeps{2}{$Kind}{$Name}};
            if($Info1{"Op"} and $Info1{"V"}
            and ($Info1{"Op"} ne $Info2{"Op"} or $Info1{"V"} ne $Info2{"V"}))
            {
                $DepChanges{$Kind}{"Details"}{$Name}{"Status"} = "changed";
                $DepChanges{$Kind}{"Changed"} += 1;
                $DepChanges{$Kind}{"SizeDelta"} += $Size;
            }
            else {
                $DepChanges{$Kind}{"Details"}{$Name}{"Status"} = "unchanged";
            }
        }
    }
    
    foreach my $Kind (keys(%{$PackageDeps{2}}))
    { # added deps
        foreach my $Name (keys(%{$PackageDeps{2}{$Kind}}))
        {
            if(not defined($PackageDeps{1}{$Kind})
            or not defined($PackageDeps{1}{$Kind}{$Name}))
            {
                $DepChanges{$Kind}{"Total"} += 1;
                $DepChanges{$Kind}{"Details"}{$Name}{"Status"} = "added";
                $DepChanges{$Kind}{"Added"} += 1;
                if(my $Size = length($Name))
                {
                    $DepChanges{$Kind}{"Size"} += $Size;
                    $DepChanges{$Kind}{"SizeDelta"} += $Size;
                }
            }
        }
    }
    
    # Info
    %InfoChanges = (
        "Added"=>0,
        "Removed"=>0,
        "Changed"=>0,
        "Total"=>0,
        "Size"=>0,
        "SizeDelta"=>0
    );
    
    my $OldPkgs = keys(%{$TargetPackages{1}});
    my $NewPkgs = keys(%{$TargetPackages{2}});
    
    if(keys(%PackageInfo)==2
    and $OldPkgs==1
    and $NewPkgs==1)
    { # renamed?
        my @Names = keys(%PackageInfo);
        my $N1 = $Names[0];
        my $N2 = $Names[1];
        
        if(defined $PackageInfo{$N1}{"V2"})
        {
            $PackageInfo{$N2}{"V2"} = $PackageInfo{$N1}{"V2"};
            delete($PackageInfo{$N1});
        }
        elsif(defined $PackageInfo{$N2}{"V2"})
        {
            $PackageInfo{$N1}{"V2"} = $PackageInfo{$N2}{"V2"};
            delete($PackageInfo{$N2});
        }
    }
    
    foreach my $Package (sort keys(%PackageInfo))
    {
        my $Old = $PackageInfo{$Package}{"V1"};
        my $New = $PackageInfo{$Package}{"V2"};
        
        my $OldSize = length($Old);
        my $NewSize = length($New);
        
        $InfoChanges{"Total"} += 1;
        if($Old and not $New)
        {
            $InfoChanges{"Details"}{$Package}{"Status"} = "removed";
            $InfoChanges{"Removed"} += 1;
            $InfoChanges{"Size"} += $OldSize;
            $InfoChanges{"SizeDelta"} += $OldSize;
        }
        elsif(not $Old and $New)
        {
            $InfoChanges{"Details"}{$Package}{"Status"} = "added";
            $InfoChanges{"Added"} += 1;
            $InfoChanges{"Size"} += $NewSize;
            $InfoChanges{"SizeDelta"} += $NewSize;
        }
        elsif($Old ne $New)
        {
            my $P1 = $TMP_DIR."/1/".$Package."-info";
            my $P2 = $TMP_DIR."/2/".$Package."-info";
            
            writeFile($P1, $Old);
            writeFile($P2, $New);
            
            my ($DLink, $Rate) = diffFiles($P1, $P2, getRPath("info-diffs", $Package."-info"));
            
            # clean space
            rmtree($TMP_DIR."/1/");
            rmtree($TMP_DIR."/2/");
            
            $DLink =~s/\A\Q$REPORT_DIR\E\///;
            
            my %Details = ();
            $Details{"Status"} = "changed";
            $Details{"Rate"} = $Rate;
            $Details{"Diff"} = $DLink;
            
            %{$InfoChanges{"Details"}{$Package}} = %Details;
            $InfoChanges{"Changed"} += 1;
            $InfoChanges{"Rate"} += $Rate;
            $InfoChanges{"Size"} += $OldSize;
            $InfoChanges{"SizeDelta"} += $OldSize*$Rate;
        }
        else
        {
            $InfoChanges{"Details"}{$Package}{"Status"} = "unchanged";
            $InfoChanges{"Size"} += $OldSize;
            $InfoChanges{"SizeDelta"} += $OldSize;
        }
    }
    
    $STAT_LINE .= "added:".keys(%AddedFiles).";";
    $STAT_LINE .= "removed:".keys(%RemovedFiles).";";
    $STAT_LINE .= "moved:".keys(%MovedFiles).";";
    $STAT_LINE .= "renamed:".keys(%RenamedFiles).";";
    $STAT_LINE .= "changed:".keys(%ChangedFiles).";";
    $STAT_LINE .= "unchanged:".keys(%UnchangedFiles).";";
}

sub htmlSpecChars($)
{
    my $Str = $_[0];
    $Str=~s/\&([^#])/&amp;$1/g;
    $Str=~s/</&lt;/g;
    $Str=~s/>/&gt;/g;
    $Str=~s/\"/&quot;/g;
    $Str=~s/\'/&#39;/g;
    return $Str;
}

sub getReportUsage()
{
    if(not keys(%PackageUsage)) {
        return "";
    }
    
    my $Report = "<a name='Usage'></a>\n";
    $Report .= "<h2>Usage Analysis</h2>\n";
    $Report .= "<table class='summary highlight'>\n";
    $Report .= "<tr><th>Package</th><th>Status</th><th>Used By</th></tr>\n";
    
    foreach my $Package (sort keys(%PackageUsage))
    {
        my $Num = keys(%{$PackageUsage{$Package}{"UsedBy"}});
        $Report .= "<tr>\n";
        $Report .= "<td class='left f_path'>$Package</td>\n";
        if($Num)
        {
            $Report .= "<td class='warning'>used</td>\n";
            if($Num==1) {
                $Report .= "<td>$Num package</td>\n";
            }
            else {
                $Report .= "<td>$Num packages</td>\n";
            }
        }
        else
        {
            $Report .= "<td class='passed'>unused</td>\n";
            $Report .= "<td></td>\n";
        }
        
        $Report .= "</tr>\n";
    }
    $Report .= "</table>\n";
    
    return $Report;
}

sub getReportHeaders()
{
    if(not keys(%PackageInfo)) {
        return "";
    }
    
    my $Report = "<a name='Info'></a>\n";
    $Report .= "<h2>Changes In Package Info</h2>\n";
    $Report .= "<table class='summary highlight'>\n";
    $Report .= "<tr><th>Package</th><th>Status</th><th>Delta</th><th>Visual Diff</th></tr>\n";
    
    my %Details = %{$InfoChanges{"Details"}};
    foreach my $Package (sort keys(%Details))
    {
        my $Status = $Details{$Package}{"Status"};
        $Report .= "<tr>\n";
        if($Status eq "removed")
        {
            $Report .= "<td class='left f_path failed'>$Package</td>\n";
            $Report .= "<td class='failed'>removed</td><td></td><td></td>\n";
        }
        elsif($Status eq "added")
        {
            $Report .= "<td class='left f_path new'>$Package</td>\n";
            $Report .= "<td class='new'>added</td><td></td><td></td>\n";
        }
        else
        {
            $Report .= "<td class='left f_path'>$Package</td>\n";
            if($Status eq "changed")
            {
                $Report .= "<td class='warning'>changed</td>\n";
                $Report .= "<td class='value'>".showNumber($Details{$Package}{"Rate"}*100)."%</td>\n";
                $Report .= "<td><a href='".encodeUrl($Details{$Package}{"Diff"})."' target=\'$LinksTarget\'>diff</a></td>\n";
            }
            else
            {
                $Report .= "<td class='passed'>unchanged</td>\n";
                $Report .= "<td>0%</td><td></td>\n";
            }
        }
        $Report .= "</tr>\n";
    }
    $Report .= "</table>\n";
    
    return $Report;
}

sub getReportDeps()
{
    my $Report = "<a name='Deps'></a>\n";
    foreach my $Kind (sort keys(%DepChanges))
    {
        my @Names = keys(%{$DepChanges{$Kind}{"Details"}});
        if(not @Names) {
            next;
        }
        $Report .= "<h2>Changes In \"".ucfirst($Kind)."\" Dependencies</h2>\n";
        $Report .= "<table class='summary highlight'>\n";
        $Report .= "<tr><th>Name</th><th>Status</th><th>Old<br/>Version</th><th>New<br/>Version</th></tr>\n";
        foreach my $Name (sort {lc($a) cmp lc($b)} @Names)
        {
            my $Status = $DepChanges{$Kind}{"Details"}{$Name}{"Status"};
            my $Color = "";
            if($Status eq "removed") {
                $Color = " failed";
            }
            elsif($Status eq "added") {
                $Color = " new";
            }
            $Report .= "<tr>\n";
            $Report .= "<td class='left f_path$Color\'>$Name</td>\n";
            if($Status eq "changed") {
                $Report .= "<td class='warning'>".$Status."</td>\n";
            }
            elsif($Status eq "removed") {
                $Report .= "<td class='failed'>".$Status."</td>\n";
            }
            elsif($Status eq "added") {
                $Report .= "<td class='new'>".$Status."</td>\n";
            }
            else {
                $Report .= "<td class='passed'>".$Status."</td>\n";
            }
            if($PackageDeps{1}{$Kind}{$Name})
            {
                my %Info1 = %{$PackageDeps{1}{$Kind}{$Name}};
                $Report .= "<td class='value'>".showOp($Info1{"Op"}).htmlSpecChars($Info1{"V"})."</td>\n";
            }
            else {
                $Report .= "<td></td>\n";
            }
            if($PackageDeps{2}{$Kind}{$Name})
            {
                my %Info2 = %{$PackageDeps{2}{$Kind}{$Name}};
                $Report .= "<td class='value'>".showOp($Info2{"Op"}).htmlSpecChars($Info2{"V"})."</td>\n";
            }
            else {
                $Report .= "<td></td>\n";
            }
            $Report .= "</tr>\n";
        }
        $Report .= "</table>\n";
    }
    return $Report;
}

sub showOp($)
{
    my $Op = $_[0];

    #$Op=~s/<=/&le;/g;
    #$Op=~s/>=/&ge;/g;

    if($Op eq "=")
    { # do not show "="
        $Op = "";
    }
    if($Op) {
        $Op = $Op." ";
    }
    return $Op;
}

sub createFileView($$$)
{
    my ($File, $V, $Dir) = @_;
    
    my $Path = $PackageFiles{$V}{$File};
    
    if(not -T $Path)
    {
        return undef;
    }
    
    my $Name = getFilename($File);
    my $Content = readFile($Path);
    my $CssStyles = readModule("Styles", "View.css");
    
    $Content = htmlSpecChars($Content);
    
    if($Name=~/\.patch\Z/)
    {
       while($Content=~s&(\A|\n)(\+.*?)(\n|\Z)&$1<span class='add'>$2</span>$3&mg){};
       while($Content=~s&(\A|\n)(\-.*?)(\n|\Z)&$1<span class='rm'>$2</span>$3&mg){};
    }
    
    $Content = "<pre class='view'>".$Content."</pre>\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";
    $Content = composeHTMLHead($Name, "", "View file ".$File, "", "", $CssStyles)."\n<body>\n".$Content;
    $Content .= "</body></html>";
    
    my $R = $Dir."/".$File."-view.html";
    writeFile($REPORT_DIR."/".$R, $Content);
    
    # plain copy
    copy($Path, $REPORT_DIR."/".$Dir."/".getDirname($File)."/");
    
    return $R;
}

sub getReportFiles()
{
    my $Report = "";
    my $JSort = "title='sort' onclick='javascript:sort(this, 1)' style='cursor:pointer'";
    foreach my $Format (sort {$FormatInfo{$b}{"Weight"}<=>$FormatInfo{$a}{"Weight"}}
    sort {lc($FormatInfo{$a}{"Summary"}) cmp lc($FormatInfo{$b}{"Summary"})} keys(%FileChanges))
    {
        my $Total = $FileChanges{$Format}{"Total"};
        
        if($HideUnchanged) {
            $Total = $FileChanges{$Format}{"Added"} + $FileChanges{$Format}{"Removed"} + $FileChanges{$Format}{"Changed"};
        }
        
        if(not $Total) {
            next;
        }
        
        if($HideUnchanged)
        {
            if(not $Total)
            { # do not show unchanged files
                next;
            }
            
            $FileChanges{$Format}{"Total"} = $Total;
        }
        
        $Report .= "<a name='".$FormatInfo{$Format}{"Anchor"}."'></a>\n";
        $Report .= "<h2>".$FormatInfo{$Format}{"Title"}." (".$FileChanges{$Format}{"Total"}.")</h2>\n";
        $Report .= "<table class='summary highlight'>\n";
        $Report .= "<tr>\n";
        $Report .= "<th $JSort>Name</th>\n";
        $Report .= "<th $JSort>Status</th>\n";
        if($Format ne "DIR")
        {
            $Report .= "<th $JSort>Delta</th>\n";
            $Report .= "<th>Visual<br/>Diff</th>\n";
            
            if($ShowDetails)
            {
                $Report .= "<th>Detailed<br/>Report</th>\n";
                
                if($Format eq "SHARED_OBJECT"
                or $Format eq "KERNEL_MODULE"
                or $Format eq "DEBUG_INFO"
                or $Format eq "STATIC_LIBRARY")
                {
                    $Report .= "<th>ABI<br/>Dumps</th>\n";
                    if($Debug) {
                        $Report .= "<th>DWARF<br/>Dumps</th>\n";
                    }
                }
            }
        }
        $Report .= "</tr>\n";
        my %Details = %{$FileChanges{$Format}{"Details"}};
        foreach my $File (sort {lc($a) cmp lc($b)} keys(%Details))
        {
            if($RenamedFiles_R{$File}
            or $MovedFiles_R{$File}) {
                next;
            }
            
            my %Info = %{$Details{$File}};
            
            if($HideUnchanged)
            {
                if($Info{"Status"} eq "unchanged")
                { # do not show unchanged files
                    next;
                }
            }
            
            my ($Join, $Color1, $Color2) = ("", "", "");
            if($Info{"Status"} eq "renamed"
            or $Info{"Status"} eq "moved")
            {
                $Join = " rowspan='2'";
                $Color1 = " failed";
                $Color2 = " new";
            }
            elsif($Info{"Status"} eq "added") {
                $Color1 = " new";
            }
            elsif($Info{"Status"} eq "removed") {
                $Color1 = " failed";
            }
            
            my $ShowFile = $File;
            
            if(defined $ListAddedRemoved
            and $Info{"Status"}=~/added|removed/)
            {
                my $FN = getFilename($ShowFile);
                if($Info{"Status"} eq "added")
                {
                    if(my $View = encodeUrl(createFileView($File, 2, "view/added"))) {
                        $ShowFile=~s&(\A|/)(\Q$FN\E)\Z&$1<a href=\'$View\' target=\'$LinksTarget\' title='View file'>$2</a>&;
                    }
                }
                elsif($Info{"Status"} eq "removed")
                {
                    if(my $View = encodeUrl(createFileView($File, 1, "view/removed"))) {
                        $ShowFile=~s&(\A|/)(\Q$FN\E)\Z&$1<a href=\'$View\' target=\'$LinksTarget\' title='View file'>$2</a>&;
                    }
                }
            }
            
            $Report .= "<tr>\n";
            $Report .= "<td class='left f_path$Color1\'>$ShowFile</td>\n";
            if($Info{"Status"} eq "changed") {
                $Report .= "<td class='warning'>".$Info{"Status"}."</td>\n";
            }
            elsif($Info{"Status"} eq "unchanged") {
                $Report .= "<td class='passed'>".$Info{"Status"}."</td>\n";
            }
            elsif($Info{"Status"} eq "removed") {
                $Report .= "<td class='failed'>".$Info{"Status"}."</td>\n";
            }
            elsif($Info{"Status"} eq "added") {
                $Report .= "<td class='new'>".$Info{"Status"}."</td>\n";
            }
            elsif($Info{"Status"} eq "renamed") {
                $Report .= "<td class='renamed'$Join>".$Info{"Status"}."</td>\n";
            }
            elsif($Info{"Status"} eq "moved") {
                $Report .= "<td class='moved'$Join>".$Info{"Status"}."</td>\n";
            }
            else {
                $Report .= "<td>unknown</td>\n";
            }
            if($Format ne "DIR")
 
Download .txt
gitextract_un2554x0/

├── .github/
│   └── FUNDING.yml
├── INSTALL
├── LICENSE
├── Makefile
├── Makefile.pl
├── README.md
├── doc/
│   └── index.html
├── modules/
│   ├── FileType.xml
│   └── Internals/
│       ├── Scripts/
│       │   └── Sort.js
│       ├── Styles/
│       │   ├── Index.css
│       │   └── View.css
│       └── Tools/
│           ├── java-dump.sh
│           └── rfcdiff-1.41-CUSTOM.sh
└── pkgdiff.pl
Download .txt
SYMBOL INDEX (2 symbols across 1 files)

FILE: modules/Internals/Scripts/Sort.js
  function sort (line 1) | function sort(el, status)
  function sort_array (line 83) | function sort_array(a,b)
Condensed preview — 14 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (270K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 113,
    "preview": "# These are supported funding model platforms\n\npatreon: LINUXABI\ncustom: https://abi-laboratory.pro/?view=donate\n"
  },
  {
    "path": "INSTALL",
    "chars": 1531,
    "preview": "\nCopyright (C) 2012-2025 Andrey Ponomarenko's ABI Laboratory\nAll rights reserved.\n\n\nRELEASE INFORMATION\n\nProject:       "
  },
  {
    "path": "LICENSE",
    "chars": 18031,
    "preview": "            GNU GENERAL PUBLIC LICENSE\n               Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foun"
  },
  {
    "path": "Makefile",
    "chars": 146,
    "preview": "prefix ?= /usr\n\n.PHONY: install\ninstall:\n\tperl Makefile.pl -install -prefix \"$(prefix)\"\n\nuninstall:\n\tperl Makefile.pl -r"
  },
  {
    "path": "Makefile.pl",
    "chars": 6794,
    "preview": "#!/usr/bin/perl\n###########################################################################\n# Makefile for PkgDiff\n# Ins"
  },
  {
    "path": "README.md",
    "chars": 1678,
    "preview": "PkgDiff 1.8\n===========\n\nPackage Changes Analyzer (pkgdiff) — a tool for visualizing changes in Linux software packages "
  },
  {
    "path": "doc/index.html",
    "chars": 17721,
    "preview": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\""
  },
  {
    "path": "modules/FileType.xml",
    "chars": 55315,
    "preview": "<files>\n\n<type>\n    <id>\n        HEADER\n    </id>\n    <summary>\n        Header file\n    </summary>\n    <extensions>\n    "
  },
  {
    "path": "modules/Internals/Scripts/Sort.js",
    "chars": 2164,
    "preview": "function sort(el, status)\n{ \n    var col_sort = el.innerHTML;\n    var tr = el.parentNode;\n    var table = tr.parentNode;"
  },
  {
    "path": "modules/Internals/Styles/Index.css",
    "chars": 1831,
    "preview": "@font-face {\n    font-family:\"Open Sans\";\n    src:url(\"../fonts/OpenSans.ttf\") format(\"truetype\");\n}\n\n@font-face {\n    f"
  },
  {
    "path": "modules/Internals/Styles/View.css",
    "chars": 616,
    "preview": "body {\n    margin:0.4em;\n}\n\n.view {\n    cursor:text;\n    /*margin-top:7px;*/\n    font-family:Consolas, 'DejaVu Sans Mono"
  },
  {
    "path": "modules/Internals/Tools/java-dump.sh",
    "chars": 1003,
    "preview": "#!/bin/bash\n\nfunction decompile {\n    # Decompile class and include private members. In preparation for the\n    # hashin"
  },
  {
    "path": "modules/Internals/Tools/rfcdiff-1.41-CUSTOM.sh",
    "chars": 30800,
    "preview": "#!/bin/bash\n#\n# Synopsis:\n#\tShow changes between 2 internet-drafts using changebars or html\n#\tside-by-side diff.\n#\t\n# Us"
  },
  {
    "path": "pkgdiff.pl",
    "chars": 114028,
    "preview": "#!/usr/bin/perl\n###########################################################################\n# PkgDiff - Package Changes "
  }
]

About this extraction

This page contains the full source code of the lvc/pkgdiff GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 14 files (245.9 KB), approximately 73.9k tokens, and a symbol index with 2 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!