Subversion Repositories Kolibri OS

Rev

Rev 5737 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5737 Rev 5809
Line 141... Line 141...
141
 
141
 
142
            INIT_LIST_HEAD(&pkg->file_list);
142
            INIT_LIST_HEAD(&pkg->file_list);
143
            pkg->id       = tmp->id;
143
            pkg->id       = tmp->id;
144
            pkg->name     = strdup(tmp->name);
144
            pkg->name     = strdup(tmp->name);
-
 
145
            pkg->version  = strdup(tmp->version);
145
            pkg->version  = strdup(tmp->version);
146
            pkg->group    = strdup(tmp->group);
146
            pkg->filename = strdup(tmp->filename);
147
            pkg->filename = strdup(tmp->filename);
147
            pkg->description = strdup(tmp->description);
148
            pkg->description = strdup(tmp->description);
148
            list_add_tail(&pkg->list, download);
149
            list_add_tail(&pkg->list, download);
149
            count++;
150
            count++;
Line 164... Line 165...
164
        con_write_asciiz(conbuf);
165
        con_write_asciiz(conbuf);
165
        cache_path = make_cache_path(pkg->filename);
166
        cache_path = make_cache_path(pkg->filename);
166
        count = http_load_file(cache_path, make_url(pkg->filename));
167
        count = http_load_file(cache_path, make_url(pkg->filename));
167
        sprintf(conbuf,"%s %d bytes loaded\n",cache_path, count);
168
        sprintf(conbuf,"%s %d bytes loaded\n",cache_path, count);
168
        con_write_asciiz(conbuf);
169
        con_write_asciiz(conbuf);
-
 
170
 
169
        if( !test_archive(cache_path))
171
        if( !test_archive(cache_path))
170
            list_del_pkg(pkg);
172
            list_del_pkg(pkg);
171
        else
173
        else
172
            unlink(cache_path);
174
            unlink(cache_path);
173
    };
175
    };
Line 190... Line 192...
190
        }
192
        }
191
        list_del_pkg(mpkg);
193
        list_del_pkg(mpkg);
192
    };
194
    };
193
};
195
};
Line 194... Line 196...
194
 
196
 
195
int build_install_list(list_t *list, collection_t *collection)
-
 
196
{
-
 
197
    pkg_group_t *gr;
-
 
198
    int count = 0;
-
 
199
 
-
 
200
    list_for_each_entry(gr, &collection->groups, list)
197
int copy_list(list_t *list, list_t *src)
201
    {
198
{
-
 
199
    package_t   *pkg, *tmp;
Line 202... Line 200...
202
        package_t   *pkg, *tmp;
200
    int count = 0;
203
 
201
 
204
        list_for_each_entry(tmp, &gr->packages, list)
202
    list_for_each_entry(tmp, src, list)
Line 205... Line 203...
205
        {
203
    {
206
            pkg = (package_t*)malloc(sizeof(package_t));
204
        pkg = (package_t*)malloc(sizeof(package_t));
207
 
205
 
208
            INIT_LIST_HEAD(&pkg->file_list);
206
        INIT_LIST_HEAD(&pkg->file_list);
-
 
207
        pkg->id       = tmp->id;
209
            pkg->id       = tmp->id;
208
        pkg->name     = strdup(tmp->name);
210
            pkg->name     = strdup(tmp->name);
209
        pkg->version  = strdup(tmp->version);
211
            pkg->version  = strdup(tmp->version);
210
        pkg->group    = strdup(tmp->group);
212
            pkg->filename = strdup(tmp->filename);
211
        pkg->filename = strdup(tmp->filename);
213
            pkg->description = strdup(tmp->description);
-
 
214
            list_add_tail(&pkg->list, list);
212
        pkg->description = strdup(tmp->description);
215
            count++;
213
        list_add_tail(&pkg->list, list);
216
        }
214
        count++;
Line 217... Line 215...
217
    };
215
    };
Line 228... Line 226...
228
 
226
 
Line 229... Line 227...
229
    collection = load_collection_file(path);
227
    collection = load_collection_file(path);
230
 
228
 
231
    if(collection)
-
 
232
    {
-
 
233
        pkg_group_t *gr;
-
 
234
 
-
 
235
        list_for_each_entry(gr, &collection->groups, list)
229
    if(collection)
Line 236... Line 230...
236
        {
230
    {
237
            package_t   *pkg, *tmp;
231
        package_t   *pkg, *tmp;
238
 
232
 
Line 239... Line 233...
239
            list_for_each_entry(tmp, &gr->packages, list)
233
        list_for_each_entry(tmp, &collection->packages, list)
240
            {
234
        {
241
                pkg = (package_t*)malloc(sizeof(package_t));
235
            pkg = (package_t*)malloc(sizeof(package_t));
242
 
236
 
-
 
237
            INIT_LIST_HEAD(&pkg->file_list);
243
                INIT_LIST_HEAD(&pkg->file_list);
238
            pkg->id       = tmp->id;
244
                pkg->id       = tmp->id;
239
            pkg->name     = strdup(tmp->name);
245
                pkg->name     = strdup(tmp->name);
240
            pkg->version  = strdup(tmp->version);
246
                pkg->version  = strdup(tmp->version);
241
            pkg->group    = strdup(tmp->group);
247
                pkg->filename = strdup(tmp->filename);
-
 
248
                pkg->description = strdup(tmp->description);
242
            pkg->filename = strdup(tmp->filename);
249
                list_add_tail(&pkg->list, slist);
243
            pkg->description = strdup(tmp->description);
250
                count++;
244
            list_add_tail(&pkg->list, slist);
251
            }
245
            count++;
Line 258... Line 252...
258
{
252
{
259
    package_t *pkg;
253
    package_t *pkg;
Line 260... Line 254...
260
 
254
 
261
    list_for_each_entry(pkg, list, list)
255
    list_for_each_entry(pkg, list, list)
262
    {
256
    {
263
        sprintf(conbuf,"%s-%s\n", pkg->name, pkg->version);
257
        sprintf(conbuf,"%s-%s-%s\n", pkg->name, pkg->version, pkg->group);
264
        con_write_asciiz(conbuf);
258
        con_write_asciiz(conbuf);
265
    }
259
    }
-
 
260
}
-
 
261
 
-
 
262
void process_task(list_t *task)
-
 
263
{
-
 
264
    LIST_HEAD(download_list);
-
 
265
 
-
 
266
    if(build_download_list(&download_list, task))
-
 
267
        do_download(&download_list);
-
 
268
 
-
 
269
    if(!list_empty(&download_list))
-
 
270
        remove_missing_packages(task, &download_list);
-
 
271
 
-
 
272
    do_install(task);