From: Ian Kelling Date: Tue, 19 Aug 2025 22:32:40 +0000 (-0400) Subject: random fixes X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=HEAD;p=buildscripts random fixes --- diff --git a/emacs b/emacs index b4c7511..bb7a181 100755 --- a/emacs +++ b/emacs @@ -22,14 +22,40 @@ # note: i store a log of emacs versions i've used in /a/opt/emacs/iank-readme +set -e; . /usr/local/lib/bash-bear; set +e + source /b/distro-functions/src/identify-distros source /b/distro-functions/src/package-manager-abstractions source /b/log-quiet/logq-function +source /b/buildscripts/emacsish-build-lib +source /b/ds/fsf-script-lib m() { printf "%s\n" "$*"; "$@"; } #set -x # arg = git commit to check out +usage() { + cat </dev/null) ||: - if [[ -e .git/iank-head ]]; then - head=$(cat .git/iank-head) - fi - if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then - echo "already compiled" - if emacs_path=$(type -P emacs 2>/dev/null); then - installed_info=$(file -bL $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 +m cd /a/opt/emacs echo recompile=$recompile bootstrap=$bootstrap update=$update if $dryrun; then @@ -136,9 +127,8 @@ if $dryrun; then fi if $bootstrap; then - m rsync --exclude /.git --delete-excluded -ra /a/opt/emacs/ $dir - mkdir $dir/.git - printf "%s\n" "$head" >$dir/.git/iank-head + m sudo rsync --exclude /.git --delete-excluded --delete -ra /a/opt/emacs/ $dir + { cd /a/opt/emacs; git rev-parse HEAD >$dir/iank-head; } recompile=true fi @@ -268,4 +258,4 @@ fi my-update-info-dir -echo $head >$last_build +cat $dir/iank-head >$last_built_rev_path diff --git a/emacs-lex-warn b/emacs-lex-warn new file mode 100644 index 0000000..a751601 --- /dev/null +++ b/emacs-lex-warn @@ -0,0 +1,21 @@ +#!/bin/bash +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to change +# to a recommended GPL license. + +# Copyright 2025 Ian Kelling + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/emacsish-build-lib b/emacsish-build-lib new file mode 100644 index 0000000..0c57feb --- /dev/null +++ b/emacsish-build-lib @@ -0,0 +1,32 @@ +#!/bin/bash + +#### detection of already done things ##### +done-detect() { + prog=$1 + dir=/a/opt/$prog-$(debian-codename-compat) + last_built_rev_path=$dir/iank-$prog-build + last_built_rev=$(cat $last_built_rev_path 2>/dev/null) ||: + if [[ -e $dir/iank-head ]]; then + target_rev=$(cat $dir/iank-head) + else + e "$0: file $dir/iank-head doesn't exist, setting bootstrap=true" + bootstrap=true + fi + built_rev_eq_target_rev=false + if [[ $last_built_rev && $target_rev && $last_built_rev == "$target_rev" ]]; then + echo "note: it looks already compiled" + if prog_path=$(type -P $prog 2>/dev/null); then + installed_info=$(file -bL $prog_path) + build_info=$(file -b $dir/src/$prog) + if [[ $installed_info == "$build_info" ]]; then + echo "note: it looks already installed" + if ! $recompile && ! $bootstrap; then + e "looks like nothing needs to be done, exiting early" + # this isn't perfect, because install could partially fail or the + # command after it could + exit 0 + fi + fi + fi + fi +} diff --git a/go b/go index 3cbb616..27b042e 100755 --- a/go +++ b/go @@ -88,7 +88,7 @@ if $up; then touch ~/.local/gofetch tmpf=$(git tag | sort -Vr | grep -E '^go[0-9.]+$' | head) - maptfile -t vers <<<"$tmpf" + mapfile -t vers <<<"$tmpf" # shellcheck disable=SC2154 # false positive ver=${vers[0]} diff --git a/mu4e b/mu4e index acf5f33..f5a2781 100755 --- a/mu4e +++ b/mu4e @@ -20,10 +20,24 @@ # See the License for the specific language governing permissions and # limitations under the License. +# update log: +# 2025-05-27 + +# was on: +# commit 80a2d4cef491df8941e1c9e6cb174286fb80afe9 +# Author: Dirk-Jan C. Binnema +# Date: Sat Apr 15 23:20:37 2023 +0300 + +# build: bump version to 1.10.3 + +set -e; . /usr/local/lib/bash-bear; set +e source /b/distro-functions/src/identify-distros source /b/distro-functions/src/package-manager-abstractions source /b/log-quiet/logq-function +source /b/buildscripts/emacsish-build-lib +source /b/ds/fsf-script-lib + m() { printf "%s\n" "$*"; "$@"; } @@ -31,9 +45,11 @@ cd /a/opt/mu recompile=false dryrun=false +bootstrap=false while [[ $1 == -* ]]; do case $1 in + -b) bootstrap=true; recompile=true ;; -n) dryrun=true ;; -r) recompile=true ;; --no-r) recompile=false ;; @@ -43,49 +59,16 @@ while [[ $1 == -* ]]; do shift done -bootstrap=false - -#git repo -dir=/a/opt/mu-$(debian-codename-compat) -last_build=$dir/iank-mu-build - -if [[ -e $dir ]]; then - m cd $dir - rev=$(cat $last_build 2>/dev/null) ||: - if [[ -e .git/iank-head ]]; then - head=$(cat .git/iank-head) - fi - if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then - echo "already compiled" - if mu_path=$(type -P mu 2>/dev/null); then - installed_info=$(file -bL "$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 - if [[ $rev != "$head" ]]; then - bootstrap=true - fi -else - head=$(git rev-parse HEAD) - bootstrap=true -fi +done-detect mu +echo recompile=$recompile bootstrap=$bootstrap if $dryrun; then - e recompile=$recompile bootstrap=$bootstrap exit 0 fi if $bootstrap; then m rsync --exclude /.git --delete-excluded -ra /a/opt/mu/ $dir - mkdir $dir/.git - printf "%s\n" "$head" >$dir/.git/iank-head + { cd /a/opt/mu; git rev-parse HEAD >$dir/iank-head; } recompile=true cd $dir fi @@ -101,7 +84,6 @@ else m pi libgmime-3.0-dev meson fi if $recompile; then - m git clean -xfffd nproc=$(nproc) m ./autogen.sh && make -j$nproc # note uninstall is implemented @@ -116,4 +98,4 @@ else sudo touch -d @$(($(stat -c%Y build/build.ninja) - 100)) /usr/local/bin/emacs m sudo make install fi -echo $head >$last_build +cat $dir/iank-head >$last_built_rev_path diff --git a/old-unused/textern b/textern similarity index 85% rename from old-unused/textern rename to textern index c304d61..4db7ce8 100755 --- a/old-unused/textern +++ b/textern @@ -21,11 +21,6 @@ # limitations under the License. -if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi - -shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4 -set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR source /a/bin/bash-bear-trap/bash-bear # fuck pip. i hate it.