~ubuntu-branches/ubuntu/hardy/silo/hardy-updates

« back to all changes in this revision

Viewing changes to debian/scripts/dh_split

  • Committer: Bazaar Package Importer
  • Author(s): Fabio M. Di Nitto
  • Date: 2007-10-25 09:28:08 UTC
  • mfrom: (15.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071025092808-1yhj12t7s4zqsfu5
Tags: 1.4.13a+git20070930-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Build with -fno-stack-protector.
  - Change silo.postinst to automatically update the boot block without
    invoking siloconfig and keep asking questions on upgrades.
  - Convert silo.conf to use /dev/disk/by-uuid.
  - Ubuntu maintainer foobar.
  - Fix debian/rules call to dh_installdocs.
  - Drop the requirement of gcc-4.1 and start using default gcc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
 
3
 
$control = 'debian/control';
4
 
if ( -d 'debian/packages.d' ) {
5
 
    $dir = 'debian/packages.d';
6
 
} else {
7
 
    $dir = 'debian';
8
 
}
9
 
$needclean = 0;
10
 
$needlist = 0;
11
 
$needdeps = 0;
12
 
 
13
 
if (defined($ENV{'DH_COMPAT'})) {
14
 
    $dh = $ENV{'DH_COMPAT'};
15
 
} else {
16
 
    $dh = 0;
17
 
}
18
 
 
19
 
if (@ARGV) {
20
 
    $temp = shift;
21
 
    if ($temp eq "clean") { $needclean = 1; }
22
 
    elsif ($temp eq "makedeps") { $needlist = 1; }
23
 
    elsif ($temp eq "gendeps") { $needdeps = 1; }
24
 
}
25
 
 
26
 
@packages = ();
27
 
$first_package = "";
28
 
 
29
 
open (CONTROL, "< $control");
30
 
 
31
 
while (<CONTROL>) {
32
 
    if (m/^Package:/) {
33
 
        $package = (split)[1];
34
 
        if ($first_package eq "" and $dh < 2) {
35
 
                $first_package = $package;
36
 
        }
37
 
        if ( -f "${dir}/${package}.in" ) {
38
 
            push @packages, $package;
39
 
        }
40
 
    }
41
 
}
42
 
 
43
 
close CONTROL;
44
 
 
45
 
while (@packages) {
46
 
    $package = shift(@packages);
47
 
    $inhead = 1;
48
 
    $opened = 0;
49
 
    if ($needdeps) {
50
 
        print "${dir}/${package}.in ";
51
 
        next;
52
 
    }
53
 
    open (IN, "< ${dir}/${package}.in");
54
 
    while (<IN>) {
55
 
        if (m/^\%(.*)\%$/) {
56
 
            if ($needclean) {
57
 
                if ($package ne $first_package) {
58
 
                    system("rm -f debian/${package}.${1}");
59
 
                } else {
60
 
                    system("rm -f debian/${1}");
61
 
                }
62
 
            } elsif ($needlist) {
63
 
                if ($package ne $first_package) {
64
 
                    print "debian/${package}.${1} ";
65
 
                } else {
66
 
                    print "debian/${1} ";
67
 
                }
68
 
            } else {
69
 
                $inhead = 0;
70
 
                if ($opened) { close OUT; } else { $opened = 1; }
71
 
                if ($package ne $first_package) {
72
 
                    open OUT, "> debian/${package}.${1}";
73
 
                } else {
74
 
                    open OUT, "> debian/${1}";
75
 
                }
76
 
            }
77
 
        } elsif (!$inhead) {
78
 
            print OUT $_;
79
 
        }
80
 
    }
81
 
    close OUT;
82
 
    close IN;
83
 
}