From: Ian Kelling Date: Wed, 9 Oct 2024 05:52:35 +0000 (-0400) Subject: fix conditional build logic X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=70de8b916089e011654d7257460ece8c01e43fae;p=buildscripts fix conditional build logic --- diff --git a/emacs b/emacs index 5770bbd..30e7f6b 100755 --- a/emacs +++ b/emacs @@ -20,6 +20,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +# note: i store a log of emacs versions i've used in /a/opt/emacs/iank-readme if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi @@ -53,33 +54,25 @@ export CFLAGS="-Og -g3" export DEBIAN_FRONTEND=noninteractive pupdate -# some distros, the package name is like emacs25, some its just emacs -ver=$(apt-cache showsrc emacs | sed -rn 's/^Version: 1:([0-9]+).*/\1/p' | sort -n | tail -n1) ||: -for x in {35..25} ""; do - if [[ $ver ]] && (( ver >= x )); then - latest_emacs=emacs - break - fi - if apt-cache showsrc emacs$x 2>/dev/null |grep . &>/dev/null; then - latest_emacs=emacs$x - break - fi -done - # ccache is a missing build dep for mu pkgs=(gawk attr autoconf-archive git install-info ccache) -##### warning, apt-rdepends seems to look at the newest version of the package, -##### not the one that build-dep would install. if $show_pkgs; then echo ${pkgs[*]} - for x in $latest_emacs maildir-utils; do + for x in emacs maildir-utils; do # todo, this gives fake provided packages like mailx, and then # fai ignores them. # https://askubuntu.com/questions/21379/how-do-i-find-the-build-dependencies-of-a-package if ! type -p apt-rdepends &>/dev/null; then sudo apt-get -y install --purge --auto-remove apt-rdepends fi - apt-rdepends -p --build-depends --follow=DEPENDS $x/$(debian-codename) 2>/dev/null |sed -rn 's/^\s*Build-Depends: (\S+).*/\1/p' + codename=$(debian-codename) + if [[ $x == emacs && codename == aramo ]]; then + codename=bookworm + fi + if ! apt-cache show emacs/$codename &>/dev/null; then + codename=$(debian-codename-compat) + fi + apt-rdepends -p --build-depends --follow=DEPENDS $x/$codename 2>/dev/null |sed -rn 's/^\s*Build-Depends: (\S+).*/\1/p' done exit 0 fi @@ -111,25 +104,29 @@ if [[ -e $dir ]]; then head=$(git rev-parse HEAD) if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then echo "already compiled" - installed_info=$(file -b $(readlink -f $(type -P emacs))) - build_info=$(file -b $dir/src/emacs) - if [[ $installed_info == "$build_info" ]]; then - echo "already installed exiting" - # this isn't perfect, because install could partially fail or the - # command after it could - exit 0 + if emacs_path=$(type -P emacs 2>/dev/null); then + installed_info=$(file -b $(readlink -f $emacs_path)) + build_info=$(file -b $dir/src/emacs) + if [[ $installed_info == "$build_info" ]]; then + echo "already installed exiting" + # this isn't perfect, because install could partially fail or the + # command after it could + exit 0 + fi fi fi if [[ $rev != "$head" ]]; then + echo "$0: rev:$rev != head:$head, setting bootstrap=true" bootstrap=true fi else + echo "$0: dir=$dir does not exist, setting bootstrap=true" head=$(git rev-parse HEAD) bootstrap=true fi +echo recompile=$recompile bootstrap=$bootstrap update=$update if $dryrun; then - echo recompile=$recompile bootstrap=$bootstrap update=$update exit 0 fi @@ -146,15 +143,16 @@ case $(distro-name) in debian|ubuntu|trisquel) # todo: unknown for other distros, this will fail logq p -y build-dep maildir-utils/$(debian-archive) - # oddly, on ubuntu 14.04 this installs postfix, but I dun care - # ubuntu 14.04 gave this error message - # Unable to satisfy the build-depends: Build-Depends: libpng-dev - # this is satisfied by dvipng. the build-dep is just wrong - # minor bug I'm not going to bother reporting. - # - # note, useful command to see build dep packagages: - # apt-rdepends --build-depends --follow=DEPENDS emacs25 - logq p -y build-dep $latest_emacs/$(debian-archive) + if [[ $(debian-codename) == aramo ]]; then + # we need newer build deps + logq p -y build-dep emacs/bookworm + else + codename=$(debian-codename) + if ! apt-cache show emacs/$codename &>/dev/null; then + codename=$(debian-codename-compat) + fi + logq p -y build-dep emacs/$codename + fi ;;& esac @@ -238,23 +236,16 @@ fi # from its HACKING file - -if $recompile; then - # note, not totally sure its right to put this within recompile, but its taking up most of the time, so going for it. - logq emacs --batch -l ~/.emacs.d/compile-init-dir.el -fi +# 2024: i don't know if this is important anymore so commenting out. +# if $recompile; then +# # note, not totally sure its right to put this within recompile, but its taking up most of the time, so going for it. +# logq emacs --batch -l ~/.emacs.d/compile-init-dir.el +# fi # as of 01-2017, built-in org mode has a bug that # org-edit-src-exit does not get bound, so using latest #/a/bin/buildscripts/org-mode -# disabled as i haven't used it in a while -# if $update; then -# logq pi bzr -# cd ~/.emacs.d/src/mediawiki-el -# bzr pull -# fi - # not keeping up with the latest gnus development. # # instructions from the README diff --git a/mu4e b/mu4e index d70e6ed..58955ec 100755 --- a/mu4e +++ b/mu4e @@ -52,13 +52,15 @@ if [[ -e $dir ]]; then head=$(git rev-parse HEAD) if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then echo "already compiled" - installed_info=$(file $(readlink -f $(type -P mu))) - build_info=$(file $dir/build/mu/mu) - if [[ $installed_info == "$build_info" ]]; then - echo "already installed exiting" - # this isn't perfect, because install could partially fail or the - # command after it could - exit 0 + if mu_path=$(type -P mu 2>/dev/null); then + installed_info=$(file -b $(readlink -f $mu_path)) + build_info=$(file -b $dir/build/mu/mu) + if [[ $installed_info == "$build_info" ]]; then + echo "already installed exiting" + # this isn't perfect, because install could partially fail or the + # command after it could + exit 0 + fi fi fi echo rev=$rev head=$head