Skip to content

Commit

Permalink
[eos-pkgbuild-setup] supporting new way of showing changelogs
Browse files Browse the repository at this point in the history
  • Loading branch information
EndeavourOS committed Aug 11, 2023
1 parent 9a71356 commit f7fe2c5
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 69 deletions.
4 changes: 2 additions & 2 deletions eos-pkgbuild-setup/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pkgname=eos-pkgbuild-setup
pkgdesc="Environment setup and tools for building EOS packages."
pkgver=2023 # new numbering! Previous was: 2022.12.25
pkgrel=32.13
pkgrel=32.14
arch=(any)
license=(GPL2)
url="https://github.com/endeavouros-team/PKGBUILDS/raw/master/eos-pkgbuild-setup"
Expand Down Expand Up @@ -61,7 +61,7 @@ source=(
sha512sums=('ef90d33ec65cf02aabc2c6aec9ac6ef9772aae7d33e7b960930904dcdf3dcde86bda132377b8ac435addba30fc6c34cb8d2f49074c96732800b3c4b7c5db85bf'
'15b4a800e60d65a5b4e888a6baa5cb6336b78255ff39f8c54563c77bdbff2299b84e65d456452097c5cbd36df1fae2cdcab41f65b9d86a2c0b6b973f5cc577a9'
'be63de6c49f05f909a0b15e406eb43cad59cd15992ad1fa1ebda58245761fccd309f3aae76e6f3f86e6cd1e0d6279ed43a08aa7f7a2c312a493a55fe819dbc87'
'2b8cf91fa839c1c4dd4e9dfb11ccc050689b6b8998447e8304244d0c556d76b19601199a470a5a71726ccddbfc7c7477b06ef6256e00722024ceb1e898067f2d'
'c02fc2ef6dda113757c5c6851e9db3b11d39a7e2531b69c7a1116bb6bb22b6d0580d01e89d23115f52b0b98ee2f8e0b2a4b0561b871c9eaa67be3de3d6aab236'
'5a73b5996de89842e28aa8b62f50a5c436c38b8ac8e2b8aa253c0db934c512987dd714dfa9551784d88b4a02326ffdaa5d2c25ef8536294e2514ce0f2f994716'
'46a4123eee031144508d713cf63b44cdd9e5ec1609948e8e2257e0cf2247589bc793ab5b933a0922a5e73f274b38d64f7a5fcd58ffcb7924524675da8ae98898'
'57fe6b53b43148cc3aa87b65abd9017d532aef516db0be2b9fee1314f2dcacaee833daade2326bf724bcd439847cc4e7c5fcdd93759db3fd16f569b5f73f80ef'
Expand Down
101 changes: 34 additions & 67 deletions eos-pkgbuild-setup/assets.make
Original file line number Diff line number Diff line change
Expand Up @@ -922,70 +922,41 @@ RunPostHooks()
fi
}

WantAurDiffs() {
Browser() {
local browser
for browser in firefox firefox-developer-edition exo-open kde-open xdg-open ; do
if [ -x /usr/bin/$browser ] ; then
/usr/bin/$browser "$@" &> /dev/null
return
fi
done
}

WantPkgDiffs() {
local xx="$1"
local pkgdirname="$2"
local diff_url="https://aur.archlinux.org/cgit/aur.git/diff/?h=$pkgdirname&context=1"

case "$xx" in
aur/*)
AurMarkingFail "$xx"
;;
*/aur)
if [ "$aurdiff" = "0" ] && [ "$already_asked_diffs" = "0" ] ; then
already_asked_diffs=1
read2 -p "AUR updates are available. Want to see diffs (Y/n)? " -t $ask_timeout
if [ $? -eq 0 ] ; then
case "$REPLY" in
""|[yY]*) aurdiff=1 ;;
esac
else
echo2 no. # no diffs if timeout
fi
fi
if [ "$aurdiff" = "1" ] ; then
case "$xx" in
aur/*)
AurMarkingFail "$xx"
;;
*/aur)
AUR_DIFFS+=("$diff_url")
AUR_DIFF_PKGS+=("$pkgdirname")
#$browser "$diff_url" >& /dev/null
;;
if [ -n "${PKG_CHANGELOGS[$pkgdirname]}" ] ; then
if [ "$pkgdiff" = "unknown" ] ; then
pkgdiff=no
read2 -p "Updates and their changelogs are available. Want to see changelogs (Y/n)? " -t $ask_timeout
if [ $? -eq 0 ] ; then
case "$REPLY" in
""|[yY]*) pkgdiff=yes ;;
esac
fi
;;
esac
}

