mirror of
https://codeberg.org/guix/guix.git
synced 2026-04-28 06:34:05 +00:00
Compare commits
4 Commits
guile-daem
...
wip-ipfs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c381c2f6c9 | ||
|
|
f26c3ac936 | ||
|
|
58d5f8fbc2 | ||
|
|
d0a7961e14 |
10
Makefile.am
10
Makefile.am
@@ -188,8 +188,9 @@ MODULES = \
|
||||
guix/import/cabal.scm \
|
||||
guix/import/cran.scm \
|
||||
guix/import/hackage.scm \
|
||||
guix/import/elpa.scm \
|
||||
guix/import/texlive.scm \
|
||||
guix/import/elpa.scm \
|
||||
guix/import/texlive.scm \
|
||||
guix/import/gopkg.scm \
|
||||
guix/scripts.scm \
|
||||
guix/scripts/download.scm \
|
||||
guix/scripts/perform-download.scm \
|
||||
@@ -214,8 +215,9 @@ MODULES = \
|
||||
guix/scripts/import/gnu.scm \
|
||||
guix/scripts/import/nix.scm \
|
||||
guix/scripts/import/hackage.scm \
|
||||
guix/scripts/import/elpa.scm \
|
||||
guix/scripts/import/texlive.scm \
|
||||
guix/scripts/import/elpa.scm \
|
||||
guix/scripts/import/texlive.scm \
|
||||
guix/scripts/import/gopkg.scm \
|
||||
guix/scripts/environment.scm \
|
||||
guix/scripts/publish.scm \
|
||||
guix/scripts/edit.scm \
|
||||
|
||||
@@ -20,7 +20,7 @@ Copyright @copyright{} 2014, 2015, 2016 Alex Kost@*
|
||||
Copyright @copyright{} 2015, 2016 Mathieu Lirzin@*
|
||||
Copyright @copyright{} 2014 Pierre-Antoine Rault@*
|
||||
Copyright @copyright{} 2015 Taylan Ulrich Bayırlı/Kammer@*
|
||||
Copyright @copyright{} 2015, 2016, 2017 Leo Famulari@*
|
||||
Copyright @copyright{} 2015, 2016, 2017, 2018 Leo Famulari@*
|
||||
Copyright @copyright{} 2015, 2016, 2017, 2018 Ricardo Wurmus@*
|
||||
Copyright @copyright{} 2016 Ben Woodcroft@*
|
||||
Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@*
|
||||
@@ -7179,6 +7179,13 @@ Import metadata from the crates.io Rust package repository
|
||||
@cindex OCaml
|
||||
Import metadata from the @uref{https://opam.ocaml.org/, OPAM} package
|
||||
repository used by the OCaml community.
|
||||
|
||||
@item gopkg
|
||||
@cindex gopkg
|
||||
@cindex Golang
|
||||
@cindex Go
|
||||
Import metadata from the @uref{https://gopkg.in/, gopkg} package
|
||||
versioning service used by some Go software.
|
||||
@end table
|
||||
|
||||
The structure of the @command{guix import} code is modular. It would be
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
235
gnu/packages/ipfs.scm
Normal file
235
gnu/packages/ipfs.scm
Normal file
@@ -0,0 +1,235 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (gnu packages ipfs)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:use-module (guix packages)
|
||||
;; #:use-module (guix download)
|
||||
#:use-module (guix git-download)
|
||||
#:use-module (guix gx-download)
|
||||
#:use-module (guix build-system go)
|
||||
;; #:use-module (guix build-system python)
|
||||
;; #:use-module (gnu packages)
|
||||
#:use-module (gnu packages golang))
|
||||
|
||||
(define-public ipfs-go-ipfs-cmdkit
|
||||
(let ((ipfs-hash "QmSP88ryZkHSRn1fnngAaV2Vcn63WUJzAavnRM9CVdU1Ky"))
|
||||
(package
|
||||
(name "ipfs-go-ipfs-cmdkit")
|
||||
(version (gx-version "1.1.3" "1" ipfs-hash))
|
||||
(source
|
||||
(origin
|
||||
(method gx-fetch)
|
||||
(uri (gx-reference (hash ipfs-hash)))
|
||||
(file-name (gx-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0qk6fshgdmhp8dip2ksm13j6nywi41m9mn0czkvmw6b697z85l2r"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
`(#:unpack-path ,(string-append "gx/ipfs/" ipfs-hash "/go-ipfs-config")
|
||||
#:import-path ,(string-append "gx/ipfs/" ipfs-hash "/go-ipfs-config")))
|
||||
(home-page
|
||||
"https://github.com/ipfs/go-ipfs-cmdkit")
|
||||
(synopsis "Shared types, functions and values for go-ipfs")
|
||||
(description "@command{cmdkit} offers some types, functions and values
|
||||
that are shared between @command{go-ipfs/commands} and its rewrite @command{go-ipfs-cmds}.")
|
||||
(license license:expat))))
|
||||
|
||||
(define-public go-github-com-ipfs-go-ipfs-cmdkit-files
|
||||
(let ((commit
|
||||
"386fcf8f18a185ec121676665fe2d9574496048d")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "go-github-com-ipfs-go-ipfs-cmdkit-files")
|
||||
(version (git-version "0.0.0" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/ipfs/go-ipfs-cmdkit.git")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0qk6fshgdmhp8dip2ksm13j6nywi41m9mn0czkvmw6b697z85l2r"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
'(#:unpack-path "github.com/ipfs/go-ipfs-cmdkit"
|
||||
#:import-path "github.com/ipfs/go-ipfs-cmdkit/files"))
|
||||
(home-page
|
||||
"https://github.com/ipfs/go-ipfs-cmdkit")
|
||||
(synopsis "Shared types, functions and values for go-ipfs")
|
||||
(description "@command{cmdkit} offers some types, functions and values
|
||||
that are shared between @command{go-ipfs/commands} and its rewrite @command{go-ipfs-cmds}.")
|
||||
(license license:expat))))
|
||||
|
||||
(define-public go-github-com-ipfs-go-ipfs-api
|
||||
(let ((commit
|
||||
"dafc2a13a4389ac1a6c2786e34ab70a4f26d3a3f")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "go-github-com-ipfs-go-ipfs-api")
|
||||
(version (git-version "0.0.0" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/ipfs/go-ipfs-api.git")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"06kibnwb037sqynk99j07wm8alvxwx3bari9gdax4jv93396kycj"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
'(#:import-path "github.com/ipfs/go-ipfs-api"
|
||||
;; TODO: Tests fail, might need network access.
|
||||
#:tests? #f))
|
||||
(native-inputs
|
||||
`(("go-github-com-ipfs-go-ipfs-cmdkit-files" ,go-github-com-ipfs-go-ipfs-cmdkit-files)
|
||||
("go-github-com-libp2p-go-libp2p-metrics" ,go-github-com-libp2p-go-libp2p-metrics)
|
||||
("go-github-com-libp2p-go-flow-metrics" ,go-github-com-libp2p-go-flow-metrics)
|
||||
("go-github-com-libp2p-go-libp2p-peer" ,go-github-com-libp2p-go-libp2p-peer)
|
||||
("go-github-com-libp2p-go-libp2p-protocol" ,go-github-com-libp2p-go-libp2p-protocol)
|
||||
("go-github-com-libp2p-go-libp2p-crypto" ,go-github-com-libp2p-go-libp2p-crypto)
|
||||
("go-github-com-mitchellh-go-homedir" ,go-github-com-mitchellh-go-homedir)
|
||||
("go-github-com-multiformats-go-multiaddr" ,go-github-com-multiformats-go-multiaddr)
|
||||
("go-github-com-multiformats-go-multiaddr-net" ,go-github-com-multiformats-go-multiaddr-net)
|
||||
("go-github-com-btcsuite-btcd-btcec" ,go-github-com-btcsuite-btcd-btcec)
|
||||
("go-github-com-gogo-protobuf-proto" ,go-github-com-gogo-protobuf-proto)
|
||||
("go-github-com-minio-blake2b-simd" ,go-github-com-minio-blake2b-simd)
|
||||
("go-github-com-minio-sha256-simd" ,go-github-com-minio-sha256-simd)
|
||||
("go-github-com-mr-tron-base58" ,go-github-com-mr-tron-base58)
|
||||
("go-github-com-multiformats-go-multihash" ,go-github-com-multiformats-go-multihash)
|
||||
("go-golang-org-x-crypto-union" ,(go-golang-org-x-crypto-union))
|
||||
("go-github-com-spaolacci-murmur3" ,go-github-com-spaolacci-murmur3)
|
||||
("go-github-com-gxed-hashland-keccakpg" ,go-github-com-gxed-hashland-keccakpg)
|
||||
("go-github-com-whyrusleeping-tar-utils" ,go-github-com-whyrusleeping-tar-utils)
|
||||
("go-github-com-cheekybits-is" ,go-github-com-cheekybits-is)))
|
||||
(home-page "https://github.com/ipfs/go-ipfs-api")
|
||||
(synopsis "Unofficial Go interface to IPFS's HTTP API")
|
||||
(description "An unofficial Go interface to IPFS's HTTP API")
|
||||
(license license:expat))))
|
||||
|
||||
(define-public gx
|
||||
(let ((commit
|
||||
"89338e509426d2895f20086685cf4c77d64cc5df")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "gx")
|
||||
(version (git-version "0.14.0" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/whyrusleeping/gx.git")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"08gh04jln8rxpq0j4fm4chjap162wp8cjwj9szbvj9c7123s42rd"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
'(#:import-path "github.com/whyrusleeping/gx"))
|
||||
(native-inputs
|
||||
`(
|
||||
("go-github-com-blang-semver" ,go-github-com-blang-semver)
|
||||
("go-github-com-gxed-hashland-keccakpg" ,go-github-com-gxed-hashland-keccakpg)
|
||||
("go-github-com-ipfs-go-ipfs-api" ,go-github-com-ipfs-go-ipfs-api)
|
||||
("go-github-com-ipfs-go-ipfs-cmdkit-files" ,go-github-com-ipfs-go-ipfs-cmdkit-files)
|
||||
("go-github-com-libp2p-go-flow-metrics" ,go-github-com-libp2p-go-flow-metrics)
|
||||
("go-github-com-libp2p-go-libp2p-crypto" ,go-github-com-libp2p-go-libp2p-crypto)
|
||||
("go-github-com-libp2p-go-libp2p-metrics" ,go-github-com-libp2p-go-libp2p-metrics)
|
||||
("go-github-com-libp2p-go-libp2p-peer" ,go-github-com-libp2p-go-libp2p-peer)
|
||||
("go-github-com-libp2p-go-libp2p-protocol" ,go-github-com-libp2p-go-libp2p-protocol)
|
||||
("go-github-com-minio-blake2b-simd" ,go-github-com-minio-blake2b-simd)
|
||||
("go-github-com-minio-sha256-simd" ,go-github-com-minio-sha256-simd)
|
||||
("go-github-com-mitchellh-go-homedir" ,go-github-com-mitchellh-go-homedir)
|
||||
("go-github-com-mr-tron-base58" ,go-github-com-mr-tron-base58)
|
||||
("go-github-com-multiformats-go-multiaddr" ,go-github-com-multiformats-go-multiaddr)
|
||||
("go-github-com-multiformats-go-multiaddr-net" ,go-github-com-multiformats-go-multiaddr-net)
|
||||
("go-github-com-multiformats-go-multihash" ,go-github-com-multiformats-go-multihash)
|
||||
("go-github-com-spaolacci-murmur3" ,go-github-com-spaolacci-murmur3)
|
||||
("go-github-com-whyrusleeping-tar-utils" ,go-github-com-whyrusleeping-tar-utils)
|
||||
("go-golang-org-x-crypto-union" ,(go-golang-org-x-crypto-union))
|
||||
("go-github-com-btcsuite-btcd-btcec" ,go-github-com-btcsuite-btcd-btcec)
|
||||
("go-github-com-gogo-protobuf-proto" ,go-github-com-gogo-protobuf-proto)
|
||||
("go-github-com-sabhiram-go-gitignore" ,go-github-com-sabhiram-go-gitignore)
|
||||
("go-github-com-urfave-cli" ,go-github-com-urfave-cli)
|
||||
("go-github-com-whyrusleeping-json-filter" ,go-github-com-whyrusleeping-json-filter)
|
||||
("go-github-com-whyrusleeping-progmeter" ,go-github-com-whyrusleeping-progmeter)
|
||||
("go-github-com-whyrusleeping-stump" ,go-github-com-whyrusleeping-stump)))
|
||||
(home-page "https://github.com/whyrusleeping/gx")
|
||||
(synopsis "@command{gx} is a packaging tool built around the
|
||||
distributed, content addressed filesystem IPFS. It aims to be flexible,
|
||||
powerful and simple.")
|
||||
(description "XXX")
|
||||
(license #f))))
|
||||
|
||||
(define-public go-ipfs
|
||||
(let ((commit
|
||||
"9bf4e4145ea897ced2f9aa2087296b3beda6e941")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "go-ipfs")
|
||||
(version (git-version "0.4.17" revision commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/ipfs/go-ipfs.git")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"01zqll453gbjjfkm6jvpp49i1al8ic3pdg3ivqhyiilcsmhf8b8i"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
;; install_unsupported:
|
||||
;; @echo "note: this command has yet to be tested to build in the system you are using"
|
||||
;; @echo "installing gx"
|
||||
;; go get -v -u github.com/whyrusleeping/gx
|
||||
;; go get -v -u github.com/whyrusleeping/gx-go
|
||||
;; @echo check gx and gx-go
|
||||
;; gx -v && gx-go -v
|
||||
;; @echo downloading dependencies
|
||||
;; gx install --global
|
||||
;; @echo "installing go-ipfs"
|
||||
;; go install -v -tags nofuse ./cmd/ipfs
|
||||
'(#:import-path "github.com/ipfs/go-ipfs/cmd/ipfs"
|
||||
#:unpack-path "github.com/ipfs/go-ipfs"
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(add-before 'reset-gzip-timestamps 'make-gzip-archive-writable
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(map (lambda (file)
|
||||
(make-file-writable file))
|
||||
(find-files
|
||||
(assoc-ref outputs "out")
|
||||
".*\\.gz$"))
|
||||
#t)))))
|
||||
(native-inputs `())
|
||||
(home-page "https://ipfs.io")
|
||||
(synopsis "IPFS implementation in Go ")
|
||||
(description "IPFS is a global, versioned, peer-to-peer filesystem. It
|
||||
combines good ideas from Git, BitTorrent, Kademlia, SFS, and the Web. It is
|
||||
like a single bittorrent swarm, exchanging git objects. IPFS provides an
|
||||
interface as simple as the HTTP web, but with permanence built in. You can
|
||||
also mount the world at /ipfs.")
|
||||
(license license:expat))))
|
||||
@@ -298,100 +298,6 @@ structs in the Go programming language.")
|
||||
(home-page "https://github.com/gobwas/glob")
|
||||
(license expat))))
|
||||
|
||||
(define* (go-github-com-gogo-protobuf-union
|
||||
#:optional (packages (list go-github-com-gogo-protobuf
|
||||
go-github-com-gogo-protobuf-protoc-gen-gogo)))
|
||||
(package
|
||||
(name "go-github-com-gogo-protobuf-union")
|
||||
(version (package-version go-github-com-gogo-protobuf))
|
||||
(source #f)
|
||||
(build-system trivial-build-system)
|
||||
(arguments
|
||||
'(#:modules ((guix build union))
|
||||
#:builder (begin
|
||||
(use-modules (ice-9 match)
|
||||
(guix build union))
|
||||
(match %build-inputs
|
||||
(((names . directories) ...)
|
||||
(union-build (assoc-ref %outputs "out")
|
||||
directories)
|
||||
#t)))))
|
||||
(inputs (map (lambda (package)
|
||||
(list (package-name package) package))
|
||||
packages))
|
||||
(synopsis "Union of Go protobuf libraries")
|
||||
(description "This is a union of Go protobuf libraries")
|
||||
(home-page (package-home-page go-github-com-gogo-protobuf))
|
||||
(license (package-license go-github-com-gogo-protobuf))))
|
||||
|
||||
(define-public go-github-com-gogo-protobuf
|
||||
(let ((commit "160de10b2537169b5ae3e7e221d28269ef40d311")
|
||||
(revision "2"))
|
||||
(package
|
||||
(name "go-github-com-gogo-protobuf")
|
||||
(version (git-version "0.5" revision commit))
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/gogo/protobuf")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"0hxq28sgxym04rv0q40gpwkh4ni359q21hq3g78wwxwx4qfd4zwm"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
`(#:import-path "github.com/gogo/protobuf/proto"
|
||||
#:unpack-path "github.com/gogo/protobuf"))
|
||||
(propagated-inputs
|
||||
`(("go-github-com-gogo-protobuf-protoc-gen-gogo"
|
||||
,go-github-com-gogo-protobuf-protoc-gen-gogo)))
|
||||
(synopsis "Protocol Buffers for Go with Gadgets")
|
||||
(description "Gogoprotobuf is a fork of golang/protobuf with extra code
|
||||
generation features. This code generation is used to achieve:
|
||||
@itemize
|
||||
@item fast marshalling and unmarshalling
|
||||
@item more canonical Go structures
|
||||
@item goprotobuf compatibility
|
||||
@item less typing by optionally generating extra helper code
|
||||
@item peace of mind by optionally generating test and benchmark code
|
||||
@item other serialization formats
|
||||
@end itemize")
|
||||
(home-page "https://github.com/gogo/protobuf")
|
||||
(license bsd-3))))
|
||||
|
||||
(define-public go-github-com-gogo-protobuf-protoc-gen-gogo
|
||||
(let ((commit "efccd33a0c20aa078705571d5ddbfa14c8395a63")
|
||||
(revision "0"))
|
||||
(package
|
||||
(name "go-github-com-gogo-protobuf-protoc-gen-gogo")
|
||||
(version (git-version "0.2" revision commit))
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url "https://github.com/gogo/protobuf")
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
"09kfa3aqmhh7p0rc6wd4fw5cjccidsk9vgcy13albv0g8vnbmmgw"))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
`(#:import-path "github.com/gogo/protobuf/protoc-gen-gogo"
|
||||
#:unpack-path "github.com/gogo/protobuf"))
|
||||
(synopsis "Protocol Buffers for Go with Gadgets")
|
||||
(description "Gogoprotobuf is a fork of golang/protobuf with extra code
|
||||
generation features. This code generation is used to achieve:
|
||||
@itemize
|
||||
@item fast marshalling and unmarshalling
|
||||
@item more canonical Go structures
|
||||
@item goprotobuf compatibility
|
||||
@item less typing by optionally generating extra helper code
|
||||
@item peace of mind by optionally generating test and benchmark code
|
||||
@item other serialization formats
|
||||
@end itemize")
|
||||
(home-page "https://github.com/gogo/protobuf")
|
||||
(license bsd-3))))
|
||||
|
||||
(define-public go-github-com-golang-groupcache-lru
|
||||
(let ((commit "84a468cf14b4376def5d68c722b139b881c450a4")
|
||||
@@ -822,44 +728,6 @@ generation.")
|
||||
(home-page "https://github.com/vitrun/qart")
|
||||
(license bsd-3))))
|
||||
|
||||
;; Go searches for library modules by looking in the GOPATH environment
|
||||
;; variable. This variable is a list of paths. However, Go does not
|
||||
;; keep searching on GOPATH if it tries and fails to import a module.
|
||||
;; So, we use a union for packages sharing a namespace.
|
||||
(define* (go-golang-org-x-crypto-union #:optional
|
||||
(packages (list go-golang-org-x-crypto-blowfish
|
||||
go-golang-org-x-crypto-bcrypt
|
||||
go-golang-org-x-crypto-tea
|
||||
go-golang-org-x-crypto-xtea
|
||||
go-golang-org-x-crypto-pbkdf2
|
||||
go-golang-org-x-crypto-twofish
|
||||
go-golang-org-x-crypto-cast5
|
||||
go-golang-org-x-crypto-salsa20)))
|
||||
(package
|
||||
(name "go-golang-org-x-crypto")
|
||||
(version (package-version go-golang-org-x-crypto-bcrypt))
|
||||
(source #f)
|
||||
(build-system trivial-build-system)
|
||||
(arguments
|
||||
'(#:modules ((guix build union))
|
||||
#:builder (begin
|
||||
(use-modules (ice-9 match)
|
||||
(guix build union))
|
||||
(match %build-inputs
|
||||
(((names . directories) ...)
|
||||
(union-build (assoc-ref %outputs "out")
|
||||
directories)
|
||||
#t)))))
|
||||
(inputs (map (lambda (package)
|
||||
(list (package-name package) package))
|
||||
packages))
|
||||
(synopsis "Union of the Go x crypto libraries")
|
||||
(description "A union of the Golang cryptographic libraries. A
|
||||
union is required because `go build` assumes that all of the headers and
|
||||
libraries are in the same directory.")
|
||||
(home-page (package-home-page go-golang-org-x-crypto-bcrypt))
|
||||
(license (package-license go-golang-org-x-crypto-bcrypt))))
|
||||
|
||||
(define* (go-golang-org-x-net-union #:optional
|
||||
(packages (list go-golang-org-x-net-ipv4
|
||||
go-golang-org-x-net-bpf
|
||||
|
||||
60
guix/build/gx.scm
Normal file
60
guix/build/gx.scm
Normal file
@@ -0,0 +1,60 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (guix build gx)
|
||||
#:use-module (guix build utils)
|
||||
#:use-module (ice-9 popen)
|
||||
#:export (gx-fetch))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; This is the build-side support code of (guix gx-download). It allows a
|
||||
;;; gx hash to be fetched.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define* (gx-fetch hash directory
|
||||
#:key (gx-command "gx"))
|
||||
"Fetch IPFS HASH into DIRECTORY. HASH must be a valid IPFS hash.
|
||||
Return #t on success, #f otherwise."
|
||||
|
||||
(mkdir-p directory)
|
||||
|
||||
(with-directory-excursion directory
|
||||
;; TODO: Silence verbose output.
|
||||
|
||||
;; Initialization is interactive, but we can shut it up by piping it to
|
||||
;; nothing.
|
||||
(let ((port (open-pipe* OPEN_WRITE gx-command "init")))
|
||||
(display "\n" port)
|
||||
(if (not (eqv? 0 (status:exit-val (close-pipe port))))
|
||||
(error "Cannot initialize gx package")))
|
||||
|
||||
;; Fetch to the "vendor" directory.
|
||||
(let ((port (open-pipe* OPEN_WRITE gx-command "import" "--local" hash)))
|
||||
(display "N\n" port)
|
||||
(if (not (eqv? 0 (status:exit-val (close-pipe port))))
|
||||
(error "Cannot import gx package")))
|
||||
|
||||
(delete-file "package.json")
|
||||
(mkdir-p "gx/ipfs")
|
||||
(rename-file (string-append "vendor/gx/ipfs/" hash) (string-append "gx/ipfs/" hash))
|
||||
(delete-file-recursively "vendor")
|
||||
#t))
|
||||
|
||||
;;; gx.scm ends here
|
||||
131
guix/gx-download.scm
Normal file
131
guix/gx-download.scm
Normal file
@@ -0,0 +1,131 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (guix gx-download)
|
||||
#:use-module (guix gexp)
|
||||
#:use-module (guix store)
|
||||
#:use-module (guix monads)
|
||||
#:use-module (guix records)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix modules)
|
||||
;; #:autoload (guix build-system gnu) (standard-packages)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 vlist)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:export (gx-reference
|
||||
gx-reference?
|
||||
gx-reference-hash
|
||||
|
||||
gx-fetch
|
||||
gx-version
|
||||
gx-file-name))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; An <origin> method that uses gx to fetch a specific hash over IPFS.
|
||||
;;; See https://github.com/whyrusleeping/gx.
|
||||
;;; The hash is specified with a <gx-reference> object.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define-record-type* <gx-reference>
|
||||
gx-reference make-gx-reference
|
||||
gx-reference?
|
||||
(hash gx-reference-hash))
|
||||
|
||||
(define (gx-package)
|
||||
"Return the default gx package."
|
||||
(let ((distro (resolve-interface '(gnu packages ipfs))))
|
||||
(module-ref distro 'gx)))
|
||||
|
||||
(define* (gx-fetch ref hash-algo hash
|
||||
#:optional name
|
||||
#:key (system (%current-system)) (guile (default-guile))
|
||||
(gx (gx-package)))
|
||||
"Return a fixed-output derivation that fetches REF, a <gx-reference>
|
||||
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 inputs
|
||||
;; ;; When doing 'git clone --recursive', we need sed, grep, etc. to be
|
||||
;; ;; available so that 'git submodule' works.
|
||||
;; ;; (if (git-reference-recursive? ref)
|
||||
;; ;; (standard-packages)
|
||||
;; ;; '())
|
||||
;; )
|
||||
|
||||
;; (define zlib
|
||||
;; (module-ref (resolve-interface '(gnu packages compression)) 'zlib))
|
||||
|
||||
;; (define config.scm
|
||||
;; (scheme-file "config.scm"
|
||||
;; #~(begin
|
||||
;; (define-module (guix config)
|
||||
;; #:export (%libz))
|
||||
|
||||
;; (define %libz
|
||||
;; #+(file-append zlib "/lib/libz")))))
|
||||
|
||||
;; (define modules
|
||||
;; (cons `((guix config) => ,config.scm)
|
||||
;; (delete '(guix config)
|
||||
;; (source-module-closure '((guix build git)
|
||||
;; (guix build utils)
|
||||
;; (guix build download-nar))))))
|
||||
|
||||
(define build
|
||||
(with-imported-modules '((guix build gx)
|
||||
(guix build utils))
|
||||
#~(begin
|
||||
(use-modules (guix build gx)
|
||||
;; (guix build utils)
|
||||
;; (guix build download-nar)
|
||||
;; (ice-9 match)
|
||||
)
|
||||
|
||||
;; The 'git submodule' commands expects Coreutils, sed,
|
||||
;; grep, etc. to be in $PATH.
|
||||
;; (set-path-environment-variable "PATH" '("bin")
|
||||
;; (match '#+inputs
|
||||
;; (((names dirs outputs ...) ...)
|
||||
;; dirs)))
|
||||
|
||||
(or (gx-fetch '#$(gx-reference-hash ref)
|
||||
#$output
|
||||
#:gx-command (string-append #+gx "/bin/gx"))
|
||||
;; (download-nar #$output)
|
||||
))))
|
||||
|
||||
(mlet %store-monad ((guile (package->derivation guile system)))
|
||||
(gexp->derivation (or name "gx-checkout") build
|
||||
#:system system
|
||||
#:local-build? #t
|
||||
#:hash-algo hash-algo
|
||||
#:hash hash
|
||||
#:recursive? #t
|
||||
#:guile-for-build guile)))
|
||||
|
||||
(define (gx-version version revision hash)
|
||||
"Return the version string for packages using gx-download."
|
||||
(string-append version "-" revision "." (string-take hash 7)))
|
||||
|
||||
(define (gx-file-name name version)
|
||||
"Return the file-name for packages using gx-download."
|
||||
(string-append name "-" version "-checkout"))
|
||||
|
||||
;;; gx-download.scm ends here
|
||||
356
guix/import/gopkg.scm
Normal file
356
guix/import/gopkg.scm
Normal file
@@ -0,0 +1,356 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (guix import gopkg)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 regex)
|
||||
#:use-module ((ice-9 rdelim) #:select (read-line))
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (texinfo string-utils) ; transform-string
|
||||
#:use-module (gcrypt hash)
|
||||
;; #:use-module (guix hash)
|
||||
#:use-module (guix base32)
|
||||
#:use-module (guix serialization)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix build utils)
|
||||
#:use-module ((guix licenses) #:prefix license:)
|
||||
#:export (gopkg->guix-package))
|
||||
|
||||
(define (vcs-file? file stat)
|
||||
;; TODO: Factorize
|
||||
(case (stat:type stat)
|
||||
((directory)
|
||||
(member (basename file) '(".bzr" ".git" ".hg" ".svn" "CVS")))
|
||||
((regular)
|
||||
;; Git sub-modules have a '.git' file that is a regular text file.
|
||||
(string=? (basename file) ".git"))
|
||||
(else
|
||||
#f)))
|
||||
|
||||
(define (file->hash-base32 file)
|
||||
"Return hash of FILE in nix base32 sha256 format. If FILE is a directory,
|
||||
exclude vcs files."
|
||||
(let-values (((port get-hash) (open-sha256-port)))
|
||||
(write-file file port #:select? (negate vcs-file?))
|
||||
(force-output port)
|
||||
(bytevector->nix-base32-string (get-hash))))
|
||||
|
||||
(define (git->hash url commit file)
|
||||
"Clone git repository and return FILE hash in nix base32 sha256 format."
|
||||
(if (not (file-exists? (string-append file "/.git")))
|
||||
(git-fetch url commit file #:recursive? #f))
|
||||
(file->hash-base32 file))
|
||||
|
||||
(define (git-ref->commit path tag)
|
||||
"Return commit number coresponding to git TAG. Return \"XXX\" if tag is not
|
||||
found."
|
||||
(define (loop port)
|
||||
(let ((line (read-line port)))
|
||||
(cond
|
||||
((eof-object? line) ; EOF
|
||||
(begin
|
||||
(close-port port)
|
||||
"XXX"))
|
||||
((string-match tag line) ; Match tag
|
||||
(let ((commit (car (string-split (transform-string line #\tab " ")
|
||||
#\ ))))
|
||||
commit))
|
||||
(else ; Else
|
||||
(loop port)))))
|
||||
|
||||
(let ((file (if (file-exists? (string-append path "/.git/packed-refs"))
|
||||
(string-append path "/.git/packed-refs")
|
||||
(string-append path "/.git/FETCH_HEAD"))))
|
||||
(loop (open-input-file file))))
|
||||
|
||||
(define* (git-fetch url commit directory
|
||||
#:key (git-command "git") recursive?)
|
||||
"Fetch COMMIT from URL into DIRECTORY. COMMIT must be a valid Git commit
|
||||
identifier. When RECURSIVE? is true, all the sub-modules of URL are fetched,
|
||||
recursively. Return #t on success, #f otherwise."
|
||||
(mkdir-p directory)
|
||||
|
||||
(with-directory-excursion directory
|
||||
(invoke git-command "init")
|
||||
(invoke git-command "remote" "add" "origin" url)
|
||||
(if (zero? (system* git-command "fetch" "--depth" "1" "origin" commit))
|
||||
(invoke git-command "checkout" "FETCH_HEAD")
|
||||
(begin
|
||||
(invoke git-command "fetch" "origin")
|
||||
(if (not (zero? (system* git-command "checkout" commit)))
|
||||
(let ((commit-hash (git-ref->commit directory commit)))
|
||||
(invoke git-command "checkout" "master")
|
||||
(if (not (equal? "XXX" commit-hash)) ;HACK else stay on master
|
||||
(zero? (system* git-command "checkout" commit-hash))))
|
||||
#t)))))
|
||||
|
||||
;;
|
||||
;; Append attributes.
|
||||
;;
|
||||
|
||||
(define (append-inputs inputs name)
|
||||
"Return list with new input corresponding to package NAME."
|
||||
(let ((unquote-name (list 'unquote (string->symbol name))))
|
||||
(append inputs (list (list name unquote-name)))))
|
||||
|
||||
;;
|
||||
;; Parse attributes.
|
||||
;;
|
||||
|
||||
(define (url->package-name url)
|
||||
"Compute URL and return package name."
|
||||
(let* ((url-no-slash (string-replace-substring url "/" "-"))
|
||||
(url-no-slash-no-dot (string-replace-substring url-no-slash
|
||||
"." "-")))
|
||||
(string-downcase (string-append "go-" url-no-slash-no-dot))))
|
||||
|
||||
(define (cut-url url)
|
||||
"Return URL without protocol prefix and git file extension."
|
||||
(string-replace-substring
|
||||
(cond
|
||||
((string-match "http://" url)
|
||||
(string-replace-substring url "http://" ""))
|
||||
((string-match "https://" url)
|
||||
(string-replace-substring url "https://" ""))
|
||||
((string-match "git://" url)
|
||||
(string-replace-substring url "git://" ""))
|
||||
(else
|
||||
url))
|
||||
".git" ""))
|
||||
|
||||
(define (url->dn url)
|
||||
"Return the web site DN form url 'gnu.org/software/guix' --> 'gnu.org'"
|
||||
(car (string-split url #\/)))
|
||||
|
||||
(define (url->git-url url)
|
||||
(string-append "https://" url ".git"))
|
||||
|
||||
(define (comment? line)
|
||||
"Return #t if LINE start with comment delimiter, else return #f."
|
||||
(eq? (string-ref (string-trim line) 0) #\#))
|
||||
|
||||
(define (empty-line? line)
|
||||
"Return #t if LINE is empty, else #f."
|
||||
(string-null? (string-trim line)))
|
||||
|
||||
(define (attribute? line attribute)
|
||||
"Return #t if LINE contain ATTRIBUTE."
|
||||
(equal? (string-trim-right
|
||||
(string-trim
|
||||
(car (string-split line #\=)))) attribute))
|
||||
|
||||
(define (attribute-by-name line name)
|
||||
"Return attribute value corresponding to NAME."
|
||||
(let* ((line-no-attribut-name (string-replace-substring
|
||||
line
|
||||
(string-append name " = ") ""))
|
||||
(value-no-double-quote (string-replace-substring
|
||||
line-no-attribut-name
|
||||
"\"" "")))
|
||||
(string-trim value-no-double-quote)))
|
||||
|
||||
;;
|
||||
;; Packages functions.
|
||||
;;
|
||||
|
||||
(define (make-go-sexp->package packages dependencies
|
||||
name url version revision
|
||||
commit str-license home-page
|
||||
git-url is-dep? hash)
|
||||
"Create Guix sexp package for Go software NAME. Return new package sexp."
|
||||
(define (package-inputs)
|
||||
(if (not is-dep?)
|
||||
`((native-inputs ,(list 'quasiquote dependencies)))
|
||||
'()))
|
||||
|
||||
(values
|
||||
`(define-public ,(string->symbol name)
|
||||
(let ((commit ,commit)
|
||||
(revision ,revision))
|
||||
(package
|
||||
(name ,name)
|
||||
(version (git-version ,version revision commit))
|
||||
(source (origin
|
||||
(method git-fetch)
|
||||
(uri (git-reference
|
||||
(url ,git-url)
|
||||
(commit commit)))
|
||||
(file-name (git-file-name name version))
|
||||
(sha256
|
||||
(base32
|
||||
,hash))))
|
||||
(build-system go-build-system)
|
||||
(arguments
|
||||
'(#:import-path ,url))
|
||||
,@(package-inputs)
|
||||
(home-page ,home-page)
|
||||
(synopsis "XXX")
|
||||
(description "XXX")
|
||||
(license #f))))))
|
||||
|
||||
(define (create-package->packages+dependencies packages dependencies
|
||||
url version directory
|
||||
revision commit
|
||||
constraint? is-dep?)
|
||||
"Return packages and dependencies with new package sexp corresponding to
|
||||
URL."
|
||||
(call-with-temporary-directory
|
||||
(lambda (dir)
|
||||
(let ((name (url->package-name url))
|
||||
(home-page (string-append "https://" url))
|
||||
(git-url (url->git-url url))
|
||||
(synopsis "XXX")
|
||||
(description "XXX")
|
||||
(license "XXX"))
|
||||
(let ((hash (git->hash (url->git-url url)
|
||||
commit
|
||||
dir))
|
||||
(commit-hash (if (< (string-length commit) 40)
|
||||
(git-ref->commit dir
|
||||
commit)
|
||||
commit)))
|
||||
(values
|
||||
(append packages
|
||||
(list
|
||||
(make-go-sexp->package packages dependencies
|
||||
name url version
|
||||
revision commit-hash
|
||||
license home-page
|
||||
git-url is-dep? hash)))
|
||||
(if constraint?
|
||||
(append-inputs dependencies name)
|
||||
dependencies)))))))
|
||||
|
||||
(define (parse-dependencies->packages+dependencies port constraint?
|
||||
packages dependencies)
|
||||
"Parse one dependencies in PORT, and return packages and dependencies list."
|
||||
(let ((url "XXX")
|
||||
(version "0.0.0")
|
||||
(revision "0")
|
||||
(commit "XXX"))
|
||||
(define (loop port url commit packages dependencies)
|
||||
(let ((line (read-line port)))
|
||||
(cond
|
||||
((eof-object? line) ; EOF
|
||||
(values packages dependencies))
|
||||
((empty-line? line) ; Empty line
|
||||
(if (not (or (equal? "k8s.io" (url->dn url)) ; HACK bypass k8s
|
||||
(equal? "golang.org" (url->dn url)) ; HACK bypass golang
|
||||
(equal? "cloud.google.com" (url->dn url)))) ; HACK bypass cloud.google
|
||||
(create-package->packages+dependencies packages dependencies
|
||||
url version port revision
|
||||
commit
|
||||
constraint? #t)
|
||||
(values packages dependencies)))
|
||||
((comment? line) ; Comment
|
||||
(loop port url commit
|
||||
packages dependencies))
|
||||
((attribute? line "name") ; Name
|
||||
(loop port
|
||||
(attribute-by-name line "name")
|
||||
commit
|
||||
packages dependencies))
|
||||
((attribute? line "revision") ; Revision
|
||||
(loop port
|
||||
url
|
||||
(attribute-by-name line "revision")
|
||||
packages dependencies))
|
||||
((attribute? line "version") ; Version
|
||||
(loop port
|
||||
url
|
||||
(attribute-by-name line "version")
|
||||
packages dependencies))
|
||||
((attribute? line "branch") ; Branch
|
||||
(loop port
|
||||
url
|
||||
(attribute-by-name line "branch")
|
||||
packages dependencies))
|
||||
((string-match "=" line) ; Other options
|
||||
(loop port url commit
|
||||
packages dependencies))
|
||||
(else (loop port url commit
|
||||
packages dependencies)))))
|
||||
(loop port url commit
|
||||
packages dependencies)))
|
||||
|
||||
(define (parse-toml->packages+dependencies port packages dependencies)
|
||||
"Read toml file on PORT and return all dependencies packages sexp and list
|
||||
of constraint dependencies."
|
||||
(define (loop port packages dependencies)
|
||||
(let ((line (read-line port)))
|
||||
(cond
|
||||
((eof-object? line) ; EOF
|
||||
(values packages dependencies))
|
||||
((empty-line? line) ; Empty line
|
||||
(loop port packages dependencies))
|
||||
((comment? line) ; Comment
|
||||
(loop port packages dependencies))
|
||||
((equal? line "[prune]") ; Ignored
|
||||
(loop port packages dependencies))
|
||||
((equal? "[[constraint]]" line) ; Direct dependencies
|
||||
(let-values (((packages dependencies)
|
||||
(parse-dependencies->packages+dependencies port #t
|
||||
packages
|
||||
dependencies)))
|
||||
(loop port packages dependencies)))
|
||||
((equal? "[[override]]" line) ; Dependencies of dependencies
|
||||
(let-values (((packages dependencies)
|
||||
(parse-dependencies->packages+dependencies port #f
|
||||
packages
|
||||
dependencies)))
|
||||
(loop port packages dependencies)))
|
||||
(else (loop port packages dependencies)))))
|
||||
(loop port packages dependencies))
|
||||
|
||||
(define (gopkg-dep->packages+dependencies path)
|
||||
"Open toml file if exist and parse it and return packages sexp and
|
||||
dependencies list. Or return two empty list if file not found."
|
||||
(if (file-exists? path)
|
||||
(let ((port (open-input-file path)))
|
||||
(let-values (((packages dependencies)
|
||||
(parse-toml->packages+dependencies port
|
||||
'() '())))
|
||||
(close-port port)
|
||||
(values packages dependencies)))
|
||||
(values '() '())))
|
||||
|
||||
;;
|
||||
;; Entry point.
|
||||
;;
|
||||
|
||||
(define (gopkg->guix-package url branch)
|
||||
"Create package for git repository dans branch verison and all dependencies
|
||||
sexp packages with Gopkg.toml file."
|
||||
(let ((name (url->package-name (cut-url url)))
|
||||
(version "0.0.0")
|
||||
(revision "0"))
|
||||
(call-with-temporary-directory
|
||||
(lambda (directory)
|
||||
(git-fetch url branch directory #:recursive? #f)
|
||||
|
||||
(let-values (((packages dependencies)
|
||||
(gopkg-dep->packages+dependencies
|
||||
(string-append directory
|
||||
"/Gopkg.toml"))))
|
||||
(let-values (((packages dependencies)
|
||||
(create-package->packages+dependencies packages dependencies
|
||||
(cut-url url) version
|
||||
directory
|
||||
revision branch
|
||||
#f #f)))
|
||||
(values packages)))))))
|
||||
@@ -75,7 +75,7 @@ rather than \\n."
|
||||
;;;
|
||||
|
||||
(define importers '("gnu" "nix" "pypi" "cpan" "hackage" "stackage" "elpa" "gem"
|
||||
"cran" "crate" "texlive" "json" "opam"))
|
||||
"cran" "crate" "texlive" "json" "opam" "gopkg"))
|
||||
|
||||
(define (resolve-importer name)
|
||||
(let ((module (resolve-interface
|
||||
|
||||
99
guix/scripts/import/gopkg.scm
Normal file
99
guix/scripts/import/gopkg.scm
Normal file
@@ -0,0 +1,99 @@
|
||||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
|
||||
;;;
|
||||
;;; 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (guix scripts import gopkg)
|
||||
#:use-module (guix ui)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix scripts)
|
||||
#:use-module (guix import gopkg)
|
||||
#:use-module (guix scripts import)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-gopkg))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Command-line options.
|
||||
;;;
|
||||
|
||||
(define %default-options
|
||||
'())
|
||||
|
||||
(define (show-help)
|
||||
(display (G_ "Usage: guix import gopkg PACKAGE-URL BRANCH
|
||||
Import and convert the Git repository with TOML file to a Guix package
|
||||
using PACKAGE-URL and matching BRANCH.\n"))
|
||||
(display (G_ "
|
||||
-h, --help display this help and exit"))
|
||||
(display (G_ "
|
||||
-V, --version display version information and exit"))
|
||||
(newline)
|
||||
(show-bug-report-information))
|
||||
|
||||
(define %options
|
||||
;; Specification of the command-line options.
|
||||
(cons* (option '(#\h "help") #f #f
|
||||
(lambda args
|
||||
(show-help)
|
||||
(exit 0)))
|
||||
(option '(#\V "version") #f #f
|
||||
(lambda args
|
||||
(show-version-and-exit "guix import gopkg")))
|
||||
%standard-import-options))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Entry point.
|
||||
;;;
|
||||
|
||||
(define (guix-import-gopkg . args)
|
||||
(define (parse-options)
|
||||
;; Return the alist of option values.
|
||||
(args-fold* args %options
|
||||
(lambda (opt name arg result)
|
||||
(leave (G_ "~A: unrecognized option~%") name))
|
||||
(lambda (arg result)
|
||||
(alist-cons 'argument arg result))
|
||||
%default-options))
|
||||
|
||||
(let* ((opts (parse-options))
|
||||
(args (filter-map (match-lambda
|
||||
(('argument . value)
|
||||
value)
|
||||
(_ #f))
|
||||
(reverse opts))))
|
||||
(match args
|
||||
((package-url branch)
|
||||
(let ((sexp (gopkg->guix-package package-url branch)))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||
package-url))
|
||||
sexp))
|
||||
((package-url)
|
||||
(let ((sexp (gopkg->guix-package package-url "master")))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||
package-url))
|
||||
sexp))
|
||||
(()
|
||||
(leave (G_ "too few arguments~%")))
|
||||
((many ...)
|
||||
(leave (G_ "too many arguments~%"))))))
|
||||
Reference in New Issue
Block a user