Rev 5726 | Rev 5728 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5726 | Rev 5727 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #include "tinyxml/tinyxml.h" |
1 | #include "tinyxml/tinyxml.h" |
2 | #include "collection.h" |
2 | #include "collection.h" |
- | 3 | #include |
|
Line 3... | Line 4... | ||
3 | 4 | ||
4 | const char *key_collection = "collection"; |
5 | const char *key_collection = "collection"; |
5 | const char *key_package = "package"; |
6 | const char *key_package = "package"; |
6 | const char *key_name = "name"; |
7 | const char *key_name = "name"; |
Line 68... | Line 69... | ||
68 | }; |
69 | }; |
Line 69... | Line 70... | ||
69 | 70 | ||
70 | return collection; |
71 | return collection; |
Line -... | Line 72... | ||
- | 72 | } |
|
- | 73 | ||
- | 74 | int build_install_list(list_t *list, collection_t *collection) |
|
- | 75 | { |
|
- | 76 | pkg_group_t *gr; |
|
- | 77 | int count = 0; |
|
- | 78 | ||
- | 79 | list_for_each_entry(gr, &collection->groups, list) |
|
Line -... | Line 80... | ||
- | 80 | { |
|
- | 81 | package_t *pkg, *tmp; |
|
- | 82 | ||
- | 83 | list_for_each_entry(tmp, &gr->packages, list) |
|
- | 84 | { |
|
- | 85 | pkg = (package_t*)malloc(sizeof(package_t)); |
|
- | 86 | ||
- | 87 | pkg->id = tmp->id; |
|
- | 88 | pkg->name = strdup(tmp->name); |
|
- | 89 | pkg->version = strdup(tmp->version); |
|
- | 90 | pkg->filename = strdup(tmp->filename); |
|
- | 91 | pkg->description = strdup(tmp->description); |
|
- | 92 | list_add_tail(&pkg->list, list); |
|
- | 93 | // printf("add package %s-%s\n", pkg->name, pkg->version); |
|
- | 94 | ||
- | 95 | count++; |
|
- | 96 | } |
|
- | 97 | }; |
|
- | 98 | return count; |
|
- | 99 | } |
|
- | 100 | ||
- | 101 | int build_download_list(list_t *download, list_t *src) |
|
- | 102 | { |
|
- | 103 | int count = 0; |
|
- | 104 | char *cache_path; |
|
- | 105 | package_t *pkg, *tmp; |
|
- | 106 | fileinfo_t info; |
|
- | 107 | list_for_each_entry(tmp, src, list) |
|
- | 108 | { |
|
- | 109 | cache_path = make_cache_path(tmp->filename); |
|
- | 110 | ||
- | 111 | if( get_fileinfo(cache_path, &info) != 0) |
|
- | 112 | { |
|
- | 113 | pkg = (package_t*)malloc(sizeof(package_t)); |
|
- | 114 | ||
- | 115 | pkg->id = tmp->id; |
|
- | 116 | pkg->name = strdup(tmp->name); |
|
- | 117 | pkg->version = strdup(tmp->version); |
|
- | 118 | pkg->filename = strdup(tmp->filename); |
|
- | 119 | pkg->description = strdup(tmp->description); |
|
- | 120 | list_add_tail(&pkg->list, download); |
|
- | 121 | count++; |
|
- | 122 | printf("add package %s-%s\n", pkg->name, pkg->version); |
|
- | 123 | }; |