From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 21 09:21:20 2018 Received: (at 30385) by debbugs.gnu.org; 21 Jun 2018 13:21:20 +0000 Received: from localhost ([127.0.0.1]:58366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVzWV-00022I-Vn for submit@debbugs.gnu.org; Thu, 21 Jun 2018 09:21:20 -0400 Received: from sinope02.bbbm.mdc-berlin.de ([141.80.25.24]:59038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVzWQ-000227-6M for 30385@debbugs.gnu.org; Thu, 21 Jun 2018 09:21:11 -0400 Received: from localhost (localhost [127.0.0.1]) by sinope02.bbbm.mdc-berlin.de (Postfix) with ESMTP id 4820911A16E6; Thu, 21 Jun 2018 15:21:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mdc-berlin.de; h= content-type:content-type:mime-version:message-id:date:date :in-reply-to:subject:subject:from:from:user-agent:references :received:received:received:received; s=mdc; t=1529587263; x= 1531401664; bh=mUhAq0z/utpYUaw5ptcuVmDXoo+rtp/vfqwV9NWI2W0=; b=Q 3c+jJFqxpx0S35gxl/O4Wv40vjnn//Pz3pefGYOja/07KhtHS3L5SSqYnwT7TEH9 KFvXQUiNxgj9I1tKP+shiDIjA4AyAvx4UrwYgz0d5IWhlN/lkIbnuouHgFJKN2lF af3LUBqJNhy/sznVd8koTvMTMO9EQWfF1OnBYME0s4= X-Virus-Scanned: amavisd-new at mdc-berlin.de Received: from sinope02.bbbm.mdc-berlin.de ([127.0.0.1]) by localhost (sinope02.bbbm.mdc-berlin.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DqYWzYICIFce; Thu, 21 Jun 2018 15:21:03 +0200 (CEST) Received: from HTCATWO.mdc-berlin.net (puck.citx.mdc-berlin.de [141.80.36.101]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by sinope02.bbbm.mdc-berlin.de (Postfix) with ESMTPS; Thu, 21 Jun 2018 15:21:03 +0200 (CEST) Received: from SW-IT-P-CAS4.mdc-berlin.net (141.80.113.59) by HTCATWO.mdc-berlin.net (141.80.180.190) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 21 Jun 2018 15:21:03 +0200 Received: from localhost (141.80.113.51) by SW-IT-P-CAS4.mdc-berlin.net (141.80.113.59) with Microsoft SMTP Server id 14.3.399.0; Thu, 21 Jun 2018 15:21:02 +0200 References: <87a7wkv3eh.fsf@abyayala.i-did-not-set--mail-host-address--so-tickle-me> User-agent: mu4e 1.0; emacs 26.1 From: Ricardo Wurmus To: Subject: Re: [bug#30385] Add vim-build-system In-Reply-To: <87a7wkv3eh.fsf@abyayala.i-did-not-set--mail-host-address--so-tickle-me> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Date: Thu, 21 Jun 2018 15:20:52 +0200 Message-ID: <871sd0tgwb.fsf@mdc-berlin.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [141.80.113.51] X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.2.1013-23920.006 X-TM-AS-Result: No-13.231200-8.000000-10 X-TMASE-MatchedRID: zGP2F0O7j/vo2d3orePV3fHkpkyUphL9Za7LkubQvj9jPrlNB+gMq1e/ KWmAuveArc2kEsHh4aZl2Szw4gtLAeBX8Ypq0C8lSk3ASAlP761ezmeoa8MJ80uCjz4ggdtwoQE YbyRPJnd53DrnZ9A6ExEIoddjVdcsIly/lfs5uYn9vE/QVDV5IRNtTUpgahCn+Cckfm+bb6DOXi w/vAtmtSPKmcaFmhj14gap5MvM7lCsP7gN7d9IwTWnQyoYXNHZVkJ4hxc37K9fNjF5BHUO+80X3 rZe95Q5TQ0j/deBrVPCQOCHizeBUgOPIDYCx7que0f0oZqxJUk= X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--13.231200-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.2.1013-23920.006 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30385 Cc: 30385@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable > This adds a first version of a functional vim-build-system. Thank you. Sorry for the delay. I just went through this but found a couple of defects. I fixed the regular expressions in %default-exclude, removed unused module imports, and fixed minor indentation problems, but then I noticed a few more fundamental problems. * %default-exclude is not used. The =E2=80=9Cinstall=E2=80=9D phase uncond= itionally installs everything * The build system does not support an #:exclude argument that would allow a user to override the behaviour. (Compare this to the ant-build-system, which supports excluding tests, for example.) * The build system allows users to specify a test-target and disable tests (they default to #t), but there is no check phase anyway. It also supports configure-flags, but it would not use them. Attached is the patch with my minor changes. Could you please send an updated patch where these problems are addressed? Thanks! -- Ricardo --=-=-= Content-Type: text/x-patch; charset="utf-8" Content-Disposition: inline; filename="0001-build-system-Add-vim-build-system.patch" Content-Transfer-Encoding: quoted-printable From 7decc6cd27af54994abfc396beaeae68a6acd69a Mon Sep 17 00:00:00 2001 From: ng0 Date: Sun, 2 Jul 2017 16:07:48 +0000 Subject: [PATCH] build-system: Add vim-build-system. * Makefile.am (MODULES): Add guix/build-system/vim.scm and guix/build/vim-build-system.scm. * guix/build-system/vim.scm: New file. * guix/build/vim-build-system.scm: New file. Signed-off-by: Ricardo Wurmus --- Makefile.am | 2 + guix/build-system/vim.scm | 129 ++++++++++++++++++++++++++++++++ guix/build/vim-build-system.scm | 91 ++++++++++++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 guix/build-system/vim.scm create mode 100644 guix/build/vim-build-system.scm diff --git a/Makefile.am b/Makefile.am index ab145065d..b5d910139 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,6 +114,7 @@ MODULES =3D \ guix/build-system/perl.scm \ guix/build-system/python.scm \ guix/build-system/ocaml.scm \ + guix/build-system/vim.scm \ guix/build-system/waf.scm \ guix/build-system/r.scm \ guix/build-system/ruby.scm \ @@ -143,6 +144,7 @@ MODULES =3D \ guix/build/font-build-system.scm \ guix/build/go-build-system.scm \ guix/build/asdf-build-system.scm \ + guix/build/vim-build-system.scm \ guix/build/git.scm \ guix/build/hg.scm \ guix/build/glib-or-gtk-build-system.scm \ diff --git a/guix/build-system/vim.scm b/guix/build-system/vim.scm new file mode 100644 index 000000000..9bd44e077 --- /dev/null +++ b/guix/build-system/vim.scm @@ -0,0 +1,129 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 ng0 +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system vim) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix derivations) + #:use-module (guix store) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:export (%vim-build-system-modules + vim-build + vim-build-system)) + +;; Commentary: +;; +;; Standard build procedure for vim packages. This is +;; implemented as an extension of 'gnu-build-system'. +;; +;; Code: + +(define %vim-build-system-modules + ;; Build-side modules imported by default. + `((guix build vim-build-system) + ,@%gnu-build-system-modules)) + +(define* (lower name + #:key source inputs native-inputs outputs system target + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:target #:inputs #:exclude #:native-inputs)) + + (bag + (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + ,(list "tar" (module-ref (resolve-interface '(gnu packa= ges base)) 'tar)) + ,@(let ((compression (resolve-interface '(gnu packages = compression)))) + (map (match-lambda + ((name package) + (list name (module-ref compression package)= ))) + `(("gzip" gzip) + ("bzip2" bzip2) + ("unzip" unzip) + ("xz" xz)))))) + (build-inputs native-inputs) + (outputs outputs) + (build vim-build) + (arguments (strip-keyword-arguments private-keywords arguments)))) + +(define* (vim-build store name inputs + #:key source + (tests? #t) + (test-target "test") + (configure-flags ''()) + (phases '(@ (guix build vim-build-system) + %standard-phases)) + (outputs '("out")) + (search-paths '()) + (system (%current-system)) + (guile #f) + (imported-modules %vim-build-system-modules) + (modules '((guix build vim-build-system) + (guix build utils)))) + "Build SOURCE with INPUTS." + (define builder + `(begin + (use-modules ,@modules) + (vim-build #:name ,name + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:configure-flags ,configure-flags + #:system ,system + #:test-target ,test-target + #:tests? ,tests? + #:phases ,phases + #:outputs %outputs + #:search-paths ',(map search-path-specification->sexp + search-paths) + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:inputs inputs + #:system system + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) + +(define vim-build-system + (build-system + (name 'vim) + (description "The build system for vim packages") + (lower lower))) diff --git a/guix/build/vim-build-system.scm b/guix/build/vim-build-system.= scm new file mode 100644 index 000000000..a8a6221e9 --- /dev/null +++ b/guix/build/vim-build-system.scm @@ -0,0 +1,91 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2018 ng0 +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build vim-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module (guix build utils) + #:use-module (srfi srfi-11) + #:export (%standard-phases + %default-exclude + vim-build)) + +;; Commentary: +;; +;; Builder-side code of the build procedure for vim packages. +;; +;; Code: + +;; These are the default inclusion/exclusion regexps for the install phase. +(define %default-exclude '("^.github$" "^.*\\.md$" "LICENSE" "COPYING" + "^.*README.*$" "^\\.travis\\.yml$" + "^.*Makefile.*$")) + +(define gnu:unpack (assoc-ref gnu:%standard-phases 'unpack)) + +(define (store-file->vim-source-file file) + "Convert FILE, a store file name for an Vim source file, into a file +name that has been stripped of the hash and version number." + (let ((suffix ".vim")) + (let-values (((name version) + (package-name->name+version + (basename + (strip-store-file-name file) suffix)))) + (string-append name suffix)))) + +(define* (unpack #:key source #:allow-other-keys) + "Unpack SOURCE into the build directory. SOURCE may be a compressed +archive, a directory or a '.vim' file." + (if (string-suffix? ".vim" source) + (begin + (mkdir "source") + (chdir "source") + (copy-file source (store-file->vim-source-file source)) + #t) + (gnu:unpack #:source source))) + +;; FIXME: Files like README.md and other, more unpredictable file names, +;; are currently being installed. Because there is no concept of a +;; standardized build-system in Vim extensions, we have to find a long-term +;; solution to exclusion of files that are not used at runtime. +(define* (install #:key outputs + (exclude %default-exclude) + #:allow-other-keys) + "Install the package contents." + (let* ((out (assoc-ref outputs "out")) + (source (getcwd)) + (vimfiles (string-append out "/share/vim/vimfiles"))) + (for-each delete-file-recursively + (find-files source "^\\.git$")) + (for-each delete-file-recursively + (find-files source "^\\.gitignore$")) + (mkdir out) + (copy-recursively "." vimfiles) + #t)) + +(define %standard-phases + (modify-phases gnu:%standard-phases + (replace 'unpack unpack) + (delete 'configure) + (delete 'check) + (delete 'build) + (replace 'install install))) + +(define* (vim-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given vim package, applying all of PHASES in order." + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) --=20 2.17.1 --=-=-=--