Skip to content

Commit

Permalink
Create debian/changelog if not exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
alee-ntap authored and nanory committed Nov 30, 2023
1 parent 7f7b4a8 commit ae98c89
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ on:
message:
type: string
default: ""
tag_suffix:
type: string
default: ""
tag_mangel:
type: string
default: ""
jobs:
source:
name: source package
Expand Down
26 changes: 23 additions & 3 deletions container/bin/build_source
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ main() (
debian_source="$(yq -r '.jobs.build_pkg.with.debian_source // "'$debian_source'"' < "$inputs_file")"
build_options="terse $(yq -r '.jobs.build_pkg.with.build_options // ""' < "$inputs_file")"
build_profiles="$(yq -r '.jobs.build_pkg.with.build_profiles // ""' < "$inputs_file")"
tag_suffix="$(yq -r '.jobs.build_pkg.with.tag_suffix // ""' < "$inputs_file")"
tag_mangle="$(yq -r '.jobs.build_pkg.with.tag_mangle // ""' < "$inputs_file")"

# Define Build Options
export DEB_BUILD_OPTIONS="$build_options"
Expand Down Expand Up @@ -144,15 +146,23 @@ apply_patches() (
distribution="$(yq -r '.jobs.build_pkg.with.distribution // "'"$distribution"'"' < "$inputs_file")"
message="$(yq -r '.jobs.build_pkg.with.message // "'"$message"'"' < "$inputs_file")"

DEBEMAIL="$email" DEBFULLNAME="$maintainer" dch --newversion "$(get_version)" --distribution "$distribution" --force-distribution -- "$message"
if [ -f debian/changelog ]; then
DEBEMAIL="$email" DEBFULLNAME="$maintainer" dch \
--newversion "$(get_version)" --distribution "$distribution" \
--force-distribution -- "$message"
else
DEBEMAIL="$email" DEBFULLNAME="$maintainer" EDITOR=true dch --create --package $name \
--newversion "$(get_version)" --distribution "$distribution" \
--force-distribution -- "$message"
fi

if [ -x "$1/exec.post" ]; then
SOURCE="$source" "$1/exec.post"
fi
)

get_sources() (
local source=$1
#local source=$1

# What kind of source do we have?
if [[ "$source" = "git+"* ]]; then
Expand All @@ -164,14 +174,24 @@ get_sources() (
fi
)

get_upstream-version() (
IFS='#' read -r url ref <<< "${source#git+}"
git ls-remote --tags --refs $url "$tag_suffix"* | awk -F/ '{ print $3 }' | \
grep -Ev "$tag_mangle" | tail -1 | sed -e s/"$tag_suffix"//
)

get_version() (
local version=$PACKAGE_VERSION

# If version is undefined, let's simply use
# the version of the upstream package and add
# the git tag to it.
if [ -z "$version" ]; then
package_version=$(dpkg-parsechangelog --show-field Version)
if [ -f /input/debian/changelog ]; then
package_version=$(dpkg-parsechangelog --show-field Version)
else
package_version=$(get_upstream-version)
fi
commit_hash=$(git -C /input rev-parse HEAD)

# No version has been provided. Check if there is already a Garden Linux version 0
Expand Down

0 comments on commit ae98c89

Please sign in to comment.