Skip to content

Commit

Permalink
Changes in the version details file handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michacassola committed Apr 4, 2024
1 parent c1570b0 commit a33f767
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
21 changes: 13 additions & 8 deletions unypkg-base-build-stage1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,25 +154,30 @@ function git_clone_source_repo {
git clone $gitdepth --single-branch -b "$pkg_head" "$pkg_git_repo"
}
function version_details {
function check_if_newer_version {
# Download last vdet file
curl -LO https://github.com/unypkg/"$pkgname"/releases/latest/download/vdet
old_commit_id="$(sed '2q;d' vdet)"
uny_build_date_seconds_old="$(sed '4q;d' vdet)"
[[ $latest_commit_id == "" ]] && latest_commit_id="$latest_ver"
# pkg will be built, if commit id is different and newer.
# Before a pkg is built the existence of a vdet-"$pkgname"-new file is checked
# Before a pkg is built the existence of a build-"$pkgname" file is checked
if [[ "$latest_commit_id" != "$old_commit_id" && "$uny_build_date_seconds_now" -gt "$uny_build_date_seconds_old" ]]; then
{
echo "$latest_ver"
echo "$latest_commit_id"
echo "$uny_build_date_now"
echo "$uny_build_date_seconds_now"
} >vdet-"$pkgname"-new
echo "newer" >release-"$pkgname"
fi
}
function version_details {
{
echo "$latest_ver"
echo "$latest_commit_id"
echo "$uny_build_date_now"
echo "$uny_build_date_seconds_now"
} >vdet-"$pkgname"
check_if_newer_version
}
function archiving_source {
rm -rf "$pkg_git_repo_dir"/.git "$pkg_git_repo_dir"/.git*
[[ -d "$pkgname-$latest_ver" ]] && rm -rf "$pkgname-$latest_ver"
Expand Down
10 changes: 5 additions & 5 deletions unypkg-base-build-stage2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2083,10 +2083,10 @@ gh -R unypkg/base release create "$uny_build_date_now" --generate-notes \
### Packaging individual ones

cd $UNY/pkg || exit
for pkg in /var/uny/sources/vdet-*-new; do
vdet_content="$(cat "$pkg")"
vdet_new_file="$pkg"
pkg="$(echo "$pkg" | grep -Eo "vdet.*new$" | sed -e "s|vdet-||" -e "s|-new||")"
for pkg in /var/uny/sources/release-*; do
vdet_content="$(basename "$pkg" | sed "s|release-|vdet-|" | xargs cat)"
vdet_new_file="${pkg//release-/vdet-}"
pkg="$(echo "$pkg" | grep -Eo "release.*" | sed -e "s|release-||")"
pkgv="$(echo "$vdet_content" | head -n 1)"

cp "$vdet_new_file" "$pkg"/"$pkgv"/vdet
Expand All @@ -2098,5 +2098,5 @@ for pkg in /var/uny/sources/vdet-*-new; do
XZ_OPT="-9 --threads=0" tar -cJpf unypkg-"$pkg".tar.xz "$pkg"
# To-do: Also upload source with next command
gh -R unypkg/"$pkg" release create "$pkgv"-"$uny_build_date_now" --generate-notes \
"$pkg/$pkgv/vdet#vdet - $vdet_content" unypkg-"$pkg".tar.xz "$pkg"-build.log "$source_archive_new"
"$pkg/$pkgv/vdet#vdet - $vdet_content" "$pkg"/"$pkgv"/rdep unypkg-"$pkg".tar.xz "$pkg"-build.log "$source_archive_new"
done

0 comments on commit a33f767

Please sign in to comment.