~ubuntu-branches/ubuntu/karmic/knetfilter/karmic

« back to all changes in this revision

Viewing changes to admin/debianrules

  • Committer: Bazaar Package Importer
  • Author(s): Angel Ramos
  • Date: 2002-01-21 08:15:00 UTC
  • Revision ID: james.westby@ubuntu.com-20020121081500-poxwa9o2h1z4dlch
Tags: 2.2.0-4

Fixed problems with new libpng (Closes: #129982).

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
chomp $origPwd;
9
9
 
10
10
 
11
 
if (@ARGV && $ARGV[0] eq 'update') {
12
 
  @packages = `ls -1d debian/*/DEBIAN`;
13
 
  foreach $dir (@packages) {
14
 
    chomp $dir;
15
 
    next if (! -d $dir);
16
 
    foreach $file (qw{postinst postrm preinst prerm}) {  
17
 
      next if (! -f "$dir/$file");
18
 
      $found = 0;
19
 
      open(IN, "$dir/$file");
20
 
      open(OUT, ">/tmp/kde.dpkg");
21
 
      while (<IN>) { 
22
 
        if (/^#KDEHELPER#/) {
23
 
            $found = 1;
24
 
            if (-d $dir . "/../usr/lib/mime/packages") {
25
 
              if ($file eq 'postinst') {
26
 
                print OUT "# added by kderules\n";
27
 
                print OUT 'case "$1" in' . "\n";
28
 
                print OUT "  configure)\n";
29
 
                print OUT "    if [ -x /usr/sbin/update-mime ]; then\n";
30
 
                print OUT "       update-mime\n";
31
 
                print OUT "    fi\n";
32
 
                print OUT "  ;;\n";
33
 
                print OUT "esac\n";
34
 
              } elsif ($file eq 'postrm') {
35
 
                print OUT "# added by kderules\n";
36
 
                print OUT 'case "$1" in' . "\n";
37
 
                print OUT "   remove|purge)\n";
38
 
                print OUT "    if [ -x /usr/sbin/update-mime ]; then\n";
39
 
                print OUT "       update-mime\n";
40
 
                print OUT "    fi\n";
41
 
                print OUT "  ;;\n";
42
 
                print OUT "esac\n";
43
 
              }
44
 
            }
45
 
            
46
 
            next;
47
 
          }
48
 
        print OUT $_;
49
 
      }
50
 
      
51
 
      close IN;
52
 
      close OUT;
53
 
 
54
 
      if ($found == 0) {
55
 
        rm("/tmp/kde.dpkg");
56
 
      } else {
57
 
        mv("/tmp/kde.dpkg", "$dir/$file");
58
 
        chown("root.root","dir/$file");
59
 
        chmod(0755,"$dir/$file");   
60
 
      }
61
 
    }
62
 
  }
63
 
  exit;
64
 
}
65
 
 
66
 
$QTDIR="/usr/lib/qt2";
67
 
$kde_prefix="usr";
 
11
if (@ARGV && $ARGV[0] eq 'cleanup') {
 
12
 
 
13
if (-d "debian/tmp/usr/share/config") {
 
14
        if (! -d "debian/tmp/$kde_confdir") {
 
15
          system("mv debian/tmp/usr/share/config debian/tmp/$kde_confdir");
 
16
        }
 
17
}
 
18
system("rm -f `find debian/ -name \".anchors\"`");
 
19
system("chmod 755 debian/*preinst debian/*postinst");
 
20
 
 
21
exit;
 
22
}
 
23
 
 
24
$QTDIR="/usr/share/qt";
 
25
$kde_prefix="/usr";
68
26
$kde_htmldir="$kde_prefix/share/doc/kde/HTML";
69
27
$kde_icondir="$kde_prefix/share/icons";
70
28
$kde_sounddir="$kde_prefix/share/sounds";
71
29
$kde_datadir="$kde_prefix/share/apps";
72
30
$kde_locale="$kde_prefix/share/locale";
73
 
$kde_confdir="etc/kde2";
 
31
$kde_confdir="/etc/kde2";
 
32
$kde_cgidir="$kde_prefix/lib/cgi-bin";
74
33
$kde_appsdir="$kde_prefix/share/applnk";
75
34
$kde_mimedir="$kde_prefix/share/mimelnk";
76
35
$kde_wallpaperdir="$kde_prefix/share/wallpapers";
79
38
$kde_servicetypesdir="$kde_prefix/share/servicetypes";
80
39
$kde_includedir="$kde_prefix/include/kde";
81
40
$kde_libdir="$kde_prefix/lib";
 
41
$kde_moduledir="$kde_prefix/lib/kde2";
82
42
$mandir="$kde_prefix/share/man"; 
83
43
$infodir="$kde_prefix/share/info";
84
 
$IDL="/$kde_bindir/cuteidl";
85
 
$DCOPIDL="/$kde_bindir/dcopidl";
86
 
$DCOPIDL2CPP="/$kde_bindir/dcopidl2cpp";
87
 
$KDB2HTML="/$kde_bindir/kdb2html";
88
 
$MCOPIDL="/$kde_bindir/mcopidl";
89
 
$ARTSCCONFIG="/$kde_bindir/artsc-config";
 
44
$IDL="$kde_bindir/cuteidl";
 
45
$DCOPIDL="$kde_bindir/dcopidl";
 
46
$DCOPIDL2CPP="$kde_bindir/dcopidl2cpp";
 
47
$KDB2HTML="$kde_bindir/kdb2html";
 
48
$MCOPIDL="$kde_bindir/mcopidl";
 
49
$ARTSCCONFIG="$kde_bindir/artsc-config";
90
50
 
91
51
if (@ARGV && $ARGV[0] eq 'echodirs') {
92
52
  print STDOUT "export kde_htmldir=$kde_htmldir\n";
94
54
  print STDOUT "export kde_icondir=$kde_icondir\n";
95
55
  print STDOUT "export kde_sounddir=$kde_sounddir\n";
96
56
  print STDOUT "export kde_datadir=$kde_datadir\n";
 
57
  print STDOUT "export kde_cgidir=$kde_cgidir\n";
97
58
  print STDOUT "export kde_locale=$kde_locale\n";
98
59
  print STDOUT "export kde_confdir=$kde_confdir\n";
99
60
  print STDOUT "export kde_mimedir=$kde_mimedir\n";
103
64
  print STDOUT "export kde_servicetypesdir=$kde_servicetypesdir\n";
104
65
  print STDOUT "export kde_includedir=$kde_includedir\n";
105
66
  print STDOUT "export kde_libdir=$kde_libdir\n";
 
67
  print STDOUT "export kde_moduledir=$kde_moduledir\n";
106
68
  print STDOUT "export mandir=$mandir\n";
107
69
  print STDOUT "export infodir=$infodir\n";
108
70
  print STDOUT "export QTDIR=$QTDIR\n";
114
76
  print STDOUT "export KDB2HTML=$KDB2HTML\n";
115
77
  print STDOUT "export MCOPIDL=$MCOPIDL\n";
116
78
  print STDOUT "export ARTSCCONFIG=$ARTSCCONFIG\n";
117
 
  print STDOUT "configkde=--enable-debug --disable-rpath --prefix=/\$(kde_prefix) --libexecdir=/\$(kde_bindir) --with-qt-dir=\$(QTDIR) --mandir=/\$(mandir) --infodir=/\$(infodir)\n";
118
 
  print STDOUT "configkdevelop=--enable-docbase --enable-kdoc2 --enable-debug --disable-rpath --libdir=/\$(kde_libdir) --includedir=/\$(kde_includedir) --with-qt-dir=\$(QTDIR) --mandir=/\$(mandir) --with-kdelibsdoc-dir=/usr/share/doc/kdelibs3-doc/html\n";
 
79
  print STDOUT "configkde=--disable-debug --disable-rpath --prefix=\$(kde_prefix) --libexecdir=\$(kde_bindir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --infodir=\$(infodir)\n";
 
80
  print STDOUT "configkdevelop=--disable-debug --enable-docbase --enable-kdoc2 --disable-rpath --libdir=\$(kde_libdir) --includedir=\$(kde_includedir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --with-kdelibsdoc-dir=/usr/share/doc/kdelibs3-doc/html\n";
 
81
  print STDOUT "configkdepim=--disable-debug --with-extra-includes=/usr/include/libpisock --enable-shared --disable-rpath --prefix=\$(kde_prefix) --libexecdir=\$(kde_bindir) --with-qt-includes=/usr/include/qt --mandir=\$(mandir) --infodir=\$(infodir)\n";
119
82
  exit
120
83
}
121
84
 
122
 
if (@ARGV && $ARGV[0]) {  
123
 
  $package = $ARGV[0];
124
 
} else {
125
 
  open(CHANGELOG,"debian/changelog") 
126
 
        or die "can't read debian/changelog : $!\n";
127
 
  $_ = <CHANGELOG>;
128
 
  close(CHANGELOG);
129
 
  /^(.*) \((.*)\) /;
130
 
  $package = $1;
131
 
}
132
 
 
133
 
# Find documentation and install it
134
 
sub docwanted {
135
 
        local $dir = $File::Find::dir;
136
 
        $dir =~ s/^$origPwd//;
137
 
        if ($dir =~ /debian/) { return 0 ; }
138
 
        if ($dir =~ /build/) { return 0 ; }
139
 
        if ( ( /debian/ ) or ( /^INSTALL$/ ) or ( /^LICENSE$/ ) 
140
 
        or ( /^ARTISTIC$/ ) or ( /^COPYING$/ ) ) { return 0 ; } 
141
 
        if ( (! /CVS/ ) 
142
 
        and ( /^[A-Z]*$/ or /^README$/ or /^ChangeLog$/ or /lsm$/ or /SWALLOW/
143
 
        or /^TODO$/ or /^kdedoc$/ or /Header/ or /Documentation/ or /Tutorial/ ) )
144
 
        {       
145
 
                if ($dir) {
146
 
                  $_ = "$dir/$_";
147
 
                  $_ =~ s/^\///;
148
 
                }
149
 
                push @docs, "$_" ;
150
 
        }
151
 
}
152
 
 
153
 
$pwd = './';
154
 
 
155
 
find(\&docwanted, $pwd);
156
 
if ($pwd =~ ?^(.*/)build_([^/]*)$?) {
157
 
  $pwd = $1 . $2;
158
 
  if (-d $pwd) {
159
 
     find(\&docwanted, $pwd);
160
 
  }
161
 
}
162
 
 
163
 
if (! -d "debian/tmp/usr/share/doc/$package") {
164
 
        mkdir("-p", "debian/tmp/usr/share/doc/$package") ;
165
 
}
166
 
 
167
 
if (-d "debian/tmp/usr/share/config") {
168
 
        if (! -d "debian/tmp/$kde_confdir") {
169
 
             system("mv debian/tmp/usr/share/config debian/tmp/$kde_confdir");
170
 
        }
171
 
}
172
 
 
173
 
 
174
 
if (@docs) {
175
 
       chdir($origPwd);
176
 
       cp( "-aP", @docs, "debian/tmp/usr/share/doc/$package") ;
177
 
       if (-f "debian/tmp/usr/share/doc/$package/ChangeLog") {
178
 
          mv("debian/tmp/usr/share/doc/$package/ChangeLog", 
179
 
                "debian/tmp/usr/share/doc/$package/changelog");
180
 
        }
181
 
        if (-f "debian/tmp/usr/share/doc/$package/CHANGES") {
182
 
          mv("debian/tmp/usr/share/doc/$package/CHANGES",
183
 
                "debian/tmp/usr/share/doc/$package/changelog");
184
 
        }
185
 
}
186
 
 
187
 
# Create doc-base file
188
 
 
189
 
if (-d "debian/doc-base") {
190
 
        if (! -d "debian/tmp/usr/share/doc-base") {
191
 
                  mkdir("-p", "debian/tmp/usr/share/doc-base");
192
 
        }
193
 
        while (<debian/doc-base/*>) {
194
 
                  cp( "-a", $_, "debian/tmp/usr/share/doc-base")
195
 
                    unless (-d $_);
196
 
        }
197
 
#        cp( "-a", <debian/doc-base/*>, "debian/tmp/usr/share/doc-base") ;
198
 
}
199
 
 
200
 
 
201
 
# Create debian/menu files
202
 
 
203
 
sub findkdelnk {
204
 
        /\.desktop$/ && push @lnkfiles, "$File::Find::dir/$_" ;
205
 
}
206
 
 
207
 
if (-d "debian/tmp/$kde_appsdir") {
208
 
        find(\&findkdelnk,"debian/tmp/$kde_appsdir");
209
 
}
210
 
 
211
 
if (-e "debian/menu.in") {
212
 
        open MENUIN, "debian/menu.in" ;
213
 
        while (<MENUIN>) {
214
 
                chop ;
215
 
                ($prog,$type,$sect) = split / /;
216
 
                $type{$prog}=$type;
217
 
                $sect{$prog}=$sect;
218
 
        }
219
 
        close MENUIN;
220
 
}
221
 
 
222
 
open MENU, ">debian/menu" or die "can't open debian/menu : $!\n";
223
 
open MIME, ">debian/mailcap" or die "can't open debian/mailcap : $!\n";
224
 
 
225
 
foreach $file (@lnkfiles) {
226
 
        open KDELNK, $file;
227
 
        undef %kdelnk;
228
 
        while (<KDELNK>) {
229
 
                /^#/ && next ;
230
 
                /^\[KDE Desktop Entry\]/ && next ;
231
 
                /^\s*$/ && next ;
232
 
                chop ;
233
 
                ($what,$value) = split /=/ ;
234
 
                $kdelnk{ucfirst lc $what}=$value;
235
 
        }
236
 
        close KDELNK;
237
 
        if (defined $kdelnk{"Type"}) {
238
 
                if ($kdelnk{"Type"} ne "Application" ) {
239
 
                        print STDERR "Type is not Application : $file !\n" ;
240
 
                        next ;
241
 
                }
242
 
        } else {
243
 
                print STDERR "has no Type= defaults to Application : $file !\n" ;
244
 
        }
245
 
        if (! defined $kdelnk{"Exec"}) {
246
 
                print STDERR "has no Exec= : $file !\n" ;
247
 
                next ;
248
 
        }
249
 
 
250
 
        if (defined $kdelnk{"Mimetype"} && ! $kdelnk{"Mimetype"} eq '') {
251
 
 
252
 
           $execline = $kdelnk{"Exec"};
253
 
           $execline =~ s/%f/%s/;
254
 
           $execline =~ s/%c/$kdelnk{"Name"}/;
255
 
           $execline =~ s/%i//;
256
 
           $execline =~ s/%m//;
257
 
           $execline =~ s/%u/%s/;
258
 
           $mimeline = $kdelnk{"Mimetype"};
259
 
           @mimetypes = split(';', $mimeline);
260
 
           foreach $mimetype (@mimetypes) {
261
 
           print MIME "$mimetype; $execline;" . 'test=test "$DISPLAY" != ""; priority=7' . "\n";
262
 
           }
263
 
 
264
 
        }
265
 
 
266
 
        ($prog,)=split / /, $kdelnk{"Exec"} ;
267
 
        if (! defined($type{$prog})) {
268
 
                open MENUIN, ">>debian/menu.in" ;
269
 
                print MENUIN "$prog x11 NONE\n";
270
 
                close MENUIN;
271
 
                next ;
272
 
        }
273
 
        if ($sect{$prog} eq "NONE") { next ; }
274
 
        $icon="";
275
 
        if (not defined $kdelnk{"Name"}) {
276
 
                print STDERR "No Name : $package $kdelnk\n";
277
 
                next ;
278
 
        }
279
 
        if (defined $kdelnk{"Icon"}) {
280
 
                $icon=$kdelnk{"Icon"} ;
281
 
                if (! -f "debian/tmp/$kde_icondir/mini/$prog.png" ) {
282
 
                   $icon="";
283
 
                } else {
284
 
                  $icon="/$kde_icondir/mini/$prog.png";
285
 
               }
286
 
        }
287
 
        ($kdelnk=$file) =~ s/^.*tmp// ;
288
 
        print MENU "?package($package):\\\n" ;
289
 
        print MENU "    needs=$type{$prog}\\\n" ;
290
 
        print MENU "    section=$sect{$prog}\\\n" ;
291
 
        print MENU "    title=\"$kdelnk{Name}\"\\\n" ;
292
 
        print MENU "    command=$prog\\\n" ;
293
 
        print MENU "    icon=\"$icon\"\n\n" ;
294
 
 
295
 
}
296
 
 
297
 
if (-e "debian/menu.add") {
298
 
        open MENUADD, "debian/menu.add" ;
299
 
        while (<MENUADD>) {
300
 
                print MENU $_ ;
301
 
        }
302
 
        close MENUADD;
303
 
}
304
 
 
305
 
close MENU;
306
 
 
307
 
if (-z "debian/menu") {
308
 
        rm("debian/menu");
309
 
}
310
 
 
311
 
close MIME;
312
 
 
313
 
if (-z "debian/mailcap") {
314
 
  rm("debian/mailcap");
315
 
} else {
316
 
  mkdir("-p", "debian/tmp/usr/lib/mime/packages");
317
 
  cp("debian/mailcap", "debian/tmp/usr/lib/mime/packages/$package");
318
 
}
319