2013-01-05 18:47:50 -05:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2021-03-05 03:41:40 -05:00
|
|
|
|
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
|
2015-07-05 13:11:04 -04:00
|
|
|
|
;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
|
2016-02-21 18:29:54 -05:00
|
|
|
|
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
|
2016-07-22 13:55:47 -04:00
|
|
|
|
;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
|
2016-08-01 05:05:28 -04:00
|
|
|
|
;;; Copyright © 2016 David Craven <david@craven.ch>
|
2022-03-28 17:03:03 -04:00
|
|
|
|
;;; Copyright © 2016, 2017, 2020, 2022 Efraim Flashner <efraim@flashner.co.il>
|
2017-01-27 14:48:37 -05:00
|
|
|
|
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
|
2019-03-15 13:02:51 -04:00
|
|
|
|
;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
|
2012-11-12 17:10:26 -05:00
|
|
|
|
;;;
|
2013-01-05 18:47:50 -05:00
|
|
|
|
;;; This file is part of GNU Guix.
|
2012-11-12 17:10:26 -05:00
|
|
|
|
;;;
|
2013-01-05 18:47:50 -05:00
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
2012-11-12 17:10:26 -05:00
|
|
|
|
;;; 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.
|
|
|
|
|
;;;
|
2013-01-05 18:47:50 -05:00
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
2012-11-12 17:10:26 -05:00
|
|
|
|
;;; 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
|
2013-01-05 18:47:50 -05:00
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
2012-11-12 17:10:26 -05:00
|
|
|
|
|
|
|
|
|
(define-module (guix download)
|
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:use-module (guix derivations)
|
|
|
|
|
#:use-module (guix packages)
|
monads: Move '%store-monad' and related procedures where they belong.
This turns (guix monads) into a generic module for monads, and moves the
store monad and related monadic procedures in their corresponding
module.
* guix/monads.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file, package-file, package->derivation,
package->cross-derivation, origin->derivation, imported-modules,
compiled, modules, built-derivations, run-with-store): Move to...
* guix/store.scm (store-return, store-bind, %store-monad, store-lift,
text-file, interned-file): ... here.
(%guile-for-build): New variable.
(run-with-store): Moved from monads.scm. Remove default value for
#:guile-for-build.
* guix/packages.scm (default-guile): Export.
(set-guile-for-build): New procedure.
(package-file, package->derivation, package->cross-derivation,
origin->derivation): Moved from monads.scm.
* guix/derivations.scm (%guile-for-build): Remove.
(imported-modules): Rename to...
(%imported-modules): ... this.
(compiled-modules): Rename to...
(%compiled-modules): ... this.
(built-derivations, imported-modules, compiled-modules): New
procedures.
* gnu/services/avahi.scm, gnu/services/base.scm, gnu/services/dbus.scm,
gnu/services/dmd.scm, gnu/services/networking.scm,
gnu/services/ssh.scm, gnu/services/xorg.scm, gnu/system/install.scm,
gnu/system/linux-initrd.scm, gnu/system/shadow.scm, guix/download.scm,
guix/gexp.scm, guix/git-download.scm, guix/profiles.scm,
guix/svn-download.scm, tests/monads.scm: Adjust imports accordingly.
* guix/monad-repl.scm (default-guile-derivation): New procedure.
(store-monad-language, run-in-store): Use it.
* build-aux/hydra/gnu-system.scm (qemu-jobs): Add explicit
'set-guile-for-build' call.
* guix/scripts/archive.scm (derivation-from-expression): Likewise.
* guix/scripts/build.scm (options/resolve-packages): Likewise.
* guix/scripts/environment.scm (guix-environment): Likewise.
* guix/scripts/system.scm (guix-system): Likewise.
* doc/guix.texi (The Store Monad): Adjust module names accordingly.
2015-01-14 07:34:52 -05:00
|
|
|
|
#:use-module (guix store)
|
2021-03-19 07:02:08 -04:00
|
|
|
|
#:autoload (guix build download) (url-fetch)
|
2014-05-01 15:07:52 -04:00
|
|
|
|
#:use-module (guix monads)
|
|
|
|
|
#:use-module (guix gexp)
|
2012-11-12 17:10:26 -05:00
|
|
|
|
#:use-module (guix utils)
|
2013-10-12 10:39:10 -04:00
|
|
|
|
#:use-module (web uri)
|
2013-01-20 16:28:38 -05:00
|
|
|
|
#:use-module (srfi srfi-1)
|
2012-11-12 17:20:06 -05:00
|
|
|
|
#:use-module (srfi srfi-26)
|
2012-11-13 16:57:36 -05:00
|
|
|
|
#:export (%mirrors
|
2021-05-15 06:19:03 -04:00
|
|
|
|
%disarchive-mirrors
|
2021-10-14 09:41:43 -04:00
|
|
|
|
%download-fallback-test
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(url-fetch* . url-fetch)
|
2019-06-14 09:04:09 -04:00
|
|
|
|
url-fetch/executable
|
2016-02-21 18:29:54 -05:00
|
|
|
|
url-fetch/tarbomb
|
2017-01-25 07:16:00 -05:00
|
|
|
|
url-fetch/zipbomb
|
2013-04-21 16:40:23 -04:00
|
|
|
|
download-to-store))
|
2012-11-12 17:10:26 -05:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; Produce fixed-output derivations with data fetched over HTTP or FTP.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2012-11-12 17:20:06 -05:00
|
|
|
|
(define %mirrors
|
2023-08-11 11:21:42 -04:00
|
|
|
|
;; Mirror lists used when `mirror://' URLs are passed. The first mirror
|
|
|
|
|
;; entry of each set should ideally be the most authoritative one, as that's
|
|
|
|
|
;; what the generic HTML updater will pick to look for updates, with
|
|
|
|
|
;; possible exceptions when the authoritative mirror is too slow.
|
2012-11-12 17:20:06 -05:00
|
|
|
|
(let* ((gnu-mirrors
|
|
|
|
|
'(;; This one redirects to a (supposedly) nearby and (supposedly)
|
|
|
|
|
;; up-to-date mirror.
|
2017-09-11 05:51:50 -04:00
|
|
|
|
"https://ftpmirror.gnu.org/gnu/"
|
2012-11-12 17:20:06 -05:00
|
|
|
|
|
|
|
|
|
"ftp://ftp.cs.tu-berlin.de/pub/gnu/"
|
|
|
|
|
"ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/gnu/"
|
|
|
|
|
|
|
|
|
|
;; This one is the master repository, and thus it's always
|
|
|
|
|
;; up-to-date.
|
|
|
|
|
"http://ftp.gnu.org/pub/gnu/")))
|
|
|
|
|
`((gnu ,@gnu-mirrors)
|
|
|
|
|
(gcc
|
|
|
|
|
"ftp://ftp.nluug.nl/mirror/languages/gcc/"
|
|
|
|
|
"ftp://ftp.fu-berlin.de/unix/languages/gcc/"
|
|
|
|
|
"ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/"
|
|
|
|
|
"ftp://gcc.gnu.org/pub/gcc/"
|
|
|
|
|
,@(map (cut string-append <> "/gcc") gnu-mirrors))
|
|
|
|
|
(gnupg
|
2017-08-09 15:53:24 -04:00
|
|
|
|
"http://artfiles.org/gnupg.org"
|
|
|
|
|
"http://www.crysys.hu/"
|
|
|
|
|
"https://gnupg.org/ftp/gcrypt/"
|
2014-11-26 13:52:11 -05:00
|
|
|
|
"ftp://mirrors.dotsrc.org/gcrypt/"
|
2012-11-12 17:20:06 -05:00
|
|
|
|
"ftp://mirror.cict.fr/gnupg/"
|
2014-11-26 13:52:11 -05:00
|
|
|
|
"ftp://ftp.franken.de/pub/crypt/mirror/ftp.gnupg.org/gcrypt/"
|
|
|
|
|
"ftp://ftp.freenet.de/pub/ftp.gnupg.org/gcrypt/"
|
|
|
|
|
"ftp://ftp.hi.is/pub/mirrors/gnupg/"
|
|
|
|
|
"ftp://ftp.heanet.ie/mirrors/ftp.gnupg.org/gcrypt/"
|
|
|
|
|
"ftp://ftp.bit.nl/mirror/gnupg/"
|
|
|
|
|
"ftp://ftp.surfnet.nl/pub/security/gnupg/"
|
|
|
|
|
"ftp://ftp.iasi.roedu.net/pub/mirrors/ftp.gnupg.org/"
|
|
|
|
|
"ftp://ftp.sunet.se/pub/security/gnupg/"
|
|
|
|
|
"ftp://mirror.switch.ch/mirror/gnupg/"
|
|
|
|
|
"ftp://mirror.tje.me.uk/pub/mirrors/ftp.gnupg.org/"
|
|
|
|
|
"ftp://ftp.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/"
|
|
|
|
|
"ftp://ftp.ring.gr.jp/pub/net/gnupg/"
|
|
|
|
|
"ftp://ftp.gnupg.org/gcrypt/")
|
2013-03-05 04:16:17 -05:00
|
|
|
|
(gnome
|
2017-02-01 17:41:12 -05:00
|
|
|
|
"https://download.gnome.org/"
|
2023-07-08 20:00:03 -04:00
|
|
|
|
"http://ftp.gnome.org/pub/GNOME/")
|
2016-10-29 12:30:58 -04:00
|
|
|
|
(hackage
|
2016-11-01 04:28:24 -04:00
|
|
|
|
"http://hackage.haskell.org/")
|
2020-07-20 14:38:51 -04:00
|
|
|
|
(savannah ; http://download0.savannah.gnu.org/mirmon/savannah/
|
2022-09-01 05:01:51 -04:00
|
|
|
|
"https://download.savannah.gnu.org/releases/"
|
2022-11-12 19:00:04 -05:00
|
|
|
|
"https://de.freedif.org/savannah/"
|
2022-09-01 05:01:51 -04:00
|
|
|
|
"https://ftp.cc.uoc.gr/mirrors/nongnu.org/"
|
|
|
|
|
"http://ftp.twaren.net/Unix/NonGNU/" ; https appears unsupported
|
|
|
|
|
"https://mirror.csclub.uwaterloo.ca/nongnu/"
|
|
|
|
|
"https://nongnu.askapache.com/"
|
|
|
|
|
"https://savannah.c3sl.ufpr.br/"
|
|
|
|
|
"https://download-mirror.savannah.gnu.org/releases/"
|
2017-11-12 17:40:52 -05:00
|
|
|
|
"ftp://ftp.twaren.net/Unix/NonGNU/"
|
|
|
|
|
"ftp://mirror.csclub.uwaterloo.ca/nongnu/"
|
|
|
|
|
"ftp://mirror.publicns.net/pub/nongnu/"
|
|
|
|
|
"ftp://savannah.c3sl.ufpr.br/")
|
2016-05-30 04:37:03 -04:00
|
|
|
|
(sourceforge ; https://sourceforge.net/p/forge/documentation/Mirrors/
|
2016-07-22 13:55:47 -04:00
|
|
|
|
"http://downloads.sourceforge.net/project/"
|
2016-07-12 18:32:36 -04:00
|
|
|
|
"http://ufpr.dl.sourceforge.net/project/"
|
|
|
|
|
"http://freefr.dl.sourceforge.net/project/"
|
|
|
|
|
"http://internode.dl.sourceforge.net/project/"
|
|
|
|
|
"http://jaist.dl.sourceforge.net/project/"
|
|
|
|
|
"http://liquidtelecom.dl.sourceforge.net/project/"
|
2017-08-25 01:53:51 -04:00
|
|
|
|
;; "http://nbtelecom.dl.sourceforge.net/project/" ;never returns 404s
|
2016-07-12 18:32:36 -04:00
|
|
|
|
"http://nchc.dl.sourceforge.net/project/"
|
|
|
|
|
"http://netcologne.dl.sourceforge.net/project/"
|
|
|
|
|
"http://netix.dl.sourceforge.net/project/"
|
|
|
|
|
"http://pilotfiber.dl.sourceforge.net/project/"
|
2023-01-21 19:00:00 -05:00
|
|
|
|
"http://tenet.dl.sourceforge.net/project/")
|
2017-02-26 19:32:22 -05:00
|
|
|
|
(netfilter.org ; https://www.netfilter.org/mirrors.html
|
|
|
|
|
"http://ftp.netfilter.org/pub/"
|
|
|
|
|
"ftp://ftp.es.netfilter.org/mirrors/netfilter/"
|
|
|
|
|
"ftp://ftp.hu.netfilter.org/"
|
|
|
|
|
"ftp://www.lt.netfilter.org/pub/")
|
2012-11-27 15:55:53 -05:00
|
|
|
|
(kernel.org
|
2023-11-05 10:27:11 -05:00
|
|
|
|
"https://cdn.kernel.org/pub/"
|
2013-08-25 14:49:03 -04:00
|
|
|
|
"http://ftp.be.debian.org/pub/"
|
2022-09-01 05:01:53 -04:00
|
|
|
|
"https://mirrors.edge.kernel.org/pub/"
|
2017-11-12 17:40:52 -05:00
|
|
|
|
"ftp://ftp.funet.fi/pub/mirrors/ftp.kernel.org/pub/")
|
2013-01-25 15:49:49 -05:00
|
|
|
|
(apache ; from http://www.apache.org/mirrors/dist.html
|
|
|
|
|
"http://www.eu.apache.org/dist/"
|
|
|
|
|
"http://www.us.apache.org/dist/"
|
2020-07-05 02:22:11 -04:00
|
|
|
|
"https://ftp.nluug.nl/internet/apache/"
|
2020-06-12 11:28:36 -04:00
|
|
|
|
"http://apache.mirror.iweb.ca/"
|
2013-01-25 15:49:49 -05:00
|
|
|
|
"http://mirrors.ircam.fr/pub/apache/"
|
2020-06-12 11:28:36 -04:00
|
|
|
|
"http://apache.mirrors.ovh.net/ftp.apache.org/dist/"
|
2014-01-27 17:31:28 -05:00
|
|
|
|
"http://apache-mirror.rbc.ru/pub/apache/"
|
2020-06-12 11:28:36 -04:00
|
|
|
|
"ftp://ftp.osuosl.org/pub/apache/"
|
|
|
|
|
"http://mirrors.ibiblio.org/apache/"
|
2014-01-27 17:31:28 -05:00
|
|
|
|
|
|
|
|
|
;; As a last resort, try the archive.
|
|
|
|
|
"http://archive.apache.org/dist/")
|
2013-02-23 12:59:43 -05:00
|
|
|
|
(xorg ; from http://www.x.org/wiki/Releases/Download
|
2013-03-03 13:50:26 -05:00
|
|
|
|
"http://www.x.org/releases/" ; main mirrors
|
2017-11-12 17:40:52 -05:00
|
|
|
|
"http://mirror.csclub.uwaterloo.ca/x.org/" ; North America
|
2013-02-23 12:59:43 -05:00
|
|
|
|
"http://xorg.mirrors.pair.com/"
|
2017-11-12 17:40:52 -05:00
|
|
|
|
"ftp://mirror.csclub.uwaterloo.ca/x.org/"
|
|
|
|
|
"ftp://xorg.mirrors.pair.com/"
|
2013-02-23 12:59:43 -05:00
|
|
|
|
"ftp://artfiles.org/x.org/" ; Europe
|
|
|
|
|
"ftp://ftp.chg.ru/pub/X11/x.org/"
|
|
|
|
|
"ftp://ftp.fu-berlin.de/unix/X11/FTP.X.ORG/"
|
|
|
|
|
"ftp://ftp.gwdg.de/pub/x11/x.org/"
|
|
|
|
|
"ftp://ftp.mirrorservice.org/sites/ftp.x.org/"
|
|
|
|
|
"ftp://ftp.ntua.gr/pub/X11/"
|
|
|
|
|
"ftp://ftp.piotrkosoft.net/pub/mirrors/ftp.x.org/"
|
|
|
|
|
"ftp://ftp.portal-to-web.de/pub/mirrors/x.org/"
|
|
|
|
|
"ftp://ftp.solnet.ch/mirror/x.org/"
|
|
|
|
|
"ftp://mi.mirror.garr.it/mirrors/x.org/"
|
|
|
|
|
"ftp://mirror.cict.fr/x.org/"
|
|
|
|
|
"ftp://mirror.switch.ch/mirror/X11/"
|
|
|
|
|
"ftp://mirrors.ircam.fr/pub/x.org/"
|
|
|
|
|
"ftp://x.mirrors.skynet.be/pub/ftp.x.org/"
|
2023-07-08 20:00:02 -04:00
|
|
|
|
"ftp://ftp.cs.cuhk.edu.hk/pub/X11" ; East Asia
|
2013-02-23 12:59:43 -05:00
|
|
|
|
"ftp://ftp.u-aizu.ac.jp/pub/x11/x.org/"
|
|
|
|
|
"ftp://ftp.yz.yamagata-u.ac.jp/pub/X11/x.org/"
|
|
|
|
|
"ftp://ftp.kaist.ac.kr/x.org/"
|
|
|
|
|
"ftp://mirrors.go-part.com/xorg/"
|
2013-03-03 18:46:27 -05:00
|
|
|
|
"ftp://ftp.is.co.za/pub/x.org") ; South Africa
|
2017-10-30 19:49:32 -04:00
|
|
|
|
(cpan
|
2013-03-03 18:46:27 -05:00
|
|
|
|
"http://www.cpan.org/"
|
2017-10-30 19:49:32 -04:00
|
|
|
|
"http://cpan.metacpan.org/"
|
|
|
|
|
;; A selection of HTTP mirrors from http://www.cpan.org/SITES.html.
|
|
|
|
|
;; Europe.
|
|
|
|
|
"http://ftp.belnet.be/mirror/ftp.cpan.org/"
|
|
|
|
|
"http://mirrors.nic.cz/CPAN/"
|
|
|
|
|
"http://mirror.ibcp.fr/pub/CPAN/"
|
|
|
|
|
"http://ftp.ntua.gr/pub/lang/perl/"
|
|
|
|
|
"http://mirror.as43289.net/pub/CPAN/"
|
|
|
|
|
"http://cpan.cs.uu.nl/"
|
|
|
|
|
"http://cpan.uib.no/"
|
|
|
|
|
"http://cpan-mirror.rbc.ru/pub/CPAN/"
|
|
|
|
|
"http://mirror.sbb.rs/CPAN/"
|
|
|
|
|
"http://cpan.lnx.sk/"
|
|
|
|
|
"http://ftp.rediris.es/mirror/CPAN/"
|
|
|
|
|
"http://mirror.ox.ac.uk/sites/www.cpan.org/"
|
|
|
|
|
;; Africa.
|
|
|
|
|
"http://mirror.liquidtelecom.com/CPAN/"
|
|
|
|
|
"http://cpan.mirror.ac.za/"
|
|
|
|
|
"http://mirror.is.co.za/pub/cpan/"
|
|
|
|
|
"http://cpan.saix.net/"
|
|
|
|
|
"http://mirror.ucu.ac.ug/cpan/"
|
|
|
|
|
;; North America.
|
|
|
|
|
"http://mirrors.gossamer-threads.com/CPAN/"
|
|
|
|
|
"http://mirror.csclub.uwaterloo.ca/CPAN/"
|
|
|
|
|
"http://mirrors.ucr.ac.cr/CPAN/"
|
|
|
|
|
"http://www.msg.com.mx/CPAN/"
|
|
|
|
|
"http://mirrors.namecheap.com/CPAN/"
|
|
|
|
|
"http://mirror.uic.edu/CPAN/"
|
|
|
|
|
"http://mirror.datapipe.net/CPAN/"
|
|
|
|
|
"http://mirror.cc.columbia.edu/pub/software/cpan/"
|
|
|
|
|
"http://mirror.uta.edu/CPAN/"
|
|
|
|
|
;; South America.
|
|
|
|
|
"http://cpan.mmgdesigns.com.ar/"
|
|
|
|
|
"http://mirror.nbtelecom.com.br/CPAN/"
|
|
|
|
|
"http://linorg.usp.br/CPAN/"
|
|
|
|
|
"http://cpan.dcc.uchile.cl/"
|
|
|
|
|
"http://mirror.cedia.org.ec/CPAN/"
|
|
|
|
|
;; Oceania.
|
|
|
|
|
"http://cpan.mirror.serversaustralia.com.au/"
|
|
|
|
|
"http://mirror.waia.asn.au/pub/cpan/"
|
|
|
|
|
"http://mirror.as24220.net/pub/cpan/"
|
|
|
|
|
"http://cpan.lagoon.nc/pub/CPAN/"
|
|
|
|
|
"http://cpan.inspire.net.nz/"
|
|
|
|
|
;; Asia.
|
|
|
|
|
"http://mirror.dhakacom.com/CPAN/"
|
|
|
|
|
"http://mirrors.ustc.edu.cn/CPAN/"
|
|
|
|
|
"http://ftp.cuhk.edu.hk/pub/packages/perl/CPAN/"
|
|
|
|
|
"http://kambing.ui.ac.id/cpan/"
|
|
|
|
|
"http://cpan.hostiran.ir/"
|
|
|
|
|
"http://ftp.nara.wide.ad.jp/pub/CPAN/"
|
|
|
|
|
"http://mirror.neolabs.kz/CPAN/"
|
|
|
|
|
"http://cpan.nctu.edu.tw/"
|
|
|
|
|
"http://cpan.ulak.net.tr/"
|
|
|
|
|
"http://mirrors.vinahost.vn/CPAN/")
|
2015-02-12 06:58:11 -05:00
|
|
|
|
(cran
|
|
|
|
|
;; Arbitrary mirrors from http://cran.r-project.org/mirrors.html
|
|
|
|
|
;; This one automatically redirects to servers worldwide
|
2015-09-21 04:34:52 -04:00
|
|
|
|
"http://cran.r-project.org/"
|
2015-02-12 06:58:11 -05:00
|
|
|
|
"http://cran.rstudio.com/"
|
|
|
|
|
"http://cran.univ-lyon1.fr/"
|
|
|
|
|
"http://cran.ism.ac.jp/"
|
|
|
|
|
"http://cran.stat.auckland.ac.nz/"
|
|
|
|
|
"http://cran.mirror.ac.za/"
|
|
|
|
|
"http://cran.csie.ntu.edu.tw/")
|
2022-04-20 21:57:30 -04:00
|
|
|
|
(ctan
|
|
|
|
|
;; This is the CTAN mirror multiplexor service, which automatically
|
|
|
|
|
;; redirect to a mirror in or close to the country of the requester
|
|
|
|
|
;; (see: https://ctan.org/mirrors/).
|
|
|
|
|
"https://mirror.ctan.org/")
|
2014-05-22 15:58:08 -04:00
|
|
|
|
(imagemagick
|
|
|
|
|
;; from http://www.imagemagick.org/script/download.php
|
|
|
|
|
;; (without mirrors that are unavailable or not up to date)
|
2020-12-12 10:36:26 -05:00
|
|
|
|
"https://sunsite.icm.edu.pl/packages/ImageMagick/releases"
|
|
|
|
|
"http://mirror.checkdomain.de/imagemagick/releases"
|
|
|
|
|
"ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/releases"
|
2014-05-22 15:58:08 -04:00
|
|
|
|
"ftp://ftp.nluug.nl/pub/ImageMagick/"
|
2020-12-12 10:36:26 -05:00
|
|
|
|
"http://www.imagemagick.org/download/releases/"
|
|
|
|
|
;; Try this if all else fails (normally contains just the latest version).
|
|
|
|
|
"http://www.imagemagick.org/download/")
|
2013-10-05 10:45:39 -04:00
|
|
|
|
(debian
|
|
|
|
|
"http://ftp.de.debian.org/debian/"
|
|
|
|
|
"http://ftp.fr.debian.org/debian/"
|
2016-05-16 05:10:49 -04:00
|
|
|
|
"http://ftp.debian.org/debian/"
|
2016-08-01 05:05:01 -04:00
|
|
|
|
"http://archive.debian.org/debian/")
|
|
|
|
|
(kde
|
2022-03-28 17:03:03 -04:00
|
|
|
|
"https://download.kde.org/"
|
|
|
|
|
"https://download.kde.org/Attic/" ; for when it gets archived.
|
2022-07-23 20:00:00 -04:00
|
|
|
|
;; I could not find the classic static mirror list anymore. Instead,
|
|
|
|
|
;; add ‘.mirrorlist’ to the end of a recent download.kde.org tarball URL.
|
2016-08-01 05:05:01 -04:00
|
|
|
|
;; Europe
|
2022-07-23 20:00:00 -04:00
|
|
|
|
"https://mirrors.xtom.de/kde/"
|
|
|
|
|
"https://mirror.lyrahosting.com/pub/kde/"
|
|
|
|
|
"https://mirrors.xtom.nl/kde/"
|
|
|
|
|
"https://mirror.hs-esslingen.de/Mirrors/ftp.kde.org/pub/kde/"
|
|
|
|
|
"https://mirror.kumi.systems/kde/ftp/"
|
|
|
|
|
"https://mirrors.ircam.fr/pub/KDE/"
|
|
|
|
|
"https://ftp.gwdg.de/pub/linux/kde/"
|
|
|
|
|
"https://mirrors.gethosted.online/kde/pub/kde/"
|
|
|
|
|
"https://fr2.rpmfind.net/linux/KDE/"
|
|
|
|
|
"https://mirror.faigner.de/kde/ftp/"
|
|
|
|
|
"https://www.mirrorservice.org/sites/download.kde.org/"
|
|
|
|
|
"https://mirrors.ukfast.co.uk/sites/kde.org/ftp/"
|
|
|
|
|
"https://mirrors.dotsrc.org/kde/"
|
2016-08-01 05:05:01 -04:00
|
|
|
|
"http://kde.mirror.anlx.net/"
|
2022-07-23 20:00:00 -04:00
|
|
|
|
"https://mirror.karneval.cz/pub/kde/"
|
|
|
|
|
"https://ftp.fi.muni.cz/pub/kde/"
|
|
|
|
|
"https://www-ftp.lip6.fr/pub/X11/kde/"
|
|
|
|
|
"https://ftp.icm.edu.pl/pub/unix/kde/"
|
|
|
|
|
"https://kde.mirror.garr.it/kde/ftp/"
|
|
|
|
|
"https://ftp.acc.umu.se/mirror/kde.org/ftp/"
|
|
|
|
|
"https://mirrors.up.pt/pub/kde/"
|
|
|
|
|
"https://mirrors.nav.ro/kde/"
|
|
|
|
|
"https://mirrors.xtom.ee/kde/"
|
|
|
|
|
"https://ftp.funet.fi/pub/mirrors/ftp.kde.org/pub/kde/"
|
|
|
|
|
"https://kde.ip-connect.vn.ua/"
|
|
|
|
|
"https://mirrors.netix.net/kde/"
|
|
|
|
|
"https://ftp.cc.uoc.gr/mirrors/kde/"
|
2016-08-01 05:05:01 -04:00
|
|
|
|
;; North America
|
2022-07-23 20:00:00 -04:00
|
|
|
|
"https://mirror.its.dal.ca/kde/"
|
|
|
|
|
"https://nnenix.mm.fcix.net/kdeftp/"
|
|
|
|
|
"https://mirrors.mit.edu/kde/"
|
|
|
|
|
"https://mirror.csclub.uwaterloo.ca/kde/"
|
|
|
|
|
"https://mirror.fcix.net/kdeftp/"
|
|
|
|
|
"https://mirrors.ocf.berkeley.edu/kde/"
|
|
|
|
|
"https://mirrors.xtom.com/kde/"
|
|
|
|
|
;; South America
|
|
|
|
|
"https://kde.c3sl.ufpr.br/"
|
|
|
|
|
;; Asia
|
|
|
|
|
"https://mirrors.bfsu.edu.cn/kde/"
|
|
|
|
|
"https://ftp-srv2.kddi-research.jp/pub/X11/kde/"
|
|
|
|
|
"https://mirrors.xtom.jp/kde/"
|
|
|
|
|
"https://mirrors.xtom.hk/kde/"
|
|
|
|
|
;; Africa
|
|
|
|
|
"http://mirror.retentionrange.co.bw/kde/"
|
2016-08-01 05:05:01 -04:00
|
|
|
|
;; Oceania
|
2022-07-23 20:00:00 -04:00
|
|
|
|
"https://mirrors.xtom.au/kde/")
|
2017-07-18 19:42:08 -04:00
|
|
|
|
(openbsd
|
|
|
|
|
"https://ftp.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
;; Anycast CDN redirecting to your friendly local mirror.
|
|
|
|
|
"https://mirrors.evowise.com/pub/OpenBSD/"
|
|
|
|
|
;; Other HTTPS mirrors from https://www.openbsd.org/ftp.html
|
|
|
|
|
"https://mirror.aarnet.edu.au/pub/OpenBSD/"
|
|
|
|
|
"https://ftp2.eu.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.c3sl.ufpr.br/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.ipacct.com/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.OpenBSD.org/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.cs.toronto.edu/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.delfic.org/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.mirror.netelligent.ca/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.ucr.ac.cr/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.dotsrc.org/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.one.com/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.fr.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://ftp2.fr.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.ircam.fr/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.spline.de/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.hs-esslingen.de/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.halifax.rwth-aachen.de/openbsd/"
|
|
|
|
|
"https://ftp.hostserver.de/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.fau.de/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.cc.uoc.gr/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.hk/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.heanet.ie/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.mirror.garr.it/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.litnet.lt/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.meerval.net/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.nluug.nl/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.bit.nl/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.dalenys.com/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.icm.edu.pl/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.rnl.tecnico.ulisboa.pt/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.pidginhost.com/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.yandex.ru/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.eu.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://ftp.yzu.edu.tw/pub/OpenBSD/"
|
|
|
|
|
"https://www.mirrorservice.org/pub/OpenBSD/"
|
|
|
|
|
"https://anorien.csc.warwick.ac.uk/pub/OpenBSD/"
|
|
|
|
|
"https://mirror.bytemark.co.uk/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.sonic.net/pub/OpenBSD/"
|
|
|
|
|
"https://ftp3.usa.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://mirrors.syringanetworks.net/pub/OpenBSD/"
|
|
|
|
|
"https://openbsd.mirror.constant.com/pub/OpenBSD/"
|
|
|
|
|
"https://ftp4.usa.openbsd.org/pub/OpenBSD/"
|
|
|
|
|
"https://ftp5.usa.openbsd.org/pub/OpenBSD/"
|
2019-03-15 13:02:51 -04:00
|
|
|
|
"https://mirror.esc7.net/pub/OpenBSD/")
|
|
|
|
|
(mate
|
|
|
|
|
"https://pub.mate-desktop.org/releases/"
|
2023-08-09 13:59:14 -04:00
|
|
|
|
"http://pub.mate-desktop.org/releases/")
|
|
|
|
|
(qt
|
|
|
|
|
"https://mirrors.ocf.berkeley.edu/qt/official_releases/"
|
|
|
|
|
"https://ftp.jaist.ac.jp/pub/qtproject/official_releases/"
|
|
|
|
|
"https://ftp.nluug.nl/languages/qt/official_releases/"
|
|
|
|
|
"https://mirrors.cloud.tencent.com/qt/official_releases/"
|
|
|
|
|
"https://mirrors.sjtug.sjtu.edu.cn/qt/official_releases/"
|
|
|
|
|
"https://qtproject.mirror.liquidtelecom.com/official_releases/"
|
|
|
|
|
"https://download.qt.io/official_releases/")))) ;slow
|
2012-11-12 17:20:06 -05:00
|
|
|
|
|
2015-08-29 17:47:53 -04:00
|
|
|
|
(define %mirror-file
|
|
|
|
|
;; Copy of the list of mirrors to a file. This allows us to keep a single
|
|
|
|
|
;; copy in the store, and computing it here avoids repeated calls to
|
|
|
|
|
;; 'object->string'.
|
|
|
|
|
(plain-file "mirrors" (object->string %mirrors)))
|
|
|
|
|
|
2016-05-14 11:37:47 -04:00
|
|
|
|
(define %content-addressed-mirrors
|
|
|
|
|
;; List of content-addressed mirrors. Each mirror is represented as a
|
2016-07-20 11:00:50 -04:00
|
|
|
|
;; procedure that takes a file name, an algorithm (symbol) and a hash
|
|
|
|
|
;; (bytevector), and returns a URL or #f.
|
2018-11-13 16:26:07 -05:00
|
|
|
|
'(begin
|
2021-09-14 03:54:12 -04:00
|
|
|
|
(use-modules (guix base16) (guix base32))
|
2018-11-28 16:17:39 -05:00
|
|
|
|
|
2018-11-28 16:23:10 -05:00
|
|
|
|
(define (guix-publish host)
|
|
|
|
|
(lambda (file algo hash)
|
|
|
|
|
;; Files served by 'guix publish' are accessible under a single
|
|
|
|
|
;; hash algorithm.
|
|
|
|
|
(string-append "https://" host "/file/"
|
|
|
|
|
file "/" (symbol->string algo) "/"
|
|
|
|
|
(bytevector->nix-base32-string hash))))
|
|
|
|
|
|
2023-02-06 10:55:05 -05:00
|
|
|
|
(list (guix-publish
|
|
|
|
|
;; bordeaux.guix.gnu.org uses the nar-herder rather than guix
|
|
|
|
|
;; publish, but it supports the same style of requests
|
|
|
|
|
"bordeaux.guix.gnu.org")
|
|
|
|
|
(guix-publish "ci.guix.gnu.org")
|
2018-11-13 16:26:07 -05:00
|
|
|
|
(lambda (file algo hash)
|
|
|
|
|
;; 'tarballs.nixos.org' supports several algorithms.
|
2018-11-13 16:27:58 -05:00
|
|
|
|
(string-append "https://tarballs.nixos.org/"
|
2018-11-13 16:26:07 -05:00
|
|
|
|
(symbol->string algo) "/"
|
|
|
|
|
(bytevector->nix-base32-string hash)))
|
|
|
|
|
(lambda (file algo hash)
|
|
|
|
|
;; Software Heritage usually archives VCS history rather than
|
|
|
|
|
;; tarballs, but tarballs are sometimes available (and can be
|
|
|
|
|
;; explicitly stored there.) For example, see
|
|
|
|
|
;; <https://archive.softwareheritage.org/api/1/content/sha256:92d0fa1c311cacefa89853bdb53c62f4110cdfda3820346b59cbd098f40f955e/>.
|
2018-11-13 16:27:58 -05:00
|
|
|
|
(string-append "https://archive.softwareheritage.org/api/1/content/"
|
2018-11-13 16:26:07 -05:00
|
|
|
|
(symbol->string algo) ":"
|
|
|
|
|
(bytevector->base16-string hash) "/raw/")))))
|
2016-05-14 11:37:47 -04:00
|
|
|
|
|
|
|
|
|
(define %content-addressed-mirror-file
|
|
|
|
|
;; Content-addressed mirrors stored in a file.
|
|
|
|
|
(plain-file "content-addressed-mirrors"
|
|
|
|
|
(object->string %content-addressed-mirrors)))
|
|
|
|
|
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(define %no-mirrors-file
|
|
|
|
|
;; File specifying an empty list of mirrors, for fallback tests.
|
|
|
|
|
(plain-file "no-content-addressed-mirrors" (object->string ''())))
|
|
|
|
|
|
2021-03-19 23:03:25 -04:00
|
|
|
|
(define %disarchive-mirrors
|
2021-09-14 04:11:42 -04:00
|
|
|
|
;; TODO: Eventually turn into a procedure that takes a hash algorithm
|
|
|
|
|
;; (symbol) and hash (bytevector).
|
2021-10-14 08:32:58 -04:00
|
|
|
|
'("https://disarchive.guix.gnu.org/"
|
|
|
|
|
"https://disarchive.ngyro.com/"))
|
2021-03-19 23:03:25 -04:00
|
|
|
|
|
|
|
|
|
(define %disarchive-mirror-file
|
|
|
|
|
(plain-file "disarchive-mirrors" (object->string %disarchive-mirrors)))
|
|
|
|
|
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(define %no-disarchive-mirrors-file
|
|
|
|
|
;; File specifying an empty list of Disarchive mirrors, for fallback tests.
|
|
|
|
|
(plain-file "no-disarchive-mirrors" (object->string '())))
|
|
|
|
|
|
2016-11-16 11:44:50 -05:00
|
|
|
|
(define built-in-builders*
|
2019-04-16 04:26:46 -04:00
|
|
|
|
(store-lift built-in-builders))
|
2012-11-12 17:20:06 -05:00
|
|
|
|
|
2016-11-16 11:44:50 -05:00
|
|
|
|
(define* (built-in-download file-name url
|
|
|
|
|
#:key system hash-algo hash
|
|
|
|
|
mirrors content-addressed-mirrors
|
2021-03-19 23:03:25 -04:00
|
|
|
|
disarchive-mirrors
|
2019-06-14 09:04:09 -04:00
|
|
|
|
executable?
|
2016-11-16 11:44:50 -05:00
|
|
|
|
(guile 'unused))
|
2019-06-14 09:04:09 -04:00
|
|
|
|
"Download FILE-NAME from URL using the built-in 'download' builder. When
|
|
|
|
|
EXECUTABLE? is true, make the downloaded file executable.
|
2012-11-12 17:10:26 -05:00
|
|
|
|
|
2016-11-16 11:44:50 -05:00
|
|
|
|
This is an \"out-of-band\" download in that the returned derivation does not
|
|
|
|
|
explicitly depend on Guile, GnuTLS, etc. Instead, the daemon performs the
|
|
|
|
|
download by itself using its own dependencies."
|
|
|
|
|
(mlet %store-monad ((mirrors (lower-object mirrors))
|
|
|
|
|
(content-addressed-mirrors
|
2021-03-19 23:03:25 -04:00
|
|
|
|
(lower-object content-addressed-mirrors))
|
|
|
|
|
(disarchive-mirrors (lower-object disarchive-mirrors)))
|
2016-11-16 11:44:50 -05:00
|
|
|
|
(raw-derivation file-name "builtin:download" '()
|
|
|
|
|
#:system system
|
|
|
|
|
#:hash-algo hash-algo
|
|
|
|
|
#:hash hash
|
2019-06-14 09:04:09 -04:00
|
|
|
|
#:recursive? executable?
|
2021-03-19 23:03:25 -04:00
|
|
|
|
#:sources (list mirrors
|
|
|
|
|
content-addressed-mirrors
|
|
|
|
|
disarchive-mirrors)
|
2016-11-16 11:44:50 -05:00
|
|
|
|
|
|
|
|
|
;; Honor the user's proxy and locale settings.
|
|
|
|
|
#:leaked-env-vars '("http_proxy" "https_proxy"
|
|
|
|
|
"LC_ALL" "LC_MESSAGES" "LANG"
|
|
|
|
|
"COLUMNS")
|
|
|
|
|
|
|
|
|
|
#:env-vars `(("url" . ,(object->string url))
|
|
|
|
|
("mirrors" . ,mirrors)
|
|
|
|
|
("content-addressed-mirrors"
|
2019-06-14 09:04:09 -04:00
|
|
|
|
. ,content-addressed-mirrors)
|
2021-03-19 23:03:25 -04:00
|
|
|
|
("disarchive-mirrors" . ,disarchive-mirrors)
|
2019-06-14 09:04:09 -04:00
|
|
|
|
,@(if executable?
|
|
|
|
|
'(("executable" . "1"))
|
|
|
|
|
'()))
|
2016-11-18 04:48:31 -05:00
|
|
|
|
|
|
|
|
|
;; Do not offload this derivation because we cannot be
|
|
|
|
|
;; sure that the remote daemon supports the 'download'
|
|
|
|
|
;; built-in. We may remove this limitation when support
|
|
|
|
|
;; for that built-in is widespread.
|
|
|
|
|
#:local-build? #t)))
|
2016-11-16 11:44:50 -05:00
|
|
|
|
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(define %download-fallback-test
|
|
|
|
|
;; Define whether to test one of the download fallback mechanism. Possible
|
|
|
|
|
;; values are:
|
|
|
|
|
;;
|
|
|
|
|
;; - #f, to use the normal download methods, not trying to exercise the
|
|
|
|
|
;; fallback mechanism;
|
|
|
|
|
;;
|
2021-10-15 16:21:02 -04:00
|
|
|
|
;; - 'none, to disable all the fallback mechanisms;
|
|
|
|
|
;;
|
2021-10-14 09:41:43 -04:00
|
|
|
|
;; - 'content-addressed-mirrors, to purposefully attempt to download from
|
|
|
|
|
;; a content-addressed mirror;
|
|
|
|
|
;;
|
|
|
|
|
;; - 'disarchive-mirrors, to download from Disarchive + Software Heritage.
|
|
|
|
|
;;
|
|
|
|
|
;; This is meant to be used for testing purposes.
|
|
|
|
|
(make-parameter (and=> (getenv "GUIX_DOWNLOAD_FALLBACK_TEST")
|
|
|
|
|
string->symbol)))
|
|
|
|
|
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(define* (url-fetch* url hash-algo hash
|
|
|
|
|
#:optional name
|
|
|
|
|
#:key (system (%current-system))
|
|
|
|
|
(guile (default-guile))
|
|
|
|
|
executable?)
|
2020-10-20 03:32:05 -04:00
|
|
|
|
"Return a fixed-output derivation that fetches data from URL (a string, or a
|
|
|
|
|
list of strings denoting alternate URLs), which is expected to have hash HASH
|
|
|
|
|
of type HASH-ALGO (a symbol). By default, the file name is the base name of
|
|
|
|
|
URL; optionally, NAME can specify a different file name. When EXECUTABLE? is
|
|
|
|
|
true, make the downloaded file executable.
|
2016-11-16 11:44:50 -05:00
|
|
|
|
|
|
|
|
|
When one of the URL starts with mirror://, then its host part is
|
|
|
|
|
interpreted as the name of a mirror scheme, taken from %MIRROR-FILE.
|
|
|
|
|
|
2020-10-20 03:32:05 -04:00
|
|
|
|
Alternatively, when URL starts with file://, return the corresponding file
|
|
|
|
|
name in the store."
|
2016-11-16 11:44:50 -05:00
|
|
|
|
(define file-name
|
|
|
|
|
(match url
|
|
|
|
|
((head _ ...)
|
|
|
|
|
(basename head))
|
|
|
|
|
(_
|
|
|
|
|
(basename url))))
|
|
|
|
|
|
2014-10-03 05:02:11 -04:00
|
|
|
|
(let ((uri (and (string? url) (string->uri url))))
|
|
|
|
|
(if (or (and (string? url) (not uri))
|
|
|
|
|
(and uri (memq (uri-scheme uri) '(#f file))))
|
2015-01-14 08:42:10 -05:00
|
|
|
|
(interned-file (if uri (uri-path uri) url)
|
|
|
|
|
(or name file-name))
|
2017-07-27 09:09:26 -04:00
|
|
|
|
(mlet %store-monad ((builtins (built-in-builders*)))
|
|
|
|
|
;; The "download" built-in builder was added in guix-daemon in
|
|
|
|
|
;; Nov. 2016 and made it in the 0.12.0 release of Dec. 2016. We now
|
|
|
|
|
;; require it.
|
|
|
|
|
(unless (member "download" builtins)
|
|
|
|
|
(error "'guix-daemon' is too old, please upgrade" builtins))
|
|
|
|
|
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(built-in-download (or name file-name)
|
2021-10-15 16:21:02 -04:00
|
|
|
|
(match (%download-fallback-test)
|
|
|
|
|
((or #f 'none) url)
|
|
|
|
|
(_ "https://example.org/does-not-exist"))
|
2017-07-27 09:09:26 -04:00
|
|
|
|
#:guile guile
|
|
|
|
|
#:system system
|
|
|
|
|
#:hash-algo hash-algo
|
|
|
|
|
#:hash hash
|
2019-06-14 09:04:09 -04:00
|
|
|
|
#:executable? executable?
|
2017-07-27 09:09:26 -04:00
|
|
|
|
#:mirrors %mirror-file
|
|
|
|
|
#:content-addressed-mirrors
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(match (%download-fallback-test)
|
|
|
|
|
((or #f 'content-addressed-mirrors)
|
|
|
|
|
%content-addressed-mirror-file)
|
|
|
|
|
(_ %no-mirrors-file))
|
2021-03-19 23:03:25 -04:00
|
|
|
|
#:disarchive-mirrors
|
2021-10-14 09:41:43 -04:00
|
|
|
|
(match (%download-fallback-test)
|
|
|
|
|
((or #f 'disarchive-mirrors)
|
|
|
|
|
%disarchive-mirror-file)
|
|
|
|
|
(_ %no-disarchive-mirrors-file)))))))
|
2012-11-12 17:10:26 -05:00
|
|
|
|
|
2019-06-14 09:04:09 -04:00
|
|
|
|
(define* (url-fetch/executable url hash-algo hash
|
|
|
|
|
#:optional name
|
|
|
|
|
#:key (system (%current-system))
|
|
|
|
|
(guile (default-guile)))
|
|
|
|
|
"Like 'url-fetch', but make the downloaded file executable."
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(url-fetch* url hash-algo hash name
|
|
|
|
|
#:system system
|
|
|
|
|
#:guile guile
|
|
|
|
|
#:executable? #t))
|
2019-06-14 09:04:09 -04:00
|
|
|
|
|
2016-02-21 18:29:54 -05:00
|
|
|
|
(define* (url-fetch/tarbomb url hash-algo hash
|
|
|
|
|
#:optional name
|
|
|
|
|
#:key (system (%current-system))
|
|
|
|
|
(guile (default-guile)))
|
|
|
|
|
"Similar to 'url-fetch' but unpack the file from URL in a directory of its
|
|
|
|
|
own. This helper makes it easier to deal with \"tar bombs\"."
|
2017-01-27 14:48:37 -05:00
|
|
|
|
(define file-name
|
|
|
|
|
(match url
|
|
|
|
|
((head _ ...)
|
|
|
|
|
(basename head))
|
|
|
|
|
(_
|
|
|
|
|
(basename url))))
|
2016-02-21 18:29:54 -05:00
|
|
|
|
(define gzip
|
|
|
|
|
(module-ref (resolve-interface '(gnu packages compression)) 'gzip))
|
|
|
|
|
(define tar
|
|
|
|
|
(module-ref (resolve-interface '(gnu packages base)) 'tar))
|
|
|
|
|
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(mlet %store-monad ((drv (url-fetch* url hash-algo hash
|
|
|
|
|
(string-append "tarbomb-"
|
|
|
|
|
(or name file-name))
|
|
|
|
|
#:system system
|
|
|
|
|
#:guile guile))
|
2020-03-16 13:43:20 -04:00
|
|
|
|
(guile (package->derivation guile system)))
|
2016-02-21 18:29:54 -05:00
|
|
|
|
;; Take the tar bomb, and simply unpack it as a directory.
|
2018-04-23 08:33:11 -04:00
|
|
|
|
;; Use ungrafted tar/gzip so that the resulting tarball doesn't depend on
|
|
|
|
|
;; whether grafts are enabled.
|
2017-01-27 14:48:37 -05:00
|
|
|
|
(gexp->derivation (or name file-name)
|
2018-04-17 01:43:22 -04:00
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
|
(mkdir #$output)
|
2021-03-05 03:41:40 -05:00
|
|
|
|
(setenv "PATH" (string-append #+gzip "/bin"))
|
2018-04-17 01:43:22 -04:00
|
|
|
|
(chdir #$output)
|
2021-03-05 03:41:40 -05:00
|
|
|
|
(invoke (string-append #+tar "/bin/tar")
|
2018-04-17 01:43:22 -04:00
|
|
|
|
"xf" #$drv)))
|
2020-03-16 13:43:20 -04:00
|
|
|
|
#:system system
|
|
|
|
|
#:guile-for-build guile
|
2018-04-23 08:33:11 -04:00
|
|
|
|
#:graft? #f
|
2016-02-21 18:29:54 -05:00
|
|
|
|
#:local-build? #t)))
|
|
|
|
|
|
2017-01-25 07:16:00 -05:00
|
|
|
|
(define* (url-fetch/zipbomb url hash-algo hash
|
|
|
|
|
#:optional name
|
|
|
|
|
#:key (system (%current-system))
|
|
|
|
|
(guile (default-guile)))
|
|
|
|
|
"Similar to 'url-fetch' but unpack the zip file at URL in a directory of its
|
|
|
|
|
own. This helper makes it easier to deal with \"zip bombs\"."
|
|
|
|
|
(define file-name
|
|
|
|
|
(match url
|
|
|
|
|
((head _ ...)
|
|
|
|
|
(basename head))
|
|
|
|
|
(_
|
|
|
|
|
(basename url))))
|
|
|
|
|
(define unzip
|
gnu: Move contents of zip module into compression module.
* gnu/packages/zip.scm (zip, unzip, zziplib, perl-zip): Move to...
* gnu/packages/compression.scm: ...here.
* gnu/packages/zip.scm: Delete file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Unregister deleted file.
* po/packages/POTFILES.in: Unregister deleted file.
* gnu/packages/{audio, avr, bioinformatics, busybox, cdrom, ci, compression,
docbook, documentation, fonts, fpga, game-development, games, gl, gnome,
gnuzilla, graphics, guile, haskell, image, java, kodi, ldc, libreoffice,
markup, maths, mc, monitoring, music, php, pretty-print, python, scheme,
smalltalk, statistics, synergy, tex, textutils, video, web-browsers, xml,
zip}.scm, guix/build-system/{ant, font}.scm, guix/{download, packages}.scm:
Adapt module import.
2017-06-12 14:40:01 -04:00
|
|
|
|
(module-ref (resolve-interface '(gnu packages compression)) 'unzip))
|
2017-01-25 07:16:00 -05:00
|
|
|
|
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(mlet %store-monad ((drv (url-fetch* url hash-algo hash
|
|
|
|
|
(string-append "zipbomb-"
|
|
|
|
|
(or name file-name))
|
|
|
|
|
#:system system
|
|
|
|
|
#:guile guile))
|
2020-03-16 13:43:20 -04:00
|
|
|
|
(guile (package->derivation guile system)))
|
2017-01-25 07:16:00 -05:00
|
|
|
|
;; Take the zip bomb, and simply unpack it as a directory.
|
2018-04-23 08:33:11 -04:00
|
|
|
|
;; Use ungrafted unzip so that the resulting tarball doesn't depend on
|
|
|
|
|
;; whether grafts are enabled.
|
2017-01-25 07:16:00 -05:00
|
|
|
|
(gexp->derivation (or name file-name)
|
2018-04-17 01:43:22 -04:00
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
|
#~(begin
|
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
|
(mkdir #$output)
|
|
|
|
|
(chdir #$output)
|
2021-03-05 03:41:40 -05:00
|
|
|
|
(invoke (string-append #+unzip "/bin/unzip")
|
2018-04-17 01:43:22 -04:00
|
|
|
|
#$drv)))
|
2020-03-16 13:43:20 -04:00
|
|
|
|
#:system system
|
|
|
|
|
#:guile-for-build guile
|
2018-04-23 08:33:11 -04:00
|
|
|
|
#:graft? #f
|
2017-01-25 07:16:00 -05:00
|
|
|
|
#:local-build? #t)))
|
|
|
|
|
|
2013-04-21 16:40:23 -04:00
|
|
|
|
(define* (download-to-store store url #:optional (name (basename url))
|
2016-11-07 17:29:45 -05:00
|
|
|
|
#:key (log (current-error-port)) recursive?
|
|
|
|
|
(verify-certificate? #t))
|
2013-04-21 16:40:23 -04:00
|
|
|
|
"Download from URL to STORE, either under NAME or URL's basename if
|
2015-06-11 05:19:12 -04:00
|
|
|
|
omitted. Write progress reports to LOG. RECURSIVE? has the same effect as
|
2016-11-07 17:29:45 -05:00
|
|
|
|
the same-named parameter of 'add-to-store'. VERIFY-CERTIFICATE? determines
|
|
|
|
|
whether or not to validate HTTPS server certificates."
|
2013-10-12 10:39:10 -04:00
|
|
|
|
(define uri
|
|
|
|
|
(string->uri url))
|
|
|
|
|
|
2014-03-11 17:09:31 -04:00
|
|
|
|
(if (or (not uri) (memq (uri-scheme uri) '(file #f)))
|
2015-06-11 05:19:12 -04:00
|
|
|
|
(add-to-store store name recursive? "sha256"
|
2014-03-11 17:09:31 -04:00
|
|
|
|
(if uri (uri-path uri) url))
|
2013-10-12 10:39:10 -04:00
|
|
|
|
(call-with-temporary-output-file
|
|
|
|
|
(lambda (temp port)
|
|
|
|
|
(let ((result
|
|
|
|
|
(parameterize ((current-output-port log))
|
2021-03-19 07:02:08 -04:00
|
|
|
|
(url-fetch url temp
|
|
|
|
|
#:mirrors %mirrors
|
|
|
|
|
#:verify-certificate? verify-certificate?))))
|
2013-10-12 10:39:10 -04:00
|
|
|
|
(close port)
|
|
|
|
|
(and result
|
2015-06-11 05:19:12 -04:00
|
|
|
|
(add-to-store store name recursive? "sha256" temp)))))))
|
2013-04-21 16:40:23 -04:00
|
|
|
|
|
2012-11-12 17:10:26 -05:00
|
|
|
|
;;; download.scm ends here
|