Skip to content

Commit

Permalink
DLPX-79631 Decide on a way to retain more of the Ubuntu revision info…
Browse files Browse the repository at this point in the history
…rmation so that we can more easily determine what's in the package (#269)

* DLPX-79631 Decide on a way to retain more of the Ubuntu revision information so that we can more easily determine what's in the package

PR URL: https://www.github.com/delphix/linux-pkg/pull/269
  • Loading branch information
sumedhbala-delphix authored Jun 28, 2023
1 parent 2d6be93 commit 203e593
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion buildpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ check_env DEFAULT_GIT_BRANCH
# DEFAULT_REVISION & DEFAULT_GIT_BRANCH will be set if called from buildlist.sh.
# If the script is called manually, we set it here.
#
DEFAULT_REVISION="${DEFAULT_REVISION:-$(default_revision)}"
DEFAULT_REVISION="${DEFAULT_REVISION:-$(delphix_revision)}"

echo ""
echo_bold "===================================================================="
Expand Down
2 changes: 1 addition & 1 deletion checkupdates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ logmust check_package_exists "$PACKAGE"
#
# If the script is called manually, we set it here.
#
DEFAULT_REVISION="${DEFAULT_REVISION:-$(default_revision)}"
DEFAULT_REVISION="${DEFAULT_REVISION:-$(delphix_revision)}"

logmust load_package_config "$PACKAGE"
logmust create_workdir
Expand Down
29 changes: 21 additions & 8 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ function create_workdir() {
function install_pkgs() {
for attempt in {1..3}; do
echo "Running: sudo env DEBIAN_FRONTEND=noninteractive " \
"apt-get install -y $*"
"apt-get install -y --allow-downgrades $*"

sudo env DEBIAN_FRONTEND=noninteractive apt-get install \
-y "$@" && return
-y --allow-downgrades "$@" && return

echo "apt-get install failed, retrying."
sleep 10
Expand Down Expand Up @@ -596,10 +596,11 @@ function install_kernel_headers() {
done
}

function default_revision() {
function delphix_revision() {
#
# We use "delphix" in the default revision to make it easy to find all
# packages built by delphix installed on an appliance.
# packages built by delphix installed on an appliance. This will be used
# along with DEFAULT_REVISION to get the full revision.
#
# We choose a timestamp as the second part since we want each package
# built to have a unique value for its full version, as new packages
Expand All @@ -611,7 +612,7 @@ function default_revision() {
# Delphix Appliance upgrades, however we prefer keeping things in-line
# with the established conventions.
#
echo "delphix-$(date '+%Y.%m.%d.%H')"
echo "delphix.$(date '+%Y.%m.%d.%H.%M')"
}

function determine_dependencies_base_url() {
Expand Down Expand Up @@ -1004,6 +1005,7 @@ function push_to_remote() {
function set_changelog() {
check_env PACKAGE_REVISION
local src_package="${1:-$PACKAGE}"
local final_version

#
# If PACKAGE_VERSION hasn't been set already, then retrieve it from
Expand All @@ -1013,21 +1015,32 @@ function set_changelog() {
#
if [[ -z "$PACKAGE_VERSION" ]]; then
if [[ -f debian/changelog ]]; then
PACKAGE_VERSION="$(logmust dpkg-parsechangelog -S Version | awk -F'-' '{print $1}')"
PACKAGE_VERSION="$(logmust dpkg-parsechangelog -S Version)"
else
PACKAGE_VERSION=1.0.0
fi
fi

logmust export DEBEMAIL="Delphix Engineering <[email protected]>"
if [[ "${PACKAGE_VERSION}" =~ '-' ]]; then
final_version="${PACKAGE_VERSION}+${PACKAGE_REVISION}"
else
final_version="${PACKAGE_VERSION}-1${PACKAGE_REVISION}"
fi
if [[ -f debian/changelog ]]; then
# update existing changelog
logmust dch -b -v "${PACKAGE_VERSION}-${PACKAGE_REVISION}" \
# We use a + or - to easily visualize the separation
# of the delphix revision. If there is no debian revision
# then we add a debian revision using - as the separator,
# If there is already a debian revision, we use + as the
# separator and update the revision.

logmust dch -b -v "$final_version" \
"Automatically generated changelog entry."
else
# create new changelog
logmust dch --create --package "$src_package" \
-v "${PACKAGE_VERSION}-${PACKAGE_REVISION}" \
-v "$final_version" \
"Automatically generated changelog entry."
fi
}
Expand Down
6 changes: 4 additions & 2 deletions packages/zfs/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ function build() {

local hash
logmust eval hash="$(git rev-parse --short HEAD)"
logmust sed -i "s/^Release:.*/Release: $PACKAGE_REVISION-$hash/" \
META || die "failed to set version"
logmust sed -i "s/^Version:.*/Version: $PACKAGE_VERSION/" \
META || die "failed to set Version"
logmust sed -i "s/^Release:.*/Release: 1$PACKAGE_REVISION-$hash/" \
META || die "failed to set Release"
logmust set_changelog

#
Expand Down
2 changes: 1 addition & 1 deletion push-merge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fi

logmust check_package_exists "$PACKAGE"

DEFAULT_REVISION="${DEFAULT_REVISION:-$(default_revision)}"
DEFAULT_REVISION="${DEFAULT_REVISION:-$(delphix_revision)}"
logmust load_package_config "$PACKAGE"

if [[ ! -d "$WORKDIR/repo" ]]; then
Expand Down

0 comments on commit 203e593

Please sign in to comment.