6 When you release a new version ex: 3.0.3
7 - Modify the $version string
9 When you add a new category
10 - Add a print_cat() at the end of the script
12 To update the downloads.php file
14 - Change the version on the top of the file
15 - ./sf2bacula_downloads.pl > downloads.php
17 By default, it downloads the sourceforge page in the current directory
20 You can also use a previous output
22 ./sf2bacula_downloads.pl <version> <sf_list_2022.html> > downloads.php
26 # bacula|depkgs | depkgs-qt
27 my $version = '3.0.3';
28 if ($ARGV[0] =~ /^[\d\.]+$/) {
29 $version = shift(@ARGV);
31 my $depkgs_version = '18Feb09|28Jul09';
33 my $base = "http://bacula.svn.sourceforge.net/viewvc/bacula/tags/Release-$version/bacula";
34 my $notes = "$base/ReleaseNotes";
35 my $chglog = "$base/ChangeLog";
40 my $file = "sf_list_$$.html";
41 my $cmd = "wget -O $file https://sourceforge.net/projects/bacula/files";
43 if ($ARGV[0] && -f $ARGV[0]) {
53 if ($l =~ m!href="(/projects/bacula/files/([^/]+)/([^/]+)/([^/]+)/download)"!) {
62 # the size, date, and downloads are just after
63 if ($cur && $l =~ m!<td>([\d\.]+ [KMG]B)</td>!) {
67 if ($l =~ m!<td>(.*?)</td>!) {
70 } while (!$cur->{date});
73 if ($l =~ m!<td>(.*?)</td>!) {
74 $cur->{downloads} = $1;
76 } while (!$cur->{downloads});
79 # once we have a full $cur element, we can store it
80 if (!exists $seen{$cur->{file}}) {
81 push @{$cats{$cur->{cat}}}, $cur;
82 $seen{$cur->{file}} = 1;
90 <? require_once("inc/header.php"); ?>
93 <td class="contentTopic">
94 Bacula downloads for version ', $version, '
100 <a href="', $notes, '">Release Notes</a> |
101 <a href="', $chglog, '">ChangeLog</a> |
102 <a href="#bacula">Sources</a> |
103 <a href="#Win32_64">Win32/64</a> |
104 <a href="#rpms">RPM</a> |
105 <a href="https://sourceforge.net/projects/bacula/files/Bacula%20Public%20Key/Current%20Public%20Key/bacula.pub/download">Public Key</a> |
106 <a href="https://sourceforge.net/projects/bacula/files/Bacula%20Public%20Key/Current%20Public%20Key/rpmkey-bacula-0.1-3.noarch.rpm/download">RPM Public Key</a>
115 #print Data::Dumper::Dumper(\%cats);
123 <td> <br><a name="', $cat, '"></a><font size="+1"><b>', $cat, ':</b></font>
124 <table cellspacing="2">
125 <tr class="title"><th>Name</th><th align="center">', ($cat !~ /rpm/)?'Signature':'', '</th><th>Size</th><th>Date</th><th>Downloads</th></tr>
127 foreach my $elt ( sort { $a->{file} cmp $b->{file} } @{$cats{$cat}})
129 next if ($elt->{file} =~ /\.sig/); # we skip signature file
130 if ($elt->{vers} eq $version || $elt->{vers} =~ /$depkgs_version/)
134 <td><a href='https://sourceforge.net$elt->{dl}'>$elt->{file}</td>
135 <td align=\"center\">",
136 ($cat !~ /rpm/)?"<a href='https://sourceforge.net/projects/bacula/files/$cat/$elt->{vers}/$elt->{file}.sig/download'>sig":"",
138 <td align=\"right\">$elt->{size}</td>
139 <td align=\"center\">$elt->{date}</td>
140 <td align=\"center\">$elt->{downloads}</td>
144 if ($row eq 'odd') { $row = 'even'; } else { $row = 'odd'; }
152 print_cat('Win32_64');
154 print_cat('rpms-contrib-fschwarz');
155 print_cat('rpms-contrib-psheaffer');
157 print_cat('depkgs-qt');
162 <? require_once("inc/footer.php"); ?>