Re: [Nix-dev] Fetching variable and unpredictable URL download link

2015-03-02 Thread Eelco Dolstra
Hi,

On 01/03/15 16:21, Anderson Torres wrote:

 How can I fetchurl a variable url?
 
 When I download a dockapp from Windowmaker site, like
 
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz;,
 
 it in fact downloads something like wmSMPmon-${a long string of
 chars, like a checksum}.tar.gz. And the long string is unpredictable.

You can use fetchzip instead:

  fetchzip rec {
name = wmSMPmon-3.1.tar.gz;
url = http://windowmaker.org/dockapps/?download=${name};;
sha256 = 1ahp2vg6w3pzg0aar61gm122q37ljhd8ni6g0p1vp0x1wbavgljl;
  }

It calculates the hash over the unpacked data, so changes in the mtime fields of
the archive and other metadata don't matter.

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Fetching variable and unpredictable URL download link

2015-03-01 Thread Anderson Torres
2015-03-01 15:16 GMT-03:00 Berno Strik dutchma...@gmx.com:
 Op Sun, 1 Mar 2015 12:21:04 -0300
 Anderson Torres torres.anderson...@gmail.com schreef:

 Hello, Nixers!

 How can I fetchurl a variable url?

 When I download a dockapp from Windowmaker site, like

 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz;,

 it in fact downloads something like wmSMPmon-${a long string of
 chars, like a checksum}.tar.gz. And the long string is unpredictable.

 And when I run nix-prefetch-url
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz; more
 than once, it just outputs different hashes:

  nix-prefetch-url
  http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
   % Total% Received % Xferd  Average Speed   TimeTime
 Time  Current Dload  Upload   Total   SpentLeft  Speed
   0 00 00 0  0  0 --:--:--  0:00:01
 --:--:-- 0 100 241130 241130 0   3809  0
 --:--:--  0:00:06 --:--:--  5139 path is
 ‘/nix/store/lqri8zgmwz3mbf3q07kp62zl81bc6fpq-?download=wmSMPmon-3.1.tar.gz’
 104bcfj4j0vlnr4v1fzahgj9amccn1aq7rjcpy1jyqnq6lbrmc3g

  nix-prefetch-url
  http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
   % Total% Received % Xferd  Average Speed   TimeTime
 Time  Current Dload  Upload   Total   SpentLeft  Speed
   0 00 00 0  0  0 --:--:-- --:--:--
 --:--:-- 0 100 241100 241100 0   3193  0
 --:--:--  0:00:07 --:--:--  3985 path is
 ‘/nix/store/f2b7rksjfh6ajddjhx09xb0jzc04jxg9-?download=wmSMPmon-3.1.tar.gz’
 1s01whvf51jrwdmrk3bdgysaa2rzmh56c9p0kv3ydxijaagvqi2x

 How can I download it?

 Use the following code:

   src = fetchgit {
  url = git://repo.or.cz/dockapps.git;
  rev = 38c74350b02f35824554ce0c4f0f251d71762040;
  sha256 = 0g9cwhlqg065fbhav4g4n16a4cqkk9jykl3y0zwbn5whhacfqyhl;
   };

 Explanation:

 When you download a dockapp from Windowmaker site you are redirected to
 a git repo site where you get a snapshot out of it. The id of the
 snapshot is the long hexadecimal string you are getting.
 The above code does a checkout of the whole dockapp-git directory.
 The only thing you have left to do is point to the directory where your
 actual dockapp is:

 postUnpack = sourceRoot=\${sourceRoot}/dockapp-dir;


So you are just saying we need to download all dockapps and build one by one?

It appears to be better handled with a multiple-output derivation! I
will do some research on Nix docs about it.

 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Fetching variable and unpredictable URL download link

