comparison debian/patches/19_bins-insert-directory @ 4:c5749e43b1d7

Adding debian files (to original 1.1.29)
author Peter Gervai <grin@grin.hu>
date Wed, 15 Oct 2008 23:35:35 +0200
parents
children
comparison
equal deleted inserted replaced
0:a84c32f131df 4:c5749e43b1d7
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 19_bins-1.1.29-insert-directory.dpatch by <rousseau@localhost.localdomain>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: No description.
6
7 @DPATCH@
8 --- bins-1.1.29.orig/bins
9 +++ bins-1.1.29/bins
10 @@ -399,6 +399,10 @@
11 # strings on console and to
12 # convert strings from .po
13 # files.
14 +
15 + injectDir => '', # directory to be injected
16 + # without rebuilding complete
17 + # album
18 );
19
20 my $codeset;
21 @@ -985,7 +989,7 @@
22 Getopt::Long::Configure("bundling");
23 die "Invalid options\n"
24 if (!GetOptions(\%option, "h", "p", "r:s", "e", "o:s", "t=s", "d=s", "s=s",
25 - "c=s", "v:i", "i=s", "n=s", "f=s"));
26 + "c=s", "v:i", "i=s", "n=s", "f=s", "j=s"));
27
28 if (defined($option{v})) {
29 $verbose = $option{v};
30 @@ -1146,6 +1150,25 @@
31
32 die "albumdir_dir ($albumdir) can't be a subdirectory of picdir_dir ($picdir)"
33 if ($albumdir2 =~ m/^$picdir2\//);
34 +
35 + if( defined $option{j} ) {
36 + my $injectDir = $option{j};
37 + my $injectExists = 1;
38 +
39 + chdir $injectDir or warn "Can't chdir $injectDir: $!" and $injectExists = 0;
40 +
41 + if( $injectExists ) {
42 + $injectDir = File::Spec->rel2abs(".") unless -l $option{j};
43 + chdir $pwd;
44 + }
45 +
46 + die "inject_dir (specified via -j parameter) $option{j} must be a subdirectory of pic_dir ($picdir)"
47 + unless $injectDir =~ m#^$picdir2/.*#;
48 +
49 + $configHash->{injectDir}
50 + = File::Spec->rel2abs(File::Spec->canonpath($injectDir));
51 + $configHash->{injectDir} .= '/'; # add trailing slash
52 + }
53 }
54
55 $picdir = File::Spec->rel2abs(File::Spec->canonpath($picdir));
56 @@ -2190,6 +2213,16 @@
57
58 sub generateImageListPage{
59 my ($album, $albumHashRef, $imageDataRef, $xlinksRef, $configHash) = @_;
60 + if( $configHash->{injectDir} ne '' ) {
61 + my $injectDir = $configHash->{injectDir};
62 + my $oneDirUp;
63 + # drop the last subdirectory
64 + ( $oneDirUp = $configHash->{injectDir} ) =~ s#(.*/).*?/$#$1#o;
65 + my $dir = $picdir . $album;
66 + # Only generate imagelist page during injection
67 + # for 1-level-up or injected album itself
68 + return unless $dir =~ m#($oneDirUp|$injectDir)$#;
69 + }
70 my %albumHash = %{$albumHashRef};
71 my @imageData = @{$imageDataRef};
72 my $pwd;
73 @@ -2400,6 +2433,18 @@
74
75 sub generateLongSubAlbumPage{
76 my ($album, $albumHashRef, $configHash) = @_;
77 + if( $configHash->{injectDir} ne '' ) {
78 + my $injectDir = $configHash->{injectDir};
79 + my( $oneDirUp, $twoDirUp );
80 + # drop the last subdirectory
81 + ( $oneDirUp = $configHash->{injectDir} ) =~ s#(.*/).*?/$#$1#o;
82 + # drop the last subdirectory
83 + ( $twoDirUp = $oneDirUp ) =~ s#(.*/).*?/$#$1#o;
84 + my $dir = $picdir . $album;
85 + # Only generate subalbum page during injection for
86 + # 1-level-up or 2-level-up or injected album itself
87 + return unless $dir =~ m#($oneDirUp|$twoDirUp|$injectDir)$#;
88 + }
89 my %albumHash = %{$albumHashRef};
90
91 # hash for final subsitutions
92 @@ -2680,6 +2725,18 @@
93 my ($album, $albumHashRef, $firstIsIndex, $configHash,
94 $xlinkListRef,
95 @imageData) = @_;
96 +
97 + if( $configHash->{injectDir} ne '' ) {
98 + my $injectDir = $configHash->{injectDir};
99 + my $oneDirUp;
100 + # drop the last subdirectory
101 + ( $oneDirUp = $configHash->{injectDir} ) =~ s#(.*/).*?/$#$1#o;
102 + my $dir = $picdir . $album;
103 + # Only generate thumbnail page during injection for
104 + # 1-level-up or injected album itself
105 + return unless $dir =~ m#($oneDirUp|$injectDir)$#;
106 + }
107 +
108 my @xlinkList=@$xlinkListRef;
109 my %albumHash = %{$albumHashRef};
110 my $numImages = scalar(@imageData); #element count
111 @@ -3095,6 +3152,13 @@
112 my ($album, $albumHashRef, $firstIsIndex,
113 $configHash, @imagesToDisplay) = @_;
114
115 + my $skipDueToInjection = 0;
116 +
117 + if( $configHash->{injectDir} ne '' ) {
118 + # skip processing of images unless processing injected directory
119 + $skipDueToInjection = 1 unless $picdir . $album eq $configHash->{injectDir};
120 + }
121 +
122 # an array of references to hashes storing information about each image
123 my @imageData;
124
125 @@ -3350,10 +3414,12 @@
126 $imageData[$i]{'detailsLink'} =
127 generateSecondaryFieldsPage($imageData[$i], $album, $albumHashRef,
128 $crntImageBase.$crntImageType,
129 - $configHash);
130 + $configHash)
131 + unless $skipDueToInjection;
132 if ( $configHash->{searchEngine}) {
133 writeSearchString($imageData[$i], $configHash, $albumHashRef,
134 - $album);
135 + $album)
136 + unless $skipDueToInjection;
137 }
138 }
139
140 @@ -3361,6 +3427,7 @@
141
142 # now generate html
143 for ($i=0; $i<$numImages; $i++) {
144 + last if $skipDueToInjection;
145 for (my $j=0; $j <= $imageData[$i]->{maxSize}; $j++) {
146 my $lastImageURL = getHTMLImagePageLink($imageData[$numImages-1],
147 $j, $numImages-1);