From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: [PATCH] Add support for 'cvs-fetch' method in origins Date: Tue, 03 Feb 2015 03:45:18 -0500 Message-ID: <8761bjcrj5.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIZ6t-0003jL-7T for guix-devel@gnu.org; Tue, 03 Feb 2015 03:45:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIZ6q-0008K3-Ey for guix-devel@gnu.org; Tue, 03 Feb 2015 03:45:27 -0500 Received: from world.peace.net ([50.252.239.5]:60028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIZ6q-0008Io-7x for guix-devel@gnu.org; Tue, 03 Feb 2015 03:45:24 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org --=-=-= Content-Type: text/plain The motivation for this is libffcall, which hasn't been released in such a long time that http://gnu.org/s/libffcall doesn't even link to the last release, but just says to download it from CVS. guix/cvs-download.scm is based so heavily on guix/svn-download.scm that I copied the copyright notices from svn-download.scm. Mark --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Add-support-for-cvs-fetch-method-in-origins.patch Content-Transfer-Encoding: quoted-printable Content-Description: [PATCH] Add support for 'cvs-fetch' method in origins >From 118c8b739f368e4e5f691e119618568dcda0e12b Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 17 Jan 2015 22:11:45 -0500 Subject: [PATCH] Add support for 'cvs-fetch' method in origins. * guix/cvs-download.scm, guix/build/cvs.scm: New files. * Makefile.am (MODULES): Add them. --- Makefile.am | 2 ++ guix/build/cvs.scm | 65 +++++++++++++++++++++++++++++++++++++++ guix/cvs-download.scm | 84 +++++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 151 insertions(+) create mode 100644 guix/build/cvs.scm create mode 100644 guix/cvs-download.scm diff --git a/Makefile.am b/Makefile.am index 67367d6..2e0da77 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,6 +60,7 @@ MODULES =3D \ guix/gnupg.scm \ guix/elf.scm \ guix/store.scm \ + guix/cvs-download.scm \ guix/svn-download.scm \ guix/ui.scm \ guix/build/download.scm \ @@ -76,6 +77,7 @@ MODULES =3D \ guix/build/union.scm \ guix/build/pull.scm \ guix/build/rpath.scm \ + guix/build/cvs.scm \ guix/build/svn.scm \ guix/build/syscalls.scm \ guix/build/emacs-utils.scm \ diff --git a/guix/build/cvs.scm b/guix/build/cvs.scm new file mode 100644 index 0000000..18b138c --- /dev/null +++ b/guix/build/cvs.scm @@ -0,0 +1,65 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2015 Mark H Weaver +;;; +;;; 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 cvs) + #:use-module (guix build utils) + #:use-module (ice-9 regex) + #:use-module (ice-9 ftw) + #:export (cvs-fetch)) + +;;; Commentary: +;;; +;;; This is the build-side support code of (guix cvs-download). It allows= a +;;; CVS repository to be checked out at a specific revision or date. +;;; +;;; Code: + +(define (find-cvs-directories) + (define (enter? path st result) + (not (string-suffix? "/CVS" path))) + (define (leaf path st result) result) + (define (down path st result) result) + (define (up path st result) result) + (define (skip path st result) + (if (and (string-suffix? "/CVS" path) + (eqv? 'directory (stat:type st))) + (cons path result) + result)) + (define (error path st errno result) + (format (current-error-port) "cvs-fetch: ~a: ~a~%" + path (strerror errno))) + (file-system-fold enter? leaf down up skip error '() "." lstat)) + +(define* (cvs-fetch cvs-root-dir module revision directory + #:key (cvs-command "cvs")) + "Fetch REVISION from MODULE of CVS-ROOT-DIR into DIRECTORY. REVISION mu= st +either be a date in ISO-8601 format (e.g. \"2012-12-21\") or a CVS tag. +Return #t on success, #f otherwise." + (and (zero? (system* cvs-command "-z3" + "-d" cvs-root-dir + "checkout" + (if (string-match "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" re= vision) + "-D" "-r") + revision + module)) + (rename-file module directory) + (with-directory-excursion directory + (for-each delete-file-recursively (find-cvs-directories))) + #t)) + +;;; cvs.scm ends here diff --git a/guix/cvs-download.scm b/guix/cvs-download.scm new file mode 100644 index 0000000..e3d8ad1 --- /dev/null +++ b/guix/cvs-download.scm @@ -0,0 +1,84 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2014, 2015 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2014 Sree Harsha Totakura +;;; Copyright =C2=A9 2015 Mark H Weaver +;;; +;;; 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 cvs-download) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (guix store) + #:use-module (guix monads) + #:use-module (guix packages) + #:use-module (ice-9 match) + #:export (cvs-reference + cvs-reference? + cvs-reference-url + cvs-reference-revision + cvs-fetch)) + +;;; Commentary: +;;; +;;; An method that fetches a specific revision or date from a CVS +;;; repository. The CVS-ROOT-DIR, MODULE and REVISION are specified with a +;;; object. REVISION should be specified as either a date +;;; string in ISO-8601 format (e.g. "2012-12-21") or a CVS tag. +;;; +;;; Code: + +(define-record-type* + cvs-reference make-cvs-reference + cvs-reference? + (root-dir cvs-reference-root-dir) ; string + (module cvs-reference-module) ; string + (revision cvs-reference-revision)) ; string + +(define (cvs-package) + "Return the default CVS package." + (let ((distro (resolve-interface '(gnu packages version-control)))) + (module-ref distro 'cvs))) + +(define* (cvs-fetch ref hash-algo hash + #:optional name + #:key (system (%current-system)) (guile (default-guile= )) + (cvs (cvs-package))) + "Return a fixed-output derivation that fetches REF, a +object. The output is expected to have recursive hash HASH of type +HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." + (define build + #~(begin + (use-modules (guix build cvs)) + (cvs-fetch '#$(cvs-reference-root-dir ref) + '#$(cvs-reference-module ref) + '#$(cvs-reference-revision ref) + #$output + #:cvs-command (string-append #$cvs "/bin/cvs")))) + + (mlet %store-monad ((guile (package->derivation guile system))) + (gexp->derivation (or name "cvs-checkout") build + #:system system + ;; FIXME: See . + ;;#:local-build? #t + #:hash-algo hash-algo + #:hash hash + #:recursive? #t + #:modules '((guix build cvs) + (guix build utils)) + #:guile-for-build guile + #:local-build? #t))) + +;;; cvs-download.scm ends here --=20 2.2.1 --=-=-=--