Merge branch 'add-app-emacs-ement' into 'master'

app-emacs/ement: New package and its dependencies

See merge request src_prepare/src_prepare-overlay!215
This commit is contained in:
akater 2021-09-12 01:40:14 +00:00
commit 4bf8f63df4
21 changed files with 671 additions and 0 deletions

View File

@ -0,0 +1,30 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NEED_EMACS="24.1"
inherit elisp-common git-r3
DESCRIPTION="Convenient gensyms for defmacro (Emacs Lisp)"
HOMEPAGE="https://gitlab.com/akater/defmacro-gensym/-/blob/master/defmacro-gensym.org"
EGIT_REPO_URI="https://gitlab.com/akater/defmacro-gensym.git"
EGIT_BRANCH="master"
LICENSE="Unlicense"
SLOT="0"
KEYWORDS="~amd64"
DOCS="README.org"
export ORG_IMMUTABLE_SOURCES_DIRECTORY="${SITEETC}/${PN}"
pkg_postinst() {
elisp-site-regen
if declare -f readme.gentoo_print_elog >/dev/null; then
readme.gentoo_print_elog
fi
}
pkg_postrm() {
elisp-site-regen
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<longdescription>An extension of defmacro that provides more convenient
declaration/initialization of gensyms, covering both with-gensyms
and once-only functionality.
</longdescription>
<upstream>
<remote-id type="gitlab">akater/defmacro-gensym</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,41 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NEED_EMACS="24.1"
MY_PN="emacs-${PN}"
inherit elisp-common git-r3
DESCRIPTION="Extra features for Ement, Matrix client for GNU Emacs"
HOMEPAGE="https://gitlab.com/akater/emacs-ement-extras/-/blob/master/emacs-ement-extras.org"
EGIT_REPO_URI="https://gitlab.com/akater/${MY_PN}.git"
EGIT_BRANCH="release"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
DOCS="" # README.org is a relative symlink
BDEPEND="
app-emacs/defmacro-gensym
app-emacs/ement
app-emacs/plz
"
RDEPEND="
app-emacs/ement
"
export ORG_IMMUTABLE_SOURCES_DIRECTORY="${SITEETC}/${PN}"
pkg_postinst() {
elisp-site-regen
if declare -f readme.gentoo_print_elog >/dev/null; then
readme.gentoo_print_elog
fi
}
pkg_postrm() {
elisp-site-regen
}

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<longdescription>Additional features for Ement.el: - password search with auth-source - convenience functions to run pantalaimon daemon from within Emacs, including a single-command zero-config entry point to run ement via pantalaimon, and a config generator.
</longdescription>
<upstream>
<remote-id type="gitlab">akater/emacs-ement-extras</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,63 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NEED_EMACS="26.3"
inherit elisp git-r3
DESCRIPTION="Matrix client for GNU Emacs"
HOMEPAGE="https://github.com/alphapapa/ement.el"
EGIT_REPO_URI="https://github.com/alphapapa/ement.el.git"
EGIT_BRANCH="master"
EGIT_CLONE_TYPE="single"
KEYWORDS="~amd64"
LICENSE="GPL-3"
SLOT="0"
IUSE="e2e extras"
DOCS="README.org"
BDEPEND="
>=app-emacs/plz-0.1_pre
>=app-emacs/ts-0.2
e2e? ( net-im/pantalaimon )
"
# Pantalaimon's docs are needed at build time to annotate config
RDEPEND="
>=app-emacs/plz-0.1_pre
>=app-emacs/ts-0.2
e2e? ( net-im/pantalaimon )
extras? ( app-emacs/ement-extras )
"
SITEFILE="50${PN}-gentoo.el"
src_compile() {
elisp_src_compile
if use e2e ; then
einfo "Annotating suggested pantalaimon config..."
cp "${FILESDIR}"/pantalaimon.conf "${S}"
"${EMACS}" -Q -batch -l "${FILESDIR}/${PN}"-annotate-conf.el
fi
}
src_install() {
if use e2e ; then
einfo "Installing suggested pantalaimon config to /etc/${PN}"
insinto /etc/"${PN}"
doins pantalaimon.conf
DOCS+=" ${FILESDIR}/${PN}-gentoo-pantalaimon.org"
fi
elisp_src_install
}
pkg_postinst() {
if [ ! [ use e2e && use extras ] ] ; then
einfo "To start using Matrix from Emacs with E2EE without any manual configuration,"
einfo "USE=\"e2e extras\" emerge app-emacs/ement"
fi
}

View File

@ -0,0 +1,90 @@
;;; ement site-lisp configuration
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ement")
;;; begin: forms written by `autoload-generate-file-autoloads'
;;;### (autoloads nil "ement" "ement.el" (0 0 0 0))
;;; Generated autoloads from ement.el
(autoload 'ement-connect "ement" "\
Connect to Matrix with USER-ID and PASSWORD, or using SESSION.
Interactively, with prefix, ignore a saved session and log in
again; otherwise, use a saved session if `ement-save-session' is
enabled and a saved session is available, or prompt to log in if
not enabled or available.
If URI-PREFIX is specified, it should be the prefix of the
server's API URI, including protocol, hostname, and optionally
the port, e.g.
\"https://matrix-client.matrix.org\"
\"http://localhost:8080\"
\(fn &key USER-ID PASSWORD URI-PREFIX SESSION)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement" '("ement-")))
;;;***
;;;### (autoloads nil "ement-room-list" "ement-room-list.el" (0 0
;;;;;; 0 0))
;;; Generated autoloads from ement-room-list.el
(autoload 'ement-room-list "ement-room-list" "\
Show buffer listing joined rooms.
Calls `pop-to-buffer-same-window'. Interactively, with prefix,
call `pop-to-buffer'.
\(fn &rest IGNORE)" t nil)
(defalias 'ement-list-rooms 'ement-room-list)
(autoload 'ement-room-list-auto-update "ement-room-list" "\
Automatically update the room list buffer.
Does so when variable `ement-room-list-auto-update' is non-nil.
To be called in `ement-sync-callback-hook'.
\(fn SESSION)" nil nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement-room-list" '("ement-room-list-")))
;;;***
;;;### (autoloads nil "ement-room" "ement-room.el" (0 0 0 0))
;;; Generated autoloads from ement-room.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement-room" '("ement-")))
;;;***
;;;### (autoloads nil "ement-notify" "ement-notify.el" (0 0 0 0))
;;; Generated autoloads from ement-notify.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement-notify" '("ement-notify")))
;;;***
;;;### (autoloads nil "ement-api" "ement-api.el" (0 0 0 0))
;;; Generated autoloads from ement-api.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement-api" '("ement-api-error")))
;;;***
;;;### (autoloads nil "ement-macros" "ement-macros.el" (0 0 0 0))
;;; Generated autoloads from ement-macros.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "ement-macros" '("ement-")))
;;;***
;;; end: forms written by `autoload-generate-file-autoloads'

View File

@ -0,0 +1,106 @@
;; -*- lexical-binding: t -*-
(require 'rx)
(defvar ement--pantalaimon-conf-verbose (member "--verbose" command-line-args))
(defun ement--pantalaimon-conf-message (format-string &rest args)
(when ement--pantalaimon-conf-verbose
(apply #'message format-string args)))
(defmacro with-no-messages (&rest body)
(declare (indent 0))
`(progn
(advice-add 'message :around #'ignore)
(unwind-protect (progn ,@body)
(advice-remove 'message #'ignore))))
(defun ement--pantalaimon-latest-doc-dir ()
(car
(last
(directory-files "/usr/share/doc/" t (rx string-start "pantalaimon")))))
(defun ement--pantalaimon-annotate (pantalaimon-conf-file)
(let ((count 0)
(pantalaimon-options-help
(ignore-errors
(with-no-messages
(find-file-noselect
(nth 0 (directory-files (ement--pantalaimon-latest-doc-dir)
t (rx string-start "pantalaimon.5.md")
t)))))))
(if (not pantalaimon-options-help) (message "Can't find pantalaimon doc file to annotate pantalaimon config")
(ement--pantalaimon-conf-message
"Annotating file %s..." pantalaimon-conf-file)
(let ((annotations (get-buffer-create " *annotations*")))
(with-current-buffer annotations (buffer-disable-undo))
;; annotations need to be reformatted in their own buffer
;; because md syntax is different from conf syntax
(defun ement--pantalaimon-conf-insert-annotation (key &optional buffer)
(setq buffer (or buffer (current-buffer)))
(with-current-buffer pantalaimon-options-help
(save-excursion
(goto-char (point-min))
(if (not (re-search-forward (rx line-start "**" (literal key) "**"
line-end)
nil t))
(progn
(ement--pantalaimon-conf-message
"Can't find annotation for key %s" key)
nil)
(re-search-forward (rx (zero-or-more whitespace)) nil t)
(if (not (looking-at-p (rx ?\>)))
(progn (ement--pantalaimon-conf-message
"Unexpected annotation format for key %s" key)
nil)
(let ((start (point))
(end (re-search-forward
(rx line-start
(zero-or-more whitespace) line-end)
nil t)))
(with-current-buffer annotations
(erase-buffer)
(insert-buffer-substring-no-properties
pantalaimon-options-help start end)
(goto-char (point-min))
(while (re-search-forward (rx line-start ?\>) nil t)
(delete-backward-char 1)
(insert ?\#))))
(with-current-buffer buffer
(insert-buffer-substring-no-properties annotations))
t)))))
(with-current-buffer (find-file-noselect pantalaimon-conf-file)
(goto-char (point-min))
(let ((maybe-fail-ungracefully
(let ((count 0))
(lambda ()
(when (>= (setq count (1+ count)) 10000)
(error "Annotating config failed ungracefully"))))))
(while (not (= (point-max) (point)))
;; These loops are not very safe
;; todo: maybe rewrite with save-restriction
(funcall maybe-fail-ungracefully)
(when (looking-at (rx line-start
(group (one-or-more alphabetic))
(zero-or-one ?\s) ?\=))
(let ((key (match-string-no-properties 1)))
(when ement--pantalaimon-conf-verbose
"Annotating option %s..." key)
(beginning-of-line)
(open-line 1)
(when (ement--pantalaimon-conf-insert-annotation key)
(ement--pantalaimon-conf-message "Done")))
(while (looking-at-p (rx (or whitespace line-end)))
(funcall maybe-fail-ungracefully)
(delete-char 1)))
(next-logical-line)
(while (looking-at-p (rx line-start ?\#))
(funcall maybe-fail-ungracefully)
(next-logical-line))
(open-line 1)
(next-logical-line)))
(save-buffer))
(kill-buffer annotations)))))
(ement--pantalaimon-annotate (expand-file-name "pantalaimon.conf"
(getenv "S")))

View File

@ -0,0 +1,21 @@
#+title: Quick start with E2E encryption in Ement.el
* User config
You may
#+begin_src sh
ln -s /etc/ement/pantalaimon.conf ~/.config/pantalaimon/pantalaimon.conf
#+end_src
or do something equivalent. See [[/etc/ement/pantalaimon.conf][the config]], it's annotated.
* Starting the server
Start the server with e.g.
#+begin_src sh
pantalaimon --config ~/.config/pantalaimon/pantalaimon.conf
#+end_src
* Starting Ement with Pantalaimon
Follow [[file:README.org.bz2::*Encrypted room support through Pantalaimon][Ement's instructions]].

View File

@ -0,0 +1,21 @@
# This is an example config that should work with ement.el out of the box
# You may symlink ~/.config/pantalaimon/pantalaimon.conf to this file
[Default]
LogLevel=Debug
SSL=True
Notifications=Off
DebugEncryption=True
[local-matrix]
Homeserver=https://matrix.org
ListenAddress=127.0.0.1
ListenPort=8009
IgnoreVerification=False
UseKeyring=False
# UseKeyring=True does not work for me on pantalaimon restarts
# UseKeyring=No not tested
# UseKeyring=Yes not tested
DropOldKeys=False
# DropOldKeys=No not tested
# DropOldKeys=Yes not tested

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<longdescription>Ement.el is a Matrix client for GNU Emacs. Currently in development but already useful.
</longdescription>
<upstream>
<remote-id type="github">alphapapa/ement.el</remote-id>
</upstream>
<use>
<flag name="e2e">Enable end to end encryption support via pantalaimon</flag>
<flag name="extras">Install extra features (auth-source and proxy support)</flag>
</use>
</pkgmetadata>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<upstream>
<remote-id type="github">alphapapa/plz.el</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,25 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NEED_EMACS="26.3"
inherit elisp git-r3
DESCRIPTION="An HTTP library that uses curl as a backend"
HOMEPAGE="https://github.com/alphapapa/plz.el"
EGIT_REPO_URI="https://github.com/alphapapa/plz.el.git"
EGIT_BRANCH="master"
EGIT_CLONE_TYPE="single"
KEYWORDS="~amd64"
LICENSE="GPL-3"
SLOT="0"
RDEPEND="net-misc/curl"
src_test() {
emake test
}

11
app-emacs/ts/metadata.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<upstream>
<remote-id type="github">alphapapa/ts.el</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,29 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NEED_EMACS="26.1"
inherit elisp git-r3
DESCRIPTION="Timestamp and date/time library"
HOMEPAGE="https://github.com/alphapapa/ts.el"
EGIT_REPO_URI="https://github.com/alphapapa/ts.el.git"
EGIT_BRANCH="master"
EGIT_CLONE_TYPE="single"
KEYWORDS="~amd64"
LICENSE="GPL-3"
SLOT="0"
BDEPEND="
>=app-emacs/dash-2.14.1
>=app-emacs/s-1.12.0
"
RDEPEND="${BDEPEND}"
src_test() {
emake test
}

View File

@ -0,0 +1 @@
DIST janus-0.5.0.tar.gz 18006 BLAKE2B 9e22d63cdf5b388f22d2d9f021d289560db127f71b3f4d338affc204379ef633ad88c4cb87abb697b6fcbc839f2e0b2249b0ee4895262bf26e75f23ac4c12471 SHA512 9b220347ad29c1bf613a3db9468c41c0c5216d245a320ccaeb97f784d6a6e9ae631ccac951b18d15e706debd512e25de8c079e79a5c68d195b97cadbeba971a2

View File

@ -0,0 +1,34 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# credit goes to ebuild repository gentoo-zh
EAPI=7
PYTHON_COMPAT=( python3_{8,9} pypy3 )
inherit distutils-r1
DESCRIPTION="Implementation of the asyncio (PEP 3156) event-loop with Qt"
HOMEPAGE="https://github.com/aio-libs/janus"
MY_P="${P/_alpha/a}"
SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${MY_P}.tar.gz"
IUSE="test"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64"
DEPEND="
dev-python/setuptools[${PYTHON_USEDEP}]
test? (
dev-python/pytest[${PYTHON_USEDEP}]
)
"
python_test() {
py.test -v || die "Tests fail with ${EPYTHON}"
}
python_install_all() {
distutils-r1_python_install_all
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>parona@protonmail.com</email>
<name>Alfred Wingate</name>
</maintainer>
<upstream>
<remote-id type="github">aio-libs/janus</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1 @@
DIST pantalaimon-0.10.2.tar.gz 2494924 BLAKE2B fecb33571c159d71d62477f662bf146651f496f6d28aa13a197e9b2076acc4ec2b9c89586c6bbc8fee586cd31b74086fb8dd14bf417853b35c4d3941a01f2d40 SHA512 27d887959a74469967174140f1a511a152ebe2813186cd3e8136fcc91d0726a4c0fdf46427d5bcee8401567ff88468143139b0bdc1f27a389b6fb85cf28b317b

View File

@ -0,0 +1,33 @@
Do not install panctl
---
MANIFEST.in | 1 -
setup.py | 3 +--
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index 86e8433..ee8bc73 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,3 @@
include contrib/pantalaimon.service
include doc/man/pantalaimon.8
include doc/man/pantalaimon.5
-include doc/man/panctl.1
diff --git a/setup.py b/setup.py
index b13317a..e06de1a 100644
--- a/setup.py
+++ b/setup.py
@@ -40,8 +40,7 @@ setup(
]
},
entry_points={
- "console_scripts": ["pantalaimon=pantalaimon.main:main",
- "panctl=pantalaimon.panctl:main"],
+ "console_scripts": ["pantalaimon=pantalaimon.main:main"],
},
zip_safe=False
)
--
2.31.1

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>nuclearspace@gmail.com</email>
<name>Dima Akater</name>
</maintainer>
<longdescription>Pantalaimon is an end-to-end encryption aware Matrix reverse proxy daemon that handles the encryption. Messages are transparently encrypted and decrypted for clients inside of pantalaimon.
</longdescription>
<use>
<flag name="dbus">Support additional features that require dbus</flag>
<flag name="panctl">Install a CLI utility to control pantalaimon</flag>
<flag name="systemd">Install systemd .service script</flag>
</use>
<upstream>
<remote-id type="github">matrix-org/pantalaimon</remote-id>
</upstream>
</pkgmetadata>

View File

@ -0,0 +1,80 @@
# Copyright 2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_9 )
inherit distutils-r1
DESCRIPTION="A Matrix proxy daemon that adds E2E encryption capabilities"
HOMEPAGE="https://github.com/matrix-org/pantalaimon"
SRC_URI="https://github.com/matrix-org/pantalaimon/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"
IUSE="dbus panctl systemd"
RESTRICT="mirror"
DOCS=( "README.md" "docs/man/pantalaimon.5.md" "docs/man/pantalaimon.8.md" )
REQUIRED_USE="panctl? ( dbus )"
BDEPEND=""
RDEPEND="
>=dev-python/attrs-19.3.0
>=dev-python/aiohttp-3.6
>=dev-python/appdirs-1.4.4
>=dev-python/click-7.1.2
>=dev-python/keyring-21.2.1
>=dev-python/logbook-1.5.3
>=dev-python/peewee-3.13.1
>=dev-python/cachetools-3.0.0
>dev-python/prompt_toolkit-2
>=dev-python/janus-0.5
>=dev-python/matrix-nio-0.18[e2e]
dbus? (
>=dev-python/dbus-python-1.2
>=dev-python/pygobject-3.36
>=dev-python/pydbus-0.6
>=dev-python/notify2-0.3
)
"
src_prepare() {
# I don't think we should install something a priori non-functioning
if ! use panctl ; then
rm docs/man/panctl.1
rm docs/man/panctl.md
rm pantalaimon/panctl.py
eapply "${FILESDIR}/${PN}"-0.10.2-no-panctl.patch
fi
default
}
# todo: Why exactly is compilation disabled by upstream?
src_install() {
# Remove some warnings
ln -s docs doc
# This should probably be addressed by upstream
distutils-r1_src_install
doman docs/man/pantalaimon.{5,8}
if use panctl ; then
doman docs/man/panctl.1
dodoc docs/man/panctl.md
fi
# issue: contrib config could be much better
sed -i -e 's/^/# /' contrib/pantalaimon.conf
insinto /etc
doins contrib/pantalaimon.conf
if use systemd; then
insinto /usr/lib/systemd/user
doins contrib/pantalaimon.service
fi
}