Skip to content

Commit

Permalink
use filename in other replacer
Browse files Browse the repository at this point in the history
  • Loading branch information
astj committed Mar 3, 2017
1 parent 54955d5 commit bedd75d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions _tools/releng
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ sub update_changelog {
my $ret = 0;

replace 'packaging/deb/debian/changelog' => sub {
my $content = shift;
my ($content, $filename) = @_;

my $update = "$package_name ($next_version-1) stable; urgency=low\n\n";
for my $rel (@releases) {
Expand All @@ -324,11 +324,11 @@ sub update_changelog {

# '35' means a rough length to cut timestamp at the end of update.
if(index($content, substr($update, 0, length($update) - 35)) == -1){
infof "update 'packaging/deb/debian/changelog'.\n";
infof "update '$filename'.\n";
$ret = 1;
$update . $content;
} else {
infof "skip to update 'packaging/deb/debian/changelog'.\n";
infof "skip to update '$filename'.\n";
$content;
}
};
Expand Down Expand Up @@ -357,18 +357,18 @@ sub update_changelog {
replace $rpm_systemd_spec => $rpm_changelog_replacer;

replace 'CHANGELOG.md' => sub {
my $content = shift;
my ($content, $filename) = @_;

my $update = sprintf "\n\n## %s (%s)\n\n", $next_version, $now->strftime('%Y-%m-%d');
for my $rel (@releases) {
$update .= sprintf "* %s #%d (%s)\n", $rel->{title}, $rel->{num}, $rel->{user};
}
if(index($content, $update) == -1){
infof "update 'CHANGELOG.md'\n";
infof "update '$filename'\n";
$ret = 1;
$content =~ s/\A# Changelog/# Changelog$update/;
} else {
infof "skip to update 'CHANGELOG.md'\n";
infof "skip to update '$filename'\n";
}
$content;
};
Expand Down

0 comments on commit bedd75d

Please sign in to comment.