unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: "Thompson, David" <dthompson2@worcester.edu>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Problem with pkgconfig source https redirect
Date: Thu, 11 Feb 2016 10:48:49 +0100	[thread overview]
Message-ID: <877fibvapq.fsf@gnu.org> (raw)
In-Reply-To: <CAJ=RwfYzw9vo-xJ7v6zY+Ks03S5ZxNVR=G_rv=JQ94a8ERSoqQ@mail.gmail.com> (David Thompson's message of "Wed, 10 Feb 2016 16:40:03 -0500")

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

"Thompson, David" <dthompson2@worcester.edu> skribis:

> The bigger problem to be aware of is this:  No package in the gnutls
> dependency graph may have its source code downloaded over HTTPS.  Even
> if we hack around this for pkg-config, I'm sure it will bite us again
> when another upstream starts enforcing HTTPS.
>
> So, what can we do here?

Nix recently added a ‘fetchurl’ primitive to the Nix language, in part
to address this problem.

The equivalent for us is to simply perform the download on the “host
side” rather than on the “build side”, thus entirely side-stepping the
issue.  Moving code from one side to the other is obviously easy for us.

One way to do that is by adding a new origin method, along the lines of
this incomplete patch:


[-- Attachment #2: Type: text/x-patch, Size: 2059 bytes --]

diff --git a/gnu/packages/pkg-config.scm b/gnu/packages/pkg-config.scm
index 5923395..299c7c8 100644
--- a/gnu/packages/pkg-config.scm
+++ b/gnu/packages/pkg-config.scm
@@ -32,7 +32,7 @@
    (name "pkg-config")
    (version "0.29")
    (source (origin
-            (method url-fetch)
+            (method host-url-fetch)
             (uri (string-append
                   "http://pkgconfig.freedesktop.org/releases/pkg-config-"
                   version ".tar.gz"))
diff --git a/guix/download.scm b/guix/download.scm
index 204cfc0..32b5e4d 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -31,6 +31,7 @@
   #:use-module (srfi srfi-26)
   #:export (%mirrors
             url-fetch
+            host-url-fetch
             download-to-store))
 
 ;;; Commentary:
@@ -294,6 +295,12 @@ in the store."
                             ;; <https://bugs.gnu.org/18747>.)
                             #:local-build? #t)))))
 
+(define* (host-url-fetch url hash-algo hash
+                         #:optional name)
+  ;; FIXME: Check HASH, and cache downloaded stuff in ~/.cache/guix, similar
+  ;; to what 'http-fetch/cached' does.  See 'downloadFileCached' in Nix.
+  (download-to-store* url name))
+
 (define* (download-to-store store url #:optional (name (basename url))
                             #:key (log (current-error-port)) recursive?)
   "Download from URL to STORE, either under NAME or URL's basename if
@@ -314,4 +321,7 @@ the same-named parameter of 'add-to-store'."
            (and result
                 (add-to-store store name recursive? "sha256" temp)))))))
 
+(define download-to-store*
+  (store-lift download-to-store))
+
 ;;; download.scm ends here

[-- Attachment #3: Type: text/plain, Size: 147 bytes --]


Some care is needed to get performance right and to make sure we never
needlessly re-download stuff, but it’s definitely doable.

Ludo’.

      reply	other threads:[~2016-02-11  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10  2:56 Problem with pkgconfig source https redirect Christopher W Carpenter
2016-02-10  7:43 ` Efraim Flashner
2016-02-10 21:40   ` Thompson, David
2016-02-11  9:48     ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877fibvapq.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).