Browser() {
local browser
if [ -x /usr/bin/firefox ] ; then
browser=/usr/bin/firefox
elif [ -x /usr/bin/chromium ] ; then
browser=/usr/bin/chromium
else
browser=/usr/bin/xdg-open
[ "$pkgdiff" = "no" ] && echo2 no.
fi
[ "$pkgdiff" = "yes" ] && PKG_DIFFS+=("${PKG_CHANGELOGS[$pkgdirname]}")
fi
$browser "$@"
}

ShowAurDiffs() {
# If we have git source code available, then check diffs from that!
local xx ix

for ((ix=0; ix < ${#AUR_DIFFS[@]}; ix++)) ; do
xx="${AUR_DIFF_PKGS[$ix]}"
if [ -d "$ASSETSDIR/AUR/$xx/.git" ] ; then
Pushd "$ASSETSDIR/AUR/$xx"
git pull >& /dev/null
/usr/bin/gitk # gitk stops here
Popd
else
Browser "${AUR_DIFFS[$ix]}" >& /dev/null # xdg-open does not stop here...
ShowPkgDiffs() {
if [ "$pkgdiff" = "yes" ] ; then
if [ ${#PKG_DIFFS[@]} -gt 0 ] ; then
Browser "${PKG_DIFFS[@]}"
fi
done
fi
}

Exit()
Expand Down Expand Up @@ -1096,7 +1067,7 @@ Options:
-ad | --allow-downgrade New package may have smaller version number.
--pkgnames="X" X is a space separated list of packages to use instead of PKGNAMES array in assets.conf.
--repoup (Advanced) Force update of repository database files.
--aurdiff Show PKGBUILD diff for AUR packages.
--pkgdiff Show changelog for modified packages.
EOF
# --versuffix=X Append given suffix (X) to pkgver of PKGBUILD.
# --mirrorcheck=X X is the time (in seconds) to wait before starting the mirrorcheck.
Expand Down Expand Up @@ -1153,14 +1124,12 @@ Main2()
local repoup=0
local pkgver_suffix=""
local reposig # 1 = sign repo too, 0 = don't sign repo
local aurdiff=0 # 1 = show AUR diff
local already_asked_diffs=0
local pkgdiff=unknown # yes=show AUR diff, no=don't show, unknown=need to ask for yes or no
local filelist_txt
local use_filelist # yes or no
local ask_timeout=60
local allow_downgrade=no
local AUR_DIFFS=()
local AUR_DIFF_PKGS=()
local PKG_DIFFS=()
local mirror_check_wait=180
local use_release_assets # currently only for [endeavouros] repo
local save_folder=""
Expand All @@ -1181,7 +1150,7 @@ Main2()
--dryrun-local | -nl | -n) cmd=dryrun-local ;;
--dryrun | -nr | -nn) cmd=dryrun ;;
--repoup) repoup=1 ;; # sync repo even when no packages are built
--aurdiff) aurdiff=1 ;;
--pkgdiff) pkgdiff=yes ;;
--allow-downgrade | -ad) allow_downgrade=yes ;;

--pkgnames=*) PKGNAMES_PARAMETER="$xx" ;;
Expand Down Expand Up @@ -1299,16 +1268,14 @@ Main2()

((total_items_to_build++))
ShowResult "CHANGED $tmpcurr ==> $tmp" "$hookout"
if [ $cmpresult -gt 0 ] ; then
WantAurDiffs "$xx" "$pkgdirname"
fi

[ $cmpresult -gt 0 ] && WantPkgDiffs "$xx" "$pkgdirname"
done

DebugBreak

if [ -n "$AUR_DIFFS" ] ; then
ShowAurDiffs
fi
[ "${#PKG_DIFFS[@]}" -gt 0 ] && ShowPkgDiffs

Popd

local exit_code=$total_items_to_build
Expand Down

0 comments on commit f7fe2c5

Please sign in to comment.