6767chmod +x " $TEMP_DIR /usr/bin/upk"
6868print_success " Source files copied and wrapper script created"
6969
70+ # Create bash completion
71+ print_status " Creating bash completion script..."
72+ mkdir -p " $TEMP_DIR /usr/share/bash-completion/completions"
73+ # Set PYTHONPATH to current directory to ensure backends can be imported
74+ export PYTHONPATH=$PYTHONPATH :.
75+ _UPK_COMPLETE=bash_source python3 upk.py > " $TEMP_DIR /usr/share/bash-completion/completions/upk"
76+ print_success " Bash completion script created"
77+
7078# Create control file from template
7179print_status " Creating control file from template..."
7280cp " templates/DEBIAN/control" " $TEMP_DIR /DEBIAN/control"
@@ -83,10 +91,20 @@ print_status "Creating post-removal script from template..."
8391cp " templates/DEBIAN/postrm" " $TEMP_DIR /DEBIAN/postrm"
8492chmod 755 " $TEMP_DIR /DEBIAN/postrm"
8593
86- # Create changelog from template
87- print_status " Creating changelog from template..."
88- cp " templates/usr/share/doc/upk/changelog.Debian" " $TEMP_DIR /usr/share/doc/upk/changelog.Debian"
94+ # Create changelog dynamically from CHANGELOG.md
95+ print_status " Generating Debian changelog from CHANGELOG.md..."
96+ # We take the first section of CHANGELOG.md (the latest version) and format it
97+ CHANGELOG_CONTENT=$( grep -Pzn ' (?s)## \[\d+\.\d+\.\d+\].*?(?=\n## |$)' CHANGELOG.md | tr -d ' \0' | sed ' 1d' | sed ' s/^/ /' )
98+
99+ cat > " $TEMP_DIR /usr/share/doc/upk/changelog.Debian" << EOL
100+ upk ($VERSION ) unstable; urgency=medium
101+
102+ $CHANGELOG_CONTENT
89103
104+ -- undefinederror <github@object.ninja> $( date -R)
105+ EOL
106+ gzip -n -9 " $TEMP_DIR /usr/share/doc/upk/changelog.Debian"
107+ print_success " Debian changelog generated and compressed"
90108# Create copyright file from template
91109print_status " Creating copyright file from template..."
92110cp " templates/usr/share/doc/upk/copyright" " $TEMP_DIR /usr/share/doc/upk/copyright"
0 commit comments