1
0
mirror of https://github.com/lineageos4microg/docker-lineage-cicd synced 2024-11-09 10:09:56 +01:00

Tidy up code and comments

This commit is contained in:
Pete Fotheringham 2024-04-04 17:33:57 +01:00
parent 04b2d1689e
commit 901a33a1d2

@ -452,6 +452,7 @@ for branch in ${BRANCH_NAME//,/ }; do
files_to_hash=() files_to_hash=()
if (set +eu ; mka "${jobs_arg[@]}" otapackage bacon) &>> "$DEBUG_LOG"; then if (set +eu ; mka "${jobs_arg[@]}" otapackage bacon) &>> "$DEBUG_LOG"; then
if [ "$MAKE_IMG_ZIP_FILE" = true ]; then if [ "$MAKE_IMG_ZIP_FILE" = true ]; then
# make the `-img.zip` file # make the `-img.zip` file
echo ">> [$(date)] Making -img.zip file" | tee -a "$DEBUG_LOG" echo ">> [$(date)] Making -img.zip file" | tee -a "$DEBUG_LOG"
@ -466,34 +467,28 @@ for branch in ${BRANCH_NAME//,/ }; do
echo ">> [$(date)] Making -img.zip file disabled" echo ">> [$(date)] Making -img.zip file disabled"
fi fi
# Move the ROM zip files to the main OUT directory
echo ">> [$(date)] Moving build artifacts for $codename to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG" echo ">> [$(date)] Moving build artifacts for $codename to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG"
cd out/target/product/"$codename" cd out/target/product/"$codename"
# rename the zip produced by 'mka otapackage' from "lineage_$device-ota.zip" # Move the ROM zip files to the main OUT directory
# for 21.0 and "lineage_$device-ota-eng.root.zip" for 20.0 to
# "lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename.zip"
# for otapackage in lineage_*.zip; do
# mv "$otapackage" "lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename".zip &>> "$DEBUG_LOG"
# done
files_to_hash=() files_to_hash=()
for build in lineage-*.zip; do for build in lineage-*.zip; do
cp -v system/build.prop "$ZIP_DIR/$zipsubdir/$build.prop" &>> "$DEBUG_LOG" cp -v system/build.prop "$ZIP_DIR/$zipsubdir/$build.prop" &>> "$DEBUG_LOG"
mv "$build" "$ZIP_DIR/$zipsubdir/" &>> "$DEBUG_LOG" mv "$build" "$ZIP_DIR/$zipsubdir/" &>> "$DEBUG_LOG"
files_to_hash+=( "$build" ) files_to_hash+=( "$build" )
done done
# Now handle the .img files - where are they?
img_dir=$(find "$source_dir/out/target/product/$codename/obj/PACKAGING" -name "IMAGES") img_dir=$(find "$source_dir/out/target/product/$codename/obj/PACKAGING" -name "IMAGES")
if [ -d "$img_dir" ]; then if [ -d "$img_dir" ]; then
cd "$img_dir" cd "$img_dir"
fi fi
if [ "$ZIP_UP_IMAGES" = true ]; then if [ "$ZIP_UP_IMAGES" = true ]; then
# zipping the .img files
echo ">> [$(date)] Zipping the .img files" | tee -a "$DEBUG_LOG" echo ">> [$(date)] Zipping the .img files" | tee -a "$DEBUG_LOG"
files_to_zip=() files_to_zip=()
images_zip_file="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-images.zip" images_zip_file="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-images.zip"
# cd "$source_dir/out/target/product/$codename/obj/PACKAGING/target_files_intermediates/lineage_$codename-target_files-eng.root/IMAGES/"
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
if [ -f "$image.img" ]; then if [ -f "$image.img" ]; then
@ -506,8 +501,9 @@ for branch in ${BRANCH_NAME//,/ }; do
mv "$images_zip_file" "$ZIP_DIR/$zipsubdir/" mv "$images_zip_file" "$ZIP_DIR/$zipsubdir/"
files_to_hash+=( "$images_zip_file" ) files_to_hash+=( "$images_zip_file" )
else else
# just copy the mages to the zips directory
echo ">> [$(date)] Zipping the '-img' files disabled" echo ">> [$(date)] Zipping the '-img' files disabled"
# rename and copy the images to the zips directory
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
if [ -f "$image.img" ]; then if [ -f "$image.img" ]; then
recovery_name="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-$image.img" recovery_name="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-$image.img"
@ -518,6 +514,7 @@ for branch in ${BRANCH_NAME//,/ }; do
done done
fi fi
# create the checksum files
cd "$ZIP_DIR/$zipsubdir" cd "$ZIP_DIR/$zipsubdir"
for f in "${files_to_hash[@]}"; do for f in "${files_to_hash[@]}"; do
sha256sum "$f" > "$ZIP_DIR/$zipsubdir/$f.sha256sum" sha256sum "$f" > "$ZIP_DIR/$zipsubdir/$f.sha256sum"
@ -547,6 +544,8 @@ for branch in ${BRANCH_NAME//,/ }; do
/usr/bin/python /root/clean_up.py -n "$DELETE_OLD_LOGS" -V "$los_ver" -N 1 -c "$codename" "$LOGS_DIR" /usr/bin/python /root/clean_up.py -n "$DELETE_OLD_LOGS" -V "$los_ver" -N 1 -c "$codename" "$LOGS_DIR"
fi fi
fi fi
# call post-build.sh
if [ -f /root/userscripts/post-build.sh ]; then if [ -f /root/userscripts/post-build.sh ]; then
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG" echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
/root/userscripts/post-build.sh "$codename" "$build_successful" "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!" /root/userscripts/post-build.sh "$codename" "$build_successful" "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"