remove ipkg from busybox

SVN-Revision: 12498
master
Felix Fietkau 16 years ago
parent 2a58b9c729
commit 059e7be269
  1. 9
      package/busybox/config/archival/Config.in
  2. 13598
      package/busybox/patches/500-ipkg.patch
  3. 50
      package/busybox/patches/520-ipkg_secure.patch
  4. 39
      package/busybox/patches/521-ipkg_upgrade_env.patch
  5. 59
      package/busybox/patches/523-conffiles_fix.patch
  6. 241
      package/busybox/patches/524-memory_usage.patch
  7. 34
      package/busybox/patches/525-clean_temp.patch
  8. 43
      package/busybox/patches/526-ipkg_fix_pkg_comparison.patch

@ -139,15 +139,6 @@ config BUSYBOX_CONFIG_GZIP
gzip is used to compress files. gzip is used to compress files.
It's probably the most widely used UNIX compression program. It's probably the most widely used UNIX compression program.
config BUSYBOX_CONFIG_IPKG
bool "ipkg"
default n
select BUSYBOX_CONFIG_MD5SUM
select BUSYBOX_CONFIG_WGET
select BUSYBOX_CONFIG_DIFF
help
ipkg is the itsy package management system.
config BUSYBOX_CONFIG_RPM2CPIO config BUSYBOX_CONFIG_RPM2CPIO
bool "rpm2cpio" bool "rpm2cpio"
default n default n

File diff suppressed because it is too large Load Diff

