Skip to content

Commit

Permalink
add support for packages without revision numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
adrelanos committed Dec 31, 2024
1 parent 5734f73 commit 6a9e444
Showing 1 changed file with 32 additions and 27 deletions.
59 changes: 32 additions & 27 deletions usr/share/genmkfile/make-helper-one.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 )
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 6a9e444

Please sign in to comment.