Skip to content

Commit b9d7639

Browse files
committed
twoliter: error if old rpm structure is discovered
Add a check to Makefile.toml to see if the user has rpms in the build/rpms directory. If so, this is likely a problem because the new version of Buildsys will expect per-package subdirectories, and Cargo will not know it needs to rebuild. Raise an error that informs the user they need to run cargo make clean.
1 parent 8ae705a commit b9d7639

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

twoliter/embedded/Makefile.toml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,37 @@ cargo metadata \
750750
'''
751751
]
752752

753+
# This task is temporarily necessary due to changes in Twoliter that occurred in June 2024. A new
754+
# directory structure was introduced for build/rpms. Attempts to do an incremental build when the
755+
# build output was in the old directory structure would fail, so we needed a way to inform users
756+
# that the need to run a cargo make clean.
757+
#
758+
# Once the changed build/rpms structure has been around long enough (in, say, August 2024), this
759+
# task can be removed as we can assume that no lingering old incremental builds exist in the wild.
760+
#
761+
# TODO - remove this task sometime around, or after, August 2024.
762+
[tasks.check-rpm-structure]
763+
script_runner = "bash"
764+
script = [
765+
'''
766+
if [ ! -d "${BUILDSYS_PACKAGES_DIR}" ]; then
767+
exit 0
768+
fi
769+
770+
count=$(find "${BUILDSYS_PACKAGES_DIR}" -maxdepth 1 -name "*.rpm" | wc -l)
771+
772+
if [ "${count}" != "0" ]; then
773+
echo "ERROR: You have rpms in a flat structure in ${BUILDSYS_PACKAGES_DIR}"
774+
echo "Twoliter and Buildsys have been updated to use a different RPM directory structure"
775+
echo "PLEASE RUN: cargo make clean"
776+
exit 1
777+
fi
778+
'''
779+
]
780+
753781
# Builds a package including its build-time and runtime dependency packages.
754782
[tasks.build-package]
755-
dependencies = ["check-cargo-version", "fetch-sdk", "publish-setup", "fetch-licenses", "cargo-metadata"]
783+
dependencies = ["check-cargo-version", "fetch-sdk", "publish-setup", "fetch-licenses", "cargo-metadata", "check-rpm-structure"]
756784
script_runner = "bash"
757785
script = [
758786
'''
@@ -785,7 +813,7 @@ cargo build \
785813
]
786814

787815
[tasks.build-variant]
788-
dependencies = ["fetch-sdk", "build-sbkeys", "publish-setup", "cargo-metadata"]
816+
dependencies = ["fetch-sdk", "build-sbkeys", "publish-setup", "cargo-metadata", "check-rpm-structure"]
789817
script = [
790818
'''
791819
export PATH="${TWOLITER_TOOLS_DIR}:${PATH}"

0 commit comments

Comments
 (0)