@ -1,50 +0,0 @@
--- a/archival/libipkg/ipkg_conf.c
+++ b/archival/libipkg/ipkg_conf.c
@@ -66,6 +66,8 @@
{ "offline_root_pre_script_cmd", IPKG_OPT_TYPE_STRING, &conf->offline_root_pre_script_cmd },
{ "proxy_passwd", IPKG_OPT_TYPE_STRING, &conf->proxy_passwd },
{ "proxy_user", IPKG_OPT_TYPE_STRING, &conf->proxy_user },
+ { "http_user", IPKG_OPT_TYPE_STRING, &conf->http_user },
+ { "http_passwd", IPKG_OPT_TYPE_STRING, &conf->http_passwd },
{ "query-all", IPKG_OPT_TYPE_BOOL, &conf->query_all },
{ "verbose-wget", IPKG_OPT_TYPE_BOOL, &conf->verbose_wget },
{ "verbosity", IPKG_OPT_TYPE_BOOL, &conf->verbosity },
@@ -160,6 +162,9 @@
conf->proxy_user = NULL;
conf->proxy_passwd = NULL;
+ conf->http_user = NULL;
+ conf->http_passwd = NULL;
+
pkg_hash_init("pkg-hash", &conf->pkg_hash, IPKG_CONF_DEFAULT_HASH_LEN);
hash_table_init("file-hash", &conf->file_hash, IPKG_CONF_DEFAULT_HASH_LEN);
hash_table_init("obs-file-hash", &conf->obs_file_hash, IPKG_CONF_DEFAULT_HASH_LEN);
--- a/archival/libipkg/ipkg_conf.h
+++ b/archival/libipkg/ipkg_conf.h
@@ -79,6 +79,10 @@
char *proxy_user;
char *proxy_passwd;
+ /* http user/pass */
+ char *http_user;
+ char *http_passwd;
+
hash_table_t pkg_hash;
hash_table_t file_hash;
hash_table_t obs_file_hash;
--- a/archival/libipkg/ipkg_download.c
+++ b/archival/libipkg/ipkg_download.c
@@ -69,8 +69,12 @@
}
/* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */
- sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s %s -P %s %s",
+ sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s %s%s %s%s %s -P %s %s",
(conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "",
+ conf->http_user ? "--http-user=" : "",
+ conf->http_user ? conf->http_user : "",
+ conf->http_passwd ? "--http-password=" : "",
+ conf->http_passwd ? conf->http_passwd : "",
conf->proxy_user ? "--proxy-user=" : "",
conf->proxy_user ? conf->proxy_user : "",
conf->proxy_passwd ? "--proxy-passwd=" : "",

@ -1,39 +0,0 @@
--- a/archival/libipkg/ipkg_install.c
+++ b/archival/libipkg/ipkg_install.c
@@ -136,6 +136,7 @@
ipkg_error_t ipkg_install_by_name(ipkg_conf_t *conf, const char *pkg_name)
{
int cmp;
+ int u = 0;
pkg_t *old, *new;
char *old_version, *new_version;
@@ -201,6 +202,7 @@
} else if (cmp < 0) {
new->dest = old->dest;
old->state_want = SW_DEINSTALL; /* Here probably the problem for bug 1277 */
+ u = 1;
}
}
@@ -211,7 +213,7 @@
anyone ever wants to make a nice libipkg. */
ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__);
- return ipkg_install_pkg(conf, new,0);
+ return ipkg_install_pkg(conf, new,u);
}
ipkg_error_t ipkg_install_multi_by_name(ipkg_conf_t *conf, const char *pkg_name)
@@ -750,8 +752,10 @@
char* file_md5;
- if ( from_upgrade )
+ if ( from_upgrade ) {
message = 1; /* Coming from an upgrade, and should change the output message */
+ setenv("IPKG_UPGRADE", "yes", 1);
+ }
if (!pkg) {
ipkg_message(conf, IPKG_ERROR,

@ -1,59 +0,0 @@
--- a/archival/libipkg/pkg.c
+++ b/archival/libipkg/pkg.c
@@ -575,25 +575,28 @@
return temp;
}
- len = 14 ;
+ len = sizeof("Conffiles:") ;
for (iter = pkg->conffiles.head; iter; iter = iter->next) {
if (iter->data->name && iter->data->value) {
- len = len + (strlen(iter->data->name)+strlen(iter->data->value)+5);
- }
+ /* " <filename> <md5hash>" */
+ len += 1+strlen(iter->data->name)+1+strlen(iter->data->value);
+ }
}
+ len +=2; /* "\n\0" */
temp = (char *)realloc(temp,len);
if ( temp == NULL ){
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
return NULL;
}
temp[0]='\0';
- strncpy(temp, "Conffiles:\n", 12);
+ strcpy(temp, "Conffiles:");
for (iter = pkg->conffiles.head; iter; iter = iter->next) {
if (iter->data->name && iter->data->value) {
- snprintf(line_str, LINE_LEN, "%s %s\n", iter->data->name, iter->data->value);
+ snprintf(line_str, LINE_LEN, " %s %s", iter->data->name, iter->data->value);
strncat(temp, line_str, strlen(line_str));
}
}
+ strcat(temp, "\n");
} else if (strcasecmp(field, "Conflicts") == 0) {
int i;
--- a/archival/libipkg/pkg_parse.c
+++ b/archival/libipkg/pkg_parse.c
@@ -88,17 +88,14 @@
if(!strncmp(raw, "Conffiles:", 10))
raw += strlen("Conffiles:");
+ while(*raw && isspace(*raw)) raw++;
while(*raw && (sscanf(raw, "%s%s", file_name, md5sum) == 2)){
conffile_list_append(&pkg->conffiles, file_name, md5sum);
/* fprintf(stderr, "%s %s ", file_name, md5sum);*/
- while (*raw && isspace(*raw)) {
- raw++;
- }
raw += strlen(file_name);
- while (*raw && isspace(*raw)) {
- raw++;
- }
+ while(*raw && isspace(*raw)) raw++;
raw += strlen(md5sum);
+ while(*raw && isspace(*raw)) raw++;
}
}

