Skip to content

Commit

Permalink
Merge pull request #1344 from pjf/faster_metadata
Browse files Browse the repository at this point in the history
Download default metadata in .tar.gz rather than .zip format
  • Loading branch information
dbent committed Jul 31, 2015
2 parents fa08b0e + fa57da0 commit 0862b9b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file.
- [GUI] On first start we always refresh the modlist, with an option to do so each time the CKAN is loaded (Postremus, #1285)
- [Core] KSP instance names now default to the folder in which they're installed (Postremus, #1261)
- [Core] Processing an updated mod list is now faster, and other speed enhancements (Postremus, #1229)
- [Core] Metadata is now downloaded in `.tar.gz` rather than `.zip` format, resulting in much faster downloads (pjf, #1344)
- [Spec] `install_to` can now target `Ships/` subdirectories (dbent and plague006, #1243 #1244)

### Internal
Expand Down
12 changes: 12 additions & 0 deletions Core/Registry/Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,18 @@ private void DeSerialisationFixes(StreamingContext context)
}
}

// If we spot a default repo with the old .zip URL, flip it to the new .tar.gz URL
// Any other repo we leave *as-is*, even if it's the github meta-repo, as it's been
// custom-added by our user.

Repository default_repo;
var oldDefaultRepo = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.zip");
if (repositories != null && repositories.TryGetValue(Repository.default_ckan_repo_name, out default_repo) && default_repo.uri == oldDefaultRepo)
{
log.InfoFormat("Updating default metadata URL from {0} to {1}", oldDefaultRepo, Repository.default_ckan_repo_uri);
repositories["default"].uri = Repository.default_ckan_repo_uri;
}

registry_version = LATEST_REGISTRY_VERSION;
}

Expand Down
2 changes: 1 addition & 1 deletion Core/Types/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace CKAN
public class Repository
{
[JsonIgnore] public static readonly string default_ckan_repo_name = "default";
[JsonIgnore] public static readonly Uri default_ckan_repo_uri = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.zip");
[JsonIgnore] public static readonly Uri default_ckan_repo_uri = new Uri("https://github.com/KSP-CKAN/CKAN-meta/archive/master.tar.gz");
[JsonIgnore] public static readonly Uri default_repo_master_list = new Uri("https://raw.githubusercontent.com/KSP-CKAN/CKAN-meta/master/repositories.json");

public string name;
Expand Down

0 comments on commit 0862b9b

Please sign in to comment.