2 Commity 2b642da3b9 ... 49485fee0a

Autor SHA1 Správa Dátum
  cel7t 49485fee0a Parameterized Guix 1 rok pred
  cel7t 2b642da3b9 Patched with Parameters 1 rok pred
7 zmenil súbory, kde vykonal 228 pridanie a 66 odobranie
  1. 2 1
      Makefile.am
  2. 33 28
      gnu/packages/emacs.scm
  3. 1 6
      guix/parameters.scm
  4. 1 1
      guix/transformations.scm
  5. 1 1
      guix/ui.scm
  6. 37 29
      parameterization.patch
  7. 153 0
      test-packages.scm

+ 2 - 1
Makefile.am

@@ -17,6 +17,7 @@
 # Copyright © 2020, 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 # Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
 # Copyright © 2021 Andrew Tropin <andrew@trop.in>
+# Copyright © 2023 Sarthak Shah <shahsarthakw@gmail.com>
 #
 # This file is part of GNU Guix.
 #
@@ -114,6 +115,7 @@ MODULES =					\
   guix/repl.scm					\
   guix/rpm.scm					\
   guix/transformations.scm			\
+  guix/parameters.scm				\
   guix/inferior.scm				\
   guix/describe.scm				\
   guix/quirks.scm				\
@@ -306,7 +308,6 @@ MODULES =					\
   guix/scripts/archive.scm			\
   guix/scripts/import.scm			\
   guix/scripts/package.scm			\
-  guix/parameters.scm                           \
   guix/scripts/locate.scm			\
   guix/scripts/install.scm			\
   guix/scripts/remove.scm			\

+ 33 - 28
gnu/packages/emacs.scm

@@ -80,6 +80,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages tree-sitter)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages web)       ; for jansson
   #:use-module (gnu packages webkit)
   #:use-module (gnu packages xml)
@@ -707,6 +708,9 @@ display and edit the text.
 This package contains the library runtime.")
     (license license:lgpl2.1+)))
 
+(define-global-parameter
+  (package-parameter
+   (name 'x11)))
 
 (define-public emacs-p
   (package-with-parameters
@@ -717,32 +721,33 @@ This package contains the library runtime.")
           (name 'next)
           (variants
            (parameter-variant-match
-            (_ #:lambda (lambda (pkg)
-                          (package
-                           (inherit pkg)
-                           (version "29.0.92")
-                           (source
-                            (origin
-                             (inherit (package-source pkg))
-                             (method git-fetch)
-                             (uri (git-reference
-                                   (url "https://git.savannah.gnu.org/git/emacs.git/")
-                                   (commit (string-append "emacs-" version))))
-                             (file-name (git-file-name (package-name pkg) version))
-                             (patches
-                              (parameter-if #:package pkg (pgtk)
-                                            (search-patches
-                                             "emacs-exec-path.patch"
-                                             "emacs-fix-scheme-indent-function.patch"
-                                             "emacs-native-comp-driver-options.patch"
-                                             "emacs-pgtk-super-key-fix.patch")
-                                            (search-patches
-                                             "emacs-exec-path.patch"
-                                             "emacs-fix-scheme-indent-function.patch"
-                                             "emacs-native-comp-driver-options.patch")))
-                             (sha256
-                              (base32
-                               "1h3p325859svcy43iv7wr27dp68049j9d44jq5akcynqdkxz4jjn"))))))))))
+            (_ #:lambda
+               (lambda (pkg)
+                 (package
+                  (inherit pkg)
+                  (version "29.0.92")
+                  (source
+                   (origin
+                    (inherit (package-source pkg))
+                    (method git-fetch)
+                    (uri (git-reference
+                          (url "https://git.savannah.gnu.org/git/emacs.git/")
+                          (commit (string-append "emacs-" version))))
+                    (file-name (git-file-name (package-name pkg) version))
+                    (patches
+                     (parameter-if #:package pkg (pgtk)
+                                   (search-patches
+                                    "emacs-exec-path.patch"
+                                    "emacs-fix-scheme-indent-function.patch"
+                                    "emacs-native-comp-driver-options.patch"
+                                    "emacs-pgtk-super-key-fix.patch")
+                                   (search-patches
+                                    "emacs-exec-path.patch"
+                                    "emacs-fix-scheme-indent-function.patch"
+                                    "emacs-native-comp-driver-options.patch")))
+                    (sha256
+                     (base32
+                      "1h3p325859svcy43iv7wr27dp68049j9d44jq5akcynqdkxz4jjn"))))))))))
          (package-parameter (name 'tree-sitter)
                             (dependencies '(tree-sitter)))
          (package-parameter
@@ -796,5 +801,5 @@ This package contains the library runtime.")
                              (((x11 #:off))
                               (delete "libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
                                       "imagemagick" "libpng" "librsvg" "libxpm" "libice" "libsm"
-                                      "cairo" "pango" "harfbuzz" "libotf" "m17n-lib" "dbus"))))
-   ))
+                                      "cairo" "pango" "harfbuzz" "libotf" "m17n-lib" "dbus"))))))
+

