Changeset 547 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Sep 18, 2008, 1:56:00 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r545 r547 18 18 use File::stat; 19 19 use File::Temp qw(tempdir); 20 use Time::localtime qw(localtime); 20 21 use POSIX qw(strftime); 21 22 use lib qw (lib); … … 445 446 446 447 pb_announce(); 448 } elsif ($action =~ /^webnews2html$/) { 449 # For news handling only. Require avoids the systematic load of these modules 450 require DBI; 451 452 pb_web_news2html(); 447 453 } else { 448 454 pb_log(0,"\'$action\' is not available\n"); … … 1929 1935 } 1930 1936 1937 # TODO: use virtual/real names here now 1931 1938 $findstr .= "-name \'$pbpkg-$pbver-$pbtag\.*.rpm\' -o -name \'$pbpkg"."_$pbver*\.deb\' -o -name \'$pbpkg-$pbver\.ebuild\' "; 1932 1939 … … 2091 2098 } 2092 2099 2100 # 2101 # Creates a set of HTML file containing the news for the project 2102 # based on what has been generated by the pb_announce function 2103 # 2104 sub pb_web_news2html { 2105 2106 # Get all required parameters 2107 my ($pkgv, $pkgt, $testver) = pb_conf_get_if("pkgver","pkgtag","testver"); 2108 2109 # DB of announces for external usage (Web pages generation) 2110 my $db = "$ENV{'PBCONFDIR'}/announces3.sql"; 2111 2112 my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","", 2113 { RaiseError => 1, AutoCommit => 1 }) 2114 || die "Unable to connect to $db"; 2115 # For date handling 2116 $ENV{LANGUAGE}="C"; 2117 my $firstjan = strftime("%Y-%m-%d", 0, 0, 1, 1, localtime->year(), 0, 0, -1); 2118 my $oldfirst = strftime("%Y-%m-%d", 0, 0, 1, 1, localtime->year()-1, 0, 0, -1); 2119 my $all = $dbh->selectall_arrayref("SELECT id,date,announce FROM announces ORDER BY date DESC"); 2120 my $ynews = ""; # year's news 2121 my $lynews = ""; # last year news 2122 my $pynews = ""; # previous years news 2123 my $fpnews = ""; # first page news 2124 my $cpt = 4; # how many news for first page 2125 # Extract info from DB 2126 foreach my $row (@$all) { 2127 my ($id, $date, $announce) = @$row; 2128 $ynews = $ynews."<p><B>$date</B> $announce\n" if (("$date" le $pbdate) && ($firstjan le "$date")); 2129 $lynews = $lynews."<p><B>$date</B> $announce\n" if (("$date" le $firstjan) && ($oldfirst le "$date")); 2130 $pynews = $pynews."<p><B>$date</B> $announce\n" if ("$date" le $oldfirst); 2131 $fpnews = $fpnews."<p><B>$date</B> $announce\n" if ($cpt > 0); 2132 $cpt--; 2133 } 2134 pb_log(1,"fpnews: $fpnews\n"); 2135 $dbh->disconnect; 2136 } 2137 2093 2138 # Return the SSH key file to use 2094 2139 # Potentially create it if needed
Note:
See TracChangeset
for help on using the changeset viewer.