Changeset 328 for devel/pb/lib/ProjectBuilder/Base.pm
 Timestamp:
 Feb 22, 2008, 12:00:13 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

devel/pb/lib/ProjectBuilder/Base.pm
r327 r328 18 18 use POSIX qw(strftime); 19 19 use Time::localtime qw(localtime); 20 21 use ProjectBuilder::Changelog qw (pb_changelog);20 use Date::Manip; 21 use English; 22 22 23 23 # Inherit from the "Exporter" module which handles exporting functions. … … 889 889 if (not defined $p2) { 890 890 # No ref in CMS project conf file so use the home dir one. 891 $p1>{$ENV{'PBPROJ'}} = $p1>{'default'} if ( not defined $p1>{$ENV{'PBPROJ'}});891 $p1>{$ENV{'PBPROJ'}} = $p1>{'default'} if ((not defined $p1>{$ENV{'PBPROJ'}}) && (defined $p1>{'default'})); 892 892 } else { 893 893 # Ref found in CMS project conf file 894 894 if (not defined $p1) { 895 895 # No ref in home dir project conf file so use the CMS one. 896 $p2>{$ENV{'PBPROJ'}} = $p2>{'default'} if ( not defined $p2>{$ENV{'PBPROJ'}});896 $p2>{$ENV{'PBPROJ'}} = $p2>{'default'} if ((not defined $p2>{$ENV{'PBPROJ'}}) && (defined $p2>{'default'})); 897 897 $p1 = $p2; 898 898 } else { … … 906 906 if (not defined $p1>{$ENV{'PBPROJ'}}) { 907 907 if (defined $p2>{$ENV{'PBPROJ'}}) { 908 $p1>{$ENV{'PBPROJ'}} = $p2>{$ENV{'PBPROJ'}} ;908 $p1>{$ENV{'PBPROJ'}} = $p2>{$ENV{'PBPROJ'}} if (defined $p2>{$ENV{'PBPROJ'}}); 909 909 } else { 910 $p1>{$ENV{'PBPROJ'}} = $p1>{'default'} ;910 $p1>{$ENV{'PBPROJ'}} = $p1>{'default'} if (defined $p1>{'default'}); 911 911 } 912 912 } … … 1544 1544 } 1545 1545 1546 sub pb_changelog { 1547 1548 my $dtype = shift; 1549 my $pkg = shift; 1550 my $pbver = shift; 1551 my $pbtag = shift; 1552 my $dsuf = shift; 1553 my $path = shift; 1554 my $OUTPUT = shift; 1555 my $doit = shift; 1556 my $chglog = shift  undef; 1557 1558 my $log = ""; 1559 1560 # For date handling 1561 $ENV{LANG}="C"; 1562 1563 if ((not (defined $dtype))  ($dtype eq "")  1564 (not (defined $pkg))  ($pkg eq "")  1565 (not (defined $pbver))  ($pbver eq "")  1566 (not (defined $pbtag))  ($pbtag eq "")  1567 (not (defined $dsuf))  ($dsuf eq "")  1568 (not (defined $path))  ($path eq "")  1569 (not (defined $OUTPUT))  ($OUTPUT eq "")  1570 (not (defined $doit))  ($doit eq "")) { 1571 print $OUTPUT "\n"; 1572 return; 1573 } 1574 1575 if (((not defined $chglog)  (! f $chglog)) && ($doit eq "yes")) { 1576 #pb_log(2,"No ChangeLog file ($chglog) for $pkg\n"; 1577 print $OUTPUT "\n"; 1578 return; 1579 } 1580 1581 my $date; 1582 my $ndate; 1583 my $n2date; 1584 my $ver; 1585 my $ver2; 1586 my ($packager) = pb_conf_get("pbpackager"); 1587 1588 # If we don't need to do it, or don't have it fake something 1589 if (((not defined $chglog)  (! f $chglog)) && ($doit ne "yes")) { 1590 my @date=(localtime>sec(), localtime>min(), localtime>hour(), localtime>mday(), localtime>mon(), localtime>year(), localtime>wday(), localtime>yday(), localtime>isdst()); 1591 $date = strftime("%Y%m%d", @date); 1592 $ndate = UnixDate($date,"%a", "%b", "%d", "%Y"); 1593 $n2date = &UnixDate($date,"%a, %d %b %Y %H:%M:%S %z"); 1594 if (($dtype eq "rpm")  ($dtype eq "fc")) { 1595 $ver2 = "$pbver$pbtag$dsuf"; 1596 print $OUTPUT "* $ndate $packager>{$ENV{'PBPROJ'}} $ver2\n"; 1597 print $OUTPUT " Updated to $pbver\n"; 1598 } 1599 if ($dtype eq "deb") { 1600 print $OUTPUT "$pkg ($pbver) unstable; urgency=low\n"; 1601 print $OUTPUT "\n"; 1602 print $OUTPUT "  $packager>{$ENV{'PBPROJ'}} $n2date\n\n\n"; 1603 } 1604 return; 1605 } 1606 1607 open(INPUT,"$chglog")  die "Unable to open $chglog (read)"; 1608 1609 # Skip first 4 lines 1610 my $tmp = <INPUT>; 1611 $tmp = <INPUT>; 1612 $tmp = <INPUT>; 1613 if ($dtype eq "announce") { 1614 print $OUTPUT $tmp; 1615 } 1616 $tmp = <INPUT>; 1617 if ($dtype eq "announce") { 1618 print $OUTPUT $tmp; 1619 } 1620 1621 my $first=1; 1622 1623 # Handle each block separated by newline 1624 while (<INPUT>) { 1625 ($ver, $date) = split(/ /); 1626 $ver =~ s/^v//; 1627 chomp($date); 1628 $date =~ s/\(([09]+)\)/$1/; 1629 #pb_log(2,"**$date**\n"; 1630 $ndate = UnixDate($date,"%a", "%b", "%d", "%Y"); 1631 $n2date = &UnixDate($date,"%a, %d %b %Y %H:%M:%S %z"); 1632 #pb_log(2,"**$ndate**\n"; 1633 1634 if (($dtype eq "rpm")  ($dtype eq "fc")) { 1635 if ($ver !~ //) { 1636 if ($first eq 1) { 1637 $ver2 = "$ver$pbtag$dsuf"; 1638 $first=0; 1639 } else { 1640 $ver2 = "$ver1$dsuf"; 1641 } 1642 } else { 1643 $ver2 = "$ver$dsuf"; 1644 } 1645 print $OUTPUT "* $ndate $packager>{$ENV{'PBPROJ'}} $ver2\n"; 1646 print $OUTPUT " Updated to $ver\n"; 1647 } 1648 if ($dtype eq "deb") { 1649 print $OUTPUT "$pkg ($ver) unstable; urgency=low\n"; 1650 print $OUTPUT "\n"; 1651 } 1652 1653 $tmp = <INPUT>; 1654 while ($tmp !~ /^$/) { 1655 if ($dtype eq "deb") { 1656 $tmp =~ s/^ //; 1657 print $OUTPUT " * $tmp"; 1658 } elsif ($dtype eq "rpm") { 1659 print $OUTPUT "$tmp"; 1660 } else { 1661 print $OUTPUT "$tmp"; 1662 } 1663 last if (eof(INPUT)); 1664 $tmp = <INPUT>; 1665 } 1666 print $OUTPUT "\n"; 1667 1668 if ($dtype eq "deb") { 1669 # Cf: http://www.debian.org/doc/debianpolicy/chsource.html#sdpkgchangelog 1670 print $OUTPUT "  $packager>{$ENV{'PBPROJ'}} $n2date\n\n\n"; 1671 } 1672 1673 last if (eof(INPUT)); 1674 last if ($dtype eq "announce"); 1675 } 1676 close(INPUT); 1677 } 1546 1678 1;
Note: See TracChangeset
for help on using the changeset viewer.