[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android 85a9757b3c5: Merge remote-tracking branch 'origin/master
From: |
Po Lu |
Subject: |
feature/android 85a9757b3c5: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Sun, 23 Apr 2023 20:51:48 -0400 (EDT) |
branch: feature/android
commit 85a9757b3c5a16870e4609274ebdf2450564dc27
Merge: 0a113a32c43 65735cee71c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
build-aux/git-hooks/commit-msg-files.awk | 33 +++++++++----
build-aux/git-hooks/pre-push | 27 +++++-----
doc/misc/tramp.texi | 10 ++++
etc/NEWS | 27 +++++-----
lisp/net/tramp-adb.el | 1 +
lisp/net/tramp-container.el | 85 ++++++++++++++++++++++++++++++--
6 files changed, 145 insertions(+), 38 deletions(-)
diff --git a/build-aux/git-hooks/commit-msg-files.awk
b/build-aux/git-hooks/commit-msg-files.awk
index 3856e474d3e..5c9b70a5de5 100644
--- a/build-aux/git-hooks/commit-msg-files.awk
+++ b/build-aux/git-hooks/commit-msg-files.awk
@@ -33,7 +33,7 @@
function get_commit_changes(commit_sha, changes, cmd, i, j, len, \
bits, filename) {
# Collect all the files touched in the specified commit.
- cmd = ("git log -1 --name-status --format= " commit_sha)
+ cmd = ("git show --name-status --first-parent --format= " commit_sha)
while ((cmd | getline) > 0) {
for (i = 2; i <= NF; i++) {
len = split($i, bits, "/")
@@ -59,15 +59,28 @@ function check_commit_msg_files(commit_sha, verbose,
changes, good, \
if (verbose && ! msg)
msg = $0
- # Find lines that reference files. We look at any line starting
- # with "*" (possibly prefixed by "; ") where the file part starts
- # with an alphanumeric character. The file part ends if we
- # encounter any of the following characters: [ ( < { :
- if (/^(; )?\*[ \t]+[[:alnum:]]/ && match($0, /[[:alnum:]][^[(<{:]*/)) {
- # There might be multiple files listed on this line, separated
+ # Find file entries in the commit message. We look at any line
+ # starting with "*" (possibly prefixed by "; ") followed by a ":",
+ # possibly on a different line. If we encounter a blank line
+ # without seeing a ":", then we don't treat that as a file entry.
+
+ # Accumulate the contents of a (possible) file entry.
+ if (/^[ \t]*$/)
+ filenames_str = ""
+ else if (/^(; )?\*[ \t]+[[:alnum:]]/)
+ filenames_str = $0
+ else if (filenames_str)
+ filenames_str = (filenames_str $0)
+
+ # We have a file entry; analyze it.
+ if (filenames_str && /:/) {
+ # Delete the leading "*" and any trailing information.
+ sub(/^(; )?\*[ \t]+/, "", filenames_str)
+ sub(/[ \t]*[[(<:].*$/, "", filenames_str)
+
+ # There might be multiple files listed in this entry, separated
# by spaces (and possibly a comma). Iterate over each of them.
- split(substr($0, RSTART, RLENGTH), filenames, ",?([[:blank:]]+|$)")
-
+ split(filenames_str, filenames, ",[ \t]+")
for (i in filenames) {
# Remove trailing slashes from any directory entries.
sub(/\/$/, "", filenames[i])
@@ -83,6 +96,8 @@ function check_commit_msg_files(commit_sha, verbose,
changes, good, \
good = 0
}
}
+
+ filenames_str = ""
}
}
close(cmd)
diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push
index adcf27d4a5d..8e8277cba4f 100755
--- a/build-aux/git-hooks/pre-push
+++ b/build-aux/git-hooks/pre-push
@@ -39,29 +39,32 @@ else
fi
# Standard input receives lines of the form:
-# <local ref> SP <local name> SP <remote ref> SP <remote name> LF
+# <local ref> SP <local sha> SP <remote ref> SP <remote sha> LF
$awk -v origin_name="$1" '
# If the local SHA is all zeroes, ignore it.
$2 ~ /^0{40}$/ {
next
}
- $2 ~ /^[a-z0-9]{40}$/ {
+ # Check any lines with a valid local SHA and whose remote ref is
+ # master or an emacs-NN release branch. (We want to avoid checking
+ # feature or scratch branches here.)
+ $2 ~ /^[a-z0-9]{40}$/ && $3 ~ /^refs\/heads\/(master|emacs-[0-9]+)$/ {
newref = $2
# If the remote SHA is all zeroes, this is a new object to be
- # pushed (likely a branch). Go backwards until we find a SHA on
- # an origin branch.
+ # pushed (likely a branch)...
if ($4 ~ /^0{40}$/) {
back = 0
- cmd = ("git branch -r -l '\''" origin_name "/*'\'' --contains " \
- newref "~" back)
- while ((cmd | getline) == 0) {
-
- # Only look back at most 1000 commits, just in case...
- if (back++ > 1000)
+ # ... Go backwards until we find a SHA on an origin branch.
+ # Stop trying after 1000 commits, just in case...
+ for (back = 0; back < 1000; back++) {
+ cmd = ("git branch -r -l '\''" origin_name "/*'\''" \
+ " --contains " newref "~" back)
+ rv = (cmd | getline)
+ close(cmd)
+ if (rv > 0)
break;
}
- close(cmd)
cmd = ("git rev-parse " newref "~" back)
cmd | getline oldref
@@ -78,6 +81,6 @@ $awk -v origin_name="$1" '
}
# Print every SHA after oldref, up to (and including) newref.
- system("git rev-list --reverse " oldref ".." newref)
+ system("git rev-list --first-parent --reverse " oldref ".." newref)
}
' | $awk -v reason=pre-push -f .git/hooks/commit-msg-files.awk
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 65892f8621e..247d718b59a 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -938,6 +938,16 @@ be used.
This method does not support user names.
+@item @option{flatpak}
+@cindex method @option{flatpak}
+@cindex @option{flatpak} method
+
+Integration of Flatpak sandboxes. The host name may be either an
+application ID, a sandbox instance ID, or a PID, as returned by
+@samp{flatpak ps}.
+
+This method does not support user names.
+
@end table
diff --git a/etc/NEWS b/etc/NEWS
index 79e45536fb5..db73a5f138c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -79,9 +79,10 @@ This is used for displaying the time and date components of
'display-time-mode'.
---
-** New icon images for general use
-Several symbolic icons are added to etc/images/symbols, including
+** New icon images for general use.
+Several symbolic icons are added to "etc/images/symbols", including
plus, minus, check-mark, start, etc.
+
* Editing Changes in Emacs 30.1
@@ -122,7 +123,7 @@ If you want to get back the old behavior, set the user
option to the value
(setopt gdb-locals-table-row-config
`((type . 0) (name . 0) (value . ,gdb-locals-value-limit)))
-** Compile
+** Grep
*** New user option 'grep-use-headings'.
When non-nil, the output of Grep is split into sections, one for each
@@ -221,16 +222,18 @@ point is not in a comment or a string. It is by default
bound to
** Tramp
+++
-*** New connection method "toolbox".
-This allows accessing system containers provided by Toolbox.
+*** New connection methods "toolbox" and "flatpak".
+They allow accessing system containers provided by Toolbox or
+sandboxes provided by Flatpak.
+++
-*** Rename 'tramp-use-ssh-controlmaster-options' to
'tramp-use-connection-share.
-The old name still exists as defvaralias. This user option controls
-now connection sharing for both ssh-based and plink-based methods. It
-allows the values t, nil, and 'suppress'. The latter suppresses
-also "ControlMaster" settings in the user's "~/.ssh/config" file,
-or connection share configuration in PuTTY sessions, respectively.
+*** Rename 'tramp-use-ssh-controlmaster-options' to
'tramp-use-connection-share'.
+The old name still exists as obsolete variable alias. This user
+option controls now connection sharing for both ssh-based and
+plink-based methods. It allows the values t, nil, and 'suppress'.
+The latter suppresses also "ControlMaster" settings in the user's
+"~/.ssh/config" file, or connection share configuration in PuTTY
+sessions, respectively.
** EWW
@@ -298,7 +301,7 @@ distracting and easily confused with actual code, or a
significant
early aid that relieves you from moving the buffer or reaching for the
mouse to consult an error message.
-** Python mode
+** Python Mode
---
*** New user option 'python-indent-block-paren-deeper'.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 14c63ba5834..3f3fb1ea6b3 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1311,6 +1311,7 @@ connection if a previous connection has died for some
reason."
(tramp-set-connection-property p "connected" t)))))))
;;; Default connection-local variables for Tramp.
+
(defconst tramp-adb-connection-local-default-shell-variables
'((shell-file-name . "/system/bin/sh")
(shell-command-switch . "-c"))
diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el
index 5ae9ebaefb2..473cb1c54b8 100644
--- a/lisp/net/tramp-container.el
+++ b/lisp/net/tramp-container.el
@@ -47,9 +47,9 @@
;; C-x C-f /kubernetes:POD:/path/to/file
;;
;; Where:
-;; POD is the pod to connect to.
-;; By default, the first container in that pod will be
-;; used.
+;; POD is the pod to connect to.
+;; By default, the first container in that pod will be
+;; used.
;;
;; Completion for POD and accessing it operate in the current
;; namespace, use this command to change it:
@@ -58,7 +58,7 @@
;;
;;
;;
-;; Open a file on an existing toolbox container via Toolbox:
+;; Open a file on an existing Toolbox container:
;;
;; C-x C-f /toolbox:CONTAINER:/path/to/file
;;
@@ -67,6 +67,16 @@
;;
;; If the container is not running, it is started. If no container is
;; specified, the default Toolbox container is used.
+;;
+;;
+;;
+;; Open a file on a running Flatpak sandbox:
+;;
+;; C-x C-f /flatpak:SANDBOX:/path/to/file
+;;
+;; Where:
+;; SANDBOX is the running sandbox to connect to.
+;; It could be an application ID, an instance ID, or a PID.
;;; Code:
@@ -104,6 +114,14 @@
:type '(choice (const "toolbox")
(string)))
+;;;###tramp-autoload
+(defcustom tramp-flatpak-program "flatpak"
+ "Name of the Flatpak client program."
+ :group 'tramp
+ :version "30.1"
+ :type '(choice (const "flatpak")
+ (string)))
+
;;;###tramp-autoload
(defconst tramp-docker-method "docker"
"Tramp method name to use to connect to Docker containers.")
@@ -120,6 +138,10 @@
(defconst tramp-toolbox-method "toolbox"
"Tramp method name to use to connect to Toolbox containers.")
+;;;###tramp-autoload
+(defconst tramp-flatpak-method "flatpak"
+ "Tramp method name to use to connect to Flatpak sandboxes.")
+
;;;###tramp-autoload
(defun tramp-container--completion-function (program)
"List running containers available for connection.
@@ -195,6 +217,30 @@ see its function help for a description of the format."
lines)))
(mapcar (lambda (name) (list nil name)) (delq nil names))))
+;;;###tramp-autoload
+(defun tramp-flatpak--completion-function (&rest _args)
+ "List Flatpak sandboxes available for connection.
+It returns application IDs or, in case there is no application
+ID, instance IDs.
+
+This function is used by `tramp-set-completion-function', please
+see its function help for a description of the format."
+ (when-let ((default-directory tramp-compat-temporary-file-directory)
+ (raw-list
+ (shell-command-to-string
+ (concat tramp-flatpak-program
+ " ps --columns=instance,application")))
+ (lines (split-string raw-list "\n" 'omit))
+ (names (mapcar
+ (lambda (line)
+ (when (string-match
+ (rx bol (* space) (group (+ (not space)))
+ (? (+ space) (group (+ (not space)))) eol)
+ line)
+ (or (match-string 2 line) (match-string 1 line))))
+ lines)))
+ (mapcar (lambda (name) (list nil name)) (delq nil names))))
+
;;;###tramp-autoload
(defvar tramp-default-remote-shell) ;; Silence byte compiler.
@@ -253,6 +299,17 @@ see its function help for a description of the format."
(add-to-list 'tramp-default-host-alist `(,tramp-toolbox-method nil ""))
+ (add-to-list 'tramp-methods
+ `(,tramp-flatpak-method
+ (tramp-login-program ,tramp-flatpak-program)
+ (tramp-login-args (("enter")
+ ("%h")
+ ("%l")))
+ (tramp-direct-async (,tramp-default-remote-shell "-c"))
+ (tramp-remote-shell ,tramp-default-remote-shell)
+ (tramp-remote-shell-login ("-l"))
+ (tramp-remote-shell-args ("-c"))))
+
(tramp-set-completion-function
tramp-docker-method
`((tramp-container--completion-function
@@ -269,7 +326,25 @@ see its function help for a description of the format."
(tramp-set-completion-function
tramp-toolbox-method
- '((tramp-toolbox--completion-function ""))))
+ '((tramp-toolbox--completion-function "")))
+
+ (tramp-set-completion-function
+ tramp-flatpak-method
+ '((tramp-flatpak--completion-function "")))
+
+ ;; Default connection-local variables for Tramp.
+
+ (defconst tramp-container-connection-local-default-flatpak-variables
+ `((tramp-remote-path . ,(cons "/app/bin" tramp-remote-path)))
+ "Default connection-local variables for remote flatpak connections.")
+
+ (connection-local-set-profile-variables
+ 'tramp-container-connection-local-default-flatpak-profile
+ tramp-container-connection-local-default-flatpak-variables)
+
+ (connection-local-set-profiles
+ `(:application tramp :protocol ,tramp-flatpak-method)
+ 'tramp-container-connection-local-default-flatpak-profile))
(add-hook 'tramp-unload-hook
(lambda ()