comparison scripts/pkg/private/get_forge_pkg.m @ 15965:7ad3eea8a3af stable

use packages.octave.org instead of sourceforge in pkg.m * pkg.m (list_forge_packages): Download package list from packages.octave.org instead of octave.sourceforge.net. * get_forge_pkg.m (get_forge_pkg): Likewise, for package index.html files and sources.
author John W. Eaton <jwe@octave.org>
date Fri, 18 Jan 2013 16:42:05 -0500
parents 72c96de7a403
children d56dd6794a20
comparison
equal deleted inserted replaced
15949:a86275134ffc 15965:7ad3eea8a3af
36 endif 36 endif
37 37
38 name = tolower (name); 38 name = tolower (name);
39 39
40 ## Try to download package's index page. 40 ## Try to download package's index page.
41 [html, succ] = urlread (sprintf ("http://octave.sourceforge.net/%s/index.html", name)); 41 [html, succ] = urlread (sprintf ("http://packages.octave.org/%s/index.html", name));
42 if (succ) 42 if (succ)
43 ## Remove blanks for simpler matching. 43 ## Remove blanks for simpler matching.
44 html(isspace(html)) = []; 44 html(isspace(html)) = [];
45 ## Good. Let's grep for the version. 45 ## Good. Let's grep for the version.
46 pat = "<tdclass=""package_table"">PackageVersion:</td><td>([\\d.]*)</td>"; 46 pat = "<tdclass=""package_table"">PackageVersion:</td><td>([\\d.]*)</td>";
49 error ("get_forge_pkg: could not read version number from package's page"); 49 error ("get_forge_pkg: could not read version number from package's page");
50 else 50 else
51 ver = t{1}{1}; 51 ver = t{1}{1};
52 if (nargout > 1) 52 if (nargout > 1)
53 # Build download string. 53 # Build download string.
54 urlbase = "http://downloads.sourceforge.net/octave/%s-%s.tar.gz?download"; 54 pkg_file = sprintf ("%s-%s.tar.gz", name, ver);
55 url = sprintf (urlbase, name, ver); 55 url = cstrcat ("http://packages.octave.org/download/", pkg_file);
56 ## Verify that the string exists on the page. 56 ## Verify that the package string exists on the page.
57 if (isempty (strfind (html, url))) 57 if (isempty (strfind (html, pkg_file)))
58 warning ("get_forge_pkg: download URL not verified"); 58 warning ("get_forge_pkg: download URL not verified");
59 endif 59 endif
60 endif 60 endif
61 endif 61 endif
62 else 62 else
63 ## Try get the list of all packages. 63 ## Try get the list of all packages.
64 [html, succ] = urlread ("http://octave.sourceforge.net/packages.php"); 64 [html, succ] = urlread ("http://packages.octave.org/packages.php");
65 if (succ) 65 if (succ)
66 t = regexp (html, "<div class=""package"" id=""(\\w+)"">", "tokens"); 66 t = regexp (html, "<div class=""package"" id=""(\\w+)"">", "tokens");
67 t = horzcat (t{:}); 67 t = horzcat (t{:});
68 if (any (strcmp (t, name))) 68 if (any (strcmp (t, name)))
69 error ("get_forge_pkg: package NAME exists, but index page not available"); 69 error ("get_forge_pkg: package NAME exists, but index page not available");