@ -1,241 +0,0 @@
--- a/archival/libipkg/pkg.c
+++ b/archival/libipkg/pkg.c
@@ -224,8 +224,7 @@
if (err) { return err; }
rewind(control_file);
- raw = read_raw_pkgs_from_stream(control_file);
- pkg_parse_raw(pkg, &raw, NULL, NULL);
+ pkg_parse_stream(pkg, control_file, NULL, NULL);
fclose(control_file);
--- a/archival/libipkg/pkg_hash.c
+++ b/archival/libipkg/pkg_hash.c
@@ -89,20 +89,20 @@
pkg_src_t *src, pkg_dest_t *dest, int is_status_file)
{
hash_table_t *hash = &conf->pkg_hash;
- char **raw;
- char **raw_start;
+ FILE *fp;
pkg_t *pkg;
- raw = raw_start = read_raw_pkgs_from_file(file_name);
- if (!raw)
- return -ENOMEM;
+ if(!(fp = fopen(file_name, "r"))){
+ fprintf(stderr, "can't get %s open for read\n", file_name);
+ return NULL;
+ }
- while(*raw){ /* don't worry, we'll increment raw in the parsing function */
+ while(!feof(fp)) { /* don't worry, we'll increment raw in the parsing function */
pkg = pkg_new();
if (!pkg)
return -ENOMEM;
- if (pkg_parse_raw(pkg, &raw, src, dest) == 0) {
+ if (pkg_parse_stream(pkg, fp, src, dest) == 0) {
if (!pkg->architecture) {
char *version_str = pkg_version_str_alloc(pkg);
pkg->architecture = pkg_get_default_arch(conf);
@@ -116,13 +116,6 @@
}
}
- /* XXX: CLEANUP: I'd like a cleaner interface for cleaning up
- memory after read_raw_pkgs_from_file */
- raw = raw_start;
- while (*raw) {
- free(*raw++);
- }
- free(raw_start);
return 0;
}
--- a/archival/libipkg/pkg_parse.c
+++ b/archival/libipkg/pkg_parse.c
@@ -224,6 +224,161 @@
Enhances, perhaps we could generalize all of these and save some
code duplication.
*/
+int pkg_parse_stream(pkg_t *pkg, FILE *stream, pkg_src_t *src, pkg_dest_t *dest)
+{
+ int reading_conffiles, reading_description;
+ int pkg_false_provides=1;
+ char ** lines;
+ char *provide=NULL;
+ char *buf, *scout;
+ int count = 0;
+ size_t size = 512;
+
+ buf = malloc (size);
+
+ pkg->src = src;
+ pkg->dest = dest;
+
+ reading_conffiles = reading_description = 0;
+
+ while (fgets(buf, size, stream)) {
+ while (strlen (buf) == (size - 1)
+ && buf[size-2] != '\n') {
+ size_t o = size - 1;
+ size *= 2;
+ buf = realloc (buf, size);
+ if (fgets (buf + o, size - o, stream) == NULL)
+ break;
+ }
+
+ if((scout = strchr(buf, '\n')))
+ *scout = '\0';
+
+ lines = &buf;
+ /* fprintf(stderr, "PARSING %s\n", *lines);*/
+ if(isGenericFieldType("Package:", *lines))
+ pkg->name = parseGenericFieldType("Package", *lines);
+ else if(isGenericFieldType("Architecture:", *lines))
+ pkg->architecture = parseGenericFieldType("Architecture", *lines);
+ else if(isGenericFieldType("Filename:", *lines))
+ pkg->filename = parseGenericFieldType("Filename", *lines);
+ else if(isGenericFieldType("Section:", *lines))
+ pkg->section = parseGenericFieldType("Section", *lines);
+ else if(isGenericFieldType("MD5sum:", *lines))
+ pkg->md5sum = parseGenericFieldType("MD5sum", *lines);
+ /* The old ipkg wrote out status files with the wrong case for MD5sum,
+ let's parse it either way */
+ else if(isGenericFieldType("MD5Sum:", *lines))
+ pkg->md5sum = parseGenericFieldType("MD5Sum", *lines);
+ else if(isGenericFieldType("Size:", *lines))
+ pkg->size = parseGenericFieldType("Size", *lines);
+ else if(isGenericFieldType("Source:", *lines))
+ pkg->source = parseGenericFieldType("Source", *lines);
+ else if(isGenericFieldType("Installed-Size:", *lines))
+ pkg->installed_size = parseGenericFieldType("Installed-Size", *lines);
+ else if(isGenericFieldType("Installed-Time:", *lines)) {
+ char *time_str = parseGenericFieldType("Installed-Time", *lines);
+ pkg->installed_time = strtoul(time_str, NULL, 0);
+ } else if(isGenericFieldType("Priority:", *lines))
+ pkg->priority = parseGenericFieldType("Priority", *lines);
+ else if(isGenericFieldType("Essential:", *lines)) {
+ char *essential_value;
+ essential_value = parseGenericFieldType("Essential", *lines);
+ if (strcmp(essential_value, "yes") == 0) {
+ pkg->essential = 1;
+ }
+ free(essential_value);
+ }
+ else if(isGenericFieldType("Status", *lines))
+ parseStatus(pkg, *lines);
+ else if(isGenericFieldType("Version", *lines))
+ parseVersion(pkg, *lines);
+ else if(isGenericFieldType("Maintainer", *lines))
+ pkg->maintainer = parseGenericFieldType("Maintainer", *lines);
+ else if(isGenericFieldType("Conffiles", *lines)){
+ parseConffiles(pkg, *lines);
+ reading_conffiles = 1;
+ }
+ else if(isGenericFieldType("Description", *lines)) {
+ pkg->description = parseGenericFieldType("Description", *lines);
+ reading_conffiles = 0;
+ reading_description = 1;
+ }
+
+ else if(isGenericFieldType("Provides", *lines)){
+/* Here we add the internal_use to align the off by one problem between provides_str and provides */
+ provide = (char * ) malloc(strlen(*lines)+ 35 ); /* Preparing the space for the new ipkg_internal_use_only */
+ if ( alterProvidesLine(*lines,provide) ){
+ return EINVAL;
+ }
+ pkg->provides_str = parseDependsString( provide, &pkg->provides_count);
+/* Let's try to hack a bit here.
+ The idea is that if a package has no Provides, we would add one generic, to permit the check of dependencies
+ in alot of other places. We will remove it before writing down the status database */
+ pkg_false_provides=0;
+ free(provide);
+ }
+
+ else if(isGenericFieldType("Depends", *lines))
+ pkg->depends_str = parseDependsString(*lines, &pkg->depends_count);
+ else if(isGenericFieldType("Pre-Depends", *lines))
+ pkg->pre_depends_str = parseDependsString(*lines, &pkg->pre_depends_count);
+ else if(isGenericFieldType("Recommends", *lines))
+ pkg->recommends_str = parseDependsString(*lines, &pkg->recommends_count);
+ else if(isGenericFieldType("Suggests", *lines))
+ pkg->suggests_str = parseDependsString(*lines, &pkg->suggests_count);
+ /* Abhaya: support for conflicts */
+ else if(isGenericFieldType("Conflicts", *lines))
+ pkg->conflicts_str = parseDependsString(*lines, &pkg->conflicts_count);
+ else if(isGenericFieldType("Replaces", *lines))
+ pkg->replaces_str = parseDependsString(*lines, &pkg->replaces_count);
+ else if(line_is_blank(*lines)) {
+ break;
+ }
+ else if(**lines == ' '){
+ if(reading_description) {
+ /* we already know it's not blank, so the rest of description */
+ pkg->description = realloc(pkg->description,
+ strlen(pkg->description)
+ + 1 + strlen(*lines) + 1);
+ strcat(pkg->description, "\n");
+ strcat(pkg->description, (*lines));
+ }
+ else if(reading_conffiles)
+ parseConffiles(pkg, *lines);
+ }
+ }
+/* If the ipk has not a Provides line, we insert our false line */
+ if ( pkg_false_provides==1)
+ pkg->provides_str = parseDependsString ((char *)"Provides: ipkg_internal_use_only ", &pkg->provides_count);
+
+ free(buf);
+ if (pkg->name) {
+ return 0;
+ } else {
+ return EINVAL;
+ }
+}
+
+#if 0
+
+/* Some random thoughts from Carl:
+
+ This function could be considerably simplified if we just kept
+ an array of all the generic string-valued field names, and looped
+ through those looking for a match. Also, these fields could perhaps
+ be stored in the package as an array as well, (or, probably better,
+ as an nv_pair_list_t).
+
+ Fields which require special parsing or storage, (such as Depends:
+ and Status:) could be handled as they are now.
+*/
+/* XXX: FEATURE: The Suggests: field needs to be changed from a string
+ to a dependency list. And, since we already have
+ Depends/Pre-Depends and need to add Conflicts, Recommends, and
+ Enhances, perhaps we could generalize all of these and save some
+ code duplication.
+*/
int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest)
{
int reading_conffiles, reading_description;
@@ -342,6 +497,7 @@
return EINVAL;
}
}
+#endif
int pkg_valorize_other_field(pkg_t *pkg, char ***raw)
{
--- a/archival/libipkg/pkg_parse.h
+++ b/archival/libipkg/pkg_parse.h
@@ -25,7 +25,10 @@
char ** parseDependsString(char * raw, int * depends_count);
int parseVersion(pkg_t *pkg, char *raw);
void parseConffiles(pkg_t * pkg, char * raw);
+#if 0
int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest);
+#endif
+int pkg_parse_stream(pkg_t *pkg, FILE *stream, pkg_src_t *src, pkg_dest_t *dest);
int pkg_valorize_other_field(pkg_t *pkg, char ***raw);
#endif

@ -1,34 +0,0 @@
--- a/archival/libipkg/pkg_extract.c
+++ b/archival/libipkg/pkg_extract.c
@@ -85,6 +85,7 @@
free(archive->buffer);
free(archive->accept);
free(archive);
+ unlink(name);
free(name);
return 0;
@@ -114,6 +115,7 @@
close(archive->src_fd);
free(archive);
free(path);
+ unlink(name);
free(name);
return 0;
@@ -138,6 +140,7 @@
close(archive->src_fd);
free(archive);
free(path);
+ unlink(name);
free(name);
return 0;
@@ -218,6 +221,7 @@
fputs(archive->buffer, file);
free(archive->buffer);
free(archive);
+ unlink(name);
free(name);
return 0;

@ -1,43 +0,0 @@
--- a/archival/libipkg/pkg.c
+++ b/archival/libipkg/pkg.c
@@ -1139,8 +1139,12 @@
return 0;
}
-int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b)
+int pkg_name_version_and_architecture_compare(const void *pkg_a, const void *pkg_b)
{
+ pkg_t * const *p1 = pkg_a;
+ pkg_t * const *p2 = pkg_b;
+ const pkg_t *a = *p1;
+ const pkg_t *b = *p2;
int namecmp;
int vercmp;
if (!a->name || !b->name) {
@@ -1167,8 +1171,12 @@
return 0;
}
-int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b)
+int abstract_pkg_name_compare(const void *apkg_a, const void *apkg_b)
{
+ abstract_pkg_t * const *ap1 = apkg_a;
+ abstract_pkg_t * const *ap2 = apkg_b;
+ const abstract_pkg_t *a = *ap1;
+ const abstract_pkg_t *b = *ap2;
if (!a->name || !b->name) {
fprintf(stderr, "abstract_pkg_name_compare: a=%p a->name=%p b=%p b->name=%p\n",
a, a->name, b, b->name);
--- a/archival/libipkg/pkg.h
+++ b/archival/libipkg/pkg.h
@@ -191,8 +191,8 @@
char *pkg_version_str_alloc(pkg_t *pkg);
int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg);
-int pkg_name_version_and_architecture_compare(pkg_t *a, pkg_t *b);
-int abstract_pkg_name_compare(abstract_pkg_t *a, abstract_pkg_t *b);
+int pkg_name_version_and_architecture_compare(const void *pkg_a, const void *pkg_b);
+int abstract_pkg_name_compare(const void *apkg_a, const void *apkg_b);
char * pkg_formatted_info(pkg_t *pkg );
char * pkg_formatted_field(pkg_t *pkg, const char *field );
Loading…
Cancel
Save