Implement incremental changelog generation for Debian packages

Fixes #22: Improve Debian package changelog to show incremental version history

The Debian package changelog now includes the complete version history
instead of just changes since the previous release. This provides users
with full visibility into the software's evolution when reviewing
package updates.

Changes:
- Rewrote changelog generation to iterate through all git tags
- Generate entries for each tagged version in reverse chronological order
- Include current development version if commits exist after latest tag
- Fixed shellcheck warnings for better script quality
- Added -f flag to gzip to force overwrite existing changelog.gz files

Benefits:
- Complete version history visible in every package
- Standard Debian changelog format compliance
- Better integration with apt changelog and dpkg tools
- Improved transparency for users reviewing updates
- Proper audit trail for administrators

The changelog now shows all versions with their respective changes,
making it easier for users to understand what has changed between
their installed version and the available update.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ole-Morten Duesund 2025-08-25 08:32:43 +02:00
commit 7c9f7dc8c9

View file

@ -69,43 +69,104 @@ echo_info " beast-dump: $(file "$DEB_DIR/usr/bin/beast-dump")"
chmod +x "$DEB_DIR/usr/bin/skyview"
chmod +x "$DEB_DIR/usr/bin/beast-dump"
# Generate changelog from git history
echo_info "Generating changelog from git history..."
# Generate incremental changelog from git history
echo_info "Generating incremental changelog from git history..."
CHANGELOG_DIR="$DEB_DIR/usr/share/doc/skyview-adsb"
mkdir -p "$CHANGELOG_DIR"
# Get the current version and previous version
CURRENT_VERSION=$(git describe --tags --always)
PREV_VERSION=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
# Function to generate incremental changelog
generate_incremental_changelog() {
local changelog_file="$1"
if [ -n "$PREV_VERSION" ]; then
echo_info "Generating changelog from $PREV_VERSION to $CURRENT_VERSION"
# Create changelog with proper Debian format
{
echo "skyview-adsb ($CURRENT_VERSION) unstable; urgency=medium"
echo ""
echo " Changes since $PREV_VERSION:"
git log --pretty=format:" * %s" "$PREV_VERSION..HEAD" | head -20
echo ""
echo " -- $(git config user.name) <$(git config user.email)> $(date -R)"
echo ""
} > "$CHANGELOG_DIR/changelog"
else
echo_info "No previous version found, generating initial changelog"
# Create initial changelog
{
echo "skyview-adsb ($CURRENT_VERSION) unstable; urgency=medium"
echo ""
echo " * Initial release"
echo " * Multi-source ADS-B aircraft tracker with Beast format support"
echo ""
echo " -- $(git config user.name) <$(git config user.email)> $(date -R)"
echo ""
} > "$CHANGELOG_DIR/changelog"
fi
# Get all tags in reverse chronological order
local tags
tags=$(git tag -l --sort=-version:refname)
# Compress changelog as per Debian standards
gzip -9 "$CHANGELOG_DIR/changelog"
# If no tags exist, create a single entry for current state
if [ -z "$tags" ]; then
local current_version
current_version=$(git describe --tags --always)
echo_info "No tags found, generating initial changelog for $current_version"
{
echo "skyview-adsb ($current_version) unstable; urgency=medium"
echo ""
echo " * Initial release"
echo " * Multi-source ADS-B aircraft tracker with Beast format support"
echo ""
echo " -- $(git config user.name) <$(git config user.email)> $(date -R)"
echo ""
} > "$changelog_file"
return
fi
# Create empty changelog
: > "$changelog_file"
# Add entry for current development version if there are commits after the last tag
local latest_tag
latest_tag=$(echo "$tags" | head -n1)
local commits_since_tag
commits_since_tag=$(git rev-list "$latest_tag"..HEAD --count 2>/dev/null || echo 0)
if [ "$commits_since_tag" -gt 0 ]; then
local current_version
current_version=$(git describe --tags --always)
echo_info "Adding entry for current development version: $current_version"
{
echo "skyview-adsb ($current_version) unstable; urgency=medium"
echo ""
git log --pretty=format:" * %s" "$latest_tag"..HEAD | head -20
echo ""
echo ""
echo " -- $(git config user.name) <$(git config user.email)> $(date -R)"
echo ""
} >> "$changelog_file"
fi
# Process all tags to create incremental changelog
local prev_tag=""
for tag in $tags; do
echo_info "Processing version $tag"
# Get tag date and author info
local tag_date
tag_date=$(git log -1 --format=%aD "$tag")
local tag_author
tag_author=$(git log -1 --format='%an <%ae>' "$tag")
# Add version header
{
echo "skyview-adsb ($tag) unstable; urgency=medium"
echo ""
} >> "$changelog_file"
# Add changes for this version
if [ -n "$prev_tag" ]; then
# Show changes between this tag and the previous one
git log --pretty=format:" * %s" "$tag..$prev_tag" | head -20 >> "$changelog_file"
else
# For the oldest tag, show changes from the beginning
git log --pretty=format:" * %s" "$tag" | head -20 >> "$changelog_file"
fi
# Add footer
{
echo ""
echo ""
echo " -- $tag_author $tag_date"
echo ""
} >> "$changelog_file"
prev_tag="$tag"
done
}
# Generate the incremental changelog
generate_incremental_changelog "$CHANGELOG_DIR/changelog"
echo_info "Generated incremental changelog with $(grep -c '^skyview-adsb (' "$CHANGELOG_DIR/changelog") version entries"
# Compress changelog as per Debian standards (force overwrite if exists)
gzip -9f "$CHANGELOG_DIR/changelog"
echo_info "Generated changelog: $CHANGELOG_DIR/changelog.gz"
# Get package info