2015-03-01 Thread Anderson Torres
2015-03-01 15:21 GMT-03:00 Harald van Dijk har...@gigawatt.nl:
 Hi,

 The problem here is not with the file names, but that you don't actually get
 the same file every time. The file is generated by the server on-the-fly,
 and the mtimes of the files in the download you get depend on the precise
 moment you download it, as you can tell by inspecting the output of

   tar tvf $download

 This is fundamentally incompatible with any package manager that checks that
 source archives are downloaded correctly.

 The original website


 http://lancre.ribbrock.org/en/binabit_en/wmsmpmon_en/wmsmpmon-changelog_en.html

 appears to link to a stable archive that you should be able to use instead.

The problem here is: some dockapps have no official site anymore. In
fact, there are some with links to Web Archive!

But the idea of Breno is cool! I will try it.


 Cheers,
 Harald van Dijk


 On 03/01/2015 04:21 PM, Anderson Torres wrote:

 Hello, Nixers!

 How can I fetchurl a variable url?

 When I download a dockapp from Windowmaker site, like

 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz;,

 it in fact downloads something like wmSMPmon-${a long string of
 chars, like a checksum}.tar.gz. And the long string is unpredictable.

 And when I run nix-prefetch-url
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz; more
 than once, it just outputs different hashes:

 nix-prefetch-url
 http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz

% Total% Received % Xferd  Average Speed   TimeTime Time
 Current
   Dload  Upload   Total   SpentLeft
 Speed
0 00 00 0  0  0 --:--:--  0:00:01 --:--:--
 0
 100 241130 241130 0   3809  0 --:--:--  0:00:06 --:--:--
 5139
 path is
 ‘/nix/store/lqri8zgmwz3mbf3q07kp62zl81bc6fpq-?download=wmSMPmon-3.1.tar.gz’
 104bcfj4j0vlnr4v1fzahgj9amccn1aq7rjcpy1jyqnq6lbrmc3g

 nix-prefetch-url
 http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz

% Total% Received % Xferd  Average Speed   TimeTime Time
 Current
   Dload  Upload   Total   SpentLeft
 Speed
0 00 00 0  0  0 --:--:-- --:--:-- --:--:--
 0
 100 241100 241100 0   3193  0 --:--:--  0:00:07 --:--:--
 3985
 path is
 ‘/nix/store/f2b7rksjfh6ajddjhx09xb0jzc04jxg9-?download=wmSMPmon-3.1.tar.gz’
 1s01whvf51jrwdmrk3bdgysaa2rzmh56c9p0kv3ydxijaagvqi2x

 How can I download it?
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev


___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Fetching variable and unpredictable URL download link

2015-03-01 Thread Berno Strik
Op Sun, 1 Mar 2015 12:21:04 -0300
Anderson Torres torres.anderson...@gmail.com schreef:

 Hello, Nixers!
 
 How can I fetchurl a variable url?
 
 When I download a dockapp from Windowmaker site, like
 
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz;,
 
 it in fact downloads something like wmSMPmon-${a long string of
 chars, like a checksum}.tar.gz. And the long string is unpredictable.
 
 And when I run nix-prefetch-url
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz; more
 than once, it just outputs different hashes:
 
  nix-prefetch-url
  http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
   % Total% Received % Xferd  Average Speed   TimeTime
 Time  Current Dload  Upload   Total   SpentLeft  Speed
   0 00 00 0  0  0 --:--:--  0:00:01
 --:--:-- 0 100 241130 241130 0   3809  0
 --:--:--  0:00:06 --:--:--  5139 path is
 ‘/nix/store/lqri8zgmwz3mbf3q07kp62zl81bc6fpq-?download=wmSMPmon-3.1.tar.gz’
 104bcfj4j0vlnr4v1fzahgj9amccn1aq7rjcpy1jyqnq6lbrmc3g
 
  nix-prefetch-url
  http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
   % Total% Received % Xferd  Average Speed   TimeTime
 Time  Current Dload  Upload   Total   SpentLeft  Speed
   0 00 00 0  0  0 --:--:-- --:--:--
 --:--:-- 0 100 241100 241100 0   3193  0
 --:--:--  0:00:07 --:--:--  3985 path is
 ‘/nix/store/f2b7rksjfh6ajddjhx09xb0jzc04jxg9-?download=wmSMPmon-3.1.tar.gz’
 1s01whvf51jrwdmrk3bdgysaa2rzmh56c9p0kv3ydxijaagvqi2x
 
 How can I download it?

