guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: gnu: emacs-company-box: Remove unclearly licensed icons from sour


From: guix-commits
Subject: 02/05: gnu: emacs-company-box: Remove unclearly licensed icons from source.
Date: Sun, 22 Jan 2023 04:07:01 -0500 (EST)

lilyp pushed a commit to branch master
in repository guix.

commit ebea3815e66b21c66a11ce23e5f406047a3ecd4a
Author: Liliana Marie Prikler <liliana.prikler@gmail.com>
AuthorDate: Sun Mar 20 14:29:36 2022 +0100

    gnu: emacs-company-box: Remove unclearly licensed icons from source.
    
    emacs-company-box bundles icons with unclear licenses.
    Confer <https://github.com/emacs-lsp/lsp-treemacs/issues/123>.
    
    * gnu/packages/emacs-xyz.scm (%emacs-company-box-upstream-source): New 
variable.
    (emacs-company-box)[source]: Use a computed origin to remove unclearly 
licensed
    icons.  Also remove source code which mentions said icons.
---
 gnu/packages/emacs-xyz.scm | 84 ++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 77 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 3c3371d755..41a0ccf09e 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7846,6 +7846,15 @@ front-ends.  Company comes with many back-ends, e.g., 
@code{company-elisp}.
 These are distributed in separate files and can be used individually.")
     (license license:gpl3+)))
 
+(define* (%emacs-company-box-upstream-source #:key commit version hash)
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+          (url "https://github.com/sebastiencs/company-box";)
+          (commit commit)))
+    (file-name (git-file-name "emacs-company-box" version))
+    (hash hash)))
+
 (define-public emacs-company-box
   ;; There is no release yet.  Version is extracted from the main
   ;; file.
@@ -7857,13 +7866,74 @@ These are distributed in separate files and can be used 
individually.")
       (version (git-version version revision commit))
       (source
        (origin
-         (method git-fetch)
-         (uri (git-reference
-               (url "https://github.com/sebastiencs/company-box";)
-               (commit commit)))
-         (file-name (git-file-name name version))
-         (sha256
-          (base32 "13fgmdy51gqdwijqfvb784pirx4lgva0y7ysi0c3fcx8f82cdj59"))))
+         (method (@@ (guix packages) computed-origin-method))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (sha256 #f)
+         (uri
+          (delay
+            (with-imported-modules '((guix build emacs-utils)
+                                     (guix build utils))
+              #~(begin
+                  (use-modules (guix build utils)
+                               (guix build emacs-utils))
+                  (let* ((dir (string-append "emacs-company-box-" #$version)))
+
+                    (set-path-environment-variable
+                     "PATH" '("bin")
+                     (list #+emacs-minimal
+                           #+(canonical-package bash)
+                           #+(canonical-package coreutils)
+                           #+(canonical-package gzip)
+                           #+(canonical-package tar)))
+
+                    ;; Copy the upstream source
+                    (copy-recursively
+                     #+(%emacs-lsp-treemacs-upstream-source
+                        #:commit commit #:version version
+                        #:hash
+                        (content-hash
+                         
"13fgmdy51gqdwijqfvb784pirx4lgva0y7ysi0c3fcx8f82cdj59"))
+                     dir)
+
+                    (with-directory-excursion dir
+                      ;; The icons are unclearly licensed and possibly 
non-free,
+                      ;; see 
<https://github.com/emacs-lsp/lsp-treemacs/issues/123>
+                      (with-directory-excursion "images"
+                        (for-each delete-file-recursively
+                                  '("eclipse" "idea" "netbeans")))
+
+                      ;; Also remove any mentions in the source code.
+                      (make-file-writable "company-box-icons.el")
+                      (emacs-batch-edit-file "company-box-icons.el"
+                        '(progn
+                          (while (search-forward-regexp
+                                  "(defvar company-box-icons-\\([a-z-]*\\)"
+                                  nil t)
+                            (pcase (match-string 1)
+                                   ((or "images"
+                                        "all-the-icons"
+                                        "icons-in-terminal") nil)
+                                   (_ (beginning-of-line)
+                                      (kill-sexp)))
+                            (basic-save-buffer))))
+
+                      ;; Also patch source to not show broken icons as 
configuration
+                      ;; option.
+                      (substitute* "company-box-icons.el"
+                        (("- .*, from.*editor.*") "")
+                        (("\\(const :tag \"([a-z]*)\".*\\)" all tag)
+                         (if (member tag
+                                     '("images" "all-the-icons" 
"icons-in-terminal"))
+                             all
+                             ""))))
+
+                    (invoke "tar" "cvfa" #$output
+                            "--mtime=@0"
+                            "--owner=root:0"
+                            "--group=root:0"
+                            "--sort=name"
+                            "--hard-dereference"
+                            dir))))))))
       (build-system emacs-build-system)
       (propagated-inputs
        (list emacs-company emacs-dash emacs-frame-local))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]