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 15... | Line 15... | ||
15 | static char url_buf[128] = "http://ftp.kolibrios.org/users/Serge/new/OS/"; |
15 | static char url_buf[128] = "http://ftp.kolibrios.org/users/Serge/new/OS/"; |
16 | strcpy(&url_buf[44], name); |
16 | strcpy(&url_buf[44], name); |
17 | return url_buf; |
17 | return url_buf; |
18 | }; |
18 | }; |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | char *make_cache_path(const char *path) |
20 | char *make_tmp_path(const char *path) |
21 | { |
21 | { |
22 | static char path_buf[64] = "/tmp0/1/"; |
22 | static char path_buf[64] = "/tmp0/1/"; |
23 | strcpy(&path_buf[8], path); |
23 | strcpy(&path_buf[8], path); |
24 | return path_buf; |
24 | return path_buf; |
Line -... | Line 25... | ||
- | 25 | }; |
|
- | 26 | ||
- | 27 | char *make_cache_path(const char *path) |
|
- | 28 | { |
|
- | 29 | static char path_buf[64] = "/kolibrios/kpm/cache/"; |
|
- | 30 | strcpy(&path_buf[21], path); |
|
- | 31 | return path_buf; |
|
25 | }; |
32 | }; |
26 | 33 | ||
27 | int http_load_file(const char *path, const char *url) |
34 | int http_load_file(const char *path, const char *url) |
28 | { |
35 | { |
29 | http_t *http; |
36 | http_t *http; |
Line 112... | Line 119... | ||
112 | 119 | ||
113 | int main(int argc, char *argv[]) |
120 | int main(int argc, char *argv[]) |
114 | { |
121 | { |
115 | int count; |
122 | int count; |
- | 123 | char *cache_path; |
|
Line 116... | Line 124... | ||
116 | char *cache_path; |
124 | char *tmp_path; |
117 | 125 | ||
Line 118... | Line 126... | ||
118 | if(http_init()) |
126 | if(http_init()) |
Line 119... | Line 127... | ||
119 | goto err_init; |
127 | goto err_init; |
Line 120... | Line 128... | ||
120 | 128 | ||
121 | cache_path = make_cache_path("packages.xml"); |
129 | tmp_path = make_tmp_path("packages.xml"); |
122 | 130 | ||
123 | count = http_load_file(cache_path, make_url("packages.xml")); |
131 | count = http_load_file(tmp_path, make_url("packages.xml")); |
- | 132 | ||
- | 133 | if(count) |
|
Line 124... | Line 134... | ||
124 | 134 | { |
|
Line 125... | Line 135... | ||
125 | if(count) |
135 | collection_t *collection; |
126 | { |
136 | package_t *pkg; |
- | 137 | LIST_HEAD(install_list); |
|
127 | collection_t *collection; |
138 | LIST_HEAD(download_list); |
128 | pkg_group_t *gr; |
- | |
129 | 139 | ||
130 | collection = load_collection_file(cache_path); |
140 | collection = load_collection_file(tmp_path); |
131 | 141 | ||
132 | list_for_each_entry(gr, &collection->groups, list) |
142 | if(collection && build_install_list(&install_list, collection)) |
133 | { |
143 | { |
134 | package_t *pkg; |
144 | if(build_download_list(&download_list, &install_list)) |
- | 145 | { |
|
135 | 146 | list_for_each_entry(pkg, &download_list, list) |
|
136 | list_for_each_entry(pkg, &gr->packages, list) |
147 | { |
137 | { |
148 | printf("package %s-%s\n", pkg->name, pkg->version); |
Line 138... | Line 149... | ||
138 | printf("package %s-%s\n", pkg->name, pkg->version); |
149 | cache_path = make_cache_path(pkg->filename); |