Use the following code:

  src = fetchgit {
 url = git://repo.or.cz/dockapps.git;
 rev = 38c74350b02f35824554ce0c4f0f251d71762040;
 sha256 = 0g9cwhlqg065fbhav4g4n16a4cqkk9jykl3y0zwbn5whhacfqyhl;
  };

Explanation:

When you download a dockapp from Windowmaker site you are redirected to
a git repo site where you get a snapshot out of it. The id of the
snapshot is the long hexadecimal string you are getting.
The above code does a checkout of the whole dockapp-git directory.
The only thing you have left to do is point to the directory where your
actual dockapp is:

postUnpack = sourceRoot=\${sourceRoot}/dockapp-dir;

 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] Fetching variable and unpredictable URL download link

2015-03-01 Thread Harald van Dijk
Hi,

The problem here is not with the file names, but that you don't actually 
get the same file every time. The file is generated by the server 
on-the-fly, and the mtimes of the files in the download you get depend 
on the precise moment you download it, as you can tell by inspecting the 
output of

   tar tvf $download

This is fundamentally incompatible with any package manager that checks 
that source archives are downloaded correctly.

The original website

 
http://lancre.ribbrock.org/en/binabit_en/wmsmpmon_en/wmsmpmon-changelog_en.html

appears to link to a stable archive that you should be able to use instead.

Cheers,
Harald van Dijk

On 03/01/2015 04:21 PM, Anderson Torres wrote:
 Hello, Nixers!

 How can I fetchurl a variable url?

 When I download a dockapp from Windowmaker site, like

 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz;,

 it in fact downloads something like wmSMPmon-${a long string of
 chars, like a checksum}.tar.gz. And the long string is unpredictable.

 And when I run nix-prefetch-url
 http://windowmaker.org/dockapps/?download=wmSMPmon-3.1.tar.gz; more
 than once, it just outputs different hashes:

 nix-prefetch-url 
 http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
% Total% Received % Xferd  Average Speed   TimeTime Time  
 Current
   Dload  Upload   Total   SpentLeft  Speed
0 00 00 0  0  0 --:--:--  0:00:01 --:--:--  0
 100 241130 241130 0   3809  0 --:--:--  0:00:06 --:--:--  5139
 path is 
 ‘/nix/store/lqri8zgmwz3mbf3q07kp62zl81bc6fpq-?download=wmSMPmon-3.1.tar.gz’
 104bcfj4j0vlnr4v1fzahgj9amccn1aq7rjcpy1jyqnq6lbrmc3g

 nix-prefetch-url 
 http://windowmaker.org/dockapps/\?download\=wmSMPmon-3.1.tar.gz
% Total% Received % Xferd  Average Speed   TimeTime Time  
 Current
   Dload  Upload   Total   SpentLeft  Speed
0 00 00 0  0  0 --:--:-- --:--:-- --:--:--  0
 100 241100 241100 0   3193  0 --:--:--  0:00:07 --:--:--  3985
 path is 
 ‘/nix/store/f2b7rksjfh6ajddjhx09xb0jzc04jxg9-?download=wmSMPmon-3.1.tar.gz’
 1s01whvf51jrwdmrk3bdgysaa2rzmh56c9p0kv3ydxijaagvqi2x

 How can I download it?
 ___
 nix-dev mailing list
 nix-dev@lists.science.uu.nl
 http://lists.science.uu.nl/mailman/listinfo/nix-dev


___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev