From 02eadfed6a9404db48bdf9439c29921a02e41863 Mon Sep 17 00:00:00 2001 From: Steve Purcell Date: Wed, 14 Feb 2024 14:38:16 +0000 Subject: [PATCH] Actions workflow for updating data/compat-symbols --- .github/workflows/compat-syms.yml | 20 ++++++++++++++++++++ tools/compat-dump | 15 +++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/compat-syms.yml diff --git a/.github/workflows/compat-syms.yml b/.github/workflows/compat-syms.yml new file mode 100644 index 0000000..8aa2da6 --- /dev/null +++ b/.github/workflows/compat-syms.yml @@ -0,0 +1,20 @@ +name: Update compat symbols + +on: + pull_request: + push: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: purcell/setup-emacs@master + with: + version: 28.2 + - run: tools/compat-dump + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Regenerate compat symbols + file_pattern: data/compat-symbols diff --git a/tools/compat-dump b/tools/compat-dump index 058d3cf..a963545 100755 --- a/tools/compat-dump +++ b/tools/compat-dump @@ -1,8 +1,14 @@ #!/usr/bin/env -S emacs -Q --script -(unless (string-suffix-p "/package-lint/" default-directory) - (error "Not in the package-lint directory")) +(require 'cl-lib) +(cl-assert (string-suffix-p "/package-lint/" default-directory) + "Not in the package-lint directory") + +(package-install 'compat) +(cl-assert (package-installed-p 'compat (version-to-list "29.1"))) + (let (symbols functions) - (dolist (file (directory-files "../compat/" t "compat-[0-9]+\\.el$")) + (dolist (file (directory-files (file-name-directory (locate-library "compat")) + t "compat-[0-9]+\\.el$")) (with-temp-buffer (insert-file-contents file) (goto-char (point-min)) @@ -18,4 +24,5 @@ ((or "defun" "defmacro" "defalias") (push (intern (match-string 2)) functions)))))) (with-temp-buffer (insert (prin1-to-string (cons symbols functions))) - (write-region (point-min) (point-max) "data/compat-symbols" nil 'quiet))) + (write-region (point-min) (point-max) "data/compat-symbols")) + (message "Wrote %d symbols and %d functions" (length symbols) (length functions)))