diff --git a/.gitmodules b/.gitmodules index 2ce6483..ca7ac1a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[borg] + pushDefault = locutus + collective = emacsg [submodule "auto-compile"] path = lib/auto-compile url = git@github.com:tarsius/auto-compile.git diff --git a/Makefile b/Makefile index 36708d1..624b9f5 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ .PHONY: all help build build-init quick bootstrap .FORCE: +SUPPRESS_WARNINGS = 2>&1 | grep -v +SUPPRESS_WARNINGS += -e "‘defgeneric’ is an obsolete macro" +SUPPRESS_WARNINGS += -e "‘defmethod’ is an obsolete macro" + all: build help: @@ -21,27 +25,26 @@ build: @rm -f init.elc @emacs -Q --batch -L lib/borg --load borg \ --funcall borg-initialize \ - --funcall borg-batch-rebuild + --funcall borg-batch-rebuild $(SUPPRESS_WARNINGS) build-init: @rm -f init.elc @emacs -Q --batch -L lib/borg --load borg \ --funcall borg-initialize \ - --funcall borg-batch-rebuild-init + --funcall borg-batch-rebuild-init 2>&1 quick: @rm -f init.elc @emacs -Q --batch -L lib/borg --load borg \ --funcall borg-initialize \ - --eval '(borg-batch-rebuild t)' + --eval '(borg-batch-rebuild t)' $(SUPPRESS_WARNINGS) lib/%: .FORCE @emacs -Q --batch -L lib/borg --load borg \ --funcall borg-initialize \ - --eval '(borg-build "$(@F)")' + --eval '(borg-build "$(@F)")' $(SUPPRESS_WARNINGS) bootstrap: git submodule init - git submodule update - git submodule foreach 'git checkout master; git reset --hard $$sha1' - make + bin/borg-bootstrap + make build diff --git a/bin/borg-bootstrap b/bin/borg-bootstrap new file mode 100755 index 0000000..669b623 --- /dev/null +++ b/bin/borg-bootstrap @@ -0,0 +1,97 @@ +#!/bin/sh + +# Copyright (C) 2016 Jonas Bernoulli +# +# Author: Jonas Bernoulli +# License: GPL v3 + +# Commentary: + +# This script is a replacement for `git submodule update'. The +# main differences are that this script resets the current branch +# if necessary instead of detaching HEAD and that it is capable of +# adding and configuring additional remotes. + +# The following variables can be set in ".gitmodules": +# +# * submodule.DRONE.remote = NAME URL +# +# This variable specifies an additional remote named DRONE that is +# fetched from URL. +# +# * borg.collective = REMOTE +# +# This variable specifies the name used for remotes that reference +# a repository that has been patched by the collective. If a NAME +# matches REMOTE, then it is configured as the upstream of the +# current branch of the respective DRONE. +# +# * borg.pushDefault = DEFAULT +# +# This variable specifies a name used for push-remotes. If a NAME +# matches DEFAULT, then it is configured as the push-remote of the +# current branch of the respective DRONE. + +# If an error occurs while `make bootstrap' runs this script, then +# fix the error(s) and run `bin/borg-bootstrap' directly, followed +# by `make build'. + +hive_remote=$(git config -f .gitmodules borg.collective) +push_remote=$(git config -f .gitmodules borg.pushDefault) + +git submodule--helper list | +while read mode sha1 stage path +do + name=$(git submodule--helper name "$path") + url=$(git config -f .gitmodules submodule."$name".url) + + if test -e "$path" && ! test -e "$path"/.git + then + git submodule--helper clone --name "$name" --path "$path" --url "$url" + + git config -f .gitmodules --get-all submodule."$name".remote | + while read remote remote_url + do + if ! test -e "$path"/.git + then + git submodule--helper clone \ + --name "$name" \ + --path "$path" \ + --url "$remote_url" && + git remote rename origin "$remote" + else + ( + cd "$path" + git remote add "$remote" "$remote_url" + git fetch "$remote" + ) + fi + + if test -e "$path"/.git + then + ( + cd "$path" + if test "$remote" = "$hive_remote" + then + git config branch.master.remote "$remote" + + elif test "$remote" = "$push_remote" + then + git config remote.pushDefault "$remote" + fi + ) + fi + done + + if test -e "$path"/.git + then + ( + cd "$path" + git reset --hard "$sha1" || + echo >&2 "futile: checkout of '$sha1' into submodule path '$path' failed" + ) + else + echo >&2 "futile: clone of any remote into submodule path '$path' failed" + fi + fi +done diff --git a/init.el b/init.el index e6c7bbf..30e6978 100644 --- a/init.el +++ b/init.el @@ -259,8 +259,8 @@ (require 'with-editor) (add-hook 'term-exec-hook 'with-editor-export-editor)) -(progn `text-mode' - (add-hook 'test-mode-hook #'indicate-buffer-boundaries-left)) +(progn ; `text-mode' + (add-hook 'text-mode-hook #'indicate-buffer-boundaries-left)) (use-package tramp :defer t diff --git a/lib/borg b/lib/borg index a43ed6c..9573646 160000 --- a/lib/borg +++ b/lib/borg @@ -1 +1 @@ -Subproject commit a43ed6ca607d059954caa00a1b9935ddad4afe8e +Subproject commit 95736460a138edb76214abfc0463979c194c218f diff --git a/lib/closql b/lib/closql index 1245d82..5e9d642 160000 --- a/lib/closql +++ b/lib/closql @@ -1 +1 @@ -Subproject commit 1245d821d5893af31f10d8e11375c682dc590ad5 +Subproject commit 5e9d64288863d6d33fac73ccf356427215daa9fb diff --git a/lib/dash b/lib/dash index d4bccfe..958e3fb 160000 --- a/lib/dash +++ b/lib/dash @@ -1 +1 @@ -Subproject commit d4bccfe1acb7cf1247d11f1b317da29900c9d096 +Subproject commit 958e3fb62fd326d3743c0603b80d24ab85712c03 diff --git a/lib/epkg b/lib/epkg index de33177..3256cac 160000 --- a/lib/epkg +++ b/lib/epkg @@ -1 +1 @@ -Subproject commit de33177656d8f48b65abbb71ab4d25b7bd799dee +Subproject commit 3256cac5b7ac2239feb9bf59beb11599e5706154 diff --git a/lib/magit b/lib/magit index 4aeaea1..f7b7cea 160000 --- a/lib/magit +++ b/lib/magit @@ -1 +1 @@ -Subproject commit 4aeaea13c2745ab76c32780f7d85cc4bbbcf6399 +Subproject commit f7b7cea23a5403af1ba7513fbc284a8269196854 diff --git a/lib/with-editor b/lib/with-editor index b2d9d6b..ab73c02 160000 --- a/lib/with-editor +++ b/lib/with-editor @@ -1 +1 @@ -Subproject commit b2d9d6b38cbb3993d4c100b098fc7efc9274b9b4 +Subproject commit ab73c028e8dbe088d7545406efc5c5c7b8fd503a