File: symlink_html_images_to_info_images

package info (click to toggle)
lilypond 2.19.83-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 76,396 kB
  • sloc: cpp: 79,385; ansic: 75,071; lisp: 59,263; xml: 31,196; python: 22,406; sh: 8,159; yacc: 3,872; perl: 3,507; asm: 1,587; lex: 1,408; makefile: 1,048; tcl: 457; awk: 199; php: 53; csh: 50
file content (36 lines) | stat: -rw-r--r-- 1,010 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl

use warnings;
use strict;

use File::Find;
use File::Spec;

my $debian_dir = $ARGV[0];

find(\&symlink_if_file,$debian_dir);

sub symlink_if_file {
    return if -l $_;
    return unless -f $_;
    my ($leading,$dir,$file_name) = $File::Find::name
        =~ m{(.+/usr/share/info/lilypond/)(.*?)([^/]+)$};
    my $n_slashes = $dir =~ m{/}g;
    my $html_file =
        File::Spec->catfile(('..') x ($n_slashes+2),
                            qw(doc lilypond html Documentation),
                            $dir,
                            $file_name
                           );
    my $info_file =
        File::Spec->catfile(('..') x ($n_slashes+4),
                            qw(info lilypond),
                            $dir,
                            $file_name);
    if (-f $html_file) {
        system('ln','-sf',$info_file,$html_file);
        print STDERR "linking $html_file -> $info_file\n";
    } else {
        print STDERR "html file $html_file doesn't exist\n";
    }
}