This file is indexed.

/usr/bin/dh_movelibkdeinit is in pkg-kde-tools 0.15.20~ubuntu4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/bin/perl -w

# Copyright (C) 2010 Modestas Vainius <modax@debian.org>
#
# 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 3 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, see <http://www.gnu.org/licenses/>

=head1 NAME

dh_movelibkdeinit - move libkdeinit4_*.so from public to the private directory

=head1 SYNOPSIS

B<dh_movelibkdeinit> [S<I<debhelper options>>]

=head1 DESCRIPTION

B<dh_movelibkdeinit> is a helper program which moves all installed
F<usr/lib/libkdeinit4_*.so> kdeinit "shared" executables from the public
location to the private subdirectory F</usr/lib/kde4/libkdeinit>.
libkdeinit*.so shared executables are not proper public shared libraries by
definition and they are built as shared library only for performance purposes.

Please note, however, that in order for the moved executables to work properly,
the following conditions must be met:

=over 4

=item *

the package should depend on the kde4libs binary packages built with the
C<-DLIBKDEINIT_INSTALL_DIR=/usr/lib/kde4/libkdeinit> cmake flag (enabled since
kde4libs 4:4.4.0). B<dh_movelibkdeinit> will try to confirm this condition and
it will do nothing if it is not met.

=item *

the source package was built with the C<-DENABLE_LIBKDEINIT_RUNPATH=ON> cmake
flag. This flag is enabled by default when building using either CDBS kde.mk
class or the debhelper kde build system which both as shipped in the 0.6.2 or
later version of the I<pkg-kde-tools> package.

=back

=head1 OPTIONS

=over 4

=item B<-X>I<item>, B<--exclude> I<item>

Do not move libkdeinit4_*.so files that contain "item" anywhere in their
filename. You may use this option multiple times to build up a list of things
to exclude.

=back

=cut

use strict;
use warnings;

use Debian::Debhelper::Dh_Lib;

use constant LIBKDEINIT_INSTALL_DIR => '/usr/lib/kde4/libkdeinit';

init();

if (@{$dh{DOPACKAGES}} && -f '/usr/bin/kdeinit4' &&
    system(sprintf("objdump -p /usr/bin/kdeinit4 2>/dev/null | grep -q 'RUNPATH.*%s'",
        LIBKDEINIT_INSTALL_DIR)) != 0)
{
    warning("kdeinit4 does not have a proper RUNPATH set, not moving public libkdeinit4_*.so");
    exit 0;
}

foreach my $package (@{$dh{DOPACKAGES}}) {
    my $tmpdir = tmpdir($package);
    if (-d "$tmpdir/usr/lib") {
        my $libkdeinit_dir = $tmpdir . LIBKDEINIT_INSTALL_DIR;
        my @libkdeinit;
        my $exclude = '';
        if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') {
            $exclude = "! \\( $dh{EXCLUDE_FIND} \\)";
        }
        open (FIND, "find $tmpdir/usr/lib -maxdepth 1 -type f \\( -name 'libkdeinit4_*.so' \\) $exclude |");
        while (<FIND>) {
            chop;
            push @libkdeinit, $_;
        }
        close FIND;

        for my $libkdeinit (@libkdeinit) {
            my $exename;
            my $exepath;
            if ($libkdeinit =~ m%/libkdeinit4_([^/]*)\.so$%) {
                $exename = $1;
                if (-x "$tmpdir/usr/bin/$exename") {
                    $exepath = "$tmpdir/usr/bin/$exename";
                } else {
                    open (FIND, "find $tmpdir -type f -executable -name $exename |");
                    $exepath = <FIND>;
                    chop $exepath if $exepath;
                    close FIND;
                }
            }
            if ($exepath) {
                if (system(sprintf("objdump -p '%s' 2>/dev/null | grep -q 'RUNPATH.*%s'",
                               $exepath, LIBKDEINIT_INSTALL_DIR)) == 0) {
                    unless (-d $libkdeinit_dir) {
                        doit("mkdir", "-p", $libkdeinit_dir);
                    }
                    doit("mv", $libkdeinit, $libkdeinit_dir);
                } else {
                    warning("unable to validate RUNPATH on the dummy kdeinit executable for $libkdeinit, not moving");
                }
            } else {
                warning("unable to find a dummy kdeinit executable for $libkdeinit, not moving");
            }
        }
    }
}

exit 0;

=head1 SEE ALSO

L<debhelper(7)>

=head1 AUTHOR

Modestas Vainius <modax@debian.org>

=cut