From 6a9e444a078b2bb74e24c10c66bde5c235dd661d Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Tue, 31 Dec 2024 15:38:16 -0500 Subject: [PATCH] add support for packages without revision numbers --- usr/share/genmkfile/make-helper-one.bsh | 59 ++++++++++++++----------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/usr/share/genmkfile/make-helper-one.bsh b/usr/share/genmkfile/make-helper-one.bsh index d944746..9b278b7 100755 --- a/usr/share/genmkfile/make-helper-one.bsh +++ b/usr/share/genmkfile/make-helper-one.bsh @@ -441,7 +441,6 @@ sudo genmkfile deb-all-dep true "dpkg_line: $dpkg_line" ## Example dpkg_line: ## Version: 0.1-1 - ## Example dpkg_line: ## Version: 1:20240810 read -r first second _ <<< "$dpkg_line" ## Example first: @@ -453,29 +452,39 @@ sudo genmkfile deb-all-dep first="${first,,}" true "first: $first" true "second: $second" - ## Example first: - ## version - if [ "$first" = "version:" ]; then + + if [ "$first" = "version:" ]; then make_changelog_version="$second" ## Example make_changelog_version: ## 3:0.1-1 ## 0.1-1 - make_pkg_revision="${make_changelog_version#*-}" - ## Example make_pkg_revision: - ## 1 - temp="${make_changelog_version%-*}" - ## Example temp: - ## 3:0.1 + ## 1:20240810 + + if [[ "$make_changelog_version" == *-* ]]; then + make_pkg_revision="${make_changelog_version#*-}" + ## prepend '-' + make_pkg_revision="-${make_pkg_revision}" + temp="${make_changelog_version%-*}" + else + make_pkg_revision="" + temp="$make_changelog_version" + fi + + ## Parse version (strip epoch if present) make_pkg_version="${temp#*:}" - ## Example make_pkg_version: - ## 0.1 - if echo "$make_changelog_version" | grep --quiet ":" ; then + + ## Parse epoch (if present) + if [[ "$make_changelog_version" == *:* ]]; then make_epoch="${temp%:*}" else make_epoch="" fi - ## Example make_epoch: - ## 3 + + ## Debugging outputs + true "make_changelog_version: $make_changelog_version" + true "make_pkg_revision: $make_pkg_revision" + true "make_pkg_version: $make_pkg_version" + true "make_epoch: $make_epoch" break fi done < <( dpkg-parsechangelog ) @@ -484,12 +493,8 @@ sudo genmkfile deb-all-dep echo "${red}${bold}ERROR:${reset} (FUNCNAME: '$FUNCNAME') variable make_pkg_version is empty." exit 1 fi - if [ "$make_pkg_revision" = "" ]; then - echo "${red}${bold}ERROR:${reset} (FUNCNAME: '$FUNCNAME') variable make_pkg_revision is empty." - exit 1 - fi - make_pkg_version_with_revision="${make_pkg_version}-${make_pkg_revision}" + make_pkg_version_with_revision="${make_pkg_version}${make_pkg_revision}" if [ "$make_pkg_use_pkg_version_without_revision_for_git_version" = "true" ]; then ## used for derivative-maker @@ -535,7 +540,7 @@ sudo genmkfile deb-all-dep true "make_pkg_revision: $make_pkg_revision" true "binary_package_architecture: $binary_package_architecture" ## Example architecture independent "all" package: anon-apt-sources-list_3.4-1_all.deb - temp="${package}_${make_pkg_version}-${make_pkg_revision}_${binary_package_architecture}.deb" + temp="${package}_${make_pkg_version}${make_pkg_revision}_${binary_package_architecture}.deb" temp="${DISTDIR}/$temp" make_package_debs_files_list="$make_package_debs_files_list $temp" if [ "$package" = "$make_source_package_name" ]; then @@ -547,23 +552,23 @@ sudo genmkfile deb-all-dep true "make_package_list: $make_package_list" true "make_package_debs_files_list: $make_package_debs_files_list" - make_main_deb_file_name="${package}_${make_pkg_version}-${make_pkg_revision}_${binary_package_architecture}.deb" + make_main_deb_file_name="${package}_${make_pkg_version}${make_pkg_revision}_${binary_package_architecture}.deb" make_main_deb_file="${DISTDIR}/$make_main_deb_file_name" - make_main_dsc_file_name="${make_source_package_name}_${make_pkg_version}-${make_pkg_revision}.dsc" + make_main_dsc_file_name="${make_source_package_name}_${make_pkg_version}${make_pkg_revision}.dsc" ## Changes file contains target_architecture such as 'amd64', not 'all'. ## Example changes file for architecture independent package: ## anon-apt-sources-list_3.4-1_amd64.changes if [ "$make_use_cowbuilder" = "true" ]; then make_main_dsc_file="$DISTDIR/$make_main_dsc_file_name" - make_main_changes_file="$DISTDIR/${make_source_package_name}_${make_pkg_version}-${make_pkg_revision}_${target_architecture}.changes" + make_main_changes_file="$DISTDIR/${make_source_package_name}_${make_pkg_version}${make_pkg_revision}_${target_architecture}.changes" else make_main_dsc_file="${DISTDIR}/$make_main_dsc_file_name" - make_main_changes_file="${DISTDIR}/${make_source_package_name}_${make_pkg_version}-${make_pkg_revision}_${target_architecture}.changes" + make_main_changes_file="${DISTDIR}/${make_source_package_name}_${make_pkg_version}${make_pkg_revision}_${target_architecture}.changes" fi - make_debian_tarball_file_name="${make_source_package_name}_${make_pkg_version}-${make_pkg_revision}.debian.tar.xz" + make_debian_tarball_file_name="${make_source_package_name}_${make_pkg_version}${make_pkg_revision}.debian.tar.xz" make_debian_tarball="${DISTDIR}/$make_debian_tarball_file_name" if [ "$make_debdist_tolower" = "false" ]; then true @@ -1430,7 +1435,7 @@ make_deb-cleanup() { } make_dput-ubuntu-ppa() { - dput "$make_source_package_name" "${DISTDIR}/${make_source_package_name}_${make_pkg_version}-${make_pkg_revision}_source.changes" + dput "$make_source_package_name" "${DISTDIR}/${make_source_package_name}_${make_pkg_version}${make_pkg_revision}_source.changes" } make_checkout() {