220-drop-release-support.patch 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812
  1. --- a/libopkg/Makefile.am
  2. +++ b/libopkg/Makefile.am
  3. @@ -15,7 +15,6 @@ opkg_cmd_sources = opkg_cmd.c opkg_cmd.h
  4. opkg_upgrade.c opkg_upgrade.h \
  5. opkg_remove.c opkg_remove.h
  6. opkg_db_sources = opkg_conf.c opkg_conf.h \
  7. - release.c release.h release_parse.c release_parse.h \
  8. opkg_utils.c opkg_utils.h pkg.c pkg.h hash_table.h \
  9. pkg_depends.c pkg_depends.h pkg_extract.c pkg_extract.h \
  10. hash_table.c pkg_hash.c pkg_hash.h pkg_parse.c pkg_parse.h \
  11. @@ -28,7 +27,6 @@ opkg_list_sources = conffile.c conffile.
  12. active_list.c active_list.h list.h
  13. opkg_util_sources = file_util.c file_util.h opkg_message.h opkg_message.c md5.c md5.h \
  14. parse_util.c parse_util.h \
  15. - cksum_list.c cksum_list.h \
  16. sprintf_alloc.c sprintf_alloc.h \
  17. xregex.c xregex.h xsystem.c xsystem.h
  18. if HAVE_PATHFINDER
  19. --- a/libopkg/cksum_list.c
  20. +++ /dev/null
  21. @@ -1,87 +0,0 @@
  22. -/* cksum_lis.c - the opkg package management system
  23. -
  24. - Copyright (C) 2010,2011 Javier Palacios
  25. -
  26. - This program is free software; you can redistribute it and/or
  27. - modify it under the terms of the GNU General Public License as
  28. - published by the Free Software Foundation; either version 2, or (at
  29. - your option) any later version.
  30. -
  31. - This program is distributed in the hope that it will be useful, but
  32. - WITHOUT ANY WARRANTY; without even the implied warranty of
  33. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  34. - General Public License for more details.
  35. -*/
  36. -
  37. -#include "config.h"
  38. -
  39. -#include <stdio.h>
  40. -
  41. -#include "cksum_list.h"
  42. -#include "libbb/libbb.h"
  43. -
  44. -
  45. -int cksum_init(cksum_t *cksum, char **itemlist)
  46. -{
  47. - cksum->value = xstrdup(*itemlist++);
  48. - cksum->size = atoi(*itemlist++);
  49. - cksum->name = xstrdup(*itemlist++);
  50. -
  51. - return 0;
  52. -}
  53. -
  54. -void cksum_deinit(cksum_t *cksum)
  55. -{
  56. - free (cksum->name);
  57. - cksum->name = NULL;
  58. -
  59. - free (cksum->value);
  60. - cksum->value = NULL;
  61. -}
  62. -
  63. -void cksum_list_init(cksum_list_t *list)
  64. -{
  65. - void_list_init((void_list_t *) list);
  66. -}
  67. -
  68. -void cksum_list_deinit(cksum_list_t *list)
  69. -{
  70. - cksum_list_elt_t *iter, *n;
  71. - cksum_t *cksum;
  72. -
  73. - list_for_each_entry_safe(iter, n, &list->head, node) {
  74. - cksum = (cksum_t *)iter->data;
  75. - cksum_deinit(cksum);
  76. -
  77. - /* malloced in cksum_list_append */
  78. - free(cksum);
  79. - iter->data = NULL;
  80. - }
  81. - void_list_deinit((void_list_t *) list);
  82. -}
  83. -
  84. -cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist)
  85. -{
  86. - /* freed in cksum_list_deinit */
  87. - cksum_t *cksum = xcalloc(1, sizeof(cksum_t));
  88. - cksum_init(cksum, itemlist);
  89. -
  90. - void_list_append((void_list_t *) list, cksum);
  91. -
  92. - return cksum;
  93. -}
  94. -
  95. -const cksum_t *cksum_list_find(cksum_list_t *list, const char *name)
  96. -{
  97. - cksum_list_elt_t *iter;
  98. - cksum_t *cksum;
  99. -
  100. - list_for_each_entry(iter, &list->head, node) {
  101. - cksum = (cksum_t *)iter->data;
  102. - if (strcmp(cksum->name, name) == 0) {
  103. - return cksum;
  104. - }
  105. - }
  106. - return NULL;
  107. -}
  108. -
  109. --- a/libopkg/cksum_list.h
  110. +++ /dev/null
  111. @@ -1,46 +0,0 @@
  112. -/* cksum_list.h - the opkg package management system
  113. -
  114. - Copyright (C) 2010,2011 Javier Palacios
  115. -
  116. - This program is free software; you can redistribute it and/or
  117. - modify it under the terms of the GNU General Public License as
  118. - published by the Free Software Foundation; either version 2, or (at
  119. - your option) any later version.
  120. -
  121. - This program is distributed in the hope that it will be useful, but
  122. - WITHOUT ANY WARRANTY; without even the implied warranty of
  123. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  124. - General Public License for more details.
  125. -*/
  126. -
  127. -#ifndef CKSUM_LIST_H
  128. -#define CKSUM_LIST_H
  129. -
  130. -typedef struct
  131. -{
  132. - char *name;
  133. - char *value;
  134. - int size;
  135. -} cksum_t;
  136. -
  137. -int cksum_init(cksum_t *cksum, char **itemlist);
  138. -void cksum_deinit(cksum_t *cksum);
  139. -
  140. -#include "void_list.h"
  141. -
  142. -typedef struct void_list_elt cksum_list_elt_t;
  143. -
  144. -typedef struct void_list cksum_list_t;
  145. -
  146. -static inline int cksum_list_empty(cksum_list_t *list)
  147. -{
  148. - return void_list_empty ((void_list_t *)list);
  149. -}
  150. -
  151. -void cksum_list_init(cksum_list_t *list);
  152. -void cksum_list_deinit(cksum_list_t *list);
  153. -
  154. -cksum_t *cksum_list_append(cksum_list_t *list, char **itemlist);
  155. -const cksum_t *cksum_list_find(cksum_list_t *list, const char *name);
  156. -
  157. -#endif
  158. --- a/libopkg/release.c
  159. +++ /dev/null
  160. @@ -1,342 +0,0 @@
  161. -/* release.c - the opkg package management system
  162. -
  163. - Copyright (C) 2010,2011 Javier Palacios
  164. -
  165. - This program is free software; you can redistribute it and/or
  166. - modify it under the terms of the GNU General Public License as
  167. - published by the Free Software Foundation; either version 2, or (at
  168. - your option) any later version.
  169. -
  170. - This program is distributed in the hope that it will be useful, but
  171. - WITHOUT ANY WARRANTY; without even the implied warranty of
  172. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  173. - General Public License for more details.
  174. -*/
  175. -
  176. -#include <unistd.h>
  177. -#include <ctype.h>
  178. -
  179. -#include "release.h"
  180. -#include "opkg_utils.h"
  181. -#include "libbb/libbb.h"
  182. -
  183. -#include "opkg_download.h"
  184. -#include "sprintf_alloc.h"
  185. -
  186. -#include "release_parse.h"
  187. -
  188. -#include "parse_util.h"
  189. -#include "file_util.h"
  190. -
  191. -static void
  192. -release_init(release_t *release)
  193. -{
  194. - release->name = NULL;
  195. - release->datestring = NULL;
  196. - release->architectures = NULL;
  197. - release->architectures_count = 0;
  198. - release->components = NULL;
  199. - release->components_count = 0;
  200. - release->complist = NULL;
  201. - release->complist_count = 0;
  202. -}
  203. -
  204. -release_t *
  205. -release_new(void)
  206. -{
  207. - release_t *release;
  208. -
  209. - release = xcalloc(1, sizeof(release_t));
  210. - release_init(release);
  211. -
  212. - return release;
  213. -}
  214. -
  215. -void
  216. -release_deinit(release_t *release)
  217. -{
  218. - int i;
  219. -
  220. - free(release->name);
  221. - free(release->datestring);
  222. -
  223. - for(i = 0; i < release->architectures_count; i++){
  224. - free(release->architectures[i]);
  225. - }
  226. - free(release->architectures);
  227. -
  228. - for(i = 0; i < release->components_count; i++){
  229. - free(release->components[i]);
  230. - }
  231. - free(release->components);
  232. -
  233. - for(i = 0; i < release->complist_count; i++){
  234. - free(release->complist[i]);
  235. - }
  236. - free(release->complist);
  237. -
  238. -}
  239. -
  240. -int
  241. -release_init_from_file(release_t *release, const char *filename)
  242. -{
  243. - int err = 0;
  244. - FILE *release_file;
  245. -
  246. - release_file = fopen(filename, "r");
  247. - if (release_file == NULL) {
  248. - opkg_perror(ERROR, "Failed to open %s", filename);
  249. - return -1;
  250. - }
  251. -
  252. - err=release_parse_from_stream(release, release_file);
  253. - if (!err) {
  254. - if (!release_arch_supported(release)) {
  255. - opkg_msg(ERROR, "No valid architecture found on Release file.\n");
  256. - err = -1;
  257. - }
  258. - }
  259. -
  260. - return err;
  261. -}
  262. -
  263. -const char *
  264. -item_in_list(const char *comp, char **complist, const unsigned int count)
  265. -{
  266. - int i;
  267. -
  268. - if (!complist)
  269. - return comp;
  270. -
  271. - for(i = 0; i < count; i++){
  272. - if (strcmp(comp, complist[i]) == 0)
  273. - return complist[i];
  274. - }
  275. -
  276. - return NULL;
  277. -}
  278. -
  279. -int
  280. -release_arch_supported(release_t *release)
  281. -{
  282. - nv_pair_list_elt_t *l;
  283. -
  284. - list_for_each_entry(l , &conf->arch_list.head, node) {
  285. - nv_pair_t *nv = (nv_pair_t *)l->data;
  286. - if (item_in_list(nv->name, release->architectures, release->architectures_count)) {
  287. - opkg_msg(DEBUG, "Arch %s (priority %s) supported for dist %s.\n",
  288. - nv->name, nv->value, release->name);
  289. - return 1;
  290. - }
  291. - }
  292. -
  293. - return 0;
  294. -}
  295. -
  296. -int
  297. -release_comps_supported(release_t *release, const char *complist)
  298. -{
  299. - int ret = 1;
  300. - int i;
  301. -
  302. - if (complist) {
  303. - release->complist = parse_list(complist, &release->complist_count, ' ', 1);
  304. - for(i = 0; i < release->complist_count; i++){
  305. - if (!item_in_list(release->complist[i], release->components, release->components_count)) {
  306. - opkg_msg(ERROR, "Component %s not supported for dist %s.\n",
  307. - release->complist[i], release->name);
  308. - ret = 0;
  309. - }
  310. - }
  311. - }
  312. -
  313. - return ret;
  314. -}
  315. -
  316. -const char **
  317. -release_comps(release_t *release, unsigned int *count)
  318. -{
  319. - char **comps = release->complist;
  320. -
  321. - if (!comps) {
  322. - comps = release->components;
  323. - *count = release->components_count;
  324. - } else {
  325. - *count = release->complist_count;
  326. - }
  327. -
  328. - return (const char **)comps;
  329. -}
  330. -
  331. -int
  332. -release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir)
  333. -{
  334. - int ret = 0;
  335. - unsigned int ncomp;
  336. - const char **comps = release_comps(release, &ncomp);
  337. - nv_pair_list_elt_t *l;
  338. - int i;
  339. -
  340. - for(i = 0; i < ncomp; i++){
  341. - int err = 0;
  342. - char *prefix;
  343. -
  344. - sprintf_alloc(&prefix, "%s/dists/%s/%s/binary", dist->value, dist->name,
  345. - comps[i]);
  346. -
  347. - list_for_each_entry(l , &conf->arch_list.head, node) {
  348. - char *url;
  349. - char *tmp_file_name, *list_file_name;
  350. - char *subpath = NULL;
  351. -
  352. - nv_pair_t *nv = (nv_pair_t *)l->data;
  353. -
  354. - sprintf_alloc(&list_file_name, "%s/%s-%s-%s", lists_dir, dist->name, comps[i], nv->name);
  355. -
  356. - sprintf_alloc(&tmp_file_name, "%s/%s-%s-%s%s", tmpdir, dist->name, comps[i], nv->name, ".gz");
  357. -
  358. - sprintf_alloc(&subpath, "%s/binary-%s/%s", comps[i], nv->name, dist->gzip ? "Packages.gz" : "Packages");
  359. -
  360. - if (dist->gzip) {
  361. - sprintf_alloc(&url, "%s-%s/Packages.gz", prefix, nv->name);
  362. - err = opkg_download(url, tmp_file_name, NULL, NULL, 1);
  363. - if (!err) {
  364. - err = release_verify_file(release, tmp_file_name, subpath);
  365. - if (err) {
  366. - unlink (tmp_file_name);
  367. - unlink (list_file_name);
  368. - }
  369. - }
  370. - if (!err) {
  371. - FILE *in, *out;
  372. - opkg_msg(NOTICE, "Inflating %s.\n", url);
  373. - in = fopen (tmp_file_name, "r");
  374. - out = fopen (list_file_name, "w");
  375. - if (in && out) {
  376. - err = unzip (in, out);
  377. - if (err)
  378. - opkg_msg(INFO, "Corrumpt file at %s.\n", url);
  379. - } else
  380. - err = 1;
  381. - if (in)
  382. - fclose (in);
  383. - if (out)
  384. - fclose (out);
  385. - unlink (tmp_file_name);
  386. - }
  387. - free(url);
  388. - }
  389. -
  390. - if (err) {
  391. - sprintf_alloc(&url, "%s-%s/Packages", prefix, nv->name);
  392. - err = opkg_download(url, list_file_name, NULL, NULL, 1);
  393. - if (!err) {
  394. - err = release_verify_file(release, tmp_file_name, subpath);
  395. - if (err)
  396. - unlink (list_file_name);
  397. - }
  398. - free(url);
  399. - }
  400. -
  401. - free(tmp_file_name);
  402. - free(list_file_name);
  403. - }
  404. -
  405. - if(err)
  406. - ret = 1;
  407. -
  408. - free(prefix);
  409. - }
  410. -
  411. - return ret;
  412. -}
  413. -
  414. -int
  415. -release_get_size(release_t *release, const char *pathname)
  416. -{
  417. - const cksum_t *cksum;
  418. -
  419. - if (release->md5sums) {
  420. - cksum = cksum_list_find(release->md5sums, pathname);
  421. - return cksum->size;
  422. - }
  423. -
  424. -#ifdef HAVE_SHA256
  425. - if (release->sha256sums) {
  426. - cksum = cksum_list_find(release->sha256sums, pathname);
  427. - return cksum->size;
  428. - }
  429. -#endif
  430. -
  431. - return -1;
  432. -}
  433. -
  434. -const char *
  435. -release_get_md5(release_t *release, const char *pathname)
  436. -{
  437. - const cksum_t *cksum;
  438. -
  439. - if (release->md5sums) {
  440. - cksum = cksum_list_find(release->md5sums, pathname);
  441. - return cksum->value;
  442. - }
  443. -
  444. - return '\0';
  445. -}
  446. -
  447. -#ifdef HAVE_SHA256
  448. -const char *
  449. -release_get_sha256(release_t *release, const char *pathname)
  450. -{
  451. - const cksum_t *cksum;
  452. -
  453. - if (release->sha256sums) {
  454. - cksum = cksum_list_find(release->sha256sums, pathname);
  455. - return cksum->value;
  456. - }
  457. -
  458. - return '\0';
  459. -}
  460. -#endif
  461. -
  462. -int
  463. -release_verify_file(release_t *release, const char* file_name, const char *pathname)
  464. -{
  465. - struct stat f_info;
  466. - char *f_md5 = NULL;
  467. - const char *md5 = release_get_md5(release, pathname);
  468. -#ifdef HAVE_SHA256
  469. - char *f_sha256 = NULL;
  470. - const char *sha256 = release_get_sha256(release, pathname);
  471. -#endif
  472. - int ret = 0;
  473. -
  474. - if (stat(file_name, &f_info) || (f_info.st_size!=release_get_size(release, pathname))) {
  475. - opkg_msg(ERROR, "Size verification failed for %s - %s.\n", release->name, pathname);
  476. - ret = 1;
  477. - } else {
  478. -
  479. - f_md5 = file_md5sum_alloc(file_name);
  480. -#ifdef HAVE_SHA256
  481. - f_sha256 = file_sha256sum_alloc(file_name);
  482. -#endif
  483. -
  484. - if (md5 && strcmp(md5, f_md5)) {
  485. - opkg_msg(ERROR, "MD5 verification failed for %s - %s.\n", release->name, pathname);
  486. - ret = 1;
  487. -#ifdef HAVE_SHA256
  488. - } else if (sha256 && strcmp(sha256, f_sha256)) {
  489. - opkg_msg(ERROR, "SHA256 verification failed for %s - %s.\n", release->name, pathname);
  490. - ret = 1;
  491. -#endif
  492. - }
  493. -
  494. - }
  495. -
  496. - free(f_md5);
  497. -#ifdef HAVE_SHA256
  498. - free(f_sha256);
  499. -#endif
  500. -
  501. - return ret;
  502. -}
  503. --- a/libopkg/release.h
  504. +++ /dev/null
  505. @@ -1,53 +0,0 @@
  506. -/* release.h - the opkg package management system
  507. -
  508. - Copyright (C) 2010,2011 Javier Palacios
  509. -
  510. - This program is free software; you can redistribute it and/or
  511. - modify it under the terms of the GNU General Public License as
  512. - published by the Free Software Foundation; either version 2, or (at
  513. - your option) any later version.
  514. -
  515. - This program is distributed in the hope that it will be useful, but
  516. - WITHOUT ANY WARRANTY; without even the implied warranty of
  517. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  518. - General Public License for more details.
  519. -*/
  520. -
  521. -#ifndef RELEASE_H
  522. -#define RELEASE_H
  523. -
  524. -#include <stdio.h>
  525. -#include "pkg.h"
  526. -#include "cksum_list.h"
  527. -
  528. -struct release
  529. -{
  530. - char *name;
  531. - char *datestring;
  532. - char **architectures;
  533. - unsigned int architectures_count;
  534. - char **components;
  535. - unsigned int components_count;
  536. - cksum_list_t *md5sums;
  537. -#ifdef HAVE_SHA256
  538. - cksum_list_t *sha256sums;
  539. -#endif
  540. - char **complist;
  541. - unsigned int complist_count;
  542. -};
  543. -
  544. -typedef struct release release_t;
  545. -
  546. -release_t *release_new(void);
  547. -void release_deinit(release_t *release);
  548. -int release_init_from_file(release_t *release, const char *filename);
  549. -
  550. -int release_arch_supported(release_t *release);
  551. -int release_comps_supported(release_t *release, const char *complist);
  552. -int release_download(release_t *release, pkg_src_t *dist, char *lists_dir, char *tmpdir);
  553. -
  554. -const char **release_comps(release_t *release, unsigned int *count);
  555. -
  556. -int release_verify_file(release_t *release, const char *filename, const char *pathname);
  557. -
  558. -#endif
  559. --- a/libopkg/release_parse.c
  560. +++ /dev/null
  561. @@ -1,126 +0,0 @@
  562. -/* release_parse.c - the opkg package management system
  563. -
  564. - Copyright (C) 2010,2011 Javier Palacios
  565. -
  566. - This program is free software; you can redistribute it and/or
  567. - modify it under the terms of the GNU General Public License as
  568. - published by the Free Software Foundation; either version 2, or (at
  569. - your option) any later version.
  570. -
  571. - This program is distributed in the hope that it will be useful, but
  572. - WITHOUT ANY WARRANTY; without even the implied warranty of
  573. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  574. - General Public License for more details.
  575. -*/
  576. -
  577. -#include "config.h"
  578. -
  579. -#include <stdio.h>
  580. -
  581. -#include "release.h"
  582. -#include "release_parse.h"
  583. -#include "libbb/libbb.h"
  584. -#include "parse_util.h"
  585. -
  586. -static int
  587. -release_parse_line(void *ptr, const char *line, uint mask)
  588. -{
  589. - release_t *release = (release_t *) ptr;
  590. -
  591. - int ret = 0;
  592. - unsigned int count = 0;
  593. - char **list = 0;
  594. - static int reading_md5sums = 0;
  595. -#ifdef HAVE_SHA256
  596. - static int reading_sha256sums = 0;
  597. -#endif
  598. -
  599. - switch (*line) {
  600. - case 'A':
  601. - if (is_field("Architectures", line)) {
  602. - release->architectures = parse_list(line, &release->architectures_count, ' ', 0);
  603. - }
  604. - break;
  605. -
  606. - case 'C':
  607. - if (is_field("Codename", line)) {
  608. - release->name = parse_simple("Codename", line);
  609. - }
  610. - else if (is_field("Components", line)) {
  611. - release->components = parse_list(line, &release->components_count, ' ', 0);
  612. - }
  613. - break;
  614. -
  615. - case 'D':
  616. - if (is_field("Date", line)) {
  617. - release->datestring = parse_simple("Date", line);
  618. - }
  619. - break;
  620. -
  621. - case 'M':
  622. - if (is_field("MD5sum", line)) {
  623. - reading_md5sums = 1;
  624. - if (release->md5sums == NULL) {
  625. - release->md5sums = xcalloc(1, sizeof(cksum_list_t));
  626. - cksum_list_init(release->md5sums);
  627. - }
  628. - goto dont_reset_flags;
  629. - }
  630. - break;
  631. -
  632. -#ifdef HAVE_SHA256
  633. - case 'S':
  634. - if (is_field("SHA256", line)) {
  635. - reading_sha256sums = 1;
  636. - if (release->sha256sums == NULL) {
  637. - release->sha256sums = xcalloc(1, sizeof(cksum_list_t));
  638. - cksum_list_init(release->sha256sums);
  639. - }
  640. - goto dont_reset_flags;
  641. - }
  642. - break;
  643. -#endif
  644. -
  645. - case ' ':
  646. - if (reading_md5sums) {
  647. - list = parse_list(line, &count, ' ', 1);
  648. - cksum_list_append(release->md5sums, list);
  649. - goto dont_reset_flags;
  650. - }
  651. -#ifdef HAVE_SHA256
  652. - else if (reading_sha256sums) {
  653. - list = parse_list(line, &count, ' ', 1);
  654. - cksum_list_append(release->sha256sums, list);
  655. - goto dont_reset_flags;
  656. - }
  657. -#endif
  658. - break;
  659. -
  660. - default:
  661. - ret = 1;
  662. - }
  663. -
  664. - reading_md5sums = 0;
  665. -#ifdef HAVE_SHA256
  666. - reading_sha256sums = 0;
  667. -#endif
  668. -
  669. -dont_reset_flags:
  670. -
  671. - return ret;
  672. -}
  673. -
  674. -int
  675. -release_parse_from_stream(release_t *release, FILE *fp)
  676. -{
  677. - int ret;
  678. - char *buf;
  679. - const size_t len = 4096;
  680. -
  681. - buf = xmalloc(len);
  682. - ret = parse_from_stream_nomalloc(release_parse_line, release, fp, 0, &buf, len);
  683. - free(buf);
  684. -
  685. - return ret;
  686. -}
  687. -
  688. --- a/libopkg/release_parse.h
  689. +++ /dev/null
  690. @@ -1,21 +0,0 @@
  691. -/* release_parse.h - the opkg package management system
  692. -
  693. - Copyright (C) 2010,2011 Javier Palacios
  694. -
  695. - This program is free software; you can redistribute it and/or
  696. - modify it under the terms of the GNU General Public License as
  697. - published by the Free Software Foundation; either version 2, or (at
  698. - your option) any later version.
  699. -
  700. - This program is distributed in the hope that it will be useful, but
  701. - WITHOUT ANY WARRANTY; without even the implied warranty of
  702. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  703. - General Public License for more details.
  704. -*/
  705. -
  706. -#ifndef RELEASE_PARSE_H
  707. -#define RELEASE_PARSE_H
  708. -
  709. -int release_parse_from_stream(release_t *release, FILE *fp);
  710. -
  711. -#endif
  712. --- a/libopkg/opkg_cmd.c
  713. +++ b/libopkg/opkg_cmd.c
  714. @@ -27,7 +27,6 @@
  715. #include "opkg_conf.h"
  716. #include "opkg_cmd.h"
  717. #include "opkg_message.h"
  718. -#include "release.h"
  719. #include "pkg.h"
  720. #include "pkg_dest.h"
  721. #include "pkg_parse.h"
  722. @@ -114,39 +113,6 @@ opkg_update_cmd(int argc, char **argv)
  723. }
  724. - for (iter = void_list_first(&conf->dist_src_list); iter; iter = void_list_next(&conf->dist_src_list, iter)) {
  725. - char *url, *list_file_name;
  726. -
  727. - src = (pkg_src_t *)iter->data;
  728. -
  729. - sprintf_alloc(&url, "%s/dists/%s/Release", src->value, src->name);
  730. -
  731. - sprintf_alloc(&list_file_name, "%s/%s", lists_dir, src->name);
  732. - err = opkg_download(url, list_file_name, NULL, NULL, 0);
  733. - if (!err) {
  734. - opkg_msg(NOTICE, "Downloaded release files for dist %s.\n",
  735. - src->name);
  736. - release_t *release = release_new();
  737. - err = release_init_from_file(release, list_file_name);
  738. - if (!err) {
  739. - if (!release_comps_supported(release, src->extra_data))
  740. - err = -1;
  741. - }
  742. - if (!err) {
  743. - err = release_download(release, src, lists_dir, tmp);
  744. - }
  745. - release_deinit(release);
  746. - if (err)
  747. - unlink(list_file_name);
  748. - }
  749. -
  750. - if (err)
  751. - failures++;
  752. -
  753. - free(list_file_name);
  754. - free(url);
  755. - }
  756. -
  757. for (iter = void_list_first(&conf->pkg_src_list); iter; iter = void_list_next(&conf->pkg_src_list, iter)) {
  758. char *url, *list_file_name;
  759. --- a/libopkg/pkg_hash.c
  760. +++ b/libopkg/pkg_hash.c
  761. @@ -18,7 +18,6 @@
  762. #include <stdio.h>
  763. #include "hash_table.h"
  764. -#include "release.h"
  765. #include "pkg.h"
  766. #include "opkg_message.h"
  767. #include "pkg_vec.h"
  768. @@ -184,40 +183,6 @@ pkg_hash_load_feeds(void)
  769. lists_dir = conf->restrict_to_default_dest ?
  770. conf->default_dest->lists_dir : conf->lists_dir;
  771. - for (iter = void_list_first(&conf->dist_src_list); iter;
  772. - iter = void_list_next(&conf->dist_src_list, iter)) {
  773. -
  774. - src = (pkg_src_t *)iter->data;
  775. -
  776. - sprintf_alloc(&list_file, "%s/%s", lists_dir, src->name);
  777. -
  778. - if (file_exists(list_file)) {
  779. - int i;
  780. - release_t *release = release_new();
  781. - if(release_init_from_file(release, list_file)) {
  782. - free(list_file);
  783. - return -1;
  784. - }
  785. -
  786. - unsigned int ncomp;
  787. - const char **comps = release_comps(release, &ncomp);
  788. - subdist = (pkg_src_t *) xmalloc(sizeof(pkg_src_t));
  789. - memcpy(subdist, src, sizeof(pkg_src_t));
  790. -
  791. - for(i = 0; i < ncomp; i++){
  792. - subdist->name = NULL;
  793. - sprintf_alloc(&subdist->name, "%s-%s", src->name, comps[i]);
  794. - if (dist_hash_add_from_file(lists_dir, subdist)) {
  795. - free(subdist->name); free(subdist);
  796. - free(list_file);
  797. - return -1;
  798. - }
  799. - }
  800. - free(subdist->name); free(subdist);
  801. - }
  802. - free(list_file);
  803. - }
  804. -
  805. for (iter = void_list_first(&conf->pkg_src_list); iter;
  806. iter = void_list_next(&conf->pkg_src_list, iter)) {