+ 1 - 6
guix/parameters.scm

@@ -23,7 +23,6 @@
   #:use-module (guix packages)
   #:use-module (guix profiles)
   #:use-module (guix records)
-  #:use-module (guix transformations)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-13)
   #:use-module (srfi srfi-26)
@@ -32,6 +31,7 @@
   #:use-module (ice-9 hash-table)
   #:use-module (ice-9 match)
   #:use-module (ice-9 receive)
+  #:autoload (guix transformations) (options->transformation)
   #:export (parameter-type
             package-parameter
             parameter-spec
@@ -1178,8 +1178,3 @@
      (#:off #:transform (without-tests #:package-name))))
    (description "Toggle for tests")
    (predicate #t)))
-
-(define-global-parameter
-  (package-parameter
-   (name 'x11)
-   (description "Togggle for X11 support")))

+ 1 - 1
guix/transformations.scm

@@ -24,7 +24,6 @@
   #:use-module (guix i18n)
   #:use-module (guix store)
   #:use-module (guix packages)
-  #:use-module (guix parameters)
   #:use-module (guix build-system)
   #:use-module (guix profiles)
   #:use-module (guix diagnostics)
@@ -37,6 +36,7 @@
   #:autoload   (guix cpu) (current-cpu
                            cpu->gcc-architecture
                            gcc-architecture->micro-architecture-level)
+  #:autoload (guix parameters) (package-parameter-alist parameterize-package)
   #:use-module (guix utils)
   #:use-module (guix memoization)
   #:use-module (guix gexp)

+ 1 - 1
guix/ui.scm

@@ -46,7 +46,6 @@
   #:use-module (guix store)
   #:use-module (guix config)
   #:use-module (guix packages)
-  #:use-module (guix parameters)
   #:use-module (guix profiles)
   #:use-module (guix derivations)
   #:use-module (guix build-system)
@@ -78,6 +77,7 @@
   #:use-module (ice-9 format)
   #:use-module (ice-9 regex)
   #:autoload   (ice-9 popen) (open-pipe* close-pipe)
+  #:autoload   (guix parameters) (all-spec-parameters-with-types package-parameter-spec)
   #:autoload   (system repl repl)  (start-repl)
   #:autoload   (system repl debug) (make-debug stack->vector)
   #:use-module (texinfo)

+ 37 - 29
parameterization.patch

@@ -1,18 +1,26 @@
 diff --git a/Makefile.am b/Makefile.am
-index 8924974e8a..c60aac6a71 100644
+index 8924974e8a..a9cb615b3e 100644
 --- a/Makefile.am
 +++ b/Makefile.am
-@@ -306,6 +306,7 @@ MODULES =					\
-   guix/scripts/archive.scm			\
-   guix/scripts/import.scm			\
-   guix/scripts/package.scm			\
-+  guix/parameters.scm                           \
-   guix/scripts/locate.scm			\
-   guix/scripts/install.scm			\
-   guix/scripts/remove.scm			\
+@@ -17,6 +17,7 @@
+ # Copyright © 2020, 2021, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+ # Copyright © 2021 Chris Marusich <cmmarusich@gmail.com>
+ # Copyright © 2021 Andrew Tropin <andrew@trop.in>
++# Copyright © 2023 Sarthak Shah <shahsarthakw@gmail.com>
+ #
+ # This file is part of GNU Guix.
+ #
+@@ -114,6 +115,7 @@ MODULES =					\
+   guix/repl.scm					\
+   guix/rpm.scm					\
+   guix/transformations.scm			\
++  guix/parameters.scm				\
+   guix/inferior.scm				\
+   guix/describe.scm				\
+   guix/quirks.scm				\
 diff --git a/guix/parameters.scm b/guix/parameters.scm
 new file mode 100644
-index 0000000000..64a19fa4a8
+index 0000000000..24fe1cbac9
 --- /dev/null
 +++ b/guix/parameters.scm
 @@ -0,0 +1,1180 @@
@@ -41,7 +49,6 @@ index 0000000000..64a19fa4a8
 +  #:use-module (guix packages)
 +  #:use-module (guix profiles)
 +  #:use-module (guix records)
-+  #:use-module (guix transformations)
 +  #:use-module (srfi srfi-1)
 +  #:use-module (srfi srfi-13)
 +  #:use-module (srfi srfi-26)
@@ -50,6 +57,7 @@ index 0000000000..64a19fa4a8
 +  #:use-module (ice-9 hash-table)
 +  #:use-module (ice-9 match)
 +  #:use-module (ice-9 receive)
++  #:autoload (guix transformations) (options->transformation)
 +  #:export (parameter-type
 +            package-parameter
 +            parameter-spec
@@ -1197,17 +1205,17 @@ index 0000000000..64a19fa4a8
 +   (description "Toggle for tests")
 +   (predicate #t)))
 diff --git a/guix/transformations.scm b/guix/transformations.scm
-index 9cba6bedab..5a72e3feb4 100644
+index 9cba6bedab..f451d646f9 100644
 --- a/guix/transformations.scm
 +++ b/guix/transformations.scm
-@@ -24,6 +24,7 @@ (define-module (guix transformations)
-   #:use-module (guix i18n)
-   #:use-module (guix store)
-   #:use-module (guix packages)
-+  #:use-module (guix parameters)
-   #:use-module (guix build-system)
-   #:use-module (guix profiles)
-   #:use-module (guix diagnostics)
+@@ -36,6 +36,7 @@ (define-module (guix transformations)
+   #:autoload   (guix cpu) (current-cpu
+                            cpu->gcc-architecture
+                            gcc-architecture->micro-architecture-level)
++  #:autoload (guix parameters) (package-parameter-alist parameterize-package)
+   #:use-module (guix utils)
+   #:use-module (guix memoization)
+   #:use-module (guix gexp)
 @@ -354,6 +355,59 @@ (define rewrite
          (rewrite obj)
          obj)))
@@ -1286,7 +1294,7 @@ index 9cba6bedab..5a72e3feb4 100644
                    (parser 'with-c-toolchain))
            (option '("tune") #f #t
 diff --git a/guix/ui.scm b/guix/ui.scm
-index 6f2d4fe245..8c6d434386 100644
+index 6f2d4fe245..013091d458 100644
 --- a/guix/ui.scm
 +++ b/guix/ui.scm
 @@ -19,6 +19,7 @@
@@ -1297,14 +1305,14 @@ index 6f2d4fe245..8c6d434386 100644
  ;;;
  ;;; This file is part of GNU Guix.
  ;;;
-@@ -45,6 +46,7 @@ (define-module (guix ui)
-   #:use-module (guix store)
-   #:use-module (guix config)
-   #:use-module (guix packages)
-+  #:use-module (guix parameters)
-   #:use-module (guix profiles)
-   #:use-module (guix derivations)
-   #:use-module (guix build-system)
+@@ -76,6 +77,7 @@ (define-module (guix ui)
+   #:use-module (ice-9 format)
+   #:use-module (ice-9 regex)
+   #:autoload   (ice-9 popen) (open-pipe* close-pipe)
++  #:autoload   (guix parameters) (all-spec-parameters-with-types package-parameter-spec)
+   #:autoload   (system repl repl)  (start-repl)
+   #:autoload   (system repl debug) (make-debug stack->vector)
+   #:use-module (texinfo)
 @@ -1607,7 +1609,11 @@ (define highlighting*
      (outputs                            ; multiple outputs
       (format port "outputs:~%~{~a~%~}"

+ 153 - 0
test-packages.scm

@@ -0,0 +1,153 @@
+ (define-module (test-packages)
+ 	       #:use-module (gnu packages version-control)
+ 	       #:use-module (gnu packages suckless)
+ 	       #:use-module (gnu packages emacs)
+ 	       #:use-module (gnu packages sqlite)
+ 	       #:use-module (gnu packages)
+ 	       #:use-module (guix parameters)
+ 	       #:use-module (guix packages)
+ 	       #:use-module (guix utils)
+ 	       #:use-module (guix git-download)
+ 	       #:use-module (guix build-system gnu))
+
+ (define-global-parameter
+   (package-parameter
+     (name 'tests)
+     (variants
+       (parameter-variant-match
+ 	(_ #:lambda (lambda (pkg)
+ 		      (display "Something expected!")
+ 		      (newline) pkg)
+ 	   #:lambda (lambda (pkg pv)
+ 		      (display "Something else expected!\n")
+ 		      pkg))
+ 	(off #:lambda (lambda (pkg) (display "One more test!\n") pkg)
+ 	     #:transform (without-tests #:package-name)
+ 	     #:lambda (lambda (pkg pv) (display "Global parameters work!!! ")
+ 			(display pv)
+ 			(newline) pkg)
+ 	     (lambda (pkg) (display "one more thing...\n") pkg))))
+     (description "toggle for tests")
+     (predicate (const #t)))) ;(lambda (pkg)
+ ; (eqv? (package-build-system pkg)
+ ;      gnu-build-system)))))
+
+  (define-public git-st
+  	       (package-with-parameters
+  		 ;; pspec
+  		 (parameter-spec
+  		   (local
+  		     (list
+  		       ;; (package-parameter
+  		       ;;   (name 'temp)
+  		       ;;   (type (parameter-type
+  		       ;; 	  (name 'temp-type)
+  		       ;; 	  (accepted-values '(1 2 3)))))
+  		       (package-parameter
+  			 (name 'git)
+  			 (variants
+  			   (parameter-variant-match
+  			     (off #:lambda (lambda (pkg pv) (display "IT WORKS! ") (display pv) (newline) pkg))
+  			     (on #:transform (with-git-url #:package-name "https://github.com/cel7t/st")))))))
+  		   (defaults '((git off))))
+  		 (inherit st)
+  		 (arguments (parameter-if (git) ; (list (cons 'git 'on))
+  					  (and (display "Parameter-if works\n")
+  					       (package-arguments st))
+  					  (and (display "INITIAL Parameter-if works\n")
+  					       (package-arguments st))))
+  		 (name "git-st")))
+
+(define-global-parameter
+  (package-parameter
+    (name 'x11)))
+
+(define-public emacs-p
+               (package-with-parameters
+                 [parameter-spec
+                   (local
+                     (list
+                       (package-parameter
+                         (name 'next)
+                         (variants
+                           (parameter-variant-match
+                             (_ #:lambda (lambda (pkg)
+                                           (package
+                                             (inherit pkg)
+                                             (version "29.0.92")
+                                             (source
+                                               (origin
+                                                 (inherit (package-source pkg))
+                                                 (method git-fetch)
+                                                 (uri (git-reference
+                                                        (url "https://git.savannah.gnu.org/git/emacs.git/")
+                                                        (commit (string-append "emacs-" version))))
+                                                 (file-name (git-file-name (package-name pkg) version))
+                                                 (patches
+                                                   (parameter-if #:package pkg (pgtk)
+                                                                 (search-patches
+                                                                   "emacs-exec-path.patch"
+                                                                   "emacs-fix-scheme-indent-function.patch"
+                                                                   "emacs-native-comp-driver-options.patch"
+                                                                   "emacs-pgtk-super-key-fix.patch")
+                                                                 (search-patches
+                                                                   "emacs-exec-path.patch"
+                                                                   "emacs-fix-scheme-indent-function.patch"
+                                                                   "emacs-native-comp-driver-options.patch")))
+                                                 (sha256
+                                                   (base32
+                                                     "1h3p325859svcy43iv7wr27dp68049j9d44jq5akcynqdkxz4jjn"))))))))))
+                       (package-parameter (name 'tree-sitter)
+                                          (dependencies '(tree-sitter)))
+                       (package-parameter
+                         (name 'pgtk)
+                         (variants
+                           (parameter-variant-match
+                             (_ #:transform (with-configure-flag
+                                              #:package-name "=--with-pgtk"))))
+                         (dependencies '(tree-sitter x11)))
+                       (package-parameter
+                         (name 'xwidgets)
+                         (variants
+                           (parameter-variant-match
+                             (_ #:transform (with-configure-flag
+                                              #:package-name "=--with-xwidgets")))))
+                       (package-parameter
+                         (name 'wide-int)
+                         (variants
+                           (parameter-variant-match
+                             (_ #:transform (with-configure-flag
+                                              #:package-name "=--with-wide-int")))))))
+                   (one-of '((_ (x11 #:off) pgtk)
+                             (_ (x11 #:off) xwidgets)))]
+                 (inherit emacs)
+                 (name "emacs-p")
+                 (arguments
+                   (parameter-substitute-keyword-arguments
+                     (package-arguments emacs)
+                     [((x11 #:off))
+                      '(((#:configure-flags flags #~'())
+                         #~(delete "--with-cairo" #$flags))
+                        ((#:modules _) (%emacs-modules build-system))
+                        ((#:phases phases)
+                         #~(modify-phases #$phases
+                                          (delete 'restore-emacs-pdmp)
+                                          (delete 'strip-double-wrap))))]
+                     [(#:all (xwidgets on) (pgtk #:off))
+                      '(((#:configure-flags flags #~'())
+                         #~(cons "--with-xwidgets" #$flags))
+                        ((#:modules _) (%emacs-modules build-system))
+                        ((#:phases phases)
+                         #~(modify-phases #$phases
+                                          (delete 'restore-emacs-pdmp)
+                                          (delete 'strip-double-wrap))))]))
+                 (inputs
+                   (parameter-modify-inputs (package-inputs emacs)
+                                            ((next) (prepend sqlite))
+                                            (((tree-sitter on)) (prepend tree-sitter))
+                                            (((xwidgets on)) (prepend gsettings-desktop-schemas
+                                                                      webkitgtk-with-libsoup2))
+                                            (((x11 #:off))
+                                             (delete "libx11" "gtk+" "libxft" "libtiff" "giflib" "libjpeg"
+                                                     "imagemagick" "libpng" "librsvg" "libxpm" "libice" "libsm"
+                                                     "cairo" "pango" "harfbuzz" "libotf" "m17n-lib" "dbus"))))))