Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions .github/actions_scripts/getChangelog.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,46 @@

use strict;
use warnings;
# get the file path
my $ChangeLogFile = $ARGV[0];
# get the version
my $Version = quotemeta $ARGV[1];
# open the file (slurp mode): https://perlmaven.com/slurp
# get arguments
my ($ChangeLogFile, $Version, $FormatOption) = @ARGV;
# open the file
open my $fh, '<', $ChangeLogFile or die;
$/ = undef;
my $ChangeLog = <$fh>;

my $SingleLineEntries = ($FormatOption or '') eq '--line-per-entry';

my $logversion = "";
my $entry;
my $matchedLogversion = 0;
while (my $line = <$fh>) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should stop looping through the file if we already found the correct version ($logversion changed to the next version). Then we could also check if a version wasn't found as soon as we reached the EOF and output some error message.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@npostavs could you please insert a break statement to stop looping through unneeded lines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yep, done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

if ($line =~ /^### (\S+)[^#]*###$/m) {
# The version for this section of the ChangeLog
if ($matchedLogversion) {
# We've processed the lines corresponding to $Version, and
# we're now on the next section. There's no more to do.
last;
}
$logversion = $1;
next;
}
if ($logversion eq $Version) {
$matchedLogversion = 1;
if ($SingleLineEntries) {
if ($line =~ /^- (.*)$/) { # beginning of entry
$entry = $1;
} elsif ($line =~ /^ ( \S.*)$/) { # continuation of entry
$entry .= $1;
} else { # otherwise, separator between entries
print "${entry}\n" if $entry;
$entry = undef;
}
} else {
print $line;
}
}
}

close $fh;

if ( $ChangeLog =~ m/^### $Version (.*?)$(.*?)^###/sm ) {
print $2;
} else {
print "No changelog found for this version.";
if (!$matchedLogversion) {
die "Failed to find entry for version '${Version}'";
}
30 changes: 12 additions & 18 deletions distributions/build-debian-package-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@

# Create deb files

# set armhf
#sudo dpkg --add-architecture armhf

cp -r debian ..
cd ..

# get the jamulus version from pro file
VERSION=$(cat Jamulus.pro | grep -oP 'VERSION = \K\w[^\s\\]*')

# patch changelog (with hack)

DATE=$(date "+%a, %d %b %Y %T" )
echo "jamulus (${VERSION}-0) UNRELEASED; urgency=medium" > debian/changelog
echo "" >> debian/changelog
perl .github/actions_scripts/getChangelog.pl ChangeLog ${VERSION} >> debian/changelog
echo "" >> debian/changelog
echo " -- GitHubActions <noemail@example.com> ${DATE} +0001" >> debian/changelog
echo "" >> debian/changelog
cat distributions/debian/changelog >> debian/changelog

# patch the control file
# cp the modified control file here

cp distributions/autobuilddeb/control debian/control
export DEBFULLNAME=GitHubActions DEBEMAIL=noemail@example.com
Comment thread
ann0see marked this conversation as resolved.

# Generate Changelog
echo -n generating changelog
rm -f debian/changelog
dch --create --package jamulus --empty --newversion "${VERSION}" ''
perl .github/actions_scripts/getChangelog.pl ChangeLog "${VERSION}" --line-per-entry | while read entry
do
echo -n .
dch "$entry"
done
echo

echo "${VERSION} building..."

Expand Down