libdebian-installer/0000755000000000000000000000000012147775302011660 5ustar libdebian-installer/src/0000755000000000000000000000000012271462253012443 5ustar libdebian-installer/src/hash.c0000644000000000000000000002207511557456270013550 0ustar /* * hash.c * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include typedef struct di_hash_node di_hash_node; /** * @addtogroup di_hash_table * @{ */ /** * @internal * @brief Hash table */ struct di_hash_table { size_t size; /**< the overall size */ size_t nnodes; /**< number of nodes */ di_hash_node **nodes; /**< nodes */ di_mem_chunk *mem_chunk; /**< di_mem_chunk for allocating the nodes (di_hash_node) */ di_hash_func *hash_func; /**< hashing function */ di_equal_func *key_equal_func; /**< key compare function */ di_destroy_notify *key_destroy_func; /**< key destroy function, may NULL */ di_destroy_notify *value_destroy_func; /**< value destroy function, may NULL */ }; /** * @internal * @brief Node of a hash table */ struct di_hash_node { void *key; /**< key */ void *value; /**< value */ di_hash_node *next; /**< the next node */ }; /** * @internal * Defines if a resize is necessary * * @param hash_table a di_hash_table */ #define HASH_TABLE_RESIZE(hash_table) \ if ((hash_table->size >= 3 * hash_table->nnodes && \ hash_table->size > HASH_TABLE_MIN_SIZE) || \ (3 * hash_table->size <= hash_table->nnodes && \ hash_table->size < HASH_TABLE_MAX_SIZE)) \ internal_di_hash_table_resize (hash_table); /** * @internal * The minimal hash table size */ #define HASH_TABLE_MIN_SIZE 11 /** * @internal * The maximal hash table size */ #define HASH_TABLE_MAX_SIZE 13845163 /** * @internal * @param x value * @param low low bound * @param high high bound * * @return a value between low and high */ #define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x))) static void internal_di_hash_table_resize (di_hash_table *hash_table); static di_hash_node **internal_di_hash_table_lookup_node (di_hash_table *hash_table, const void *key); static di_hash_node *internal_di_hash_node_new (di_hash_table *hash_table, void *key, void *value); static void internal_di_hash_node_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) __attribute__ ((unused)); static void internal_di_hash_nodes_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func); /** @} */ static unsigned int internal_di_spaced_primes_closest (unsigned int num); di_hash_table *di_hash_table_new (di_hash_func hash_func, di_equal_func key_equal_func) { return di_hash_table_new_full (hash_func, key_equal_func, NULL, NULL); } di_hash_table *di_hash_table_new_full (di_hash_func hash_func, di_equal_func key_equal_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) { di_hash_table *hash_table; size_t i; hash_table = di_new (di_hash_table, 1); hash_table->size = HASH_TABLE_MIN_SIZE; hash_table->nnodes = 0; hash_table->mem_chunk = di_mem_chunk_new (sizeof (di_hash_node), 4096); hash_table->hash_func = hash_func; hash_table->key_equal_func = key_equal_func; hash_table->key_destroy_func = key_destroy_func; hash_table->value_destroy_func = value_destroy_func; hash_table->nodes = di_new (di_hash_node*, hash_table->size); for (i = 0; i < hash_table->size; i++) hash_table->nodes[i] = NULL; return hash_table; } void di_hash_table_destroy (di_hash_table *hash_table) { size_t i; for (i = 0; i < hash_table->size; i++) internal_di_hash_nodes_destroy (hash_table->nodes[i], hash_table->key_destroy_func, hash_table->value_destroy_func); di_mem_chunk_destroy (hash_table->mem_chunk); di_free (hash_table->nodes); di_free (hash_table); } static inline di_hash_node** internal_di_hash_table_lookup_node (di_hash_table *hash_table, const void *key) { di_hash_node **node; node = &hash_table->nodes [hash_table->hash_func (key) % hash_table->size]; /* Hash table lookup needs to be fast. * We therefore remove the extra conditional of testing * whether to call the key_equal_func or not from * the inner loop. */ if (hash_table->key_equal_func) while (*node && !(*hash_table->key_equal_func) ((*node)->key, key)) node = &(*node)->next; else while (*node && (*node)->key != key) node = &(*node)->next; return node; } void *di_hash_table_lookup (di_hash_table *hash_table, const void *key) { di_hash_node *node; node = *internal_di_hash_table_lookup_node (hash_table, key); return node ? node->value : NULL; } void di_hash_table_insert (di_hash_table *hash_table, void *key, void *value) { di_hash_node **node; node = internal_di_hash_table_lookup_node (hash_table, key); if (*node) { if (hash_table->key_destroy_func) hash_table->key_destroy_func (key); if (hash_table->value_destroy_func) hash_table->value_destroy_func ((*node)->value); (*node)->value = value; } else { *node = internal_di_hash_node_new (hash_table, key, value); hash_table->nnodes++; HASH_TABLE_RESIZE (hash_table); } } static di_hash_node* internal_di_hash_node_new (di_hash_table *hash_table, void *key, void *value) { di_hash_node *hash_node; hash_node = di_mem_chunk_alloc (hash_table->mem_chunk); hash_node->key = key; hash_node->value = value; hash_node->next = NULL; return hash_node; } static void internal_di_hash_node_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) { if (key_destroy_func) key_destroy_func (hash_node->key); if (value_destroy_func) value_destroy_func (hash_node->value); } static void internal_di_hash_nodes_destroy (di_hash_node *hash_node, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) { if (hash_node) { di_hash_node *node = hash_node; while (node->next) { if (key_destroy_func) key_destroy_func (node->key); if (value_destroy_func) value_destroy_func (node->value); node = node->next; } if (key_destroy_func) key_destroy_func (node->key); if (value_destroy_func) value_destroy_func (node->value); } } void di_hash_table_foreach (di_hash_table *hash_table, di_hfunc *func, void *user_data) { di_hash_node *node; size_t i; for (i = 0; i < hash_table->size; i++) for (node = hash_table->nodes[i]; node; node = node->next) func (node->key, node->value, user_data); } di_ksize_t di_hash_table_size (di_hash_table *hash_table) { return hash_table->nnodes; } static void internal_di_hash_table_resize (di_hash_table *hash_table) { di_hash_node **new_nodes; di_hash_node *node; di_hash_node *next; uint32_t hash_val; size_t new_size; size_t i; new_size = internal_di_spaced_primes_closest (hash_table->nnodes); new_size = CLAMP (new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE); new_nodes = di_new0 (di_hash_node*, new_size); for (i = 0; i < hash_table->size; i++) for (node = hash_table->nodes[i]; node; node = next) { next = node->next; hash_val = (* hash_table->hash_func) (node->key) % new_size; node->next = new_nodes[hash_val]; new_nodes[hash_val] = node; } di_free (hash_table->nodes); hash_table->nodes = new_nodes; hash_table->size = new_size; } static const unsigned int internal_di_primes[] = { 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627, 47431, 71143, 106721, 160073, 240101, 360163, 540217, 810343, 1215497, 1823231, 2734867, 4102283, 6153409, 9230113, 13845163, }; static const unsigned int internal_di_nprimes = sizeof (internal_di_primes) / sizeof (internal_di_primes[0]); static unsigned int internal_di_spaced_primes_closest (unsigned int num) { unsigned int i; for (i = 0; i < internal_di_nprimes; i++) if (internal_di_primes[i] > num) return internal_di_primes[i]; return internal_di_primes[internal_di_nprimes - 1]; } libdebian-installer/src/list.c0000644000000000000000000000455111557456270013577 0ustar /* * list.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include di_list *di_list_alloc (void) { di_list *list; list = di_new0 (di_list, 1); return list; } void di_list_destroy (di_list *list, di_destroy_notify destroy_func) { di_list_node *node, *temp; node = list->head; while (node) { temp = node; node = node->next; if (destroy_func) destroy_func (temp->data); di_free (temp); } } void di_list_free (di_list *list) { di_free (list); } static void internal_di_list_append (di_list *list, void *data, di_list_node *new_node) { new_node->data = data; new_node->next = NULL; new_node->prev = list->bottom; if (list->bottom) list->bottom->next = new_node; else list->head = new_node; list->bottom = new_node; } void di_list_append (di_list *list, void *data) { return internal_di_list_append (list, data, di_new (di_list_node, 1)); } void di_list_append_chunk (di_list *list, void *data, di_mem_chunk *mem_chunk) { return internal_di_list_append (list, data, di_mem_chunk_alloc (mem_chunk)); } static void internal_di_list_prepend (di_list *list, void *data, di_list_node *new_node) { new_node->data = data; new_node->next = list->head; new_node->prev = NULL; if (new_node->next) new_node->next->prev = new_node; else list->bottom = new_node; list->head = new_node; } void di_list_prepend (di_list *list, void *data) { return internal_di_list_prepend (list, data, di_new (di_list_node, 1)); } void di_list_prepend_chunk (di_list *list, void *data, di_mem_chunk *mem_chunk) { return internal_di_list_prepend (list, data, di_mem_chunk_alloc (mem_chunk)); } libdebian-installer/src/log.c0000644000000000000000000001331511557456270013403 0ustar /* * log.c * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include typedef struct di_log_handler_struct di_log_handler_struct; /** * @addtogroup di_log */ /** * @internal * @brief Log handler info */ struct di_log_handler_struct { unsigned int id; /**< unique id */ di_log_level_flags log_level; /**< flags */ di_log_handler *log_func; /**< the handler */ void *user_data; /**< supplied data */ }; static di_slist handlers; #define ALERT_LEVELS (DI_LOG_LEVEL_ERROR | DI_LOG_LEVEL_CRITICAL | DI_LOG_LEVEL_WARNING) static void mklevel_prefix (char *level_prefix, di_log_level_flags log_level) { char *prefix = NULL; char buf[16]; switch (log_level & DI_LOG_LEVEL_MASK) { case DI_LOG_LEVEL_ERROR: prefix = "ERROR"; break; case DI_LOG_LEVEL_CRITICAL: prefix = "CRITICAL"; break; case DI_LOG_LEVEL_WARNING: prefix = "WARNING"; break; case DI_LOG_LEVEL_MESSAGE: prefix = "Message"; break; case DI_LOG_LEVEL_INFO: prefix = "INFO"; break; case DI_LOG_LEVEL_DEBUG: prefix = "DEBUG"; break; case DI_LOG_LEVEL_OUTPUT: return; default: if (log_level) { snprintf (buf, sizeof (buf), "LOG-%u", log_level & DI_LOG_LEVEL_MASK); prefix = buf; } else prefix = "LOG"; break; } strcat (level_prefix, prefix); strcat (level_prefix, log_level & ALERT_LEVELS ? " **: " : ": "); } static void handler_default (di_log_level_flags log_level, const char *message, void *user_data) { if (log_level != DI_LOG_LEVEL_DEBUG) di_log_handler_default (log_level, message, user_data); } void di_log_handler_default (di_log_level_flags log_level, const char *message, void *user_data __attribute__ ((unused))) { char buf[1280]; const char *progname = di_progname_get (); snprintf (buf, sizeof (buf), "(%s:%d): ", progname ? progname : "process", getpid ()); mklevel_prefix (buf, log_level); strcat (buf, message); strcat (buf, "\n"); fputs (buf, log_level & ALERT_LEVELS ? stderr : stdout); } void di_log_handler_syslog (di_log_level_flags log_level, const char *message, void *user_data) { char buf[1280]; static char ident_buf[128]; static int log_open; int syslog_level; if (!log_open) { if (user_data) strncpy (ident_buf, user_data, sizeof (ident_buf)); else { const char *progname = di_progname_get (); snprintf (ident_buf, sizeof (ident_buf), "%s[%d]", progname ? progname : "process", getpid ()); } openlog (ident_buf, 0, LOG_USER); log_open = 1; } buf[0] = '\0'; mklevel_prefix (buf, log_level); strcat (buf, message); strcat (buf, "\n"); switch (log_level & DI_LOG_LEVEL_MASK) { case DI_LOG_LEVEL_ERROR: syslog_level = LOG_ALERT; break; case DI_LOG_LEVEL_CRITICAL: syslog_level = LOG_CRIT; break; case DI_LOG_LEVEL_WARNING: syslog_level = LOG_WARNING; break; case DI_LOG_LEVEL_MESSAGE: syslog_level = LOG_NOTICE; break; case DI_LOG_LEVEL_INFO: case DI_LOG_LEVEL_OUTPUT: syslog_level = LOG_INFO; break; default: syslog_level = LOG_DEBUG; break; } syslog (syslog_level, "%s", buf); } static di_log_handler *internal_di_log_get_handler (di_log_level_flags log_level, void **user_data) { di_slist_node *node; for (node = handlers.head; node; node = node->next) { di_log_handler_struct *handler = node->data; if ((handler->log_level & log_level) == log_level) { *user_data = handler->user_data; return handler->log_func; } } return handler_default; } unsigned int di_log_set_handler (di_log_level_flags log_levels, di_log_handler *log_func, void *user_data) { static unsigned int handler_id = 0; di_log_handler_struct *handler; handler = di_new (di_log_handler_struct, 1); handler->id = ++handler_id; handler->log_level = log_levels; handler->log_func = log_func; handler->user_data = user_data; di_slist_append (&handlers, handler); return handler_id; } void di_log (di_log_level_flags log_level, const char *format, ...) { va_list args; va_start (args, format); di_vlog (log_level, format, args); va_end (args); } __asm__ (".symver di_log,di_log_real_4_0@LIBDI_4.0"); void di_vlog (di_log_level_flags log_level, const char *format, va_list args) { char buf[1024]; int fatal = log_level & DI_LOG_FATAL_MASK; di_log_handler *log_func; void *user_data=0; vsnprintf (buf, sizeof (buf), format, args); log_func = internal_di_log_get_handler (log_level, &user_data); log_func (log_level, buf, user_data); if (fatal) exit (1); } libdebian-installer/src/package.c0000644000000000000000000001235611557456270014221 0ustar /* * package.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include void internal_di_package_destroy_func (void *data) { di_package_destroy (data); } void di_package_destroy (di_package *package) { di_free (package->package); di_free (package->section); di_free (package->maintainer); di_free (package->architecture); di_free (package->version); di_free (package->filename); di_free (package->md5sum); di_free (package->short_description); di_free (package->description); memset (package, 0, sizeof (di_package)); } void di_package_version_free (di_package_version *version) { di_free (version); } #define order(x) ((x) == '~' ? -1 \ : isdigit((x)) ? 0 \ : !(x) ? 0 \ : isalpha((x)) ? (x) \ : (x) + 256) static int verrevcmp (const char *val, const char *ref) { if (!val) val = ""; if (!ref) ref = ""; while (*val || *ref) { int first_diff = 0; while ((*val && !isdigit (*val)) || (*ref && !isdigit (*ref))) { int vc = order (*val), rc = order (*ref); if (vc != rc) return vc - rc; val++; ref++; } while (*val == '0') val++; while (*ref == '0') ref++; while (isdigit (*val) && isdigit (*ref)) { if (!first_diff) first_diff = *val - *ref; val++; ref++; } if (isdigit (*val)) return 1; if (isdigit (*ref)) return -1; if (first_diff) return first_diff; } return 0; } int di_package_version_compare(const di_package_version *a, const di_package_version *b) { int r; if (a->epoch > b->epoch) return 1; if (a->epoch < b->epoch) return -1; r = verrevcmp(a->upstream, b->upstream); if (r != 0) return r; return verrevcmp(a->debian_revision, b->debian_revision); } di_package_version *di_package_version_parse (di_package *package) { di_package_version *version; char *hyphen, *colon, *eepochcolon, *string; const char *end; unsigned long epoch; if (!package->version) return NULL; version = di_new0 (di_package_version, 1); string = package->version; end = string + strlen (string); colon = strchr (string, ':'); if (colon) { epoch = strtoul (package->version, &eepochcolon, 10); if (colon != eepochcolon) return 0; if (!*++colon) return 0; string = colon; version->epoch = epoch; } hyphen = strrchr (string, '-'); if (hyphen) { version->upstream = di_stradup (string, hyphen - string); version->debian_revision = di_stradup (hyphen + 1, end - hyphen - 1); } else version->upstream = di_stradup (string, end - string); return version; } const char *const di_package_priority_text[] = { "unspecified", "extra", /* == di_package_priority_extra */ "optional", /* == di_package_priority_optional */ "standard", /* == di_package_priority_standard */ "important", /* == di_package_priority_important */ "required", /* == di_package_priority_required */ NULL }; const char *const di_package_status_want_text[] = { "unknown", /* == di_package_status_want_unknown */ "install", /* == di_package_status_want_install */ "hold", /* == di_package_status_want_hold */ "deinstall", /* == di_package_status_want_deinstall */ "purge", /* == di_package_status_want_purge */ NULL }; const char *const di_package_status_text[] = { "undefined", /* == di_package_status_undefined */ "not-installed", /* == di_package_status_not_installed */ "unpacked", /* == di_package_status_unpacked */ "installed", /* == di_package_status_installed */ "half-configured", /* == di_package_status_half_configured */ "config-files", /* == di_package_status_config_files */ NULL }; int di_package_array_text_from (const char *const *array, const char *text) { const di_rstring temp = { (char *) text, strlen (text) }; return internal_di_package_array_text_from_rstring (array, &temp); } int internal_di_package_array_text_from_rstring (const char *const *array, const di_rstring *text) { int i; for (i = 1; array[i]; i++) if (strncmp (array[i], text->string, text->size) == 0) { return i; } return 0; } libdebian-installer/src/packages.c0000644000000000000000000003151111557456270014376 0ustar /* * packages.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include /** * Allocate di_packages */ di_packages *di_packages_alloc (void) { di_packages *ret; ret = di_new0 (di_packages, 1); ret->table = di_hash_table_new_full (di_rstring_hash, di_rstring_equal, NULL, internal_di_package_destroy_func); return ret; } /** * Allocate di_packages_allocator */ di_packages_allocator *di_packages_allocator_alloc (void) { di_packages_allocator *ret; ret = internal_di_packages_allocator_alloc (); ret->package_mem_chunk = di_mem_chunk_new (sizeof (di_package), 16384); return ret; } /** * @internal * Partially allocate di_packages_allocator */ di_packages_allocator *internal_di_packages_allocator_alloc (void) { di_packages_allocator *ret; ret = di_new0 (di_packages_allocator, 1); ret->package_dependency_mem_chunk = di_mem_chunk_new (sizeof (di_package_dependency), 4096); ret->slist_node_mem_chunk = di_mem_chunk_new (sizeof (di_slist_node), 4096); return ret; } /** * Free di_packages */ void di_packages_free (di_packages *packages) { if (!packages) return; di_hash_table_destroy (packages->table); di_free (packages); } /** * Free di_packages_allocator */ void di_packages_allocator_free (di_packages_allocator *allocator) { di_mem_chunk_destroy (allocator->package_mem_chunk); di_mem_chunk_destroy (allocator->package_dependency_mem_chunk); di_mem_chunk_destroy (allocator->slist_node_mem_chunk); di_free (allocator); } /** * append a package. * * @param packages a di_packages */ void di_packages_append_package (di_packages *packages, di_package *package, di_packages_allocator *allocator) { di_package *tmp; tmp = di_packages_get_package (packages, package->package, 0); if (!tmp) di_slist_append_chunk (&packages->list, package, allocator->slist_node_mem_chunk); di_hash_table_insert (packages->table, &package->key, package); } /** * get a named package. * * @param packages a di_packages * @param name the name of the package * @param n size of the name or 0 * * @return the package or NULL */ di_package *di_packages_get_package (di_packages *packages, const char *name, size_t n) { di_rstring key; size_t size; if (n) size = n; else size = strlen (name); /* i know that is bad, but i know it is not written by the lookup */ key.string = (char *) name; key.size = size; return di_hash_table_lookup (packages->table, &key); } /** * get a named package. * creates a new one if non-existant. * * @param packages a di_packages * @param name the name of the package * @param n size of the name * * @return the package */ di_package *di_packages_get_package_new (di_packages *packages, di_packages_allocator *allocator, char *name, size_t n) { di_package *ret = di_packages_get_package (packages, name, n); if (!ret) { ret = di_package_alloc (allocator); ret->key.string = di_stradup (name, n); ret->key.size = n; di_hash_table_insert (packages->table, &ret->key, ret); } return ret; } bool di_packages_resolve_dependencies_recurse (di_packages_resolve_dependencies_check *r, di_package *package, di_package *dependend_package) { di_slist_node *node; /* did we already check this package? */ if (package->resolver & r->resolver) { #ifdef ENABLE_EXTENSIVE_DEBUG if (package->resolver & (r->resolver << 1)) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): already done, okay", package->package); else di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): already done, not okay", package->package); #endif return package->resolver & (r->resolver << 1); } package->resolver |= r->resolver; package->resolver |= (r->resolver << 1); #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): start", package->package); #endif switch (package->type) { case di_package_type_real_package: for (node = package->depends.head; node; node = node->next) { di_package_dependency *d = node->data; if ((d->type == di_package_dependency_type_depends || d->type == di_package_dependency_type_pre_depends) && !r->check_real (r, package, d)) goto error; } #ifdef ENABLE_EXTENSIVE_DEBUG if (dependend_package) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): mark, dependency from %s", package->package, dependend_package->package); else di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): mark", package->package); #endif r->do_real (package, r->do_real_data); break; case di_package_type_virtual_package: #ifdef ENABLE_EXTENSIVE_DEBUG if (dependend_package) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): search, dependency from %s", package->package, dependend_package->package); else di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): search", package->package); #endif for (node = package->depends.head; node; node = node->next) { di_package_dependency *d = node->data; if (d->type == di_package_dependency_type_reverse_provides) package->resolver &= ~(r->resolver << 2); } while (1) { di_package_dependency *best_provide = NULL; for (node = package->depends.head; node; node = node->next) { di_package_dependency *d = node->data; if (d->type == di_package_dependency_type_reverse_provides) { if (!(package->resolver & (r->resolver << 2))) best_provide = r->check_virtual (package, best_provide, d, r->check_virtual_data); } } if (best_provide) { if (r->check_real (r, dependend_package, best_provide)) break; else package->resolver |= (r->resolver << 2); } else if (!r->check_non_existant (r, package, NULL)) goto error; else break; } break; case di_package_type_non_existent: if (!r->check_non_existant (r, package, NULL)) goto error; } return true; error: #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): not okay", package->package); #endif package->resolver &= ~(r->resolver << 1); return false; } bool di_packages_resolve_dependencies_check_real (di_packages_resolve_dependencies_check *r, di_package *package, di_package_dependency *d) { return di_packages_resolve_dependencies_recurse (r, d->ptr, package); } di_package_dependency *di_packages_resolve_dependencies_check_virtual (di_package *package __attribute__ ((unused)), di_package_dependency *best, di_package_dependency *d, void *data __attribute__ ((unused))) { if (!best || best->ptr->priority < d->ptr->priority || (d->ptr->status >= di_package_status_unpacked && best->ptr->status < di_package_status_unpacked)) return d; return best; } bool di_packages_resolve_dependencies_check_non_existant (di_packages_resolve_dependencies_check *r __attribute__ ((unused)), di_package *package, di_package_dependency *d __attribute__ ((unused))) { di_log (DI_LOG_LEVEL_WARNING, "resolver (%s): package doesn't exist", package->package); return false; } bool di_packages_resolve_dependencies_check_non_existant_quiet (di_packages_resolve_dependencies_check *r __attribute__ ((unused)), di_package *package __attribute__ ((unused)), di_package_dependency *d __attribute__ ((unused))) { di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): package doesn't exist", package->package); return false; } bool di_packages_resolve_dependencies_check_non_existant_permissive (di_packages_resolve_dependencies_check *r __attribute__ ((unused)), di_package *package __attribute__ ((unused)), di_package_dependency *d __attribute__ ((unused))) { di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): package doesn't exist (ignored)", package->package); return true; } void di_packages_resolve_dependencies_do_real_list_append (di_package *package, void *_data) { struct di_packages_resolve_dependencies_do_real_list_append_data *data = _data; di_slist_append_chunk (&data->list, package, data->allocator->slist_node_mem_chunk); } void di_packages_resolve_dependencies_do_real_mark (di_package *package, void *data __attribute__ ((unused))) { package->status_want = di_package_status_want_install; } static void resolve_dependencies_marker_reset (void *key __attribute__ ((unused)), void *value, void *user_data __attribute__ ((unused))) { di_package *p = value; p->resolver = 0; } void di_packages_resolve_dependencies_marker (di_packages *packages) { if (!packages->resolver) packages->resolver = 1; else if (packages->resolver > (INT_MAX >> 2)) { di_hash_table_foreach (packages->table, resolve_dependencies_marker_reset, NULL); packages->resolver = 1; } else packages->resolver <<= 3; } di_slist *di_packages_resolve_dependencies_special (di_packages *packages, di_slist *list, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator) { struct di_packages_resolve_dependencies_do_real_list_append_data data = { { NULL, NULL }, allocator, }; di_slist *install = di_slist_alloc (); di_slist_node *node; s->do_real_data = &data; di_packages_resolve_dependencies_marker (packages); s->resolver = packages->resolver; for (node = list->head; node; node = node->next) { di_package *p = node->data; if (di_packages_resolve_dependencies_recurse (s, p, NULL)) internal_di_slist_append_list (install, &data.list); } return install; } di_slist *di_packages_resolve_dependencies (di_packages *packages, di_slist *list, di_packages_allocator *allocator) { struct di_packages_resolve_dependencies_check s = { di_packages_resolve_dependencies_check_real, di_packages_resolve_dependencies_check_virtual, di_packages_resolve_dependencies_check_non_existant, di_packages_resolve_dependencies_do_real_list_append, 0, NULL, NULL, }; return di_packages_resolve_dependencies_special (packages, list, &s, allocator); } di_slist *di_packages_resolve_dependencies_array_special (di_packages *packages, di_package **array, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator) { struct di_packages_resolve_dependencies_do_real_list_append_data data = { { NULL, NULL }, allocator, }; di_slist *install = di_slist_alloc (); s->do_real_data = &data; di_packages_resolve_dependencies_marker (packages); s->resolver = packages->resolver; while (*array) if (di_packages_resolve_dependencies_recurse (s, *array++, NULL)) internal_di_slist_append_list (install, &data.list); return install; } di_slist *di_packages_resolve_dependencies_array (di_packages *packages, di_package **array, di_packages_allocator *allocator) { struct di_packages_resolve_dependencies_check s = { di_packages_resolve_dependencies_check_real, di_packages_resolve_dependencies_check_virtual, di_packages_resolve_dependencies_check_non_existant, di_packages_resolve_dependencies_do_real_list_append, 0, NULL, NULL, }; return di_packages_resolve_dependencies_array_special (packages, array, &s, allocator); } void di_packages_resolve_dependencies_mark_special (di_packages *packages, di_packages_resolve_dependencies_check *s) { di_slist_node *node; di_packages_resolve_dependencies_marker (packages); s->resolver = packages->resolver; for (node = packages->list.head; node; node = node->next) { di_package *package = node->data; if (!(package->resolver & packages->resolver) && package->status_want == di_package_status_want_install) di_packages_resolve_dependencies_recurse (s, package, NULL); } } void di_packages_resolve_dependencies_mark (di_packages *packages) { struct di_packages_resolve_dependencies_check s = { di_packages_resolve_dependencies_check_real, di_packages_resolve_dependencies_check_virtual, di_packages_resolve_dependencies_check_non_existant_quiet, di_packages_resolve_dependencies_do_real_mark, 0, NULL, NULL, }; di_packages_resolve_dependencies_mark_special (packages, &s); } libdebian-installer/src/libdebian-installer-extra.ver0000644000000000000000000000060611515541630020205 0ustar LIBDI_4.1 { global: di_list_alloc; di_list_append; di_list_append_chunk; di_list_destroy; di_list_free; di_list_prepend; di_list_prepend_chunk; di_release_alloc; di_release_free; di_release_parser_fieldinfo; di_release_parser_read_file; di_release_read_file; local: *; }; #LIBDI_PRIVATE { # global: # internal_*; #} LIBDI_4.1; libdebian-installer/src/slist.c0000644000000000000000000000513211557456270013756 0ustar /* * slist.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include di_slist *di_slist_alloc (void) { di_slist *slist; slist = di_new0 (di_slist, 1); return slist; } void di_slist_destroy (di_slist *slist, di_destroy_notify destroy_func) { di_slist_node *node, *temp; node = slist->head; while (node) { temp = node; node = node->next; if (destroy_func) destroy_func (temp->data); di_free (temp); } } void di_slist_free (di_slist *slist) { di_free (slist); } static void internal_di_slist_append (di_slist *slist, void *data, di_slist_node *new_node) { new_node->data = data; new_node->next = NULL; if (slist->bottom) slist->bottom->next = new_node; else slist->head = new_node; slist->bottom = new_node; } void di_slist_append (di_slist *slist, void *data) { return internal_di_slist_append (slist, data, di_new (di_slist_node, 1)); } void di_slist_append_chunk (di_slist *slist, void *data, di_mem_chunk *mem_chunk) { return internal_di_slist_append (slist, data, di_mem_chunk_alloc (mem_chunk)); } static void internal_di_slist_prepend (di_slist *slist, void *data, di_slist_node *new_node) { new_node->data = data; new_node->next = slist->head; if (!new_node->next) slist->bottom = new_node; slist->head = new_node; } void di_slist_prepend (di_slist *slist, void *data) { return internal_di_slist_prepend (slist, data, di_new (di_slist_node, 1)); } void di_slist_prepend_chunk (di_slist *slist, void *data, di_mem_chunk *mem_chunk) { return internal_di_slist_prepend (slist, data, di_mem_chunk_alloc (mem_chunk)); } void internal_di_slist_append_list (di_slist *slist, di_slist *new) { if (!new->head || !new->bottom) return; if (slist->bottom) slist->bottom->next = new->head; else slist->head = new->head; slist->bottom = new->bottom; new->head = new->bottom = NULL; } libdebian-installer/src/parser.c0000644000000000000000000001050411557456270014113 0ustar /* * parser.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include di_parser_info *di_parser_info_alloc (void) { di_parser_info *info; info = di_new0 (di_parser_info, 1); info->table = di_hash_table_new (di_rstring_hash, di_rstring_equal); return info; } void di_parser_info_free (di_parser_info *info) { di_hash_table_destroy (info->table); di_slist_destroy (&info->list, NULL); di_free (info); } void di_parser_info_add (di_parser_info *info, const di_parser_fieldinfo *fieldinfo[]) { di_parser_fieldinfo **fip; for (fip = (di_parser_fieldinfo **) fieldinfo; *fip; fip++) { di_hash_table_insert (info->table, &(*fip)->key, *fip); di_slist_append (&info->list, *fip); } } void di_parser_read_boolean ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { int *f = (int *)((char *)*data + fip->integer); if (strncasecmp (value->string, "yes", 3) == 0) *f = 1; else *f = 0; } void di_parser_write_boolean ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { int *f = (int *)((char *)*data + fip->integer); di_rstring value = { "Yes", 3 }; if (*f) callback (&fip->key, &value, callback_data); } void di_parser_read_int ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { int *f = (int *)((char *)*data + fip->integer); *f = strtol (value->string, NULL, 10); } void di_parser_write_int ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { int *f = (int *)((char *)*data + fip->integer); char value_buf[32]; di_rstring value = { value_buf, 0 }; if (*f) { value.size = snprintf (value_buf, sizeof (value_buf), "%d", *f); callback (&fip->key, &value, callback_data); } } void di_parser_read_rstring ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { di_rstring *f = (di_rstring *)((char *)*data + fip->integer); if (f->string) di_free (f->string); f->string = di_stradup (value->string, value->size); f->size = value->size; } void di_parser_write_rstring ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { di_rstring *f = (di_rstring *)((char *)*data + fip->integer); callback (&fip->key, f, callback_data); } void di_parser_read_string ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { char **f = (char **)((char *)*data + fip->integer); if (*f) di_free (*f); *f = di_stradup (value->string, value->size); } void di_parser_write_string ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { char **f = (char **)((char *)*data + fip->integer); di_rstring value; if (*f) { value.string = *f; value.size = strlen (*f); callback (&fip->key, &value, callback_data); } } libdebian-installer/src/exec.c0000644000000000000000000001755711557456303013557 0ustar /* * exec.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define MAXLINE 1024 #define EX_NOEXEC 126 #define EX_NOTFOUND 127 static int internal_di_exec (const char *path, bool use_path, const char *const argv[], const char *const envp[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data) { char line[MAXLINE]; pid_t pid, pid2; int fds[4] = { -1, }, mode = 0, pipes = 0, i; if (stdout_handler) { mode += 1; pipes++; } if (stderr_handler) { mode += 2; pipes++; } for (i = 0; i < pipes; i++) { if (pipe (&fds[i * 2]) < 0) { int j; di_log (DI_LOG_LEVEL_WARNING, "pipe failed"); for (j = 0; j < i; j++) { close (fds[i * 2]); close (fds[i * 2 + 1]); } return -1; } } pid = fork (); if (pid <= 0) { for (i = 0; i < pipes; i++) close (fds[i * 2]); } if (pid == 0) { int temp, realfds[3] = { 0, fds[1], fds[3] }; temp = open ("/dev/null", O_RDWR); switch (mode) { case 0: realfds[1] = temp; realfds[2] = temp; break; case 2: realfds[1] = temp; realfds[2] = fds[1]; break; case 1: realfds[2] = fds[1]; break; } for (i = 1; i <= 2; i++) dup2 (realfds[i], i); close (temp); } for (i = 0; i < pipes; i++) close (fds[i * 2 + 1]); if (pid == 0) { if (child_prepare_handler) if (child_prepare_handler (pid, child_prepare_user_data)) exit (255); if (use_path) execvp (path, (char *const *) argv); else if (envp) execve (path, (char *const *) argv, (char *const *) envp); else execv (path, (char *const *) argv); exit (errno == ENOENT ? EX_NOTFOUND : EX_NOEXEC); } else if (pid < 0) { di_log (DI_LOG_LEVEL_WARNING, "fork failed"); return -1; } else { int status = -1; struct pollfd pollfds[pipes]; struct files { FILE *file; di_io_handler *handler; } files[pipes]; for (i = 0; i < pipes; i++) { fcntl (fds[i * 2], F_SETFL, O_NONBLOCK); files[i].file = fdopen (fds[i * 2], "r"); pollfds[i].fd = fds[i * 2]; pollfds[i].events = POLLIN; } switch (mode) { case 2: files[0].handler = stderr_handler; break; case 3: files[1].handler = stderr_handler; case 1: files[0].handler = stdout_handler; break; } if (parent_prepare_handler && parent_prepare_handler (pid, parent_prepare_user_data)) kill (pid, 9); else if (pipes) while (poll (pollfds, pipes, -1) >= 0) { bool exit = false; /* Implementations of poll() deliver various combinations of POLLIN and POLLHUP on EOF. fgets() detects it and we check with feof() below. References: http://www.greenend.org.uk/rjk/2001/06/poll.html */ for (i = 0; i < pipes; i++) { if (pollfds[i].revents & (POLLIN | POLLHUP)) { while (fgets (line, sizeof (line), files[i].file) != NULL) { size_t len = strlen (line); if (line[len - 1] == '\n') { line[len - 1] = '\0'; len--; } files[i].handler (line, len, io_user_data); exit = true; } } } if (exit) continue; for (i = 0; i < pipes; i++) if (feof(files[i].file)) exit = true; if (exit) break; } /* waitpid() can be interrupted by the SIGCHLD setup in log-output in case of a working poll() implementation. This depends on the kernel and the scheduler. */ do { pid2 = waitpid (pid, &status, 0); } while (pid2 == -1 && errno == EINTR); if (!pid2) return -1; for (i = 0; i < pipes; i++) fclose (files[i].file); /* closes fds[i * 2] */ return status; } return -1; } int di_exec_full (const char *path, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data) { return internal_di_exec (path, false, argv, NULL, stdout_handler, stderr_handler, io_user_data, parent_prepare_handler, parent_prepare_user_data, child_prepare_handler, child_prepare_user_data); } int di_exec_env_full (const char *path, const char *const argv[], const char *const envp[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data) { return internal_di_exec (path, false, argv, envp, stdout_handler, stderr_handler, io_user_data, parent_prepare_handler, parent_prepare_user_data, child_prepare_handler, child_prepare_user_data); } int di_exec_path_full (const char *file, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data) { return internal_di_exec (file, true, argv, NULL, stdout_handler, stderr_handler, io_user_data, parent_prepare_handler, parent_prepare_user_data, child_prepare_handler, child_prepare_user_data); } int di_exec_shell_full (const char *const cmd, di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data) { const char *const argv[] = { "sh", "-c", cmd, NULL }; return internal_di_exec ("/bin/sh", false, argv, NULL, stdout_handler, stderr_handler, io_user_data, parent_prepare_handler, parent_prepare_user_data, child_prepare_handler, child_prepare_user_data); } int di_exec_prepare_chdir (pid_t pid __attribute__ ((unused)), void *user_data) { char *path = user_data; if (chdir (path)) return -1; return 0; } int di_exec_prepare_chroot (pid_t pid __attribute__ ((unused)), void *user_data) { char *path = user_data; if (chroot (path)) return -1; if (chdir ("/")) return -1; return 0; } int di_exec_io_log (const char *buf, size_t len __attribute__ ((unused)), void *user_data __attribute__ ((unused))) { di_log (DI_LOG_LEVEL_OUTPUT, "%s", buf); return 0; } int di_exec_mangle_status (int status) { if (WIFEXITED (status)) return WEXITSTATUS (status); if (WIFSIGNALED (status)) return 128 + WTERMSIG (status); if (WIFSTOPPED (status)) return 128 + WSTOPSIG (status); return status; } libdebian-installer/src/tree.c0000644000000000000000000001615711557456270013570 0ustar /* * tree.c * * Copyright (C) 2006 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include typedef struct di_tree_node di_tree_node; /** * @addtogroup di_tree * @{ */ /** * @internal * @brief Tree */ struct di_tree { size_t nnodes; /**< number of nodes */ di_tree_node *root; /**< root node */ di_compare_func *key_compare_func; /**< key compare function */ di_destroy_notify *key_destroy_func; /**< key destroy function, may NULL */ di_destroy_notify *value_destroy_func; /**< value destroy function, may NULL */ }; /** * @internal * @brief Node of a tree */ struct di_tree_node { void *key; /**< key */ void *value; /**< value */ di_tree_node *left; /**< the left child */ di_tree_node *right; /**< the right child */ int balance, height; }; /** @} */ di_tree *di_tree_new (di_compare_func key_compare_func) { return di_tree_new_full (key_compare_func, NULL, NULL); } di_tree *di_tree_new_full (di_compare_func key_compare_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func) { di_tree *tree; tree = di_new (di_tree, 1); tree->nnodes = 0; tree->key_compare_func = key_compare_func; tree->key_destroy_func = key_destroy_func; tree->value_destroy_func = value_destroy_func; tree->root = 0; return tree; } static void di_tree_node_destroy (di_tree *tree, di_tree_node *node) { if (!node) return; di_tree_node_destroy (tree, node->left); di_tree_node_destroy (tree, node->right); if (tree->key_destroy_func) tree->key_destroy_func (node->key); if (tree->value_destroy_func) tree->value_destroy_func (node->value); di_free (node); } void di_tree_destroy (di_tree *tree) { di_tree_node_destroy (tree, tree->root); di_free (tree); } static di_tree_node* di_tree_node_new (void *key, void *value) { di_tree_node *tree_node; tree_node = di_new (di_tree_node, 1); tree_node->key = key; tree_node->value = value; tree_node->left = tree_node->right = NULL; tree_node->balance = 0; tree_node->height = 1; return tree_node; } static void di_tree_node_calculate (di_tree_node *node) { int left_height = 0; int right_height = 0; if (node->left) left_height = node->left->height; if (node->right) right_height = node->right->height; node->height = (left_height > right_height ? left_height : right_height) + 1; node->balance = right_height - left_height; } static di_tree_node *di_tree_node_rotate_left (di_tree_node *node) { di_tree_node *u = node; di_tree_node *v = u->right; di_tree_node *b = v->left; v->left = u; u->right = b; di_tree_node_calculate (u); di_tree_node_calculate (v); return v; } static di_tree_node *di_tree_node_rotate_right (di_tree_node *node) { di_tree_node *u = node; di_tree_node *v = u->left; di_tree_node *b = v->right; v->right = u; u->left = b; di_tree_node_calculate (u); di_tree_node_calculate (v); return v; } static di_tree_node *di_tree_node_rotate_left_double (di_tree_node *node) { di_tree_node *u = node; di_tree_node *v = u->right; di_tree_node *z = v->left; di_tree_node *b = z->left; di_tree_node *c = z->right; z->left = u; z->right = v; u->right = b; v->left = c; di_tree_node_calculate (u); di_tree_node_calculate (v); di_tree_node_calculate (z); return z; } static di_tree_node *di_tree_node_rotate_right_double (di_tree_node *node) { di_tree_node *u = node; di_tree_node *v = u->left; di_tree_node *z = v->right; di_tree_node *b = z->right; di_tree_node *c = z->left; z->right = u; z->left = v; u->left = b; v->right = c; di_tree_node_calculate (u); di_tree_node_calculate (v); di_tree_node_calculate (z); return z; } static di_tree_node *di_tree_node_rotate (di_tree_node *node) { di_tree_node_calculate (node); switch (node->balance) { case -2: switch (node->left->balance) { case -1: case 0: return di_tree_node_rotate_right (node); case 1: return di_tree_node_rotate_right_double (node); } case -1: case 0: case 1: return node; case 2: switch (node->right->balance) { case -1: return di_tree_node_rotate_left_double (node); case 0: case 1: return di_tree_node_rotate_left (node); } } di_error ("Internal error"); return node; } static di_tree_node *di_tree_node_insert (di_tree *tree, di_tree_node *node, void *key, void *value) { int cmp = tree->key_compare_func (key, node->key); if (cmp == 0) { // TODO } else if (cmp < 0) { if (node->left) node->left = di_tree_node_insert (tree, node->left, key, value); else { node->left = di_tree_node_new (key, value); tree->nnodes++; } } else { if (node->right) node->right = di_tree_node_insert (tree, node->right, key, value); else { node->right = di_tree_node_new (key, value); tree->nnodes++; } } return di_tree_node_rotate (node); } void di_tree_insert (di_tree *tree, void *key, void *value) { if (!tree->root) { tree->root = di_tree_node_new (key, value); tree->nnodes++; } else tree->root = di_tree_node_insert (tree, tree->root, key, value); } static void di_tree_node_foreach (di_tree_node *node, di_hfunc *func, void *user_data) { if (!node) return; di_tree_node_foreach (node->left, func, user_data); func (node->key, node->value, user_data); di_tree_node_foreach (node->right, func, user_data); } void di_tree_foreach (di_tree *tree, di_hfunc *func, void *user_data) { di_tree_node_foreach (tree->root, func, user_data); } di_ksize_t di_tree_size (di_tree *tree) { return tree->nnodes; } static void *di_tree_node_lookup (di_tree *tree, di_tree_node *node, const void *key) { int cmp; if (!node) return 0; cmp = tree->key_compare_func (key, node->key); if (cmp == 0) return node->value; else if (cmp < 0) return di_tree_node_lookup (tree, node->left, key); else return di_tree_node_lookup (tree, node->right, key); } void *di_tree_lookup (di_tree *tree, const void *key) { return di_tree_node_lookup (tree, tree->root, key); } libdebian-installer/src/mem.c0000644000000000000000000000276711557456270013411 0ustar /* * mem.c * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include void *di_malloc (size_t n_bytes) { void *mem; mem = malloc (n_bytes); if (!mem) di_error ("%s: failed to allocate %zu bytes", DI_STRLOC, n_bytes); return mem; } void *di_malloc0 (size_t n_bytes) { void *mem; mem = calloc (1, n_bytes); if (!mem) di_error ("%s: failed to allocate %zu bytes", DI_STRLOC, n_bytes); return mem; } void *di_realloc (void *mem, size_t n_bytes) { mem = realloc (mem, n_bytes); if (!mem) di_error ("%s: failed to allocate %zu bytes", DI_STRLOC, n_bytes); return mem; } void di_free (void *mem) { free (mem); } libdebian-installer/src/string.c0000644000000000000000000000433211557456270014127 0ustar /* * string.c * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include int di_snprintfcat (char *str, size_t size, const char *format, ...) { va_list ap; int retval; size_t len = strlen (str); va_start (ap, format); retval = vsnprintf (str + len, size - len, format, ap); va_end (ap); return retval; } char *di_stradup (const char *s, size_t n) { size_t len = n + 1; char *string = di_new (char, len); string[n] = '\0'; return memcpy (string, s, n); } bool di_rstring_equal (const void *key1, const void *key2) { const di_rstring *rstring1 = key1; const di_rstring *rstring2 = key2; if (rstring1->size == rstring2->size) return strncasecmp (rstring1->string, rstring2->string, rstring1->size) == 0; return false; } uint32_t di_rstring_hash (const void *key) { const di_rstring *rstring = key; const char *p = rstring->string; size_t n = 0; uint32_t h = 0; for (; n < rstring->size; n++) h = (h << 5) - h + tolower (*p++); return h; } #if 0 bool di_string_equal (const void *key1, const void *key2) { const char *string1 = key1; const char *string2 = key2; return strcmp (string1, string2) == 0; } uint32_t di_string_hash (const void *key) { const char *p = key; uint32_t h = *p; if (h) for (p += 1; *p != '\0'; p++) h = (h << 5) - h + *p; return h; } #endif libdebian-installer/src/Makefile.am0000644000000000000000000000212212271462253014474 0ustar SUBDIRS = system AM_CPPFLAGS = \ -I$(top_srcdir)/include lib_LTLIBRARIES = libdebian-installer.la libdebian-installer-extra.la libdebian_installer_la_SOURCES = \ exec.c \ hash.c \ log.c \ mem.c \ mem_chunk.c \ package.c \ package_parser.c \ packages.c \ packages_parser.c \ parser.c \ parser_rfc822.c \ slist.c \ string.c \ tree.c \ utils.c libdebian_installer_extra_la_SOURCES = \ list.c \ release.c libdebian_installer_la_LIBADD = \ system/libsystem.la libdebian_installer_extra_la_LIBADD = \ libdebian-installer.la libdebian_installer_la_LDFLAGS = \ -version-number $(LIBRARY_VERSION_LIBTOOL) \ -Wl,--version-script=$(srcdir)/libdebian-installer.ver \ -Wl,--no-undefined-version libdebian_installer_extra_la_LDFLAGS = \ -version-number $(LIBRARY_VERSION_LIBTOOL) \ -Wl,--version-script=$(srcdir)/libdebian-installer-extra.ver \ -Wl,--no-undefined-version libdebian_installer_la_DEPENDENCIES = \ $(srcdir)/libdebian-installer.ver \ system/libsystem.la libdebian_installer_extra_la_DEPENDENCIES = \ $(srcdir)/libdebian-installer-extra.ver \ libdebian-installer.la libdebian-installer/src/libdebian-installer.ver0000644000000000000000000000751011515541630017065 0ustar LIBDI_4.0 { global: di_exec_full; di_exec_io_log; di_exec_prepare_chroot; di_exec_shell_full; di_free; di_hash_table_destroy; di_hash_table_foreach; di_hash_table_insert; di_hash_table_lookup; di_hash_table_new; di_hash_table_new_full; di_hash_table_size; di_init; di_log_handler_default; di_log_handler_syslog; di_log_real_4_0; di_log_set_handler; di_malloc; di_malloc0; di_mapdevfs; di_mem_chunk_alloc; di_mem_chunk_alloc0; di_mem_chunk_destroy; di_mem_chunk_new; di_mem_chunk_size; di_package_destroy; di_package_parser_fieldinfo; di_package_parser_info; di_package_parser_read_dependency; di_package_parser_read_description; di_package_parser_read_name; di_package_parser_read_priority; di_package_parser_read_status; di_package_parser_write_dependency; di_package_parser_write_description; di_package_parser_write_priority; di_package_parser_write_status; di_package_special_read_file; di_package_version_compare; di_package_version_free; di_package_version_parse; di_packages_alloc; di_packages_allocator_alloc; di_packages_allocator_free; di_packages_append_package; di_packages_free; di_packages_get_package; di_packages_get_package_new; di_packages_minimal_parser_fieldinfo; di_packages_minimal_parser_info; di_packages_parser_fieldinfo; di_packages_parser_info; di_packages_parser_read_name; di_packages_resolve_dependencies; di_packages_resolve_dependencies_array; di_packages_resolve_dependencies_mark; di_packages_special_read_file; di_packages_special_write_file; di_packages_status_parser_fieldinfo; di_packages_status_parser_info; di_parser_info_add; di_parser_info_alloc; di_parser_info_free; di_parser_read_boolean; di_parser_read_int; di_parser_read_string; di_parser_rfc822_read; di_parser_rfc822_read_file; di_parser_rfc822_write_file; di_parser_write_boolean; di_parser_write_int; di_parser_write_string; di_prebaseconfig_append; di_progname_get; di_realloc; di_rstring_equal; di_rstring_hash; di_slist_alloc; di_slist_append; di_slist_append_chunk; di_slist_free; di_slist_prepend; di_slist_prepend_chunk; di_snprintfcat; di_stradup; di_system_devfs_map_from; di_system_dpkg_package_control_file_exec; di_system_init; di_system_package_destroy; di_system_package_parser_fieldinfo; di_system_package_parser_info; di_system_packages_alloc; di_system_packages_allocator_alloc; di_system_packages_parser_info; di_system_packages_status_parser_info; di_system_prebaseconfig_append; di_vlog; local: *; }; LIBDI_4.1 { global: di_exec_mangle_status; di_exec_prepare_chdir; di_log; di_slist_destroy; di_system_package_check_subarchitecture; } LIBDI_4.0; LIBDI_4.2 { global: di_package_array_text_from; di_package_priority_text; di_package_status_want_text; di_package_status_text; } LIBDI_4.1; LIBDI_4.2_UNSTABLE { global: di_system_packages_resolve_dependencies_array_permissive; di_system_packages_resolve_dependencies_mark_kernel; } LIBDI_4.2; LIBDI_4.3 { global: di_exec_env_full; } LIBDI_4.2; LIBDI_4.3_UNSTABLE { global: di_system_packages_resolve_dependencies_mark_anna; } LIBDI_4.2_UNSTABLE; LIBDI_4.4 { global: di_exec_path_full; } LIBDI_4.3; LIBDI_4.5 { global: di_system_subarch_analyze; } LIBDI_4.4; LIBDI_4.6 { global: di_tree_destroy; di_tree_foreach; di_tree_insert; di_tree_lookup; di_tree_new; di_tree_new_full; di_tree_size; } LIBDI_4.5; LIBDI_4.7 { global: di_system_subarch_analyze_guess; } LIBDI_4.6; #LIBDI_PRIVATE { # global: # internal_*; #} LIBDI_4.1; libdebian-installer/src/packages_parser.c0000644000000000000000000001501211557456270015750 0ustar /* * packages_parser.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include /** * @addtogroup di_packages_parser * @{ */ /** * @internal * parser info */ const di_parser_fieldinfo internal_di_packages_parser_field_package = DI_PARSER_FIELDINFO ( "Package", di_packages_parser_read_name, di_parser_write_string, offsetof (di_package, package) ); /** * Standard Packages file */ const di_parser_fieldinfo *di_packages_parser_fieldinfo[] = { &internal_di_packages_parser_field_package, &internal_di_package_parser_field_essential, &internal_di_package_parser_field_priority, &internal_di_package_parser_field_section, &internal_di_package_parser_field_installed_size, &internal_di_package_parser_field_maintainer, &internal_di_package_parser_field_architecture, &internal_di_package_parser_field_version, &internal_di_package_parser_field_replaces, &internal_di_package_parser_field_provides, &internal_di_package_parser_field_depends, &internal_di_package_parser_field_pre_depends, &internal_di_package_parser_field_recommends, &internal_di_package_parser_field_suggests, &internal_di_package_parser_field_conflicts, &internal_di_package_parser_field_enhances, &internal_di_package_parser_field_filename, &internal_di_package_parser_field_size, &internal_di_package_parser_field_md5sum, &internal_di_package_parser_field_description, NULL }; /** * Standard status file */ const di_parser_fieldinfo *di_packages_status_parser_fieldinfo[] = { &internal_di_packages_parser_field_package, &internal_di_package_parser_field_status, &internal_di_package_parser_field_essential, &internal_di_package_parser_field_priority, &internal_di_package_parser_field_section, &internal_di_package_parser_field_installed_size, &internal_di_package_parser_field_maintainer, &internal_di_package_parser_field_version, &internal_di_package_parser_field_replaces, &internal_di_package_parser_field_provides, &internal_di_package_parser_field_depends, &internal_di_package_parser_field_pre_depends, &internal_di_package_parser_field_recommends, &internal_di_package_parser_field_suggests, &internal_di_package_parser_field_conflicts, &internal_di_package_parser_field_enhances, &internal_di_package_parser_field_description, NULL }; /** * Minimal Packages file */ const di_parser_fieldinfo *di_packages_minimal_parser_fieldinfo[] = { &internal_di_packages_parser_field_package, &internal_di_package_parser_field_essential, &internal_di_package_parser_field_priority, &internal_di_package_parser_field_installed_size, &internal_di_package_parser_field_version, &internal_di_package_parser_field_provides, &internal_di_package_parser_field_depends, &internal_di_package_parser_field_pre_depends, &internal_di_package_parser_field_filename, &internal_di_package_parser_field_md5sum, &internal_di_package_parser_field_size, NULL }; /** @} */ /** * @internal * Get parser info for standard Packages file */ di_parser_info *di_packages_parser_info (void) { di_parser_info *info; info = di_parser_info_alloc (); di_parser_info_add (info, di_packages_parser_fieldinfo); return info; } /** * @internal * Get parser info for minimal Packages file */ di_parser_info *di_packages_minimal_parser_info () { di_parser_info *info; info = di_parser_info_alloc (); di_parser_info_add (info, di_packages_minimal_parser_fieldinfo); return info; } /** * @internal * Get parser info for standard status file */ di_parser_info *di_packages_status_parser_info (void) { di_parser_info *info; info = di_parser_info_alloc (); di_parser_info_add (info, di_packages_status_parser_fieldinfo); return info; } /** * Read a special Packages file * * @param file file to read * @param info parser info */ di_packages *di_packages_special_read_file (const char *file, di_packages_allocator *allocator, di_parser_info *(get_info) (void)) { di_parser_info *info = get_info (); internal_di_package_parser_data data = {allocator, NULL, NULL}; data.packages = di_packages_alloc (); if (di_parser_rfc822_read_file (file, info, NULL, NULL, &data) < 0) { di_packages_free (data.packages); data.packages = NULL; } di_parser_info_free (info); return data.packages; } /** * Write a special Packages file * * @param packages a di_packages * @param file file to write * * @return number of dumped entries */ int di_packages_special_write_file (di_packages *packages, const char *file, di_parser_info *(get_info) (void)) { int ret; di_parser_info *info = get_info (); ret = di_parser_rfc822_write_file (file, info, internal_di_packages_parser_write_entry_next, packages); di_parser_info_free (info); return ret; } void *internal_di_packages_parser_write_entry_next (void **state_data, void *user_data) { if (!*state_data) { di_packages *p = user_data; if (p->list.head) { *state_data = p->list.head; return p->list.head->data; } else return NULL; } else { di_slist_node *n = *state_data; n = n->next; if (n) { *state_data = n; return n->data; } else return NULL; } } void di_packages_parser_read_name (data, fip, field_modifier, value, user_data) void **data; const di_parser_fieldinfo *fip __attribute__ ((unused)); di_rstring *field_modifier __attribute__ ((unused)); di_rstring *value; void *user_data; { internal_di_package_parser_data *parser_data = user_data; di_package *p; p = di_packages_get_package_new (parser_data->packages, parser_data->allocator, value->string, value->size); p->type = di_package_type_real_package; di_slist_append_chunk (&parser_data->packages->list, p, parser_data->allocator->slist_node_mem_chunk); *data = p; } libdebian-installer/src/utils.c0000644000000000000000000000171011557456270013756 0ustar /* * utils.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include static const char *progname; void di_init (const char *_progname) { progname = strdup (_progname); } const char *di_progname_get (void) { return progname; } libdebian-installer/src/release.c0000644000000000000000000001124211557456270014237 0ustar /* * release.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include /** * @addtogroup di_release_parser * @{ */ /** * @internal * parser info */ const di_parser_fieldinfo internal_di_release_parser_field_origin = DI_PARSER_FIELDINFO ( "Origin", di_parser_read_string, NULL, offsetof (di_release, origin) ), internal_di_release_parser_field_suite = DI_PARSER_FIELDINFO ( "Suite", di_parser_read_string, NULL, offsetof (di_release, suite) ), internal_di_release_parser_field_codename = DI_PARSER_FIELDINFO ( "Codename", di_parser_read_string, NULL, offsetof (di_release, codename) ), internal_di_release_parser_field_md5sum = DI_PARSER_FIELDINFO ( "MD5Sum", di_release_parser_read_file, NULL, 0 ), internal_di_release_parser_field_sha1 = DI_PARSER_FIELDINFO ( "SHA1", di_release_parser_read_file, NULL, 1 ); /** * Standard Release file */ const di_parser_fieldinfo *di_release_parser_fieldinfo[] = { &internal_di_release_parser_field_origin, &internal_di_release_parser_field_suite, &internal_di_release_parser_field_codename, &internal_di_release_parser_field_md5sum, &internal_di_release_parser_field_sha1, NULL }; /** @} */ static void internal_di_release_file_destroy_func (void *data) { di_release_file *file = data; di_free (file->filename); di_free (file->sum[0]); di_free (file->sum[1]); } /** * Allocate di_release */ di_release *di_release_alloc (void) { di_release *ret; ret = di_new0 (di_release, 1); ret->md5sum = di_hash_table_new_full (di_rstring_hash, di_rstring_equal, NULL, internal_di_release_file_destroy_func); ret->release_file_mem_chunk = di_mem_chunk_new (sizeof (di_release_file), 4096); return ret; } /** * Free di_release */ void di_release_free (di_release *release) { di_free (release->origin); di_free (release->suite); di_free (release->codename); di_hash_table_destroy (release->md5sum); di_mem_chunk_destroy (release->release_file_mem_chunk); di_free (release); } static void *parser_new (void *user_data) { return user_data; } /** * Read a standard Release file * * @param file file to read */ di_release *di_release_read_file (const char *file) { di_release *release; di_parser_info *info; release = di_release_alloc (); info = di_parser_info_alloc (); di_parser_info_add (info, di_release_parser_fieldinfo); if (di_parser_rfc822_read_file (file, info, parser_new, NULL, release) < 0) { di_release_free (release); return NULL; } return release; } void di_release_parser_read_file (data, fip, field_modifier, value, user_data) void **data; const di_parser_fieldinfo *fip __attribute__ ((unused)); di_rstring *field_modifier __attribute__ ((unused)); di_rstring *value; void *user_data __attribute__ ((unused)); { char *begin = value->string, *next = begin, *end = value->string + value->size; char *buf_sum, buf_filename[129]; int ret; size_t buf_size; di_release *release = *data; di_hash_table *table = release->md5sum; while (1) { next = memchr (begin, '\n', end - begin); if (!next) next = end; ret = sscanf (begin, "%ms %zu %128s", &buf_sum, &buf_size, buf_filename); if (ret == 3) { di_rstring key = { buf_filename, strlen (buf_filename) }; di_release_file *file = di_hash_table_lookup (table, &key); if (!file) { file = di_mem_chunk_alloc0 (release->release_file_mem_chunk); file->key.string = strdup (buf_filename); file->key.size = strlen (buf_filename); di_hash_table_insert (table, &file->key, file); } file->size = buf_size; file->sum[fip->integer] = buf_sum; } begin = next + 1; if (begin >= end) break; } } libdebian-installer/src/mem_chunk.c0000644000000000000000000001326612271462253014565 0ustar /* * mem.c * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #define MEM_ALIGN sizeof (void *) #define MEM_AREA_SIZE sizeof (void *) typedef struct di_mem_area di_mem_area; /** * @addtogroup di_mem_chunk * @{ */ /** * @internal * @brief a mem chunk */ struct di_mem_chunk { int num_mem_areas; /**< the number of memory areas */ int num_marked_areas; /**< the number of areas marked for deletion */ size_t atom_size; /**< the size of an atom */ size_t area_size; /**< the size of a memory area */ size_t rarea_size; /**< the size of a real memory area */ di_mem_area *mem_area; /**< the current memory area */ di_mem_area *mem_areas; /**< a list of all the mem areas owned by this chunk */ }; /** * @internal * @brief a mem area */ struct di_mem_area { di_mem_area *next; /**< the next mem area */ di_mem_area *prev; /**< the previous mem area */ size_t index; /**< the current index into the "mem" array */ size_t free; /**< the number of free bytes in this mem area */ size_t allocated; /**< the number of atoms allocated from this area */ char mem[MEM_AREA_SIZE]; /**< the mem array from which atoms get allocated * the actual size of this array is determined by * the mem chunk "area_size". ANSI says that it * must be declared to be the maximum size it * can possibly be (even though the actual size * may be less). */ }; static size_t internal_di_mem_chunk_compute_size (size_t size, size_t min_size); /** @} */ /** * Makes a new Memory-Chunk Allocer * * @param atom_size size of each piece * @param area_size size of each alloced chunk */ di_mem_chunk* di_mem_chunk_new (di_ksize_t atom_size, di_ksize_t area_size) { di_mem_chunk *mem_chunk; if (area_size < atom_size) return NULL; area_size = (area_size + atom_size - 1) / atom_size; area_size *= atom_size; mem_chunk = di_new (di_mem_chunk, 1); mem_chunk->num_mem_areas = 0; mem_chunk->num_marked_areas = 0; mem_chunk->mem_area = NULL; mem_chunk->mem_areas = NULL; mem_chunk->atom_size = atom_size; if (mem_chunk->atom_size % MEM_ALIGN) mem_chunk->atom_size += MEM_ALIGN - (mem_chunk->atom_size % MEM_ALIGN); mem_chunk->rarea_size = internal_di_mem_chunk_compute_size (area_size + sizeof (di_mem_area) - MEM_AREA_SIZE, atom_size + sizeof (di_mem_area) - MEM_AREA_SIZE); mem_chunk->area_size = mem_chunk->rarea_size - (sizeof (di_mem_area) - MEM_AREA_SIZE); return mem_chunk; } /** * Allocate a piece * * @param mem_chunk a di_mem_chunk * * @return memory */ void *di_mem_chunk_alloc (di_mem_chunk *mem_chunk) { void *mem; if ((!mem_chunk->mem_area) || ((mem_chunk->mem_area->index + mem_chunk->atom_size) > mem_chunk->area_size)) { mem_chunk->mem_area = di_malloc (mem_chunk->rarea_size); mem_chunk->num_mem_areas += 1; mem_chunk->mem_area->next = mem_chunk->mem_areas; mem_chunk->mem_area->prev = NULL; if (mem_chunk->mem_areas) mem_chunk->mem_areas->prev = mem_chunk->mem_area; mem_chunk->mem_areas = mem_chunk->mem_area; mem_chunk->mem_area->index = 0; mem_chunk->mem_area->free = mem_chunk->area_size; mem_chunk->mem_area->allocated = 0; } mem = &mem_chunk->mem_area->mem[mem_chunk->mem_area->index]; mem_chunk->mem_area->index += mem_chunk->atom_size; mem_chunk->mem_area->free -= mem_chunk->atom_size; mem_chunk->mem_area->allocated += 1; return mem; } /** * Allocate a cleared piece * * @param mem_chunk a di_mem_chunk * * @return memory */ void *di_mem_chunk_alloc0 (di_mem_chunk *mem_chunk) { void *mem; mem = di_mem_chunk_alloc (mem_chunk); if (mem) memset (mem, 0, mem_chunk->atom_size); return mem; } void di_mem_chunk_destroy (di_mem_chunk *mem_chunk) { di_mem_area *mem_areas, *temp_area; mem_areas = mem_chunk->mem_areas; while (mem_areas) { temp_area = mem_areas; mem_areas = mem_areas->next; di_free (temp_area); } di_free (mem_chunk); } size_t di_mem_chunk_size (di_mem_chunk *mem_chunk) { di_mem_area *mem_area; size_t size = 0; for (mem_area = mem_chunk->mem_areas; mem_area; mem_area = mem_area->next) { size += mem_chunk->atom_size * mem_area->allocated; } return size; } static size_t internal_di_mem_chunk_compute_size (size_t size, size_t min_size) { size_t power_of_2; size_t lower, upper; power_of_2 = 16; while (power_of_2 < size) power_of_2 <<= 1; lower = power_of_2 >> 1; upper = power_of_2; if (size - lower < upper - size && lower >= min_size) return lower; else return upper; } libdebian-installer/src/package_parser.c0000644000000000000000000003447611557456270015604 0ustar /* * package_parser.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include const di_parser_fieldinfo internal_di_package_parser_field_package = DI_PARSER_FIELDINFO ( "Package", di_parser_read_rstring, di_parser_write_rstring, offsetof (di_package, package) ), internal_di_package_parser_field_status = DI_PARSER_FIELDINFO ( "Status", di_package_parser_read_status, di_package_parser_write_status, 0 ), internal_di_package_parser_field_essential = DI_PARSER_FIELDINFO ( "Essential", di_parser_read_boolean, di_parser_write_boolean, offsetof (di_package, essential) ), internal_di_package_parser_field_priority = DI_PARSER_FIELDINFO ( "Priority", di_package_parser_read_priority, di_package_parser_write_priority, 0 ), internal_di_package_parser_field_section = DI_PARSER_FIELDINFO ( "Section", di_parser_read_string, di_parser_write_string, offsetof (di_package, section) ), internal_di_package_parser_field_installed_size = DI_PARSER_FIELDINFO ( "Installed-Size", di_parser_read_int, di_parser_write_int, offsetof (di_package, installed_size) ), internal_di_package_parser_field_maintainer = DI_PARSER_FIELDINFO ( "Maintainer", di_parser_read_string, di_parser_write_string, offsetof (di_package, maintainer) ), internal_di_package_parser_field_architecture = DI_PARSER_FIELDINFO ( "Architecture", di_parser_read_string, di_parser_write_string, offsetof (di_package, architecture) ), internal_di_package_parser_field_version = DI_PARSER_FIELDINFO ( "Version", di_parser_read_string, di_parser_write_string, offsetof (di_package, version) ), internal_di_package_parser_field_replaces = DI_PARSER_FIELDINFO ( "Replaces", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_replaces ), internal_di_package_parser_field_provides = DI_PARSER_FIELDINFO ( "Provides", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_provides ), internal_di_package_parser_field_depends = DI_PARSER_FIELDINFO ( "Depends", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_depends ), internal_di_package_parser_field_pre_depends = DI_PARSER_FIELDINFO ( "Pre-Depends", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_pre_depends ), internal_di_package_parser_field_recommends = DI_PARSER_FIELDINFO ( "Recommends", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_recommends ), internal_di_package_parser_field_suggests = DI_PARSER_FIELDINFO ( "Suggests", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_suggests ), internal_di_package_parser_field_conflicts = DI_PARSER_FIELDINFO ( "Conflicts", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_conflicts ), internal_di_package_parser_field_enhances = DI_PARSER_FIELDINFO ( "Enhances", di_package_parser_read_dependency, di_package_parser_write_dependency, di_package_dependency_type_enhances ), internal_di_package_parser_field_filename = DI_PARSER_FIELDINFO ( "Filename", di_parser_read_string, di_parser_write_string, offsetof (di_package, filename) ), internal_di_package_parser_field_size = DI_PARSER_FIELDINFO ( "Size", di_parser_read_int, di_parser_write_int, offsetof (di_package, size) ), internal_di_package_parser_field_md5sum = DI_PARSER_FIELDINFO ( "MD5sum", di_parser_read_string, di_parser_write_string, offsetof (di_package, md5sum) ), internal_di_package_parser_field_description = DI_PARSER_FIELDINFO ( "Description", di_package_parser_read_description, di_package_parser_write_description, 0 ); const di_parser_fieldinfo *di_package_parser_fieldinfo[] = { &internal_di_package_parser_field_package, &internal_di_package_parser_field_essential, &internal_di_package_parser_field_priority, &internal_di_package_parser_field_section, &internal_di_package_parser_field_installed_size, &internal_di_package_parser_field_maintainer, &internal_di_package_parser_field_architecture, &internal_di_package_parser_field_version, &internal_di_package_parser_field_replaces, &internal_di_package_parser_field_provides, &internal_di_package_parser_field_depends, &internal_di_package_parser_field_pre_depends, &internal_di_package_parser_field_recommends, &internal_di_package_parser_field_suggests, &internal_di_package_parser_field_conflicts, &internal_di_package_parser_field_enhances, &internal_di_package_parser_field_filename, &internal_di_package_parser_field_size, &internal_di_package_parser_field_md5sum, &internal_di_package_parser_field_description, NULL }; static void *internal_di_package_parser_new (void *user_data) { internal_di_package_parser_data *parser_data = user_data; parser_data->package = di_package_alloc (parser_data->allocator); parser_data->package->type = di_package_type_real_package; return parser_data->package; } di_parser_info *di_package_parser_info (void) { di_parser_info *info; info = di_parser_info_alloc (); di_parser_info_add (info, di_package_parser_fieldinfo); return info; } di_package *di_package_special_read_file (const char *file, di_packages *packages, di_packages_allocator *allocator, di_parser_info *(get_info) (void)) { di_parser_info *info = get_info (); internal_di_package_parser_data data; data.allocator = allocator; data.packages = packages; di_parser_rfc822_read_file (file, info, internal_di_package_parser_new, NULL, &data); di_parser_info_free (info); return data.package; } void di_package_parser_read_dependency ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { internal_di_package_parser_data *parser_data = user_data; di_package *p = *data, *q; char *cur = value->string, *end = value->string + value->size; char *namebegin, *fieldend; size_t namelen; di_package_dependency *d, *d1; /* * basic depends line parser. can ignore versioning * info since the depends are already satisfied. */ while (cur < end) { namebegin = cur; namelen = strcspn (cur, " \t\n(,|"); d = di_package_dependency_alloc (parser_data->allocator); if (parser_data->packages) { q = di_packages_get_package_new (parser_data->packages, parser_data->allocator, namebegin, namelen); d->ptr = q; } else q = NULL; d->type = fip->integer; di_slist_append_chunk (&p->depends, d, parser_data->allocator->slist_node_mem_chunk); if (q && (d->type == di_package_dependency_type_provides || d->type == di_package_dependency_type_enhances)) { if (q->type == di_package_type_non_existent) q->type = di_package_type_virtual_package; if (q->type == di_package_type_virtual_package && q->priority < p->priority) q->priority = p->priority; d1 = di_package_dependency_alloc (parser_data->allocator); d1->ptr = p; if (d->type == di_package_dependency_type_provides) d1->type = di_package_dependency_type_reverse_provides; else if (d->type == di_package_dependency_type_enhances) d1->type = di_package_dependency_type_reverse_enhances; di_slist_append_chunk (&q->depends, d1, parser_data->allocator->slist_node_mem_chunk); } fieldend = cur + strcspn (cur, "\n,"); while (isspace(*++fieldend)); cur = fieldend; } } void di_package_parser_write_dependency ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { di_package *p = *data; di_slist_node *node; di_rstring value = { NULL, 0 }; size_t value_size = 0, value_size_needed; for (node = p->depends.head; node; node = node->next) { di_package_dependency *d = node->data; if (d->type == fip->integer && d->ptr) { size_t size = strlen (d->ptr->package); if (value.size) value_size_needed = size + 2; else value_size_needed = size; if (value.size + value_size_needed > value_size) { size_t new_value_size = value_size + 1024; value.string = di_renew (char, value.string, new_value_size); value.string[value_size] = 0; value_size = new_value_size; } if (value.size) strcat (value.string, ", "); strcat (value.string, d->ptr->package); value.size += value_size_needed; } } if (value.size) callback (&fip->key, &value, callback_data); di_free (value.string); } void di_package_parser_read_description ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { di_package *p = *data; char *temp; temp = memchr (value->string, '\n', value->size); if (temp) { p->short_description = di_stradup (value->string, temp - value->string); p->description = di_stradup (temp + 1, value->string + value->size - temp - 1); #if 0 fwrite (value->string, value->size, 1, stdout); fputs ("\n-----\n", stdout); fwrite (temp + 1, value->string + value->size - temp - 1, 1, stdout); fputs ("\n=====\n", stdout); #endif } else p->short_description = di_stradup (value->string, value->size); } void di_package_parser_write_description ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { di_package *p = *data; di_rstring value; if (p->short_description) { if (p->description) { value.size = strlen (p->short_description) + strlen (p->description) + 1; value.string = di_malloc (value.size + 1); snprintf (value.string, value.size + 1, "%s\n%s", p->short_description, p->description); #if 0 fprintf(stdout, "%s", p->description); fputs ("\n-----\n", stdout); fprintf(stdout, "%s", value.string); fputs ("\n=====\n", stdout); #endif } else { value.size = strlen (p->short_description); value.string = p->short_description; } callback (&fip->key, &value, callback_data); if (p->description) di_free (value.string); } } di_parser_fields_function_read di_package_parser_read_name_real_4_0 __attribute__ ((unused)); void di_package_parser_read_name_real_4_0 (data, fip, field_modifier, value, user_data) void **data; const di_parser_fieldinfo *fip __attribute__ ((unused)); di_rstring *field_modifier __attribute__ ((unused)); di_rstring *value; void *user_data __attribute__ ((unused)); { di_package *p = *data; p->key.string = di_stradup (value->string, value->size); p->key.size = value->size; } __asm__ (".symver di_package_parser_read_name_real_4_0,di_package_parser_read_name@LIBDI_4.0"); void di_package_parser_read_priority ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { di_package *p = *data; p->priority = internal_di_package_priority_text_from_rstring (value); } void di_package_parser_write_priority ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { di_package *p = *data; di_rstring value; value.string = (char *) di_package_priority_text_to (p->priority); value.size = strlen(value.string); callback (&fip->key, &value, callback_data); } void di_package_parser_read_status ( void **data, const di_parser_fieldinfo *fip __attribute__ ((unused)), di_rstring *field_modifier __attribute__ ((unused)), di_rstring *value, void *user_data __attribute__ ((unused))) { di_package *p = *data; di_rstring temp; char *next; next = memchr (value->string, ' ', value->size); temp.string = value->string; temp.size = next - value->string; p->status_want = internal_di_package_status_want_text_from_rstring (&temp); next = memchr (next + 1, ' ', value->size - (next - value->string)) + 1; temp.string = next; temp.size = value->size - (next - value->string); p->status = internal_di_package_status_text_from_rstring (&temp); } void di_package_parser_write_status ( void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data __attribute__ ((unused))) { di_package *p = *data; char value_buf[128]; di_rstring value = { value_buf, 0 }; value.size = snprintf (value.string, sizeof (value_buf), "%s ok %s", di_package_status_want_text_to(p->status_want), di_package_status_text_to(p->status)); callback (&fip->key, &value, callback_data); } libdebian-installer/src/system/0000755000000000000000000000000012277176461014000 5ustar libdebian-installer/src/system/subarch-m68k-linux.c0000644000000000000000000000253211515541630017501 0ustar #include #include #include #include #include #include struct map { char *model; char *subarch; }; static struct map map_model[] = { { "Amiga", "amiga" }, { "ARAnyM", "atari" }, { "Atari", "atari" }, { "Macintosh", "mac" }, { "BVME", "bvme6000" }, { "Motorola MVME147", "mvme147" }, { "Motorola", "mvme16x" }, { "Q40", "q40" }, { "Sun 3/160 Series", "sun3" }, { "Sun 3/50", "sun3" }, { "Sun 3/260 Series", "sun3" }, { "Sun 3/110 Series", "sun3" }, { "Sun 3/60", "sun3" }, { "Sun 3/E", "sun3" }, { "Sun 3/460 Series", "sun3x" }, { "Sun 3/80", "sun3x" }, { NULL, NULL } }; const char *di_system_subarch_analyze(void) { FILE *file; char line[1024]; char model[256]; char *pos; int i; file = fopen("/proc/hardware", "r"); if (file == NULL) return "unknown"; while (fgets(line, sizeof(line), file) != NULL) { if (strstr(line, "Model:") == line) { pos = strchr(line, ':'); if (pos == NULL) continue; while (*++pos && (*pos == ' ' || *pos == '\t')); strncpy(model, pos, sizeof(model)); break; } } fclose(file); for (i = 0; map_model[i].model; i++) { if (!strncasecmp(map_model[i].model, model, strlen(map_model[i].model))) { return( map_model[i].subarch ); } } return "unknown"; } libdebian-installer/src/system/subarch-mipsel-linux.c0000644000000000000000000000671211515541630020211 0ustar #include #include #include #include struct cpu { char *cpu; char *ret; }; struct systype { char *sys; struct cpu *cpu; }; static struct cpu system_dec_decs_cpu[] = { { "R3", "r3k-kn02" }, { "R4", "r4k-kn04" }, { NULL, "unknown" } }; static struct cpu system_sibyte_sb1_cpu[] = { { "SiByte SB1A", "sb1a-bcm91480b" }, { "SiByte SB1 ", "sb1-bcm91250a" }, { NULL, "unknown" } }; static struct cpu system_cobalt_cpu[] = { { "Nevada", "cobalt" }, { NULL, "unknown" } }; static struct cpu system_bcm_bcm947xx_cpu[] = { { "Broadcom BCM3302", "bcm947xx" }, { "Broadcom BCM4710", "bcm947xx" }, { NULL, "unknown" } }; static struct cpu system_qemu_cpu[] = { { "MIPS 4Kc", "qemu-mips32" }, { "MIPS 24Kc", "qemu-mips32" }, { NULL, "unknown" } }; static struct cpu system_malta_cpu[] = { { "MIPS 4K", "4kc-malta" }, { "MIPS 24K", "4kc-malta" }, { "MIPS 34K", "4kc-malta" }, { "MIPS 5K", "5kc-malta" }, { "MIPS 20K", "5kc-malta" }, { NULL, "unknown" } }; static struct cpu system_loongson2_cpu[] = { { "ICT Loongson-2 V0.2", "loongson-2e" }, { "ICT Loongson-2 V0.3", "loongson-2f" }, }; /* add new system types here */ static struct cpu system_unknown_cpu[] = { { NULL, "unknown" } }; static struct systype system_type[] = { /* * match any of * "Digital unknown DECstation" * "Digital DECstation" * "Digital DECsystem" * "Digital Personal DECstation" */ {"Digital ", system_dec_decs_cpu }, {"SiByte BCM9", system_sibyte_sb1_cpu }, /* match Broadcom SB1 boards */ {"MIPS Cobalt", system_cobalt_cpu }, /* old kernels */ {"Cobalt ", system_cobalt_cpu }, /* match any Cobalt machine; new kernels */ {"Broadcom BCM947XX", system_bcm_bcm947xx_cpu }, /* Broadcom based APs/NAS */ {"Qemu", system_qemu_cpu }, {"MIPS Malta", system_malta_cpu }, {"lemote-", system_loongson2_cpu }, {"dexxon-gdium-2f", system_loongson2_cpu }, { NULL, system_unknown_cpu } }; #define INVALID_SYS_IDX (sizeof(system_type) / sizeof(struct systype) - 1) #define INVALID_CPU_IDX (-1) #define BUFFER_LENGTH (1024) static int check_system(const char *entry) { int ret; for (ret = 0; system_type[ret].sys; ret++) { if (!strncmp(system_type[ret].sys, entry, strlen(system_type[ret].sys))) break; } return ret; } static int check_cpu(const char *entry, int sys_idx) { int ret; if (sys_idx == INVALID_SYS_IDX) { /* * This means an unsupported system type, because the * system type is always the first entry in /proc/cpuinfo. */ return INVALID_CPU_IDX; } for (ret = 0; system_type[sys_idx].cpu[ret].cpu; ret++) { if (!strncmp(system_type[sys_idx].cpu[ret].cpu, entry, strlen(system_type[sys_idx].cpu[ret].cpu))) break; } return ret; } const char *di_system_subarch_analyze(void) { FILE *file; int sys_idx = INVALID_SYS_IDX; int cpu_idx = INVALID_CPU_IDX; char buf[BUFFER_LENGTH]; char *pos; size_t len; if (!(file = fopen("/proc/cpuinfo", "r"))) return system_type[sys_idx].cpu[0].ret; while (fgets(buf, sizeof(buf), file)) { if (!(pos = strchr(buf, ':'))) continue; if (!(len = strspn(pos, ": \t"))) continue; if (!strncmp(buf, "system type", strlen("system type"))) sys_idx = check_system(pos + len); else if (!strncmp(buf, "cpu model", strlen("cpu model"))) cpu_idx = check_cpu(pos + len, sys_idx); } fclose(file); if (cpu_idx == INVALID_CPU_IDX) { sys_idx = INVALID_SYS_IDX; cpu_idx = 0; } return system_type[sys_idx].cpu[cpu_idx].ret; } libdebian-installer/src/system/packages.c0000644000000000000000000002021211557456270015716 0ustar /* * packages.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include const di_parser_fieldinfo internal_di_system_package_parser_field_installer_menu_item = DI_PARSER_FIELDINFO ( "Installer-Menu-Item", di_parser_read_int, di_parser_write_int, offsetof (di_system_package, installer_menu_item) ), internal_di_system_package_parser_field_subarchitecture = DI_PARSER_FIELDINFO ( "Subarchitecture", di_parser_read_string, di_parser_write_string, offsetof (di_system_package, subarchitecture) ), internal_di_system_package_parser_field_kernel_version = DI_PARSER_FIELDINFO ( "Kernel-Version", di_parser_read_string, di_parser_write_string, offsetof (di_system_package, kernel_version) ); const di_parser_fieldinfo *di_system_package_parser_fieldinfo[] = { &internal_di_system_package_parser_field_installer_menu_item, &internal_di_system_package_parser_field_subarchitecture, &internal_di_system_package_parser_field_kernel_version, NULL }; static void internal_di_system_package_destroy_func (void *data) { di_system_package_destroy (data); } void di_system_package_destroy (di_system_package *package) { di_free (package->subarchitecture); di_package_destroy (&package->p); } di_packages_allocator *di_system_packages_allocator_alloc (void) { di_packages_allocator *ret; ret = internal_di_packages_allocator_alloc (); ret->package_mem_chunk = di_mem_chunk_new (sizeof (di_system_package), 16384); return ret; } di_packages *di_system_packages_alloc (void) { di_packages *ret; ret = di_new0 (di_packages, 1); ret->table = di_hash_table_new_full (di_rstring_hash, di_rstring_equal, NULL, internal_di_system_package_destroy_func); return ret; } bool di_system_package_check_subarchitecture (di_package *package, const char *subarchitecture) { char *begin, *end, *temp; size_t len_subarchitecture = strlen (subarchitecture); begin = ((di_system_package *) package)->subarchitecture; if (!begin) return true; end = begin + strlen (begin); while (begin < end) { begin += strspn (begin, " \t\n"); temp = begin; temp += strcspn (temp, " \t\n"); if ((size_t) (temp - begin) == len_subarchitecture && strncmp (begin, subarchitecture, len_subarchitecture) == 0) return true; begin = temp; } return false; } di_parser_info *di_system_package_parser_info (void) { di_parser_info *info; info = di_package_parser_info (); di_parser_info_add (info, di_system_package_parser_fieldinfo); return info; } di_parser_info *di_system_packages_parser_info (void) { di_parser_info *info; info = di_packages_parser_info (); di_parser_info_add (info, di_system_package_parser_fieldinfo); return info; } di_parser_info *di_system_packages_status_parser_info (void) { di_parser_info *info; info = di_packages_status_parser_info (); di_parser_info_add (info, di_system_package_parser_fieldinfo); return info; } di_slist *di_system_packages_resolve_dependencies_array_permissive (di_packages *packages, di_package **array, di_packages_allocator *allocator) { struct di_packages_resolve_dependencies_do_real_list_append_data data = { { NULL, NULL }, allocator, }; struct di_packages_resolve_dependencies_check s = { di_packages_resolve_dependencies_check_real, di_packages_resolve_dependencies_check_virtual, di_packages_resolve_dependencies_check_non_existant_permissive, di_packages_resolve_dependencies_do_real_list_append, 0, NULL, &data, }; return di_packages_resolve_dependencies_array_special (packages, array, &s, allocator); } struct check { const char *subarchitecture; const char *kernel; }; static bool check_real_anna (di_packages_resolve_dependencies_check *r, di_package *package, di_package_dependency *d) { if (d->ptr->status >= di_package_status_unpacked) { #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): accept %s, already installed", package->package, d->ptr->package); #endif return true; } #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): check recursive %s", package->package, d->ptr->package); #endif return di_packages_resolve_dependencies_recurse (r, d->ptr, package); } static di_package_dependency *check_virtual_anna (di_package *package __attribute__ ((unused)), di_package_dependency *best, di_package_dependency *d, void *data) { struct check *sc = data; if (((di_system_package *)d->ptr)->kernel_version && strcmp (((di_system_package *)d->ptr)->kernel_version, sc->kernel)) { #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): discard %s: wrong kernel", package->package, d->ptr->package); #endif return best; } if (!di_system_package_check_subarchitecture (d->ptr, sc->subarchitecture)) { #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): discard %s: wrong architecture", package->package, d->ptr->package); #endif return best; } #ifdef ENABLE_EXTENSIVE_DEBUG if (!best) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): select %s: first try", package->package, d->ptr->package); else if (best->ptr->priority < d->ptr->priority) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): select %s: better priority", package->package, d->ptr->package); else if (d->ptr->status >= di_package_status_unpacked && best->ptr->status < di_package_status_unpacked) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): select %s: installed", package->package, d->ptr->package); else if (d->ptr->status_want == di_package_status_want_install && best->ptr->status_want != di_package_status_want_install) di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): select %s: marked for installation", package->package, d->ptr->package); #endif if (!best || best->ptr->priority < d->ptr->priority || (d->ptr->status >= di_package_status_unpacked && best->ptr->status < di_package_status_unpacked) || (d->ptr->status_want == di_package_status_want_install && best->ptr->status_want != di_package_status_want_install)) return d; #ifdef ENABLE_EXTENSIVE_DEBUG di_log (DI_LOG_LEVEL_DEBUG, "resolver (%s): discard %s", package->package, d->ptr->package); #endif return best; } void di_system_packages_resolve_dependencies_mark_anna (di_packages *packages, const char *subarchitecture, const char *kernel) { struct check sc = { subarchitecture, kernel, }; struct di_packages_resolve_dependencies_check s = { check_real_anna, check_virtual_anna, di_packages_resolve_dependencies_check_non_existant_permissive, di_packages_resolve_dependencies_do_real_mark, 0, &sc, NULL, }; return di_packages_resolve_dependencies_mark_special (packages, &s); } void di_system_packages_resolve_dependencies_mark_kernel_real_4_2_unstable (di_packages *packages) __attribute__ ((unused)); void di_system_packages_resolve_dependencies_mark_kernel_real_4_2_unstable (di_packages *packages) { struct utsname uts; uname (&uts); di_system_packages_resolve_dependencies_mark_anna (packages, "unknown", uts.release); } __asm__ (".symver di_system_packages_resolve_dependencies_mark_kernel_real_4_2_unstable,di_system_packages_resolve_dependencies_mark_kernel@LIBDI_4.2_UNSTABLE"); libdebian-installer/src/system/subarch-sparc-linux.c0000644000000000000000000000047111515541630020024 0ustar #include #include #include const char *di_system_subarch_analyze(void) { struct utsname buf; if (uname(&buf) == 0) { if (!strcmp(buf.machine, "sparc64")) return "sparc64"; else return "sparc32"; } return "unknown"; } libdebian-installer/src/system/subarch-ppc64el-linux.c0000777000000000000000000000000012271462273024576 2subarch-powerpc-linux.custar libdebian-installer/src/system/subarch-sh4-linux.c0000644000000000000000000000200211515541630017402 0ustar #include #include #include #include #include #include struct map { char *entry; char *ret; }; static struct map map_hardware[] = { { "RTS7751R2D", "rts7751r2d" }, { "SH7785LCR", "sh7785lcr" }, { NULL, NULL } }; const char *di_system_subarch_analyze(void) { FILE *cpuinfo; char line[1024]; char entry[256]; char *pos; int i; cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo == NULL) return "unknown"; while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (strstr(line, "machine") == line) { pos = strchr(line, ':'); if (pos == NULL) continue; while (*++pos && (*pos == '\t' || *pos == ' ')); strncpy(entry, pos, sizeof(entry)); break; } } fclose(cpuinfo); for (i = 0; map_hardware[i].entry; i++) { if (!strncasecmp(map_hardware[i].entry, entry, strlen(map_hardware[i].entry))) { return( map_hardware[i].ret ); } } return "unknown"; } libdebian-installer/src/system/subarch-arm-linux.c0000644000000000000000000001366412277176200017506 0ustar #include #include #include #include #include #include #include struct map { char *entry; char *ret; }; static const char *supported_generic_subarches[] = { "armadaxp", "dove", "exynos5", "generic", "keystone", "omap", "omap4", "mx51", "mx5", "vexpress", NULL }; static struct map map_hardware[] = { { "Acorn-RiscPC" , "rpc" }, { "EBSA285" , "netwinder" }, { "Rebel-NetWinder" , "netwinder" }, { "Chalice-CATS" , "netwinder" }, { "co-EBSA285" , "netwinder" }, { "Compaq-PersonalServer" , "netwinder" }, { "Freescale MX51 Babbage Board", "imx51" }, /* iMX51 reference hardware. */ { "Marvell Armada XP Development Board", "armadaxp" }, /* Marvell ArmadaXP development board SoC */ { "Marvell DB-MV88F6781-BP Development Board", "dove" }, /* Marvell Dove SoC */ { "ADS" , "ads" }, /* Matches only ADS boards. Put any exceptions before. */ { "Applied Data Systems" , "ads" }, /* More ADS boards. */ { "HP t5325 Thin Client", "kirkwood" }, { "Marvell DB-88F6281-BP Development Board", "kirkwood" }, { "Marvell RD-88F6192-NAS Development Board", "kirkwood" }, { "Marvell RD-88F6281 Reference Board", "kirkwood" }, { "Marvell GuruPlug Reference Board", "kirkwood" }, { "Marvell OpenRD Base Board", "kirkwood" }, { "Marvell OpenRD Client Board", "kirkwood" }, { "Marvell OpenRD Ultimate Board", "kirkwood" }, { "Marvell SheevaPlug Reference Board", "kirkwood" }, { "Marvell eSATA SheevaPlug Reference Board", "kirkwood" }, { "Globalscale Technologies Dreamplug", "kirkwood" }, { "QNAP TS-119/TS-219", "kirkwood" }, { "QNAP TS-41x", "kirkwood" }, { "Seagate FreeAgent DockStar", "kirkwood" }, { "LaCie Network Space v2", "kirkwood" }, { "LaCie Internet Space v2", "kirkwood" }, { "LaCie Network Space Max v2", "kirkwood" }, { "LaCie d2 Network v2", "kirkwood" }, { "LaCie 2Big Network v2", "kirkwood" }, { "LaCie 5Big Network v2", "kirkwood" }, { "Buffalo/Revogear Kurobox Pro", "orion5x" }, { "D-Link DNS-323", "orion5x" }, { "QNAP TS-109/TS-209", "orion5x" }, { "QNAP TS-409", "orion5x" }, { "HP Media Vault mv2120", "orion5x" }, { "Buffalo Linkstation LiveV3 (LS-CHL)", "orion5x" }, { "Buffalo Linkstation Mini", "orion5x" }, { "Buffalo Linkstation Pro/Live", "orion5x" }, { "Marvell Orion-NAS Reference Design", "orion5x" }, { "Marvell Orion-2 Development Board", "orion5x" }, { "Intel EP80219", "iop32x" }, { "Intel IQ31244", "iop32x" }, { "Intel IQ80321", "iop32x" }, { "Thecus N2100", "iop32x" }, { "Thecus N4100", "iop32x" }, { "GLAN Tank", "iop32x" }, { "Lanner EM7210", "iop32x" }, { "Intel IQ80331", "iop33x" }, { "Intel IQ80332", "iop33x" }, { "ADI Engineering Coyote", "ixp4xx" }, { "Freecom Storage Gateway", "ixp4xx" }, { "Intel IXDPG425", "ixp4xx" }, { "Intel IXDP425 Development Platform", "ixp4xx" }, { "Intel IXDP465 Development Platform", "ixp4xx" }, { "Intel IXCDP1100 Development Platform", "ixp4xx" }, { "Gateworks Avila Network Platform", "ixp4xx" }, { "Gemtek GTWX5715 (Linksys WRV54G)", "ixp4xx" }, { "Iomega NAS 100d", "ixp4xx" }, { "Linksys NSLU2", "ixp4xx" }, { "ARM-Versatile AB", "versatile" }, { "ARM-Versatile PB", "versatile" }, { "Genesi Efika MX (Smartbook)", "mx5" }, { "Genesi Efika MX (Smarttop)", "mx5" }, { "Nokia RX-51 Board", "omap" }, { "OMAP3 Beagle Board", "omap" }, { "OMAP4 Panda Board", "omap4" }, { "OMAP4430 Panda Board", "omap4" }, /* first OMAP4 hw platform, more to come */ { "OMAP4430 4430SDP board", "omap4" }, /* OMAP4 blaze platform */ { "Calxeda Highbank", "generic" }, { "Calxeda ECX-2000", "generic" }, { "Wandboard i.MX6 Quad Board", "generic" }, { "ARM-Versatile Express", "vexpress" }, { "SAMSUNG EXYNOS5 (Flattened Device Tree)", "exynos5" }, { "SAMSUNG SSDK5440 board based on EXYNOS5440", "exynos5" }, { "SAMSUNG SD5v1 board based on EXYNOS5440", "exynos5" }, { "KeyStone2", "keystone" }, { NULL, NULL } }; static int read_dt_model(char *entry, int entry_len) { FILE *model; int ret; model = fopen("/proc/device-tree/model", "r"); if (model == NULL) return 1; ret = fgets(entry, entry_len, model) == NULL; fclose(model); return ret; } static int read_cpuinfo(char *entry, int entry_len) { FILE *cpuinfo; char line[1024]; char *pos; int ret = 1; cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo == NULL) return 1; while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (strstr(line, "Hardware") == line) { pos = strchr(line, ':'); if (pos == NULL) continue; while (*++pos && (*pos == '\t' || *pos == ' ')); strncpy(entry, pos, entry_len); ret = 0; break; } } fclose(cpuinfo); return ret; } const char *di_system_subarch_analyze(void) { char entry[256]; int i; int ret; entry[0] = '\0'; ret = read_dt_model(entry, sizeof(entry)); if (ret) ret = read_cpuinfo(entry, sizeof(entry)); if (ret) return "unknown"; for (i = 0; map_hardware[i].entry; i++) { if (!strncasecmp(map_hardware[i].entry, entry, strlen(map_hardware[i].entry))) { return( map_hardware[i].ret ); } } return "unknown"; } const char *di_system_subarch_analyze_guess(void) { struct utsname sysinfo; size_t uname_release_len, i; /* Attempt to determine subarch based on kernel release version */ uname(&sysinfo); uname_release_len = strlen(sysinfo.release); for (i = 0; supported_generic_subarches[i] != NULL; i++) { size_t subarch_len = strlen (supported_generic_subarches[i]); if (!strncmp(sysinfo.release+uname_release_len-subarch_len, supported_generic_subarches[i], subarch_len)) { return supported_generic_subarches[i]; } } /* If we get here, try falling back on the normal detection method */ return di_system_subarch_analyze(); } libdebian-installer/src/system/subarch-generic.c0000644000000000000000000000016211515541630017170 0ustar #include const char *di_system_subarch_analyze(void) { return "generic"; } libdebian-installer/src/system/subarch-x86-kfreebsd.c0000777000000000000000000000000011515541630023335 2subarch-x86-linux.custar libdebian-installer/src/system/subarch-powerpc-linux.c0000644000000000000000000000377312131504167020402 0ustar #include #include #include #include #include #include struct map { char *entry; char *ret; }; static struct map map_generation[] = { { "OldWorld", "powermac_oldworld" }, { "NewWorld", "powermac_newworld" }, { "NuBus", "powermac_nubus" }, { NULL, NULL } }; static struct map map_machine[] = { { "PReP", "prep" }, { "CHRP Pegasos", "chrp_pegasos" }, { "EFIKA", "chrp_pegasos" }, { "CHRP IBM", "chrp_rs6k" }, { "CHRP", "chrp" }, { "Amiga", "amiga" }, { "64-bit iSeries Logical Partition", "iseries" }, { NULL, NULL } }; static struct map map_platform[] = { { "PS3", "ps3" }, { "Cell", "cell" }, { "PA Semi", "pasemi" }, { "Maple", "chrp_ibm" }, { "pSeries", "chrp_ibm" }, { "P4080 DS", "fsl" }, { "QEMU e500", "fsl" }, { NULL, NULL } }; static char *check_map(struct map map[], const char *entry) { for (; map->entry; map++) if (!strncasecmp(map->entry, entry, strlen(map->entry))) return map->ret; return NULL; } const char *di_system_subarch_analyze(void) { FILE *cpuinfo; char line[1024]; char cpuinfo_platform[256], cpuinfo_machine[256], cpuinfo_generation[256]; char *ret, *pos; cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo == NULL) return "unknown"; while (fgets(line, sizeof(line), cpuinfo) != NULL) { pos = strchr(line, ':'); if (pos == NULL) continue; while (*++pos && (*pos == '\t' || *pos == ' ')); if (strstr(line, "platform") == line) strncpy(cpuinfo_platform, pos, sizeof(cpuinfo_platform)); if (strstr(line, "machine") == line) strncpy(cpuinfo_machine, pos, sizeof(cpuinfo_machine)); if (strstr(line, "pmac-generation") == line) strncpy(cpuinfo_generation, pos, sizeof(cpuinfo_generation)); } fclose(cpuinfo); ret = check_map(map_platform, cpuinfo_platform); if (ret) return ret; ret = check_map(map_machine, cpuinfo_machine); if (ret) return ret; ret = check_map(map_generation, cpuinfo_generation); if (ret) return ret; return "unknown"; } libdebian-installer/src/system/subarch-mips-linux.c0000644000000000000000000000636111515541630017670 0ustar #include #include #include #include struct cpu { char *cpu; char *ret; }; struct systype { char *sys; struct cpu *cpu; }; static struct cpu system_sgi_ind_cpu[] = { { "R4", "r4k-ip22" }, /* match various R4000 variants */ { "R5000", "r5k-ip22" }, { "R8000", "r8k-ip26" }, { "R10000", "r10k-ip28" }, { NULL, "unknown" } }; static struct cpu system_sgi_origin_cpu[] = { { "R10000", "r10k-ip27" }, { "R12000", "r12k-ip27" }, { NULL, "unknown" } }; static struct cpu system_sgi_o2_cpu[] = { { "R5", "r5k-ip32" }, /* match R5000 and R5500 */ { "Nevada", "r5k-ip32" }, { "RM7000", "r5k-ip32" }, { "R10000", "r10k-ip32" }, { "R12000", "r12k-ip32" }, { NULL, "unknown" } }; static struct cpu system_sibyte_sb1_cpu[] = { { "SiByte SB1A", "sb1a-bcm91480b" }, { "SiByte SB1 ", "sb1-bcm91250a" }, { NULL, "unknown" } }; static struct cpu system_qemu_cpu[] = { { "MIPS 4Kc", "qemu-mips32" }, { "MIPS 24Kc", "qemu-mips32" }, { NULL, "unknown" } }; static struct cpu system_malta_cpu[] = { { "MIPS 4K", "4kc-malta" }, { "MIPS 24K", "4kc-malta" }, { "MIPS 34K", "4kc-malta" }, { "MIPS 5K", "5kc-malta" }, { "MIPS 20K", "5kc-malta" }, { NULL, "unknown" } }; /* add new system types here */ static struct cpu system_unknown_cpu[] = { { NULL, "unknown" } }; static struct systype system_type[] = { {"SGI Ind", system_sgi_ind_cpu }, /* match "SGI Indy" and "SGI Indigo2" */ {"SGI Origin", system_sgi_origin_cpu }, {"SGI IP32", system_sgi_o2_cpu }, {"SGI O2", system_sgi_o2_cpu }, {"SiByte BCM9", system_sibyte_sb1_cpu }, /* match Broadcom SB1 boards */ {"Qemu", system_qemu_cpu }, {"MIPS Malta", system_malta_cpu }, { NULL, system_unknown_cpu } }; #define INVALID_SYS_IDX (sizeof(system_type) / sizeof(struct systype) - 1) #define INVALID_CPU_IDX (-1) #define BUFFER_LENGTH (1024) static int check_system(const char *entry) { int ret; for (ret = 0; system_type[ret].sys; ret++) { if (!strncmp(system_type[ret].sys, entry, strlen(system_type[ret].sys))) break; } return ret; } static int check_cpu(const char *entry, int sys_idx) { int ret; if (sys_idx == INVALID_SYS_IDX) { /* * This means an unsupported system type, because the * system type is always the first entry in /proc/cpuinfo. */ return INVALID_CPU_IDX; } for (ret = 0; system_type[sys_idx].cpu[ret].cpu; ret++) { if (!strncmp(system_type[sys_idx].cpu[ret].cpu, entry, strlen(system_type[sys_idx].cpu[ret].cpu))) break; } return ret; } const char *di_system_subarch_analyze(void) { FILE *file; int sys_idx = INVALID_SYS_IDX; int cpu_idx = INVALID_CPU_IDX; char buf[BUFFER_LENGTH]; char *pos; size_t len; if (!(file = fopen("/proc/cpuinfo", "r"))) return system_type[sys_idx].cpu[0].ret; while (fgets(buf, sizeof(buf), file)) { if (!(pos = strchr(buf, ':'))) continue; if (!(len = strspn(pos, ": \t"))) continue; if (!strncmp(buf, "system type", strlen("system type"))) sys_idx = check_system(pos + len); else if (!strncmp(buf, "cpu model", strlen("cpu model"))) cpu_idx = check_cpu(pos + len, sys_idx); } fclose(file); if (cpu_idx == INVALID_CPU_IDX) { sys_idx = INVALID_SYS_IDX; cpu_idx = 0; } return system_type[sys_idx].cpu[cpu_idx].ret; } libdebian-installer/src/system/Makefile.am0000644000000000000000000000116712271462337016033 0ustar AM_CPPFLAGS = \ -I$(top_srcdir)/include noinst_LTLIBRARIES = libsystem.la libsystem_la_SOURCES = \ devfs.c \ dpkg.c \ packages.c \ prebaseconfig.c \ utils.c EXTRA_libsystem_la_SOURCES = \ subarch-generic.c \ subarch-arm-linux.c \ subarch-armeb-linux.c \ subarch-armel-linux.c \ subarch-armhf-linux.c \ subarch-m68k-linux.c \ subarch-mips-linux.c \ subarch-mipsel-linux.c \ subarch-powerpc-linux.c \ subarch-ppc64el-linux.c \ subarch-sh4-linux.c \ subarch-sparc-linux.c \ subarch-x86-linux.c \ subarch-x86-kfreebsd.c libsystem_la_LIBADD = \ @SUBARCH_SYSTEM@ libsystem_la_DEPENDENCIES = \ @SUBARCH_SYSTEM@ libdebian-installer/src/system/prebaseconfig.c0000644000000000000000000000322111557456270016750 0ustar /* * prebaseconfig.c * * Copyright (C) 2000-2002 David Kimdon * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include int di_system_prebaseconfig_append (const char *udeb, const char *format, ...) { char path[128]; FILE *fp; va_list ap; if (snprintf (path, sizeof (path), DI_SYSTEM_PREBASECONFIG_DIR "/%s", udeb) == -1) return -1; if ((fp = fopen (path, "a")) == NULL) return -1; fputs ("\n# start entry\n", fp); va_start(ap, format); vfprintf(fp, format, ap); va_end(ap); fputs ("\n# end entry\n", fp); fclose (fp); return 0; } int di_prebaseconfig_append (const char *udeb, const char *fmt, ...) __attribute__ ((alias("di_system_prebaseconfig_append"))); __asm__ (".symver di_system_prebaseconfig_append,di_system_prebaseconfig_append@LIBDI_4.0"); __asm__ (".symver di_prebaseconfig_append,di_prebaseconfig_append@LIBDI_4.0"); libdebian-installer/src/system/utils.c0000644000000000000000000000253111557456270015304 0ustar /* * utils.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include void di_system_init (const char *_progname) { di_init (_progname); di_log_set_handler (DI_LOG_LEVEL_MASK, di_log_handler_syslog, NULL); } #ifndef DI_SYSTEM_SUBARCH_CAN_GUESS /* * HACK: If there's a better way to do this, we should probably use that * instead of this stub function for non armel archs */ const char *di_system_subarch_analyze_guess (void) { return di_system_subarch_analyze(); } #endif libdebian-installer/src/system/dpkg.c0000644000000000000000000001303311557456270015070 0ustar /* * dpkg.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include /* PATH_MAX is missing on GNU/Hurd */ #ifndef PATH_MAX #define PATH_MAX 4096 #endif #if 0 int di_system_dpkg_package_configure (di_packages *status, const char *_package, bool force) { di_package *package; /* i don't think that is correct, but who cares? */ const char *argv_postinst[] = { "configure", NULL }; int ret; package = di_packages_get_package (status, _package, 0); if (!package) return -1; switch (package->status) { case di_package_status_unpacked: case di_package_status_half_configured: break; case di_package_status_installed: if (force) break; default: return 1; } package->status = di_package_status_half_configured; ret = di_system_dpkg_package_control_file_exec (package, "postinst", sizeof (argv_postinst), argv_postinst); if (ret) return -3; package->status = di_package_status_installed; return 0; } #endif int di_system_dpkg_package_control_file_exec (di_package *package, const char *name, int argc, const char *const argv[]) { char buf[PATH_MAX]; const char *real_argv[argc + 2]; int i; struct stat statbuf; snprintf (buf, sizeof (buf), "%s%s.%s", DI_SYSTEM_DPKG_INFODIR, package->package, name); if (stat (buf, &statbuf)) return -1; if (!S_ISREG (statbuf.st_mode)) return -1; real_argv[0] = buf; for (i = 0; i < argc; i++) real_argv[i+1] = argv[i]; real_argv[argc + 1] = NULL; i = di_exec (buf, real_argv); return di_exec_mangle_status (i); } #if 0 int internal_di_system_dpkg_package_unpack_control (di_packages *status, di_package **package, const char *_package, const char *filename, di_packages_allocator *allocator) { const char *argv_rm[] = { "/bin/rm", "-rf", NULL, NULL }; char buf[PATH_MAX]; char buf_infodir[PATH_MAX] = { '\0' }; char buf_tmpdir[PATH_MAX] = DI_SYSTEM_DPKG_TMPCONTROLDIR; char *infodir_rest, *tmpdir_rest; di_ksize_t infodir_len, infodir_rest_len, tmpdir_len, tmpdir_rest_len; DIR *tmpdir; struct dirent *tmpdirent; struct stat statbuf; snprintf (buf_infodir, sizeof (buf_infodir) - 10, "%s%s.", DI_SYSTEM_DPKG_INFODIR, _package); infodir_len = strnlen (buf_infodir, sizeof (buf_infodir)); infodir_rest = buf_infodir + infodir_len; infodir_rest_len = sizeof (buf_infodir) - infodir_len; tmpdir_len = strnlen (buf_tmpdir, sizeof (buf_tmpdir)); tmpdir_rest = buf_tmpdir + tmpdir_len; tmpdir_rest_len = sizeof (buf_tmpdir) - tmpdir_len; if (!stat (buf_tmpdir, &statbuf)) { argv_rm[2] = buf_tmpdir; if (di_exec (argv_rm[0], argv_rm)) return -1; } if (mkdir (buf_tmpdir, 0700)) return -1; if (chdir (buf_tmpdir)) return -1; snprintf (buf, sizeof (buf), "ar -p %s control.tar.gz|tar -xzf -", filename); if (di_exec_shell (buf)) return -2; tmpdir = opendir (buf_tmpdir); if (!tmpdir) return -2; while ((tmpdirent = readdir (tmpdir))) { if (strchr (tmpdirent->d_name, '.')) continue; if (strlen (tmpdirent->d_name) > (tmpdir_rest_len < infodir_rest_len ? tmpdir_rest_len : infodir_rest_len)) continue; strcpy (infodir_rest, tmpdirent->d_name); strcpy (tmpdir_rest, tmpdirent->d_name); if (!strcmp (tmpdirent->d_name, "control")) { if (allocator) { if (*package) di_package_destroy (*package); *package = di_system_package_read_file (buf_tmpdir, status, allocator); } continue; } if (rename (buf_tmpdir, buf_infodir)) return -2; } closedir (tmpdir); if (chdir ("/")) return -1; tmpdir_rest[0] = '\0'; argv_rm[2] = buf_tmpdir; if (di_exec (argv_rm[0], argv_rm)) return -3; return 0; } int internal_di_system_dpkg_package_unpack_data (di_package *package, const char *filename) { char buf[PATH_MAX]; if (chdir ("/")) return -1; snprintf (buf, sizeof (buf), "ar -p %s data.tar.gz|tar -xzf -", filename); if (di_exec_shell (buf)) return -2; return 0; } int di_system_dpkg_package_unpack (di_packages *status, const char *_package, const char *filename, di_packages_allocator *allocator) { di_package *package; int ret; package = di_packages_get_package (status, _package, 0); ret = internal_di_system_dpkg_package_unpack_control (status, &package, _package, filename, allocator); if (ret) return ret; ret = internal_di_system_dpkg_package_unpack_data (package, filename); di_log(DI_LOG_LEVEL_INFO, "parse file: %s, get package: %s", filename, package->package); di_packages_append_package (status, package, allocator); package->status = di_package_status_unpacked; return ret; } #endif libdebian-installer/src/system/subarch-armhf-linux.c0000777000000000000000000000000011557456270023524 2subarch-arm-linux.custar libdebian-installer/src/system/subarch-x86-linux.c0000644000000000000000000001503112054431077017341 0ustar /* * subarch-x86-linux.c * * Copyright (C) 2007 Colin Watson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Some code here borrowed from dmidecode, whose copyright and license * follow: * * (C) 2000-2002 Alan Cox * (C) 2002-2007 Jean Delvare * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * For the avoidance of doubt the "preferred form" of this code is one which * is in an open unpatent encumbered format. Where cryptographic key signing * forms part of the process of creating an executable the information * including keys needed to generate an equivalently functional executable * are deemed to be part of the source code. * * I (Colin Watson) copied this in reduced form rather than using dmidecode * directly because the d-i initrd is tight on space and this is much * smaller (1.8KB versus 46KB, at the time of writing). */ #include #include #include #include #include #include #include #include #include #define WORD(x) (*(const uint16_t *)(x)) #define DWORD(x) (*(const uint32_t *)(x)) struct dmi_header { uint8_t type; uint8_t length; uint16_t handle; }; static int checksum(const uint8_t *buf, size_t len) { uint8_t sum = 0; size_t a; for (a = 0; a < len; a++) sum += buf[a]; return (sum == 0); } /* Copy a physical memory chunk into a memory buffer. * This function allocates memory. */ static void *mem_chunk(size_t base, size_t len) { void *p; int fd; size_t mmoffset; void *mmp; fd = open("/dev/mem", O_RDONLY); if (fd == -1) return NULL; p = malloc(len); if (p == NULL) { close(fd); return NULL; } #ifdef _SC_PAGESIZE mmoffset = base % sysconf(_SC_PAGESIZE); #else mmoffset = base % getpagesize(); #endif /* Please note that we don't use mmap() for performance reasons here, * but to workaround problems many people encountered when trying * to read from /dev/mem using regular read() calls. */ mmp = mmap(0, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset); if (mmp == MAP_FAILED) { free(p); close(fd); return NULL; } memcpy(p, mmp + mmoffset, len); munmap(mmp, mmoffset + len); close(fd); return p; } static const char *dmi_string(struct dmi_header *dm, uint8_t s) { char *bp = (char *)dm; size_t i, len; if (s == 0) return "Not Specified"; bp += dm->length; while (s > 1 && *bp) { bp += strlen(bp); bp++; s--; } if (!*bp) return ""; /* ASCII filtering */ len = strlen(bp); for (i = 0; i < len; i++) if (bp[i] < 32 || bp[i] == 127) bp[i] = '.'; return bp; } static char *dmi_table(uint32_t base, uint16_t len, uint16_t num) { uint8_t *buf, *data; int i = 0; char *ret = NULL; buf = mem_chunk(base, len); if (buf == NULL) return NULL; data = buf; while (i < num && data + sizeof(struct dmi_header) <= buf + len) { uint8_t *next; struct dmi_header *h = (struct dmi_header *)data; /* Stop decoding at end of table marker */ if (h->type == 127) break; /* Look for the next handle */ next = data + h->length; while (next - buf + 1 < len && (next[0] != 0 || next[1] != 0)) next++; next += 2; /* system-manufacturer */ if (h->type == 1 && h->length > 0x04) { ret = strdup(dmi_string(h, data[0x04])); break; } data = next; i++; } free(buf); return ret; } static char *smbios_decode(uint8_t *buf) { if (checksum(buf, buf[0x05]) && memcmp(buf + 0x10, "_DMI_", 5) == 0 && checksum(buf + 0x10, 0x0F)) { return dmi_table(DWORD(buf + 0x18), WORD(buf + 0x16), WORD(buf + 0x1C)); } return NULL; } static char *legacy_decode(uint8_t *buf) { if (checksum(buf, 0x0F)) { return dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06), WORD(buf + 0x0C)); } return NULL; } static char *dmi_system_manufacturer(void) { uint8_t *buf; size_t fp; char *ret = NULL; buf = mem_chunk(0xF0000, 0x10000); if (buf == NULL) return NULL; for (fp = 0; fp <= 0xFFF0; fp += 16) { if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) { ret = smbios_decode(buf + fp); if (ret) break; fp += 16; } else if (memcmp(buf + fp, "_DMI_", 5) == 0) { ret = legacy_decode(buf + fp); if (ret) break; } } free(buf); return ret; } /* Are we on an EFI system? Check to see if /sys/firmware/efi * exists */ static int is_efi(void) { int ret = access("/sys/firmware/efi", R_OK); if (ret == 0) return 1; else return 0; } struct map { const char *entry; const char *ret; }; static struct map map_manufacturer[] = { { "Apple Computer, Inc.", "mac" }, { "Apple Inc.", "mac" }, { NULL, NULL } }; const char *di_system_subarch_analyze(void) { char *manufacturer = dmi_system_manufacturer(); const char *ret = "generic"; int i; /* Look for generic EFI first; this will be over-ridden by the mac * detection next if we're on a mac. */ if (is_efi()) ret = "efi"; if (manufacturer) { for (i = 0; map_manufacturer[i].entry; i++) { if (!strncasecmp(map_manufacturer[i].entry, manufacturer, strlen(map_manufacturer[i].entry))) { ret = map_manufacturer[i].ret; break; } } } free(manufacturer); return ret; } libdebian-installer/src/system/subarch-armel-linux.c0000777000000000000000000000000011515541630023514 2subarch-arm-linux.custar libdebian-installer/src/system/devfs.c0000644000000000000000000001647511647121666015265 0ustar /* * devfs.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #if defined(__linux__) /* Returns the devfs path name normalized into a "normal" (hdaX, sdaX) * name. This is kinda hairy, but I don't see any other way of operating * with non-devfs systems when we use devfs on the boot medium. The * numbers are taken from devices.txt in the Documentation subdirectory * of the kernel sources. */ ssize_t di_system_devfs_map_from (const char *path, char *buf, size_t n) { static struct entry { unsigned char major; unsigned char minor; char *name; enum { ENTRY_TYPE_ONE, ENTRY_TYPE_NUMBER, ENTRY_TYPE_DISC, ENTRY_TYPE_DISC_ARRAY, ENTRY_TYPE_DISC_ARRAY_CONTROLLER } type; unsigned char entry_first; unsigned char entry_disc_minor_shift; } entries[] = { /* major minor name type entry_first entry_disc_minor_shift */ { 2, 0, "fd", ENTRY_TYPE_NUMBER, 0, 0 }, { 3, 0, "hd", ENTRY_TYPE_DISC, 0, 6 }, { 4, 64, "ttyS", ENTRY_TYPE_NUMBER, 0, 0 }, { 4, 0, "tty", ENTRY_TYPE_NUMBER, 0, 0 }, { 7, 0, "loop", ENTRY_TYPE_NUMBER, 0, 0 }, { 8, 0, "sd", ENTRY_TYPE_DISC, 0, 4 }, { 9, 0, "md", ENTRY_TYPE_NUMBER, 0, 0 }, { 11, 0, "sr", ENTRY_TYPE_NUMBER, 0, 0 }, { 22, 0, "hd", ENTRY_TYPE_DISC, 2, 6 }, { 33, 0, "hd", ENTRY_TYPE_DISC, 4, 6 }, { 34, 0, "hd", ENTRY_TYPE_DISC, 6, 6 }, { 48, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 0, 3 }, { 49, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 1, 3 }, { 50, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 2, 3 }, { 51, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 3, 3 }, { 52, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 4, 3 }, { 53, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 5, 3 }, { 54, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 6, 3 }, { 55, 0, "rd", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 7, 3 }, { 56, 0, "hd", ENTRY_TYPE_DISC, 8, 6 }, { 57, 0, "hd", ENTRY_TYPE_DISC, 10, 6 }, { 65, 0, "sd", ENTRY_TYPE_DISC, 16, 4 }, { 66, 0, "sd", ENTRY_TYPE_DISC, 32, 4 }, { 67, 0, "sd", ENTRY_TYPE_DISC, 48, 4 }, { 68, 0, "sd", ENTRY_TYPE_DISC, 64, 4 }, { 69, 0, "sd", ENTRY_TYPE_DISC, 80, 4 }, { 70, 0, "sd", ENTRY_TYPE_DISC, 96, 4 }, { 71, 0, "sd", ENTRY_TYPE_DISC, 112, 4 }, { 72, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 0, 4 }, { 73, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 1, 4 }, { 74, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 2, 4 }, { 75, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 3, 4 }, { 76, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 4, 4 }, { 77, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 5, 4 }, { 78, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 6, 4 }, { 79, 0, "ida", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 7, 4 }, { 80, 0, "i2o/hd", ENTRY_TYPE_DISC, 0, 4 }, { 88, 0, "hd", ENTRY_TYPE_DISC, 12, 6 }, { 89, 0, "hd", ENTRY_TYPE_DISC, 14, 6 }, { 90, 0, "hd", ENTRY_TYPE_DISC, 16, 6 }, { 91, 0, "hd", ENTRY_TYPE_DISC, 18, 6 }, { 94, 0, "dasd", ENTRY_TYPE_DISC, 0, 2 }, { 98, 0, "ubd", ENTRY_TYPE_DISC, 0, 4 }, { 104, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 0, 4 }, { 105, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 1, 4 }, { 106, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 2, 4 }, { 107, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 3, 4 }, { 108, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 4, 4 }, { 109, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 5, 4 }, { 110, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 6, 4 }, { 111, 0, "cciss", ENTRY_TYPE_DISC_ARRAY_CONTROLLER, 7, 4 }, { 114, 0, "ataraid", ENTRY_TYPE_DISC_ARRAY, 0, 4 }, { 0, 0, NULL, ENTRY_TYPE_ONE, 0, 0 }, }; struct stat s; struct entry *e; ssize_t ret = 0; unsigned int disc; unsigned int part; if (!strcmp ("none", path)) return snprintf (buf, n, "%s", path); if (stat (path,&s) == -1) return 0; e = entries; while (e->name != NULL) { if (major (s.st_rdev) == e->major && ((e->type == ENTRY_TYPE_ONE && minor (s.st_rdev) == e->minor) || (e->type != ENTRY_TYPE_ONE && minor (s.st_rdev) >= e->minor))) { break; } e++; } if (!e->name) { #ifdef TEST fprintf(stderr, "(unknown device)\n"); #endif /* Pass unknown devices on without changes. */ return snprintf (buf, n, "%s", path); } strcat (buf, "/dev/"); switch (e->type) { case ENTRY_TYPE_ONE: ret = di_snprintfcat (buf, n, "%s", e->name); break; case ENTRY_TYPE_NUMBER: disc = minor (s.st_rdev) - e->minor + e->entry_first; ret = di_snprintfcat (buf, n, "%s%d", e->name, disc); break; case ENTRY_TYPE_DISC: case ENTRY_TYPE_DISC_ARRAY: case ENTRY_TYPE_DISC_ARRAY_CONTROLLER: disc = (minor (s.st_rdev) >> e->entry_disc_minor_shift); part = (minor (s.st_rdev) & ((1 << e->entry_disc_minor_shift) - 1)); switch (e->type) { case ENTRY_TYPE_DISC: disc += e->entry_first; if (disc + 'a' > 'z') { disc -= 26; ret = di_snprintfcat (buf, n, "%s%c%c", e->name, 'a' + disc / 26, 'a' + disc % 26); } else ret = di_snprintfcat (buf, n, "%s%c", e->name, 'a' + disc); if (part) ret = di_snprintfcat (buf, n, "%d", part); break; case ENTRY_TYPE_DISC_ARRAY: case ENTRY_TYPE_DISC_ARRAY_CONTROLLER: ret = di_snprintfcat (buf, n, "%s/", e->name); if (e->type == ENTRY_TYPE_DISC_ARRAY_CONTROLLER) ret = di_snprintfcat (buf, n, "c%d", e->entry_first); ret = di_snprintfcat (buf, n, "d%d", disc); if (part) ret = di_snprintfcat (buf, n, "p%d", part); break; default: break; } break; }; return ret; } #else /* defined(__linux__) */ ssize_t di_system_devfs_map_from (const char *path, char *buf, size_t n) { /* Do nothing on other systems */ return snprintf (buf, n, "%s", path); } #endif /* defined(__linux__) */ #ifndef TEST ssize_t di_mapdevfs (const char *path, char *buf, size_t n) __attribute__ ((alias("di_system_devfs_map_from"))); #else /* Build standalone binary with -DTEST */ main (int argc, char **argv) { static char ret[256]; if (argc != 2) { fprintf(stderr, "wrong number of args\n"); exit(1); } di_system_devfs_map_from(argv[1], ret, sizeof(ret)); printf("%s => %s", argv[1], ret); if (strcmp(argv[1], ret) == 0) { printf("\t\t(SAME)"); } printf("\n"); exit(0); } #endif libdebian-installer/src/system/subarch-armeb-linux.c0000644000000000000000000000174011515541630020002 0ustar #include #include #include #include #include #include struct map { char *entry; char *ret; }; static struct map map_hardware[] = { { "Linksys NSLU2", "ixp4xx" }, { NULL, NULL } }; const char *di_system_subarch_analyze(void) { FILE *cpuinfo; char line[1024]; char entry[256]; char *pos; int i; cpuinfo = fopen("/proc/cpuinfo", "r"); if (cpuinfo == NULL) return "unknown"; while (fgets(line, sizeof(line), cpuinfo) != NULL) { if (strstr(line, "Hardware") == line) { pos = strchr(line, ':'); if (pos == NULL) continue; while (*++pos && (*pos == '\t' || *pos == ' ')); strncpy(entry, pos, sizeof(entry)); break; } } fclose(cpuinfo); for (i = 0; map_hardware[i].entry; i++) { if (!strncasecmp(map_hardware[i].entry, entry, strlen(map_hardware[i].entry))) { return( map_hardware[i].ret ); } } return "unknown"; } libdebian-installer/src/parser_rfc822.c0000644000000000000000000001623512147775065015212 0ustar /* * parser_rfc822.c * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define READSIZE 16384 int di_parser_rfc822_read (char *begin, size_t size, di_parser_info *info, di_parser_read_entry_new entry_new, di_parser_read_entry_finish entry_finish, void *user_data) { char *cur, *end; char *field_begin, *field_end; #if MODIFIER char *field_modifier_begin, *field_modifier_end; #endif char *value_begin, *value_end; #ifndef HAVE_MEMRCHR char *temp; #endif int nr = 0; size_t readsize; size_t field_size; #if MODIFIER size_t field_modifier_size; #endif size_t value_size; const di_parser_fieldinfo *fip = NULL; di_rstring field_string; di_rstring field_modifier_string; di_rstring value_string; void *act = NULL; cur = begin; end = begin + size; while (cur < end) { if (*cur == '\n') { cur++; continue; } nr++; if (entry_new) act = entry_new (user_data); else act = NULL; while (1) { field_begin = cur; readsize = end - field_begin < READSIZE ? end - field_begin : READSIZE; if (!readsize) break; field_end = memchr (cur, ':', readsize); #if MODIFIER field_modifier_end = field_end; #endif if (!field_end) { di_warning ("parser_rfc822: Iek! Don't find end of field!"); return -1; } field_size = field_end - field_begin; #if MODIFIER #ifdef HAVE_MEMRCHR if ((field_modifier_begin = memrchr (field_begin, '-', field_end - field_begin))) field_modifier_begin++; if (field_modifier_begin) #else field_modifier_begin = field_begin; while ((temp = memchr (field_modifier_begin, '-', field_end - field_modifier_begin))) field_modifier_begin = temp + 1; if (field_modifier_begin != field_begin) #endif { field_modifier_size = field_modifier_end - field_modifier_begin; } else { field_modifier_begin = 0; field_modifier_size = 0; } #endif value_begin = field_end + 1; while (value_begin < end && (*value_begin == ' ' || *value_begin == '\t')) value_begin++; readsize = end - field_begin < READSIZE ? end - field_begin : READSIZE; value_end = memchr (field_begin, '\n', readsize); if (!value_end) { di_warning ("parser_rfc822: Iek! Don't find end of value!"); return -1; } if (value_end < field_end) { di_warning ("parser_rfc822: Iek! Don't find end of field, it seems to be after the end of the line!"); return -1; } /* while (isblank (value_end[1])) FIXME: C99 */ while (value_end[1] == ' ' || value_end[1] == '\t') { readsize = end - value_end + 1 < READSIZE ? end - value_end + 1 : READSIZE; if ((value_end = memchr (value_end + 1, '\n', readsize)) == NULL) { di_warning ("Iek! Don't find end of large value\n"); return -1; } } value_size = value_end - value_begin; field_string.string = field_begin; field_string.size = field_size; value_string.string = value_begin; value_string.size = value_size; fip = di_hash_table_lookup (info->table, &field_string); if (fip) { fip->read (&act, fip, NULL, &value_string, user_data); goto next; } #if MODIFIER if (info->wildcard) goto wildcard; else if (!info->modifier) goto next; field_string.size = field_size - field_modifier_size - 1; fip = di_hash_table_lookup (info->table, &field_string); if (fip) { field_modifier_string.string = field_modifier_begin; field_modifier_string.size = field_modifier_size; fip->read (&act, fip, &field_modifier_string, &value_string, user_data); goto next; } #endif if (!info->wildcard) goto next; #if MODIFIER wildcard: #endif field_string.size = 0; fip = di_hash_table_lookup (info->table, &field_string); if (fip) { field_modifier_string.string = field_begin; field_modifier_string.size = field_size; fip->read (&act, fip, &field_modifier_string, &value_string, user_data); } next: cur = value_end + 1; if (cur >= end || *cur == '\n') break; } if (entry_finish && entry_finish (act, user_data)) return -1; } return nr; } int di_parser_rfc822_read_file (const char *file, di_parser_info *info, di_parser_read_entry_new entry_new, di_parser_read_entry_finish entry_finish, void *user_data) { struct stat statbuf; char *begin; int fd, ret = -1; if ((fd = open (file, O_RDONLY)) < 0) return ret; if (fstat (fd, &statbuf)) goto cleanup; if (!statbuf.st_size) { ret = 0; goto cleanup; } begin = mmap (NULL, statbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0); if (begin == MAP_FAILED) goto cleanup; madvise (begin, statbuf.st_size, MADV_SEQUENTIAL); ret = di_parser_rfc822_read (begin, statbuf.st_size, info, entry_new, entry_finish, user_data); munmap (begin, statbuf.st_size); cleanup: close (fd); return ret; } static void callback (const di_rstring *field, const di_rstring *value, void *data) { FILE *f = data; fwrite (field->string, field->size, 1, f); fputs (": ", f); fwrite (value->string, value->size, 1, f); fputs ("\n", f); } int di_parser_rfc822_write_file (const char *file, di_parser_info *info, di_parser_write_entry_next entry_next, void *user_data) { int nr = 0; const di_parser_fieldinfo *fip; void *act = NULL, *state_data = NULL; di_slist_node *node; FILE *f; char tmpfile[PATH_MAX]; if (!strncmp (file, "-", 1)) { tmpfile[0] = '\0'; f = stdout; } else { snprintf (tmpfile, sizeof (tmpfile), "%s.tmp", file); f = fopen (tmpfile, "w"); } if (!f) return -1; while (1) { act = entry_next (&state_data, user_data); if (!act) break; nr++; for (node = info->list.head; node; node = node->next) { fip = node->data; if (fip->write) fip->write (&act, fip, callback, f, user_data); } fputc ('\n', f); } if (*tmpfile) { fclose (f); if (rename (tmpfile, file)) return -1; } return nr; } libdebian-installer/HACKING0000644000000000000000000000041512147775065012655 0ustar If you use the git version, you need to have automake and libtool installed. To get compilable source, run: autoreconf -i -v This is not needed, and should be avoided, when building Debian packages since the autoreconf dh sequence already takes care of everything. libdebian-installer/libdebian-installer.pc.in0000644000000000000000000000036411515541630016511 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Debian Installer Description: Library of common debian-installer functions Version: @VERSION@ Libs: -L${libdir} -ldebian-installer Cflags: -I${includedir} libdebian-installer/include/0000755000000000000000000000000012054430476013300 5ustar libdebian-installer/include/Makefile.am0000644000000000000000000000010411515541630015323 0ustar SUBDIRS = debian-installer include_HEADERS = \ debian-installer.h libdebian-installer/include/debian-installer/0000755000000000000000000000000012271462253016514 5ustar libdebian-installer/include/debian-installer/hash.h0000644000000000000000000001134311557456270017622 0ustar /* * hash.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__HASH_H #define DEBIAN_INSTALLER__HASH_H #include /** * @addtogroup di_hash * @{ */ di_equal_func di_rstring_equal; di_hash_func di_rstring_hash; #if 0 di_equal_func di_string_equal; di_hash_func di_string_hash; #endif /** @} */ typedef struct di_hash_table di_hash_table; /** * @addtogroup di_hash_table * @{ */ /** * Creates a new di_hash_table. * * @param hash_func a function to create a hash value from a key. * Hash values are used to determine where keys are stored within the * di_hash_table data structure. * @param key_equal_func a function to check two keys for equality. This is * used when looking up keys in the di_hash_table. * * @return a new di_hash_table. */ di_hash_table *di_hash_table_new (di_hash_func hash_func, di_equal_func key_equal_func); /** * Creates a new di_hash_table like di_hash_table_new and allows to specify * functions to free the memory allocated for the key and value that get * called when removing the entry from the di_hash_table * * @param hash_func a function to create a hash value from a key. * Hash values are used to determine where keys are stored within the * di_hash_table data structure. * @param key_equal_func a function to check two keys for equality. This is * used when looking up keys in the di_hash_table. * @param key_destroy_func a function to free the memory allocated for the key * used when removing the entry from the di_hash_table or %NULL if you * don't want to supply such a function. * @param value_destroy_func a function to free the memory allocated for the * value used when removing the entry from the di_hash_table or %NULL if * you don't want to supply such a function. * * @return a new di_hash_table. */ di_hash_table *di_hash_table_new_full (di_hash_func hash_func, di_equal_func key_equal_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func); /** * Destroys the di_hash_table. If keys and/or values are dynamically * allocated, you should either free them first or create the di_hash_table * using di_hash_table_new_full. In the latter case the destroy functions * you supplied will be called on all keys and values before destroying * the di_hash_table. * * @param hash_table a di_hash_table. */ void di_hash_table_destroy (di_hash_table *hash_table); /** * Inserts a new key and value into a di_hash_table. * * If the key already exists in the di_hash_table its current value is replaced * with the new value. If you supplied a value_destroy_func when creating the * di_hash_table, the old value is freed using that function. If you supplied * a key_destroy_func when creating the di_hash_table, the passed key is freed * using that function. * * @param hash_table a di_hash_table. * @param key a key to insert. * @param value the value to associate with the key. */ void di_hash_table_insert (di_hash_table *hash_table, void *key, void *value); /** * Looks up a key in a di_hash_table. * * @param hash_table a di_hash_table, * @param key the key to look up. * * @return the associated value, or %NULL if the key is not found. */ void *di_hash_table_lookup (di_hash_table *hash_table, const void *key); /** * Calls the given function for each of the key/value pairs in the * di_hash_table. The function is passed the key and value of each * pair, and the given user_data parameter. * * @post The hash table may not be modified while iterating over it * (you can't add/remove items). * * @param hash_table a di_hash_table. * @param func the function to call for each key/value pair. * @param user_data user data to pass to the function. */ void di_hash_table_foreach (di_hash_table *hash_table, di_hfunc *func, void *user_data); /** * Returns the number of elements contained in the di_hash_table. * * @param hash_table a di_hash_table. * * @return the number of key/value pairs. */ di_ksize_t di_hash_table_size (di_hash_table *hash_table); /** @} */ #endif libdebian-installer/include/debian-installer/packages.h0000644000000000000000000001217211557456270020456 0ustar /* * packages.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PACKAGES_H #define DEBIAN_INSTALLER__PACKAGES_H #include #include #include #include #include typedef struct di_packages di_packages; typedef struct di_packages_allocator di_packages_allocator; /** * @addtogroup di_packages * @{ */ /** * @brief Packages file */ struct di_packages { di_hash_table *table; /**< includes di_package */ di_slist list; /**< includes di_package */ unsigned int resolver; /**< @internal */ }; /** * @internal * @brief Packages file - Allocator */ struct di_packages_allocator { di_mem_chunk *package_mem_chunk; /**< @internal */ di_mem_chunk *package_dependency_mem_chunk; /**< @internal */ di_mem_chunk *slist_node_mem_chunk; /**< @internal */ }; #include di_packages *di_packages_alloc (void); void di_packages_free (di_packages *packages); di_packages_allocator *di_packages_allocator_alloc (void); void di_packages_allocator_free (di_packages_allocator *packages); void di_packages_append_package (di_packages *packages, di_package *package, di_packages_allocator *allocator); di_package *di_packages_get_package (di_packages *packages, const char *name, size_t n); di_package *di_packages_get_package_new (di_packages *packages, di_packages_allocator *allocator, char *name, size_t n); di_slist *di_packages_resolve_dependencies (di_packages *packages, di_slist *list, di_packages_allocator *allocator); di_slist *di_packages_resolve_dependencies_array (di_packages *packages, di_package **array, di_packages_allocator *allocator); void di_packages_resolve_dependencies_mark (di_packages *packages); /** @} */ di_parser_fields_function_read di_packages_parser_read_name; /** * @addtogroup di_packages_parser * @{ */ extern const di_parser_fieldinfo *di_packages_parser_fieldinfo[]; extern const di_parser_fieldinfo *di_packages_status_parser_fieldinfo[]; extern const di_parser_fieldinfo *di_packages_minimal_parser_fieldinfo[]; di_parser_info *di_packages_parser_info (void); di_parser_info *di_packages_minimal_parser_info (void); di_parser_info *di_packages_status_parser_info (void); /** * Read a special Packages file * * @param file file to read */ di_packages *di_packages_special_read_file (const char *file, di_packages_allocator *allocator, di_parser_info *(info) (void)); /** * Write a special Packages file * * @param packages the packages structure * @param file file to write * * @return number of written entries */ int di_packages_special_write_file (di_packages *packages, const char *file, di_parser_info *(info) (void)); /** * Read a standard Packages file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_packages *di_packages_read_file (const char *file, di_packages_allocator *allocator) { return di_packages_special_read_file (file, allocator, di_packages_parser_info); } /** * Read a minimal Packages file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_packages *di_packages_minimal_read_file (const char *file, di_packages_allocator *allocator) { return di_packages_special_read_file (file, allocator, di_packages_minimal_parser_info); } /** * Read a standard status file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_packages *di_packages_status_read_file (const char *file, di_packages_allocator *allocator) { return di_packages_special_read_file (file, allocator, di_packages_status_parser_info); } /** * Write a standard Packages file * * @param packages the packages structure * @param file file to write * * @return number of written entries */ static inline int di_packages_write_file (di_packages *packages, const char *file) { return di_packages_special_write_file (packages, file, di_packages_parser_info); } /** * Write a standard status file * * @param packages the packages structure * @param file file to write * * @return number of written entries */ static inline int di_packages_status_write_file (di_packages *packages, const char *file) { return di_packages_special_write_file (packages, file, di_packages_status_parser_info); } /** @} */ #endif libdebian-installer/include/debian-installer/log.h0000644000000000000000000000606511557456270017465 0ustar /* * log.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__LOG_H #define DEBIAN_INSTALLER__LOG_H #include /** * @addtogroup di_log * @{ */ /** * @brief Log levels and other flags */ typedef enum { DI_LOG_FLAG_FATAL = 1 << 1, /**< flag as fatal */ DI_LOG_LEVEL_ERROR = 1 << 2, /**< error level, always fatal */ DI_LOG_LEVEL_CRITICAL = 1 << 3, /**< critical level */ DI_LOG_LEVEL_WARNING = 1 << 4, /**< warning level */ DI_LOG_LEVEL_MESSAGE = 1 << 5, /**< message level */ DI_LOG_LEVEL_INFO = 1 << 6, /**< information level */ DI_LOG_LEVEL_DEBUG = 1 << 7, /**< debug level */ DI_LOG_LEVEL_OUTPUT = 1 << 8, /**< command output */ DI_LOG_LEVEL_MASK = ~DI_LOG_FLAG_FATAL, /**< defines mask for levels */ DI_LOG_FATAL_MASK = DI_LOG_LEVEL_ERROR, /**< defines always fatal levels */ } di_log_level_flags; typedef void di_log_handler (di_log_level_flags log_level, const char *message, void *user_data); /** * logs an error */ #define di_error(format...) di_log (DI_LOG_LEVEL_ERROR, format) /** * logs a warning */ #define di_warning(format...) di_log (DI_LOG_LEVEL_WARNING, format) /** * logs information */ #define di_info(format...) di_log (DI_LOG_LEVEL_INFO, format) /** * logs debug info */ #define di_debug(format...) di_log (DI_LOG_LEVEL_DEBUG, format) /** * Logs the resolved formatstring with log_level * * @param log_level the level of the message * @param format printf compatible format */ void di_log (di_log_level_flags log_level, const char *format, ...) __attribute__ ((format(printf,2,3))); /** * Logs the resolved formatstring with log_level * * @param log_level the level of the message * @param format printf compatible format * @param args variable arguments list */ void di_vlog (di_log_level_flags log_level, const char *format, va_list args); /** * Sets a log handler * * @param log_levels levels * @param log_func the log handler * @param user_data data for log_func */ unsigned int di_log_set_handler (di_log_level_flags log_levels, di_log_handler *log_func, void *user_data); di_log_handler /** * Default log handler. * Logs to STDOUT and STDERR. */ di_log_handler_default, /** * SYSLOG log handler. * Logs to SYSLOG. */ di_log_handler_syslog; /** @} */ #endif libdebian-installer/include/debian-installer/types.h0000644000000000000000000000407511557456270020047 0ustar /* * types.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__TYPES_H #define DEBIAN_INSTALLER__TYPES_H #include #include #include /** * @addtogroup di_types * @{ */ /** * Compare key1 and key2 * @param key1 first key * @param key2 second key */ typedef int di_compare_func (const void *key1, const void *key2); /** * Checks the equality of key1 and key2 * @param key1 first key * @param key2 second key * @return true if equal */ typedef bool di_equal_func (const void *key1, const void *key2); /** * Destroys data * @param pointer */ typedef void di_destroy_notify (void *data); /** * Build hash from key * @param key key * @return hash */ typedef uint32_t di_hash_func (const void *key); typedef void di_hfunc (void *key, void *value, void *user_data); typedef void di_func (void *data, void *user_data); /** * Handles IO * @param buf pointer to the io buffer * @param len size of buf * @param user_data user data */ typedef int di_io_handler (const char *buf, size_t len, void *user_data); /** * Handler which is called after the fork * @param pid return value of fork * @param user_data user data */ typedef int di_process_handler (pid_t pid, void *user_data); /** * small size type used in many internal structures */ typedef uint32_t di_ksize_t; /** @} */ #endif libdebian-installer/include/debian-installer/macros.h0000644000000000000000000000241311557456270020161 0ustar /* * macros.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__MACROS_H #define DEBIAN_INSTALLER__MACROS_H #define DI_STRINGIFY(contents) DI_STRINGIFY_ARG (contents) #define DI_STRINGIFY_ARG(contents) #contents #define DI_STRLOC __FILE__ ":" DI_STRINGIFY(__LINE__) /* GCC version checking borrowed from glibc. */ #if defined(__GNUC__) && defined(__GNUC_MINOR__) # define DI_GNUC_PREREQ(maj,min) \ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) #else # define DI_GNUC_PREREQ(maj,min) 0 #endif #endif libdebian-installer/include/debian-installer/string.h0000644000000000000000000000325411557456270020207 0ustar /* * string.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__STRING_H #define DEBIAN_INSTALLER__STRING_H #include #include typedef struct di_rstring di_rstring; /** * @addtogroup di_string * @{ */ /** * @brief raw string */ struct di_rstring { char *string; /**< pointer to a string, don't need to be 0-terminated */ di_ksize_t size; /**< size of string */ }; /** * cat resolved format to str * * @param str string * @param size len of str * @param format printf compatible string * @return append chars */ int di_snprintfcat (char *str, size_t size, const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif ; /** * Copies n bytes from s, without calculating the length of s itself. * * @param s source * @param n len of source without delimiter * @return malloced string */ char *di_stradup (const char *s, size_t n); /** @} */ #endif libdebian-installer/include/debian-installer/parser.h0000644000000000000000000001106211557456270020171 0ustar /* * parser.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PARSER_H #define DEBIAN_INSTALLER__PARSER_H #include #include #include #include #include #include #include typedef struct di_parser_info di_parser_info; typedef struct di_parser_fieldinfo di_parser_fieldinfo; /** * @addtogroup di_parser * @{ */ /** * Read a single field * * @param data the actual data * @param fip info of the actual field * @param value the actual value * @param value_size size of the actual value * @param user_data data supplied to the parser */ typedef void di_parser_fields_function_read (void **data, const di_parser_fieldinfo *fip, di_rstring *field_modifier, di_rstring *value, void *user_data); /** * Write a single field - callback * * @param field the field * @param value the value of the field * @param data the callback_data */ typedef void di_parser_fields_function_write_callback (const di_rstring *field, const di_rstring *value, void *data); /** * Write a single field * * @param data the actual data * @param fip info of the actual field * @param output static buffer for output * @param user_data data supplied to the parser * * @return written bytes */ typedef void di_parser_fields_function_write (void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data); /** * @param user_data data supplied to di_parse * @return new data */ typedef void *di_parser_read_entry_new (void *user_data); /** * @param data the actual data * @param user_data data supplied to di_parse */ typedef int di_parser_read_entry_finish (void *data, void *user_data); /** * @param data the actual data * @param user_data data supplied to di_parse */ typedef void *di_parser_write_entry_next (void **state_data, void *user_data); /** * @brief Parse info */ struct di_parser_info { di_hash_table *table; /**< table of di_parser_fieldinfo */ di_slist list; /**< list of di_parser_fieldinfo */ bool modifier; /**< use modifier */ bool wildcard; /**< use wildcard (entry with key "") */ }; /** * @brief Info about a parser field */ struct di_parser_fieldinfo { di_rstring key; /**< field name */ di_parser_fields_function_read *read; /**< function for reading a field */ di_parser_fields_function_write *write; /**< function for writing a field */ unsigned int integer; /**< Simple value, usage is defined by the read and write functions. * Most used with an offset of the field in the structure. */ }; /** * generates a di_parser_fieldinfo */ #define DI_PARSER_FIELDINFO(name, read, write, integer) \ { { name, sizeof (name) - 1 }, read, write, integer } di_parser_fields_function_read /** * Read function for a boolean (true == "Yes") */ di_parser_read_boolean, /** * Read function for an int */ di_parser_read_int, /** * Read function for a di_rstring */ di_parser_read_rstring, /** * Read function for a string */ di_parser_read_string; di_parser_fields_function_write /** * Write function for a boolean ("Yes" == true) */ di_parser_write_boolean, /** * Write function for an int */ di_parser_write_int, /** * Write function for a di_string */ di_parser_write_rstring, /** * Write function for a string */ di_parser_write_string; di_parser_info *di_parser_info_alloc (void); void di_parser_info_free (di_parser_info *info); void di_parser_info_add (di_parser_info *info, const di_parser_fieldinfo *fieldinfo[]); /** @} */ #endif libdebian-installer/include/debian-installer/Makefile.am0000644000000000000000000000060211515541630020543 0ustar SUBDIRS = system realincludedir = $(includedir)/debian-installer realinclude_HEADERS = \ config.h \ exec.h \ hash.h \ list.h \ log.h \ macros.h \ mem.h \ mem_chunk.h \ package.h \ packages.h \ parser.h \ parser_rfc822.h \ release.h \ slist.h \ string.h \ tree.h \ types.h \ utils.h noinst_HEADERS = \ package_internal.h \ packages_internal.h \ slist_internal.h libdebian-installer/include/debian-installer/package.h0000644000000000000000000002151011557456270020267 0ustar /* * package.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PACKAGE_H #define DEBIAN_INSTALLER__PACKAGE_H #include #include #include #include typedef struct di_package di_package; typedef struct di_package_dependency di_package_dependency; typedef struct di_package_version di_package_version; typedef enum di_package_dependency_type di_package_dependency_type; typedef enum di_package_priority di_package_priority; typedef enum di_package_status di_package_status; typedef enum di_package_status_want di_package_status_want; typedef enum di_package_type di_package_type; #include /** * @addtogroup di_package * @{ */ /** * Priority field */ enum di_package_priority { di_package_priority_extra = 1, di_package_priority_optional, di_package_priority_standard, di_package_priority_important, di_package_priority_required, }; /** * Status field, third part */ enum di_package_status { di_package_status_undefined = 0, di_package_status_not_installed, di_package_status_unpacked, di_package_status_installed, di_package_status_half_configured, di_package_status_config_files, }; /** * Status field, first part */ enum di_package_status_want { di_package_status_want_unknown = 0, di_package_status_want_install, di_package_status_want_hold, di_package_status_want_deinstall, di_package_status_want_purge, }; /** * type of package */ enum di_package_type { di_package_type_non_existent = 0, /**< @internal Non existing package */ di_package_type_virtual_package, /**< Virtual package */ di_package_type_real_package, /**< Real package */ }; /** * @brief Package */ struct di_package { union { char *package; /**< Package field */ di_rstring key; /**< @internal hash key */ }; di_package_type type; /**< Type of package */ di_package_status_want status_want; /**< Status field, first part */ di_package_status status; /**< Status field, third part */ int essential; /**< Essential field */ di_package_priority priority; /**< Priority field */ char *section; /**< Section field */ int installed_size; /**< Installed-Size field */ char *maintainer; /**< Maintainer field */ char *architecture; /**< Architecture field */ char *version; /**< Version field */ di_slist depends; /**< Any different dependency types */ char *filename; /**< Filename field */ size_t size; /**< Size field */ char *md5sum; /**< MD5Sum field */ char *short_description; /**< Description field, first part*/ char *description; /**< Description field, second part */ unsigned int resolver; /**< @internal */ }; /** * Type of dependency */ enum di_package_dependency_type { di_package_dependency_type_replaces = 1, /**< Replaces field */ di_package_dependency_type_provides, /**< Provides field */ di_package_dependency_type_depends, /**< Depends field */ di_package_dependency_type_pre_depends, /**< Pre-Depends field */ di_package_dependency_type_recommends, /**< Recommends field */ di_package_dependency_type_suggests, /**< Suggests field */ di_package_dependency_type_conflicts, /**< Conflicts field */ di_package_dependency_type_enhances, /**< Enhances field */ di_package_dependency_type_reverse_provides = 0x100, /**< @internal */ di_package_dependency_type_reverse_enhances, /**< @internal */ }; /** * @brief Package dependency */ struct di_package_dependency { di_package_dependency_type type; /**< type of dependency */ di_package *ptr; /**< the package, may be NULL */ }; /** * @brief Package version */ struct di_package_version { unsigned long epoch; /**< epoch */ char *upstream; /**< upstream */ char *debian_revision; /**< debian revision */ }; void di_package_destroy (di_package *package); static inline di_package *di_package_alloc (di_packages_allocator *allocator) { return di_mem_chunk_alloc0 (allocator->package_mem_chunk); } static inline di_package_dependency *di_package_dependency_alloc (di_packages_allocator *allocator) { return di_mem_chunk_alloc0 (allocator->package_dependency_mem_chunk); } void di_package_version_free (di_package_version *version); int di_package_version_compare (const di_package_version *a, const di_package_version *b); di_package_version *di_package_version_parse (di_package *package); extern const char *const di_package_priority_text[]; extern const char *const di_package_status_want_text[]; extern const char *const di_package_status_text[]; int di_package_array_text_from (const char *const *array, const char *text); static inline di_package_priority di_package_priority_text_from (const char *text) { return di_package_array_text_from (di_package_priority_text, text); } static inline di_package_status_want di_package_status_want_text_from (const char *text) { return di_package_array_text_from (di_package_status_want_text, text); } static inline di_package_status di_package_status_text_from (const char *text) { return di_package_array_text_from (di_package_status_text, text); } static inline const char *di_package_priority_text_to (const di_package_priority priority) { return di_package_priority_text[priority]; } static inline const char *di_package_status_want_text_to (const di_package_status_want status) { return di_package_status_want_text[status]; } static inline const char *di_package_status_text_to (const di_package_status status) { return di_package_status_text[status]; } /** @} */ /** * @addtogroup di_package_parser * @{ */ di_parser_fields_function_read /** * Read function for Dependency field */ di_package_parser_read_dependency, /** * Read function for Description field */ di_package_parser_read_description, /** * Read function for Priority field */ di_package_parser_read_priority, /** * Read function for Status field */ di_package_parser_read_status; di_parser_fields_function_write /** * Write function for Dependency field */ di_package_parser_write_dependency, /** * Write function for Description field */ di_package_parser_write_description, /** * Write function for Priority field */ di_package_parser_write_priority, /** * Write function for Status field */ di_package_parser_write_status; /** * Standard package control file */ extern const di_parser_fieldinfo *di_package_parser_fieldinfo[]; /** * @internal * Get parser info for standard control file */ di_parser_info *di_package_parser_info (void); /** * Read a special package control file * * @param file file to read * @param packages di_packages which the package is add to * @param allocator the corresponding allocator */ di_package *di_package_special_read_file (const char *file, di_packages *packages, di_packages_allocator *allocator, di_parser_info *(info) (void)); /** * Read a package control file * * @param file file to read * @param packages di_packages which the package is add to * @param allocator the corresponding allocator */ static inline di_package *di_package_read_file (const char *file, di_packages *packages, di_packages_allocator *allocator) { return di_package_special_read_file (file, packages, allocator, di_package_parser_info); } /** @} */ #endif libdebian-installer/include/debian-installer/slist.h0000644000000000000000000000614011557456270020034 0ustar /* * slist.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SLIST_H #define DEBIAN_INSTALLER__SLIST_H #include typedef struct di_slist di_slist; typedef struct di_slist_node di_slist_node; /** * @addtogroup di_slist * @{ */ /** * @brief Single-linked list */ struct di_slist { di_slist_node *head; /**< head of list */ di_slist_node *bottom; /**< bottom of list */ }; /** * @brief Node of a single-linked list */ struct di_slist_node { di_slist_node *next; /**< next node */ void *data; /**< data */ }; /** * Allocate a single-linked list * * @return a di_slist */ di_slist *di_slist_alloc (void); /** * Destroy the contents of a single-linked list * * @warning never use this function with a list which makes use of the chunk allocator * * @param slist a di_slist */ void di_slist_destroy (di_slist *slist, di_destroy_notify destroy_func) __attribute__ ((nonnull(1))); /** * Free a single-linked list * * @param slist a di_slist */ void di_slist_free (di_slist *slist); /** * Append to a single-linked list * * @warning don't mix with di_slist_append_chunk * * @param slist a di_slist * @param data the data */ void di_slist_append (di_slist *slist, void *data) __attribute__ ((nonnull(1))); /** * Append to a single-linked list * * @warning don't mix with di_slist_append * * @param slist a di_slist * @param data the data * @param mem_chunk a di_mem_chunk for allocation of new nodes * * @pre the di_mem_chunk must return chunks with at least the size of di_slist_node */ void di_slist_append_chunk (di_slist *slist, void *data, di_mem_chunk *mem_chunk) __attribute__ ((nonnull(1,3))); /** * Prepend to a single-linked list * * @warning don't mix with di_slist_prepend_chunk * * @param slist a di_slist * @param data the data */ void di_slist_prepend (di_slist *slist, void *data) __attribute__ ((nonnull(1))); /** * Prepend to a single-linked list * * @warning don't mix with di_slist_prepend * * @param slist a di_slist * @param data the data * @param mem_chunk a di_mem_chunk for allocation of new nodes * * @pre the di_mem_chunk must return chunks with at least the size of di_slist_node */ void di_slist_prepend_chunk (di_slist *slist, void *data, di_mem_chunk *mem_chunk) __attribute__ ((nonnull(1,3))); /** @} */ #endif libdebian-installer/include/debian-installer/packages_internal.h0000644000000000000000000000660511557456270022356 0ustar /* * packages_internal.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PACKAGES_INTERNAL_H #define DEBIAN_INSTALLER__PACKAGES_INTERNAL_H #include #include typedef struct di_packages_resolve_dependencies_check di_packages_resolve_dependencies_check; /** * @addtogroup di_packages * @{ */ di_packages_allocator *internal_di_packages_allocator_alloc (void); typedef bool di_packages_resolve_dependencies_check_package (di_packages_resolve_dependencies_check *r, di_package *package, di_package_dependency *d); typedef di_package_dependency *di_packages_resolve_dependencies_check_provide (di_package *package, di_package_dependency *best, di_package_dependency *d, void *data); typedef void di_packages_resolve_dependencies_do_package (di_package *package, void *data); struct di_packages_resolve_dependencies_check { di_packages_resolve_dependencies_check_package *check_real; di_packages_resolve_dependencies_check_provide *check_virtual; di_packages_resolve_dependencies_check_package *check_non_existant; di_packages_resolve_dependencies_do_package *do_real; unsigned int resolver; void *check_virtual_data; void *do_real_data; }; di_slist *di_packages_resolve_dependencies_special (di_packages *packages, di_slist *list, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator); di_slist *di_packages_resolve_dependencies_array_special (di_packages *packages, di_package **array, di_packages_resolve_dependencies_check *s, di_packages_allocator *allocator); void di_packages_resolve_dependencies_mark_special (di_packages *packages, di_packages_resolve_dependencies_check *s); void di_packages_resolve_dependencies_marker (di_packages *packages); bool di_packages_resolve_dependencies_recurse (di_packages_resolve_dependencies_check *r, di_package *package, di_package *dependend_package); di_packages_resolve_dependencies_check_package di_packages_resolve_dependencies_check_real, di_packages_resolve_dependencies_check_non_existant, di_packages_resolve_dependencies_check_non_existant_quiet, di_packages_resolve_dependencies_check_non_existant_permissive; di_packages_resolve_dependencies_check_provide di_packages_resolve_dependencies_check_virtual; di_packages_resolve_dependencies_do_package di_packages_resolve_dependencies_do_real_list_append, di_packages_resolve_dependencies_do_real_mark; struct di_packages_resolve_dependencies_do_real_list_append_data { di_slist list; di_packages_allocator *allocator; }; /** @} */ /** * @addtogroup di_packages_parser * @{ */ di_parser_write_entry_next internal_di_packages_parser_write_entry_next; const di_parser_fieldinfo internal_di_packages_parser_field_package; /** @} */ #endif libdebian-installer/include/debian-installer/utils.h0000644000000000000000000000215411557456270020037 0ustar /* * utils.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__UTILS_H #define DEBIAN_INSTALLER__UTILS_H /** * @addtogroup di_utils * @{ */ /** * Inits the lib * @param progname name of the called binary */ void di_init (const char *progname); /** * Get the name of the called binary * @return name */ const char *di_progname_get (void); /** @} */ #endif libdebian-installer/include/debian-installer/mem_chunk.h0000644000000000000000000000243612271462253020640 0ustar /* * mem_chunk.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__MEM_CHUNK_H #define DEBIAN_INSTALLER__MEM_CHUNK_H #include typedef struct di_mem_chunk di_mem_chunk; /** * @addtogroup di_mem_chunk * @{ */ di_mem_chunk* di_mem_chunk_new (di_ksize_t atom_size, di_ksize_t area_size); void *di_mem_chunk_alloc (di_mem_chunk *mem_chunk); void *di_mem_chunk_alloc0 (di_mem_chunk *mem_chunk); void di_mem_chunk_destroy (di_mem_chunk *mem_chunk); size_t di_mem_chunk_size (di_mem_chunk *mem_chunk); /** @} */ #endif libdebian-installer/include/debian-installer/parser_rfc822.h0000644000000000000000000000477711557456270021276 0ustar /* * parser_rfc822.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PARSER_RFC822_H #define DEBIAN_INSTALLER__PARSER_RFC822_H #include #include #include /** * @addtogroup di_parser_rfc822 * @{ */ /** * Parse a rfc822 formated file * * @param begin begin of memory segment * @param size size of memory segment * @param fieldinfo parser info * @param entry_new function which is called before each entry, may return the new entry or return NULL * @param entry_finish function which is called after each entry, return non-0 aborts the parsing * @param user_data user_data for parser functions * * @return number of parsed entries */ int di_parser_rfc822_read (char *begin, size_t size, di_parser_info *fieldinfo, di_parser_read_entry_new entry_new, di_parser_read_entry_finish entry_finish, void *user_data); /** * Parse a rfc822 formated file * * @param file filename * @param fieldinfo parser info * @param entry_new function which is called before each entry, may return the new entry or return NULL * @param entry_finish function which is called after each entry, return non-0 aborts the parsing * @param user_data user_data for parser functions * * @return number of parsed entries */ int di_parser_rfc822_read_file (const char *file, di_parser_info *fieldinfo, di_parser_read_entry_new entry_new, di_parser_read_entry_finish entry_finish, void *user_data); /** * Dump a rfc822 formated file * * @param file filename * @param fieldinfo parser info * @param entry_next function which is called to gather the next entry * @param user_data user_data for parser functions * * @return number of dumped entries */ int di_parser_rfc822_write_file (const char *file, di_parser_info *fieldinfo, di_parser_write_entry_next entry_next, void *user_data); /** @} */ #endif libdebian-installer/include/debian-installer/mem.h0000644000000000000000000000423511557456270017457 0ustar /* * mem.h * * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald * 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__MEM_H #define DEBIAN_INSTALLER__MEM_H #include #include /** * @addtogroup di_mem * @{ */ /** * Allocate memory * * @param n_bytes size in bytes * * @post never returns NULL */ void *di_malloc (size_t n_bytes) __attribute__ ((malloc)); /** * Allocate cleared memory * * @param n_bytes size in bytes * * @post never returns NULL */ void *di_malloc0 (size_t n_bytes) __attribute__ ((malloc)); /** * Reallocate memory * * @param mem memory * @param n_bytes size in bytes * * @post never returns NULL */ void *di_realloc (void *mem, size_t n_bytes) __attribute__ ((malloc)); /** * Free memory * * @param mem memory */ void di_free (void *mem); /** * @param struct_type returned type * @param n_structs number of returned structs */ #define di_new(struct_type, n_structs) \ ((struct_type *) di_malloc (sizeof (struct_type) * (n_structs))) /** * @param struct_type returned type * @param n_structs number of returned structs */ #define di_new0(struct_type, n_structs) \ ((struct_type *) di_malloc0 (sizeof (struct_type) * (n_structs))) /** * @param struct_type returned type * @param mem current memory pointer * @param n_structs number of returned structs */ #define di_renew(struct_type, mem, n_structs) \ ((struct_type *) di_realloc ((mem), sizeof (struct_type) * (n_structs))) /** @} */ #endif libdebian-installer/include/debian-installer/tree.h0000644000000000000000000000743711557456270017647 0ustar /* * tree.h * * Copyright (C) 2006 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__TREE_H #define DEBIAN_INSTALLER__TREE_H #include typedef struct di_tree di_tree; /** * @addtogroup di_tree * @{ */ /** * Creates a new di_tree. * * @param key_compare_func a function to compare two keys. This is used when * looking up keys in the di_tree. * * @return a new di_tree. */ di_tree *di_tree_new (di_compare_func key_compare_func); /** * Creates a new di_tree like di_tree_new and allows to specify functions to * free the memory allocated for the key and value that get called when * removing the entry from the di_tree * * @param key_compare_func a function to check two keys for equality. This is * used when looking up keys in the di_tree. * @param key_destroy_func a function to free the memory allocated for the key * used when removing the entry from the di_tree or %NULL if you don't want * to supply such a function. * @param value_destroy_func a function to free the memory allocated for the * value used when removing the entry from the di_tree or %NULL if you don't * want to supply such a function. * * @return a new di_tree. */ di_tree *di_tree_new_full (di_compare_func key_compare_func, di_destroy_notify key_destroy_func, di_destroy_notify value_destroy_func); /** * Destroys the di_tree. If keys and/or values are dynamically allocated, you * should either free them first or create the di_tree using di_tree_new_full. * In the latter case the destroy functions you supplied will be called on all * keys and values before destroying the di_hash_table. * * @param tree a di_tree. */ void di_tree_destroy (di_tree *tree); /** * Inserts a new key and value into a di_tree. * * If the key already exists in the di_tree its current value is replaced with * the new value. If you supplied a value_destroy_func when creating the * di_tree, the old value is freed using that function. If you supplied a * key_destroy_func when creating the di_tree, the passed key is freed using * that function. * * @param tree a di_tree. * @param key a key to insert. * @param value the value to associate with the key. */ void di_tree_insert (di_tree *tree, void *key, void *value); /** * Looks up a key in a di_tree. * * @param tree a di_tree., * @param key the key to look up. * * @return the associated value, or %NULL if the key is not found. */ void *di_tree_lookup (di_tree *tree, const void *key); /** * Calls the given function for each of the key/value pairs in the di_tree. The * function is passed the key and value of each pair, and the given user_data * parameter. * * @post The hash table may not be modified while iterating over it * (you can't add/remove items). * * @param tree a di_tree. * @param func the function to call for each key/value pair. * @param user_data user data to pass to the function. */ void di_tree_foreach (di_tree *tree, di_hfunc *func, void *user_data); /** * Returns the number of elements contained in the di_tree. * * @param hash_table a di_tree. * * @return the number of key/value pairs. */ di_ksize_t di_tree_size (di_tree *tree); /** @} */ #endif libdebian-installer/include/debian-installer/list.h0000644000000000000000000000575611557456270017665 0ustar /* * list.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__LIST_H #define DEBIAN_INSTALLER__LIST_H #include typedef struct di_list di_list; typedef struct di_list_node di_list_node; /** * @addtogroup di_list * @{ */ /** * @brief Double-linked list */ struct di_list { di_list_node *head; /**< head of list */ di_list_node *bottom; /**< bottom of list */ }; /** * @brief Node of a double-linked list */ struct di_list_node { di_list_node *next; /**< next node */ di_list_node *prev; /**< previsous node */ void *data; /**< data */ }; /** * Allocate a double-linked list * * @return a di_list */ di_list *di_list_alloc (void); /** * Destroy the contents of a double-linked list * * @warning never use this function with a list which makes use of the chunk allocator * * @param list a di_list */ void di_list_destroy (di_list *list, di_destroy_notify destroy_func) __attribute__ ((nonnull(1))); /** * Free a double-linked list * * @param list a di_list */ void di_list_free (di_list *list); /** * Append to a double-linked list * * @warning don't mix with di_list_append_chunk * * @param list a di_list * @param data the data */ void di_list_append (di_list *list, void *data) __attribute__ ((nonnull(1))); /** * Append to a double-linked list * * @warning don't mix with di_list_append_chunk * * @param list a di_list * @param data the data */ void di_list_append_chunk (di_list *list, void *data, di_mem_chunk *mem_chunk) __attribute__ ((nonnull(1,3))); /** * Prepend to a double-linked list * * @warning don't mix with di_list_prepend_chunk * * @param list a di_list * @param data the data */ void di_list_prepend (di_list *list, void *data) __attribute__ ((nonnull(1))); /** * Prepend to a double-linked list * * @warning don't mix with di_list_prepend * * @param list a di_list * @param data the data * @param mem_chunk a di_mem_chunk for allocation of new nodes * * @pre the di_mem_chunk must return chunks with at least the size of di_list_node */ void di_list_prepend_chunk (di_list *list, void *data, di_mem_chunk *mem_chunk) __attribute__ ((nonnull(1,3))); /** @} */ #endif libdebian-installer/include/debian-installer/package_internal.h0000644000000000000000000000620711557456270022171 0ustar /* * package_internal.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__PACKAGE_INTERNAL_H #define DEBIAN_INSTALLER__PACKAGE_INTERNAL_H #include typedef struct internal_di_package_parser_data internal_di_package_parser_data; /** * @addtogroup di_package_parser * @{ */ /** * @internal * parser info */ const di_parser_fieldinfo internal_di_package_parser_field_status, internal_di_package_parser_field_essential, internal_di_package_parser_field_priority, internal_di_package_parser_field_section, internal_di_package_parser_field_installed_size, internal_di_package_parser_field_maintainer, internal_di_package_parser_field_architecture, internal_di_package_parser_field_version, internal_di_package_parser_field_replaces, internal_di_package_parser_field_provides, internal_di_package_parser_field_depends, internal_di_package_parser_field_pre_depends, internal_di_package_parser_field_recommends, internal_di_package_parser_field_suggests, internal_di_package_parser_field_conflicts, internal_di_package_parser_field_enhances, internal_di_package_parser_field_filename, internal_di_package_parser_field_size, internal_di_package_parser_field_md5sum, internal_di_package_parser_field_description; /** * @internal * Holds data for the Package parser */ struct internal_di_package_parser_data { di_packages_allocator *allocator; /**< the used allocator */ di_packages *packages; /**< the used packages struct */ di_package *package; /**< only used in the control file parser */ }; /** @} */ /** * @addtogroup di_package * @{ */ /** * Destroys a di_package struct */ di_destroy_notify internal_di_package_destroy_func; int internal_di_package_array_text_from_rstring (const char *const *array, const di_rstring *text); static inline di_package_priority internal_di_package_priority_text_from_rstring (const di_rstring *text) { return internal_di_package_array_text_from_rstring (di_package_priority_text, text); } static inline di_package_status_want internal_di_package_status_want_text_from_rstring (const di_rstring *text) { return internal_di_package_array_text_from_rstring (di_package_status_want_text, text); } static inline di_package_status internal_di_package_status_text_from_rstring (const di_rstring *text) { return internal_di_package_array_text_from_rstring (di_package_status_text, text); } /** @} */ #endif libdebian-installer/include/debian-installer/system/0000755000000000000000000000000012054430476020041 5ustar libdebian-installer/include/debian-installer/system/subarch.h0000644000000000000000000000251311557456270021651 0ustar /* * subarch.h * * Copyright (C) 2003 Bastian Blank * Copyright (C) 2005 Colin Watson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__SUBARCH_H #define DEBIAN_INSTALLER__SYSTEM__SUBARCH_H #ifdef __ARMEL__ #define DI_SYSTEM_SUBARCH_CAN_GUESS 1 #endif /** * @addtogroup di_system_subarch * @{ */ /** * Returns a string describing the current subarchitecture, e.g. * "powermac_newworld". */ const char *di_system_subarch_analyze (void); /** * Return a string with a best-guess of the current subarchitecture * * Only present on armel currently, and is a stub on all other architectures */ const char *di_system_subarch_analyze_guess (void); /** @} */ #endif libdebian-installer/include/debian-installer/system/packages.h0000644000000000000000000000750711557456270022010 0ustar /* * packages.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__PACKAGES_H #define DEBIAN_INSTALLER__SYSTEM__PACKAGES_H #include #include #include typedef struct di_system_package di_system_package; /** * @addtogroup di_system_packages * @{ */ /** * @brief Package - System */ struct di_system_package { di_package p; /**< standard package */ int installer_menu_item; /**< Installer-Menu-Item field */ char *subarchitecture; /**< Subarchitecture field */ char *kernel_version; /**< Kernel-Version field */ }; void di_system_package_destroy (di_system_package *package); di_packages *di_system_packages_alloc (void); di_packages_allocator *di_system_packages_allocator_alloc (void); bool di_system_package_check_subarchitecture (di_package *package, const char *subarchitecture); extern const di_parser_fieldinfo *di_system_package_parser_fieldinfo[]; di_parser_info *di_system_package_parser_info (void); di_parser_info *di_system_packages_parser_info (void); di_parser_info *di_system_packages_status_parser_info (void); /** * Read a standard package control file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_package *di_system_package_read_file (const char *file, di_packages *packages, di_packages_allocator *allocator) { return di_package_special_read_file (file, packages, allocator, di_system_package_parser_info); } /** * Read a standard Packages file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_packages *di_system_packages_read_file (const char *file, di_packages_allocator *allocator) { return di_packages_special_read_file (file, allocator, di_system_packages_parser_info); } /** * Read a standard status file * * @param file file to read * @param allocator the allocator for the packages structure */ static inline di_packages *di_system_packages_status_read_file (const char *file, di_packages_allocator *allocator) { return di_packages_special_read_file (file, allocator, di_system_packages_status_parser_info); } /** * Write a standard Packages file * * @param packages the packages structure * @param file file to read */ static inline int di_system_packages_write_file (di_packages *packages, const char *file) { return di_packages_special_write_file (packages, file, di_system_packages_parser_info); } /** * Write a standard status file * * @param packages the packages structure * @param file file to read */ static inline int di_system_packages_status_write_file (di_packages *packages, const char *file) { return di_packages_special_write_file (packages, file, di_system_packages_status_parser_info); } di_slist *di_system_packages_resolve_dependencies_array_permissive (di_packages *packages, di_package **array, di_packages_allocator *allocator); void di_system_packages_resolve_dependencies_mark_anna (di_packages *packages, const char *subarchitecture, const char *kernel); /** @} */ #endif libdebian-installer/include/debian-installer/system/prebaseconfig.h0000644000000000000000000000255511557456270023037 0ustar /* * prebaseconfig.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__PREBASECONFIG_H #define DEBIAN_INSTALLER__SYSTEM__PREBASECONFIG_H /** * @addtogroup di_system_prebaseconfig * @{ */ /** * Directory for prebaseconfig files */ #define DI_SYSTEM_PREBASECONFIG_DIR "/usr/lib/prebaseconfig.d" /** * Append resolved format to the prebaseconfig file for udeb */ int di_system_prebaseconfig_append (const char *udeb, const char *format, ...) __attribute__ ((format(printf,2,3))); /** * @deprecated * Alias of di_system_prebaseconfig_append */ int di_prebaseconfig_append (const char *udeb, const char *format, ...) __attribute__ ((format(printf,2,3),deprecated)); /** @} */ #endif libdebian-installer/include/debian-installer/system/dpkg_internal.h0000644000000000000000000000220011557456270023034 0ustar /* * dpkg_internal.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__DPKG_INTERNAL_H #define DEBIAN_INSTALLER__SYSTEM__DPKG_INTERNAL_H #include int internal_di_system_dpkg_package_unpack_control (di_packages *status, di_package **package, const char *_package, const char *filename, di_packages_allocator *allocator); int internal_di_system_dpkg_package_unpack_data (di_package *package, const char *filename); #endif libdebian-installer/include/debian-installer/system/Makefile.am0000644000000000000000000000030211515541630022064 0ustar realincludedir = $(includedir)/debian-installer/system realinclude_HEADERS = \ devfs.h \ dpkg.h \ packages.h \ prebaseconfig.h \ subarch.h \ utils.h noinst_HEADERS = \ dpkg_internal.h libdebian-installer/include/debian-installer/system/utils.h0000644000000000000000000000204211557456270021357 0ustar /* * utils.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__UTILS_H #define DEBIAN_INSTALLER__SYSTEM__UTILS_H /** * @addtogroup di_system_utils * @{ */ /** * Inits the lib. * In addition to di_init, this functions sets a syslog log handler. * @param progname name of the called binary */ void di_system_init (const char *progname); /** @} */ #endif libdebian-installer/include/debian-installer/system/devfs.h0000644000000000000000000000237611557456270021340 0ustar /* * devfs.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__DEVFS_H #define DEBIAN_INSTALLER__SYSTEM__DEVFS_H #include /** * @addtogroup di_system_devfs * @{ */ /** * Maps a devfs path to the corresponding standard dev path * * @param path an existing device * @param ret device * @param len len of ret */ ssize_t di_system_devfs_map_from (const char *path, char *ret, size_t len); /** * @deprecated * Alias of di_system_devfs_map_from */ ssize_t di_mapdevfs (const char *path, char *ret, size_t len) __attribute__ ((deprecated)); /** @} */ #endif libdebian-installer/include/debian-installer/system/dpkg.h0000644000000000000000000000302711557456270021150 0ustar /* * dpkg.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SYSTEM__DPKG_H #define DEBIAN_INSTALLER__SYSTEM__DPKG_H #include #include /** * @addtogroup di_system_dpkg * @{ */ #define DI_SYSTEM_DPKG_ADMINDIR "/var/lib/dpkg/" #define DI_SYSTEM_DPKG_INFODIR DI_SYSTEM_DPKG_ADMINDIR "info/" #define DI_SYSTEM_DPKG_STATUSFILE DI_SYSTEM_DPKG_ADMINDIR "status" #define DI_SYSTEM_DPKG_TMPCONTROLDIR DI_SYSTEM_DPKG_ADMINDIR "tmp.ci/" #if 0 int di_system_dpkg_package_configure (di_packages *status, const char *package, bool force); #endif int di_system_dpkg_package_control_file_exec (di_package *package, const char *name, int argc, const char *const argv[]); #if 0 int di_system_dpkg_package_unpack (di_packages *status, const char *_package, const char *filename, di_packages_allocator *allocator); #endif /** @} */ #endif libdebian-installer/include/debian-installer/release.h0000644000000000000000000000427011557456270020320 0ustar /* * release.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__RELEASE_H #define DEBIAN_INSTALLER__RELEASE_H #include #include #include typedef struct di_release di_release; typedef struct di_release_file di_release_file; /** * @addtogroup di_release * @{ */ /** * @brief Release file */ struct di_release { char *origin; /**< Origin field */ char *suite; /**< Suite field */ char *codename; /**< Codename field */ di_hash_table *md5sum; /**< checksum fields, includes di_release_file */ di_mem_chunk *release_file_mem_chunk; /**< @internal */ }; /** * @brief Release file - file entry */ struct di_release_file { union { char *filename; /**< filename */ di_rstring key; /**< @internal */ }; unsigned int size; /**< size */ char *sum[2]; /**< checksums, currently md5 and sha1 */ }; di_release *di_release_alloc (void); void di_release_free (di_release *packages); /** * @} * @addtogroup di_release_parser * @{ */ di_release *di_release_read_file (const char *file); /** @} */ di_parser_fields_function_read di_release_parser_read_file; /** * @addtogroup di_release_parser * @{ */ extern const di_parser_fieldinfo *di_release_parser_fieldinfo[]; /** @} */ #endif libdebian-installer/include/debian-installer/exec.h0000644000000000000000000001545711557456270017635 0ustar /* * exec.h * * Copyright (C) 2003 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__EXEC_H #define DEBIAN_INSTALLER__EXEC_H #include #include #include #include /** * @addtogroup di_exec * @{ */ di_io_handler /** * logs the output */ di_exec_io_log; di_process_handler /** * chdir to user_data * * @param user_data path */ di_exec_prepare_chdir, /** * chroot to user_data * * @param user_data path */ di_exec_prepare_chroot; /** * execv like call * * @param path executable with path * @param argv NULL-terminated area of char pointer * @param stdout_handler di_io_handler which gets stdout (and to stderr if stderr_handler is NULL) * @param stderr_handler di_io_handler which gets stderr * @param io_user_data user_data for di_io_handler * @param parent_prepare_handler di_process_handler which is called after the fork in the parent * @param parent_prepare_user_data user_data for parent_prepare_handler * @param child_prepare_handler di_process_handler which is called after the fork in the child * @param child_prepare_user_data user_data for child_prepare_handler * * @return status or error */ int di_exec_full (const char *path, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data); /** * execv like call * * @param path executable with path * @param argv NULL-terminated area of char pointer * * @return status or error */ static inline int di_exec (const char *path, const char *const argv[]) { return di_exec_full (path, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /** * execve like call * * @param path executable with path * @param argv NULL-terminated area of char pointer * @param envp NULL-terminated area of char pointer * @param stdout_handler di_io_handler which gets stdout (and to stderr if stderr_handler is NULL) * @param stderr_handler di_io_handler which gets stderr * @param io_user_data user_data for di_io_handler * @param parent_prepare_handler di_process_handler which is called after the fork in the parent * @param parent_prepare_user_data user_data for parent_prepare_handler * @param child_prepare_handler di_process_handler which is called after the fork in the child * @param child_prepare_user_data user_data for child_prepare_handler * * @return status or error */ int di_exec_env_full (const char *path, const char *const argv[], const char *const envp[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data); /** * execve like call * * @param path executable with path * @param argv NULL-terminated area of char pointer * @param envp NULL-terminated area of char pointer * * @return status or error */ static inline int di_exec_env (const char *path, const char *const argv[], const char *const envp[]) { return di_exec_env_full (path, argv, envp, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /** * execvp like call * * @param file executable * @param argv NULL-terminated area of char pointer * @param stdout_handler di_io_handler which gets stdout (and to stderr if stderr_handler is NULL) * @param stderr_handler di_io_handler which gets stderr * @param io_user_data user_data for di_io_handler * @param parent_prepare_handler di_process_handler which is called after the fork in the parent * @param parent_prepare_user_data user_data for parent_prepare_handler * @param child_prepare_handler di_process_handler which is called after the fork in the child * @param child_prepare_user_data user_data for child_prepare_handler * * @return status or error */ int di_exec_path_full (const char *file, const char *const argv[], di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data); /** * execvp like call * * @param file executable * @param argv NULL-terminated area of char pointer * * @return status or error */ static inline int di_exec_path (const char *file, const char *const argv[]) { return di_exec_path_full (file, argv, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /** * system like call * * @param cmd command * @param stdout_handler di_io_handler which gets stdout * @param stderr_handler di_io_handler which gets stderr * @param io_user_data user_data for di_io_handler * @param parent_prepare_handler di_process_handler which is called after the fork in the parent * @param parent_prepare_user_data user_data for parent_prepare_handler * @param child_prepare_handler di_process_handler which is called after the fork in the child * @param child_prepare_user_data user_data for child_prepare_handler * * @return status or error */ int di_exec_shell_full (const char *const cmd, di_io_handler *stdout_handler, di_io_handler *stderr_handler, void *io_user_data, di_process_handler *parent_prepare_handler, void *parent_prepare_user_data, di_process_handler *child_prepare_handler, void *child_prepare_user_data); /** * system like call * * @param cmd command * * @return status or error */ static inline int di_exec_shell (const char *const cmd) { return di_exec_shell_full (cmd, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } /** * system like call with output via log * * @param cmd command * * @return status or error */ inline static int di_exec_shell_log (const char *const cmd) { return di_exec_shell_full (cmd, di_exec_io_log, NULL, NULL, NULL, NULL, NULL, NULL); } /** * mangle status like sh does it: * * if signaled: 128 + signal * * else return code */ int di_exec_mangle_status (int status); /** * @deprecated * Alias of di_exec_shell_log */ inline static int di_execlog (const char *const cmd) __attribute__ ((deprecated)); inline static int di_execlog (const char *const cmd) { return di_exec_shell_log (cmd); } /** @} */ #endif libdebian-installer/include/debian-installer/config.h.in0000644000000000000000000000034011515541630020531 0ustar /* Library version */ #undef LIBDI_VERSION /* Library version - major */ #undef LIBDI_VERSION_MAJOR /* Library version - minor */ #undef LIBDI_VERSION_MINOR /* Library version - revision */ #undef LIBDI_VERSION_REVISION libdebian-installer/include/debian-installer/slist_internal.h0000644000000000000000000000176611557456270021741 0ustar /* * slist_internal.h * * Copyright (C) 2004 Bastian Blank * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef DEBIAN_INSTALLER__SLIST_INTERNAL_H #define DEBIAN_INSTALLER__SLIST_INTERNAL_H #include /** * @addtogroup di_slist * @{ */ /** * @internal */ void internal_di_slist_append_list (di_slist *slist, di_slist *slist_append); /** @} */ #endif libdebian-installer/include/debian-installer.h0000644000000000000000000000165011515541630016664 0ustar #define LIBDEBIAN_INSTALLER_MAP_REAL #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include libdebian-installer/debian/0000755000000000000000000000000012312570774013102 5ustar libdebian-installer/debian/libdebian-installer-extra4.install0000644000000000000000000000005112271462253021573 0ustar usr/lib/*/libdebian-installer-extra.so.* libdebian-installer/debian/libdebian-installer-extra4.shlibs.local0000644000000000000000000000002611515541630022501 0ustar libdebian-installer 4 libdebian-installer/debian/rules0000755000000000000000000000250512271462253014160 0ustar #! /usr/bin/make -f %: dh $@ --builddirectory=build --with autoreconf DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) #CFLAGS = -Wall -W -Werror -ggdb -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes CFLAGS = -Wall -W -Werror -ggdb -Wmissing-declarations ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -Os -fomit-frame-pointer endif export CFLAGS override_dh_auto_build: dh_auto_build $(MAKE) -C build/doc doc override_dh_install: install $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdebian-installer.so.4 $(CURDIR)/debian/libdebian-installer4-udeb/lib install $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdebian-installer-extra.so.4 $(CURDIR)/debian/libdebian-installer-extra4-udeb/lib dh_install --sourcedir=debian/tmp override_dh_makeshlibs: dh_makeshlibs -plibdebian-installer4 -V \ --add-udeb=libdebian-installer4-udeb dh_makeshlibs -plibdebian-installer-extra4 -V \ --add-udeb=libdebian-installer-extra4-udeb override_dh_shlibdeps: dh_shlibdeps -N libdebian-installer-extra4 -N libdebian-installer-extra4-udeb dh_shlibdeps -p libdebian-installer-extra4 -p libdebian-installer-extra4-udeb -- -L$(CURDIR)/debian/libdebian-installer-extra4.shlibs.local libdebian-installer/debian/libdebian-installer4-dev.install0000644000000000000000000000014612271462253021233 0ustar usr/include usr/lib/*/*.a usr/lib/*/*.so usr/lib/*/pkgconfig usr/share/doc/libdebian-installer4-dev/* libdebian-installer/debian/libdebian-installer4.install0000644000000000000000000000004312271462253020453 0ustar usr/lib/*/libdebian-installer.so.* libdebian-installer/debian/copyright0000644000000000000000000000422311557456270015042 0ustar This is a common library for Debian GNU/Linux installer. Authors: David Whedon Bastian Blank many others The combined code is copyrighted by: Copyright © 2001-2002 David Whedon|Kimdon Copyright © 2001-2002 Tollef Fog Heen Copyright © 2002-2003 Martin Sjogren Copyright © 2002 Junichi Uekawa Copyright © 2002 Michael Cardenas Copyright © 2003-2009 Bastian Blank Copyright © 2003-2004 Petter Reinholdtsen Copyright © 2003-2004 Petter Reinholdtsen Copyright © 2003-2008 Joey Hess Copyright © 2004 Matt Kraai Copyright © 2004 Alastair McKinstry Copyright © 2004-2008 Stephen R. Marenka Copyright © 2004-2006 Thiemo Seufer Copyright © 2004 Joshua Kwan Copyright © 2005 Matt Zimmerman Copyright © 2005-2009 Colin Watson Copyright © 2006-2009 Martin Michlmayr Copyright © 2007 Sven Luther Copyright © 2007-2009 Frans Pop Copyright © 2008 Aurélien Jarno Copyright © 2008 Julien Blache Copyright © 2009 Michael Casadevall This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. libdebian-installer/debian/libdebian-installer4-udeb.dirs0000644000000000000000000000000411515541630020655 0ustar lib libdebian-installer/debian/source/0000755000000000000000000000000012271462253014376 5ustar libdebian-installer/debian/source/format0000644000000000000000000000001512271462253015605 0ustar 3.0 (native) libdebian-installer/debian/compat0000644000000000000000000000000212271462253014274 0ustar 9 libdebian-installer/debian/control0000644000000000000000000000642112271462253014504 0ustar Source: libdebian-installer Section: libs Priority: optional Maintainer: Ubuntu Installer Team XSBC-Original-Maintainer: Debian Install System Team Uploaders: Bastian Blank , Colin Watson , Christian Perrier Build-Depends: dpkg-dev (>= 1.13.5), debhelper (>= 9), dh-autoreconf, doxygen Standards-Version: 3.9.4 XS-Debian-Vcs-Browser: http://anonscm.debian.org/gitweb/?p=d-i/libdebian-installer.git XS-Debian-Vcs-Git: git://anonscm.debian.org/d-i/libdebian-installer.git Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/libdebian-installer/ubuntu Package: libdebian-installer4 Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: Library of common debian-installer functions This library is used by debian-installer to perform common functions such as logging messages and executing commands. If you aren't working on debian-installer or building your own install system based on debian-installer, then you probably don't need this library. Package: libdebian-installer4-dev Section: libdevel Architecture: any Depends: ${misc:Depends}, libdebian-installer4 (= ${binary:Version}), libdebian-installer-extra4 (= ${binary:Version}) Conflicts: libdebian-installer-dev Provides: libdebian-installer-dev Description: Library of common debian-installer functions This library is used by debian-installer to perform common functions such as logging messages and executing commands. If you aren't working on debian-installer or building your own install system based on debian-installer, then you probably don't need this library. . This package contains files needed to do libdebian-installer development. Package: libdebian-installer4-udeb Package-Type: udeb Section: debian-installer Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Library of common debian-installer functions This library is used by debian-installer to perform common functions such as logging messages and executing commands. If you aren't working on debian-installer or building your own install system based on debian-installer, then you probably don't need this library. Package: libdebian-installer-extra4 Architecture: any Multi-Arch: same Depends: ${shlibs:Depends}, ${misc:Depends}, libdebian-installer4 (= ${binary:Version}) Description: Library of some extra debian-installer functions This library is used by debian-installer to perform common functions such as logging messages and executing commands. If you aren't working on debian-installer or building your own install system based on debian-installer, then you probably don't need this library. Package: libdebian-installer-extra4-udeb Package-Type: udeb Section: debian-installer Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, libdebian-installer4-udeb (= ${binary:Version}) Provides: libdebian-installer-extra4 Description: Library of some extra debian-installer functions This library is used by debian-installer to perform common functions such as logging messages and executing commands. If you aren't working on debian-installer or building your own install system based on debian-installer, then you probably don't need this library. libdebian-installer/debian/libdebian-installer-extra4-udeb.dirs0000644000000000000000000000000411515541630021776 0ustar lib libdebian-installer/debian/changelog0000644000000000000000000011261512312570772014760 0ustar libdebian-installer (0.88ubuntu4) trusty; urgency=medium * Report the Calxeda ECX-2000 as generic-lpae, not generic, to match base-installer which already has a different way to detect LPAE (thanks, dann frazier; LP: #1293832). -- Colin Watson Thu, 20 Mar 2014 13:49:45 +0000 libdebian-installer (0.88ubuntu3) trusty; urgency=medium * Build for ppc64el. -- Colin Watson Mon, 27 Jan 2014 13:54:00 +0000 libdebian-installer (0.88ubuntu2) trusty; urgency=low * Add support for keystone subarch -- Michael Casadevall Thu, 02 Jan 2014 06:10:22 -0500 libdebian-installer (0.88ubuntu1) trusty; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add more OMAP4 Panda support. - Add OMAP4 Blaze support. - Add ArmadaXP support. - Add Calxeda Highbank support. - Add Freescale "P4080 DS" and "QEMU e500" support. - Add Calxedda ECX-2000 support. (LP: #1196946) - Add support for EXYNOS5440-based platforms (LP: #1231251) - Add support for the WandBoard quad. -- Stéphane Graber Thu, 14 Nov 2013 17:12:57 -0500 libdebian-installer (0.88) unstable; urgency=low [ Colin Watson ] * Drop the nonnull function attribute from di_mem_chunk_new and internal_di_mem_chunk_compute_size; it is meaningless on functions none of whose parameters are pointers, and clang warns about this. * Switch from INCLUDES to AM_CPPFLAGS in Makefile.am files. * Restore handling of pipe errors, since this is now a build failure in Debian due to -Werror=unused-result. * Convert to multiarch. (libdebian-installer4-dev cannot currently be Multi-Arch: same due to differences in doxygen output.) [ Dmitrijs Ledkovs ] * Set debian source format to '3.0 (native)'. * Bump debhelper compat level to 9. * Set Vcs-* to canonical format. [ Christian Perrier ] * Update Standards to 3.9.4 (checked) -- Christian Perrier Sun, 14 Jul 2013 13:18:37 +0200 libdebian-installer (0.87ubuntu5) trusty; urgency=low * Add support for the WandBoard quad. -- Stéphane Graber Mon, 11 Nov 2013 17:04:01 -0500 libdebian-installer (0.87ubuntu4) saucy; urgency=low * Add support for EXYNOS5440-based platforms (LP: #1231251) -- dann frazier Thu, 03 Oct 2013 13:52:12 +0100 libdebian-installer (0.87ubuntu3) saucy; urgency=low * Change the Calxeda ECX-2000 suggested kernel to generic-lpae. -- Adam Conrad Tue, 10 Sep 2013 15:27:10 -0400 libdebian-installer (0.87ubuntu2) saucy; urgency=low * Add Calxedda ECX-2000 support. (LP: #1196946) -- Dmitrijs Ledkovs Wed, 21 Aug 2013 23:35:25 +0100 libdebian-installer (0.87ubuntu1) saucy; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add more OMAP4 Panda support. - Add OMAP4 Blaze support. - Add ArmadaXP support. - Add Calxeda Highbank support. - Add Freescale "P4080 DS" and "QEMU e500" support. -- Colin Watson Sat, 25 May 2013 00:41:12 +0100 libdebian-installer (0.87) unstable; urgency=low * Drop autotools-dev dh sequence (autoreconf already does what's needed and one should use only one of them anyway), and autotools-dev build-dep. * Update the HACKING file: no need for a manual “autoreconf -i -v” when building a Debian package. That clutters source diffs, which the autoreconf dh sequence aims at keeping clean, be it only for release managers' ease of reviewing. -- Cyril Brulebois Tue, 09 Apr 2013 04:50:44 +0200 libdebian-installer (0.86) unstable; urgency=low * Drop support for PGP signed files in RFC822 parser. -- Bastian Blank Sat, 06 Apr 2013 15:33:36 +0200 libdebian-installer (0.85ubuntu3) raring; urgency=low * Switch to using the "generic" kernel flavor for Calxeda Highbank * Update hardware map for Highbank to match the model string exposed by /proc/device-tree/model since that takes precedence over /proc/cpuinfo (LP: #1166595) -- dann frazier Thu, 11 Apr 2013 10:57:19 +0100 libdebian-installer (0.85ubuntu2) raring; urgency=low * Add platform detection of "P4080 DS" and "QEMU e500" to produce "powerpc/fsl" for result. The "fsl" subarch can be expanded for other Freescale platforms. I'll probably add a full list at some point. -- Ben Collins Thu, 17 Jan 2013 14:11:03 -0500 libdebian-installer (0.85ubuntu1) raring; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add more OMAP4 Panda support. - Add OMAP4 Blaze support. - Add ArmadaXP support. - Add Calxeda Highbank support. -- Colin Watson Sun, 25 Nov 2012 15:00:07 +0000 libdebian-installer (0.85) unstable; urgency=low * Add support for versatile express platform. -- Aurelien Jarno Sat, 20 Oct 2012 14:30:32 +0200 libdebian-installer (0.84) unstable; urgency=low [ Steve McIntyre ] * Add "efi" as a subarch for amd64 and i386 -- Cyril Brulebois Thu, 20 Sep 2012 16:13:10 +0200 libdebian-installer (0.83) unstable; urgency=low * Re-upload without files from git checkout. * Use dh-autoreconf to avoid huge diffs when automake gets an update: - Add dh-autoreconf to Build-Depends. - Use the autoreconf dh sequence. - Get rid of the configure target accordingly (it was running autoreconf, then exiting with error code 1). * Simplify the config.{guess,sub} update by using the autotools-dev dh sequence. -- Cyril Brulebois Sun, 12 Aug 2012 21:21:55 +0200 libdebian-installer (0.82) unstable; urgency=low [ Ian Campbell ] * Support for reading hardware model from Device Tree (armel). * Add Dreamplug device (Kirkwood) [ Christian Perrier ] * Add myself to Uploaders. * Replace XC-Package-Type by Package-Type. * Update Standards to 3.9.3. -- Christian Perrier Tue, 07 Aug 2012 22:03:02 +0200 libdebian-installer (0.81) unstable; urgency=low [ Simon Guinot ] * Add LaCie NAS devices (Kirkwood) Closes: #670527 [ Julien Cristau ] * parser_rfc822: mmap returns MAP_FAILED on error, not NULL. [ Bastian Blank ] * Support PGP signed files in RFC822 parser. (closes: #674060) -- Bastian Blank Fri, 01 Jun 2012 18:50:51 +0200 libdebian-installer (0.80) unstable; urgency=low * Detect IBM pSeries platform as powerpc/chrp_ibm. -- Aurelien Jarno Mon, 02 Jan 2012 23:45:48 +0100 libdebian-installer (0.79ubuntu3) quantal; urgency=low * Add support for Calxeda Highbank -- Michael Casadevall Wed, 16 May 2012 14:41:24 +0100 libdebian-installer (0.79ubuntu2) precise; urgency=low * Add support for ArmadaXP (LP: #934451) -- Michael Casadevall Wed, 22 Feb 2012 20:41:10 -0800 libdebian-installer (0.79ubuntu1) precise; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add the i386/efi and amd64/efi platforms. - Add more OMAP4 Panda support. - Add OMAP4 Blaze support. -- Colin Watson Mon, 17 Oct 2011 22:59:00 +0100 libdebian-installer (0.79) unstable; urgency=low [ Hector Oron ] * subarch-arm-linux.c: add mx5 flavour (armhf architecture) [ Sebastian Reichel ] * Add support for Nokia N900 * Add support for Pandaboard * Add support for Beagleboard [ Luk Claes ] * Do'nt ship .la files (Closes: #621628). [ Otavio Salvador ] * devfs: linux references the CD device as srX instead of scdX. Closes: #635400. -- Otavio Salvador Wed, 27 Jul 2011 23:00:47 +0200 libdebian-installer (0.78ubuntu1) oneiric; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add Beagle OMAP3 support. - Add the i386/efi and amd64/efi platforms. - Add OMAP4 Panda and Blaze support. -- Colin Watson Mon, 02 May 2011 09:04:49 +0100 libdebian-installer (0.78) unstable; urgency=low [ Jeremie Koenig ] * internal_di_exec(): use feof() instead of preprocessor conditionals to handle the os-dependant status returned by poll() on end-of-file (closes: #584538). [ Martin Michlmayr ] * Add support for Buffalo Linkstation LiveV3 (LS-CHL). Closes: #612168 * Add support for Buffalo Linkstation Mini (LS-WSGL). [ Konstantinos Margaritis ] * Add support for the new armhf port and the Genesi EfikaMX Smartbook/ Smarttop platforms. [ Bastian Blank ] * Add minimal support for SHA1 checksums in Release file parser. * Adopt copyright file to reality. [ Colin Watson ] * Add a proper copyright/licence statement to subarch-x86-linux.c. -- Hector Oron Tue, 22 Mar 2011 12:04:06 +0000 libdebian-installer (0.77ubuntu2) natty; urgency=low * Map "OMAP4 Panda board" to armel/omap4 (LP: #744862). -- Colin Watson Sun, 10 Apr 2011 22:06:11 +0100 libdebian-installer (0.77ubuntu1) natty; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add Beagle OMAP3 support. - Add the i386/efi and amd64/efi platforms. - Add OMAP4 Panda and Blaze support. -- Colin Watson Mon, 31 Jan 2011 18:54:33 +0000 libdebian-installer (0.77) unstable; urgency=low [ Milan Kupcevic ] * subarch-powerpc-linux.c: Shorten unnecessarily long Efika machine map entry to let it match with "Efika 5200B PowerPC System" machine string, too. * subarch-powerpc-linux.c: Add support for YDL PowerStation, a CHRP machine with IBM Bimini board and SLOF firmware (closes: #603891). -- Otavio Salvador Fri, 24 Dec 2010 19:25:56 -0200 libdebian-installer (0.76ubuntu2) maverick; urgency=low * add support for the OMAP4 Panda Board * add support for the OMAP4 Blaze board -- Oliver Grawert Thu, 16 Sep 2010 14:13:02 +0200 libdebian-installer (0.76ubuntu1) maverick; urgency=low * Resynchronise with Debian, in order to get Michael's archdetect heuristic work for Maverick. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add Beagle OMAP3 support. - Add the i386/efi and amd64/efi platforms. -- Colin Watson Tue, 14 Sep 2010 17:59:37 +0100 libdebian-installer (0.76) unstable; urgency=low [ Martin Michlmayr ] * Add the Seagate FreeAgent DockStar. [ Michael Casadevall ] * Add di_system_subarch_analyze_guess function (stub on architectures other than armel) adding a heuristic option that makes it easier to bring up new boards. See http://lists.debian.org/debian-boot/2010/08/msg00641.html for rationale. -- Colin Watson Tue, 14 Sep 2010 15:02:00 +0100 libdebian-installer (0.75) unstable; urgency=low [ Martin Michlmayr ] * Add support for loongson-2e and loongson-2f. [ Colin Watson ] * Use 'dh $@ --options' rather than 'dh --options $@', for forward-compatibility with debhelper v8. * When selecting among packages providing a virtual package, consider whether any of the choices are already marked for installation. [ Jeremie Koenig ] * Re-enable doxygen build on hurd-i386. -- Colin Watson Thu, 05 Aug 2010 21:56:46 +0100 libdebian-installer (0.74) unstable; urgency=low * Add support for OpenRD-Ultimate. -- Martin Michlmayr Sat, 19 Jun 2010 11:00:17 +0100 libdebian-installer (0.73) unstable; urgency=low * Add support for the HP t5325 Thin Client -- Martin Michlmayr Sun, 13 Jun 2010 20:06:12 +0100 libdebian-installer (0.72) unstable; urgency=low * Add support for the eSATA SheevaPlug. -- Martin Michlmayr Mon, 24 May 2010 14:05:03 +0100 libdebian-installer (0.71) unstable; urgency=low * Add support for the GuruPlug. -- Martin Michlmayr Mon, 24 May 2010 14:02:30 +0100 libdebian-installer (0.70) unstable; urgency=low * Add support for SH4 RTS7751R2D and SH7785LCR boards. -- Aurelien Jarno Thu, 13 May 2010 12:19:18 +0200 libdebian-installer (0.69ubuntu2) maverick; urgency=low * archdetect: Add the i386/efi and amd64/efi platforms. -- Colin Watson Thu, 10 Jun 2010 18:18:31 +0100 libdebian-installer (0.69ubuntu1) maverick; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. - Add Beagle OMAP3 support. -- Colin Watson Thu, 06 May 2010 15:50:08 +0100 libdebian-installer (0.69) unstable; urgency=low [ Frans Pop ] * Use XC-Package-Type instead of XB-Package-Type. [ Martin Michlmayr ] * Add support for QNAP TS-41x. -- Martin Michlmayr Tue, 03 Nov 2009 18:11:44 +0000 libdebian-installer (0.68ubuntu3) lucid; urgency=low * Reupload with the right autotools bits. -- Colin Watson Tue, 13 Apr 2010 13:00:20 +0100 libdebian-installer (0.68ubuntu2) lucid; urgency=low * add beagle OMAP3 support -- Oliver Grawert Tue, 13 Apr 2010 13:09:26 +0200 libdebian-installer (0.68ubuntu1) lucid; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add Dove SoC subarchitecture. -- Colin Watson Mon, 02 Nov 2009 17:49:09 -0800 libdebian-installer (0.68) unstable; urgency=low [ Martin Michlmayr ] * Add support for Marvell's OpenRD Base and Client. -- Martin Michlmayr Fri, 25 Sep 2009 19:03:44 +0100 libdebian-installer (0.67) unstable; urgency=low [ Aurelien Jarno ] * Fix internal_di_exec() in case of a working poll() implementation. This fixes d-i on GNU/kFreeBSD when running on dual-core CPU or more. -- Aurelien Jarno Fri, 04 Sep 2009 00:06:07 +0200 libdebian-installer (0.66) unstable; urgency=low [ Colin Watson ] * Upgrade to debhelper v7. [ Aurelien Jarno ] * Don't use devfs-mapping on non Linux architectures. -- Aurelien Jarno Fri, 21 Aug 2009 23:58:03 +0200 libdebian-installer (0.65) unstable; urgency=low [ Aurelien Jarno ] * Teach archdetect about GNU/kFreeBSD. * Fix build with recent automake by removing GNU extension usage in doc/Makefile.am. * Point to the right GPL version in debian/copyright. -- Aurelien Jarno Thu, 13 Aug 2009 17:02:11 +0200 libdebian-installer (0.64) unstable; urgency=low [ Colin Watson ] * Remove a duplicated line from debian/copyright. [ Luca Favatella ] * The poll() system call has EOF-related portability issues. Solve them on kfreebsd-i386. Thanks to Colin Watson for the "poll() and EOF" URL. [ Wouter Verhelst ] * Teach archdetect about the Intel SS4000-E -- Otavio Salvador Sat, 18 Jul 2009 11:06:19 -0300 libdebian-installer (0.63ubuntu2) karmic; urgency=low [ Michael Casadevall ] * Added Dove SoC subarchitecture (LP: #409238) -- Colin Watson Mon, 24 Aug 2009 12:26:17 +0100 libdebian-installer (0.63ubuntu1) karmic; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. -- Colin Watson Thu, 25 Jun 2009 22:29:52 +0100 libdebian-installer (0.63) unstable; urgency=low [ Michael Casadevall ] * Add subarchitecture imx51 for Freescale iMX51 SoCs (LP: #345534). [ Colin Watson ] * Fix memory leak in subarch-x86-linux.c:di_system_subarch_analyze. [ Christian Perrier ] * Remplace obsolete ${Source-Version} by ${binary:Version} in dependencies (any->any dependency) * Update Standards to 3.8.1 (no change) * Include complete copyright for the code by going through the package changelog -- Christian Perrier Sat, 13 Jun 2009 14:20:34 +0200 libdebian-installer (0.62ubuntu1) karmic; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. - Add subarchitecture imx51 for Freescale iMX51 SoCs. * Remove rather silly fwrite _FORTIFY_SOURCE workaround, since Ubuntu's glibc no longer requires this. -- Colin Watson Tue, 28 Apr 2009 12:09:26 +0100 libdebian-installer (0.62) unstable; urgency=low [ Martin Michlmayr ] * Add support for Marvell's Kirkwood platform, including devices such as the SheevaPlug and QNAP TS-219. -- Martin Michlmayr Fri, 27 Mar 2009 18:03:49 +0100 libdebian-installer (0.61ubuntu2) jaunty; urgency=low [ Michael Casadevall ] * Added subarchitecture imx51 for Freescale iMX51 SoCs (LP: #345534). -- Colin Watson Fri, 27 Mar 2009 11:54:26 +0000 libdebian-installer (0.61ubuntu1) jaunty; urgency=low * Resynchronise with Debian. Remaining changes: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. -- Colin Watson Mon, 03 Nov 2008 13:41:45 +0000 libdebian-installer (0.61) unstable; urgency=low [ Bastian Blank ] * Fix off-by-one error in the rfc822 parser (closes: #500378). * Remove workarounds for ignored errors. -- Frans Pop Sat, 27 Sep 2008 18:37:27 +0200 libdebian-installer (0.60) unstable; urgency=low [ Colin Watson ] * Remove incorrect unused attribute from di_packages_parser_read_name's user_data parameter. * Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. Why exactly glibc demands that fwrite be checked but not fputs is beyond me. -- Otavio Salvador Tue, 23 Sep 2008 21:36:38 -0300 libdebian-installer (0.59ubuntu1) intrepid; urgency=low * Backport from trunk: - Appease the combination of _FORTIFY_SOURCE=2 (used by default on Ubuntu) and -Werror. Why exactly glibc demands that fwrite be checked but not fputs is beyond me. -- Colin Watson Tue, 02 Sep 2008 13:07:03 +0100 libdebian-installer (0.59) unstable; urgency=low * Apply patch to include 'Apple Inc.' as a possible vendor string for a Intel's based Mac. Thanks to Julien BLACHE for the patch (closes: #483182). -- Otavio Salvador Tue, 29 Jul 2008 12:13:29 -0300 libdebian-installer (0.58) unstable; urgency=low [ Martin Michlmayr ] * Add support for QNAP TS-409 (orion5x) * Add support for HP Media Vault mv2120 (orion5x). * Add support for Buffalo Linkstation Pro/Live (orion5x). -- Martin Michlmayr Sun, 11 May 2008 09:44:21 +0200 libdebian-installer (0.57) unstable; urgency=low [ Frans Pop ] * Add support for PA Semi's evaluation systems (closes: #464429). Thanks to Olof Johansson for the patch. [ Martin Michlmayr ] * Rename orion to orion5x to allow for support of other Orion platforms in the future. -- Martin Michlmayr Sat, 22 Mar 2008 18:13:19 +0100 libdebian-installer (0.56) unstable; urgency=low [ Bastian Blank ] * Return more correct errors fom execution. [ Joey Hess ] * Fix subarch detection of mips on current versions of qemu. The cpu model is reported as "MIPS 24K", not "MIPS 4K". Left the old value in to support old qemu versions. -- Joey Hess Thu, 06 Mar 2008 18:18:13 -0500 libdebian-installer (0.55) unstable; urgency=low [ Stephen R. Marenka ] * archdetect: Add support for m68k/aranym (atari). [ Aurelien Jarno ] * archdetect: Add support for mips{,el}/{4,5}kc-malta platforms. [ Martin Michlmayr ] * archdetect: Add support for QNAP TS-109/TS-209. -- Martin Michlmayr Tue, 05 Feb 2008 11:12:15 -0700 libdebian-installer (0.54) unstable; urgency=low [ Frans Pop ] * Add Description field to pkg-config files as their absence is making 'pkg-config --list-all' fail. Closes: #453187. * Make Name in pkg-config files a bit more descriptive. [ Martin Michlmayr ] * Add support for the Orion (ARM) platform. -- Martin Michlmayr Thu, 29 Nov 2007 09:10:54 +0100 libdebian-installer (0.53) unstable; urgency=low * Remove compatibility with ancient dpkg-architecture; build-depend on newer dpkg-dev instead. * archdetect: Add the powerpc/cell platform. -- Colin Watson Sat, 20 Oct 2007 03:34:24 +0100 libdebian-installer (0.52) unstable; urgency=low [ Joey Hess ] * Move one more resolver debug message to ENABLE_EXTENSIVE_DEBUG. [ Martin Michlmayr ] * Match SGI O2 machines with 300MHz RM5200SC (Nevada) CPUs. [ Colin Watson ] * archdetect: Add the powerpc/ps3 platform. -- Frans Pop Sat, 30 Jun 2007 08:45:53 +0200 libdebian-installer (0.51) unstable; urgency=low * archdetect: Add the i386/mac and amd64/mac platforms, using reduced code from dmidecode. -- Colin Watson Sun, 08 Apr 2007 22:09:41 +0100 libdebian-installer (0.50) unstable; urgency=low [ Joey Hess ] * Add back subarch-armeb-linux.c, and modify the Makefile to include it, so it's used after all. * Add support for armel. -- Frans Pop Thu, 22 Feb 2007 12:11:32 +0100 libdebian-installer (0.49) unstable; urgency=low [ Joey Hess ] * Remove subarch-armeb-linux.c, which was never used. subarch-arm-linux.c is used for all arm variants. -- Frans Pop Sun, 18 Feb 2007 13:44:15 +0100 libdebian-installer (0.48) unstable; urgency=low [ Sven Luther ] * Added support for Efika /proc/cpuinfo machine field. Closes: #403293. -- Frans Pop Tue, 13 Feb 2007 23:24:24 +0100 libdebian-installer (0.47) unstable; urgency=low * Fix FTBFS on mips/mipsel. -- Thiemo Seufer Wed, 22 Nov 2006 15:59:38 +0000 libdebian-installer (0.46) unstable; urgency=low [ Thiemo Seufer ] * archdetect: Add mips/qemu-mips32 and mipsel/qemu-mips32. [ Colin Watson ] * include/debian-installer/macros.h: Add DI_GNUC_PREREQ macro useful for making use of __attribute__ in various places throughout d-i. -- Frans Pop Wed, 22 Nov 2006 15:06:29 +0100 libdebian-installer (0.45) unstable; urgency=low * archdetect: Add the ARM Versatile platform. * archdetect: Return ixp4xx rather than nslu2 on Linksys NSLU2 since the NSLU2-specific flavour is no longer needed. -- Martin Michlmayr Sat, 30 Sep 2006 17:10:13 +0200 libdebian-installer (0.44) unstable; urgency=low * archdetect: Add the arm/iop32x platform, listing a number if Intel evaluation boards, the Thecus N2100 and N4100 and the GLAN Tank. * archdetect: Add the arm/iop33x platform, listing a number if Intel evaluation boards. * archdetect: Add the arm/ixp4xx platform. -- Martin Michlmayr Mon, 21 Aug 2006 00:21:24 +0200 libdebian-installer (0.43) unstable; urgency=low * Add mapping for I20 hard disks. Patch from Robert Millan Closes: #373730 * Call dh_makeshlibs w/o -n to get postinsts created. * Current policy. -- Joey Hess Thu, 15 Jun 2006 14:48:35 -0400 libdebian-installer (0.42) unstable; urgency=low [ Bastian Blank ] * Bump shared library revision to 6. * Add small AVL tree implementation. [ Martin Michlmayr ] * Remove (incomplete) BAST and LAST support. * Drop Riscstation since it's no longer supported in 2.6 kernels. * Rename arm/riscpc to arm/rpc for consistency. [ Colin Watson ] * Fix Hurd detection at build time. [ Joey Hess ] * Move more resolver debug logging into ENABLE_EXTENSIVE_DEBUG ifdefs. -- Bastian Blank Wed, 31 May 2006 23:02:10 +0200 libdebian-installer (0.41) unstable; urgency=low * --add-udeb only works for one udeb, correct dh_makeshlibs call to not generate bad udeb shlibs. -- Joey Hess Sat, 18 Mar 2006 14:15:07 -0500 libdebian-installer (0.40) unstable; urgency=low [ Martin Michlmayr ] * archdetect: Add support for the Broadcom BCM91480B evaluation board (aka "BigSur"). * archdetect: Rename sb1-swarm-bn to sb1-bcm91250a for consistency. * archdetect: Remove ARM platforms we don't actually support. * archdetect: Remove mips/mipsel platforms we don't actually support. [ Joey Hess ] * Make libdebian-installer-extra4-udeb depend on libdebian-installer-udeb, not the deb. -- Martin Michlmayr Fri, 17 Mar 2006 22:42:16 +0000 libdebian-installer (0.39) unstable; urgency=low * Add udeb lines to shlibs file. * Drop libdebian-installer4-udeb's provide of libdebian-installer4 since it's on the initrd and packages will get a proper dep once they're rebuilt against this. -- Joey Hess Wed, 15 Mar 2006 15:10:49 -0500 libdebian-installer (0.38) unstable; urgency=low [ Martin Michlmayr ] * Fix synatx error in mipsel file. -- Martin Michlmayr Wed, 18 Jan 2006 20:11:56 +0000 libdebian-installer (0.37) unstable; urgency=low [ Martin Michlmayr ] * Define Broadcom BCM947XX for archdetect. * Define Linksys NSLU2 for archdetect. -- Martin Michlmayr Sat, 14 Jan 2006 23:06:14 +0000 libdebian-installer (0.36) unstable; urgency=low [ Sven Luther ] * No need to list CHRP IBM models explicitly, as this breaks with models we don't know about or newer models, which is unnecessary. (Closes: #338045) -- Colin Watson Mon, 14 Nov 2005 18:58:35 +0000 libdebian-installer (0.35) unstable; urgency=low * Add archdetect support for ADS boards running the 2.6 kernel, including the BitsyXb. -- Joey Hess Wed, 7 Sep 2005 15:07:32 -0400 libdebian-installer (0.34) unstable; urgency=low * Collapse all ADS boards into one ads subarch. -- Joey Hess Thu, 18 Aug 2005 10:10:07 -0400 libdebian-installer (0.33) unstable; urgency=low * Add various ADS arm boards to the archdetect list (AGX, VGX, GCX, Sphere). -- Joey Hess Wed, 17 Aug 2005 09:53:00 -0400 libdebian-installer (0.32) unstable; urgency=low * Update GPL notices with the FSF's new address. * Use -ggdb instead of -gstabs. The latter doesn't work on ia64. -- Colin Watson Wed, 3 Aug 2005 10:36:54 +0100 libdebian-installer (0.31) unstable; urgency=low [ Colin Watson ] * When compiling with gcc, perform printf format string checking on the arguments to di_snprintfcat. * Add di_system_subarch_analyze, moved here from hw-detect. * Bump shared library revision to 5. [ Joey Hess ] * Add loop devices to devfs table. Closes: #320039 -- Colin Watson Thu, 28 Jul 2005 10:08:44 +0100 libdebian-installer (0.30) unstable; urgency=low * Bastian Blank - Bump shared library revision to 4. - Deprecate di_prebaseconfig_append and di_system_prebaseconfig_append. - Add di_exec_path(_full) (execvp wrapper). * Joey Hess - Patch log.c to build under gcc 4.0. Closes: #287384 * Colin Watson - doxygen doesn't work yet on the Hurd, so avoid building documentation there. - Add myself to Uploaders. * Matt Zimmerman - Add devfs-mapping support for UML ubd devices (closes: #258176). -- Colin Watson Wed, 25 May 2005 12:49:09 +0100 libdebian-installer (0.29) unstable; urgency=low * Joey Hess - Re-enable character device mapping. Though it often gets it wrong, the cases where it gets it right are used by prebaseconfig. -- Joey Hess Tue, 15 Jun 2004 12:41:12 -0400 libdebian-installer (0.28) unstable; urgency=low * Joey Hess - fix devfs.c test mode (to really work) - fix /dev/ida support off by one - fix /dev/ataraid support, leave off the cN part of device name - don't map character devices to block device namesb -- Joey Hess Mon, 14 Jun 2004 11:34:03 -0400 libdebian-installer (0.27) unstable; urgency=low * Bastian Blank - anna dependency resolver stops on already installed packages. - Make debugging output a little bit better to read. - Make anna dependency resolver permissive again. - Add an option to enable extensive debugging output. - Fix ABI. (closes: #250299, #253037) * Joshua Kwan - quote an argument in configure.ac to fix test complaining about no LHS for extensive-debug -- Bastian Blank Mon, 14 Jun 2004 14:23:10 +0200 libdebian-installer (0.23) unstable; urgency=low * Bastian Blank - Bump revision to 3. - Add a special dependency resolver type for anna (checks Kernel-Version and Subarchitecture) (unstable interface). - Mark the old Kernel-Version resolver as deprecated. - Remove backward compatiblity from dependency resolver. - Remove two undocumented symbols. - Use debhelper udeb support. - Add environment support to execution helpers. - The size of a hash map is the number of elements, not the size of the array. - RFC822 parser only allows space and horizontal tab before a value. -- Bastian Blank Thu, 13 May 2004 17:50:15 +0200 libdebian-installer (0.22) unstable; urgency=low * Bastian Blank - Fix handling of nonresolvable virtual packages. - Fix handling of subarchitecture strings with different length (closes: #243692). * Joey Hess - Add more major numbers for cciss devices. - Add support for all of the /dev/ida/ devices. Closes: #243411 - Add support for /dev/ataraid/ devices. - Allow devfs.c to be built as a standalone binary, for simplified testing. -- Joey Hess Wed, 21 Apr 2004 23:13:06 -0400 libdebian-installer (0.21) unstable; urgency=low * Bastian Blank - Support diskarrays in mapdevfs. (closes: #235617, #239291) * Thiemo Seufer - Minor code cleanup in the subarchitecture check. -- Joey Hess Mon, 5 Apr 2004 18:49:56 -0400 libdebian-installer (0.20) unstable; urgency=low * Bastian Blank - Bump revision to 2. - Add conversation functions for parts of a package entry (exported interface). - Add support for Kernel-Version to Packages parser. - Fix dependency resolver marker reset. - Split dependency resolver (internal interface). - Add two special dependency resolver types for anna (checks Kernel-Version) and main-menu (never fails) (unstable interface). - Fix Subarchitecture check. * Stephen R. Marenka - Add scsi cd (scd?) device info to mapdevfs. -- Bastian Blank Mon, 15 Mar 2004 11:13:17 +0100 libdebian-installer (0.19) unstable; urgency=low * Bastian Blank - Minimal Packages parser parses Size and Priority. - Packages parser uses simpler matches. -- Bastian Blank Fri, 06 Feb 2004 14:07:18 +0100 libdebian-installer (0.18) unstable; urgency=low * Alastair McKinstry - Add di_info(), di_debug() logging macros. * Bastian Blank - Bump revision to 1. - Remove mapping of di_log. - Add any symbol to the version script. - Use size_t in hash map and mem_chunk allocer. (closes: #215448) - Improve and install documentation. - Add -extra lib. - Fix description parsing. (closes: #219902) - Remove some references to the chunk allocator. - Add version info to installed headers. - Default log handler suppress debug messages. - Enable support for Subarchitecure. - Correctly terminate argv. * Petter Reinholdtsen - Define PATH_MAX if it is undefined, to get this building on GNU/Hurd. Patch from Santiago Vila. (Closes: #219464) * Matt Kraai - Prefer a package that is installed to one that isn't when satisfying a dependency on a virtual package. -- Bastian Blank Wed, 21 Jan 2004 17:56:11 +0100 libdebian-installer (0.17) unstable; urgency=low * Bastian Blank - disable subarch stuff -- Bastian Blank Fri, 03 Oct 2003 18:07:44 +0200 libdebian-installer (0.16) experimental; urgency=low * Bastian Blank - rework lib - add rfc822 parser - add logging - add packages file parsing - dump major to 4 -- Bastian Blank Thu, 28 Aug 2003 17:46:27 +0200 libdebian-installer (0.15) unstable; urgency=low * Bastian Blank - Don't log to stderr and close stdin. - Never cast malloc return values. * Joey Hess - added di_status_read and di_config_package -- Petter Reinholdtsen Tue, 22 Jul 2003 13:19:17 +0200 libdebian-installer (0.14) unstable; urgency=low * Bastian Blank - Add Enhances parsing. * Petter Reinholdtsen - Add support in di_mapdevfs for SW RAID devices, /dev/md#. (Closes: #185574) -- Bastian Blank Sun, 01 Jun 2003 20:54:45 +0200 libdebian-installer (0.13) unstable; urgency=low * Martin Sjögren - Add di_mapdevfs function. - Change section of libdebian-installer3-dev to libdevel. - Add Recommends parsing. - Don't log to stderr, it will interfere with frontends. - Revert to major/minor/micro. current/revision/age is something else. * Bastian Blank - cleanup di_mapdevfs. * Petter Reinholdtsen - Add new functin di_logf(), a vararg version of di_log(). -- Martin Sjogren Sun, 4 May 2003 16:20:20 +0200 libdebian-installer (0.12) unstable; urgency=low * Martin Sjögren - Build-dep on d-shlib >= 0.10 (Closes: #178073). -- Martin Sjogren Fri, 24 Jan 2003 20:24:00 +0100 libdebian-installer (0.11) unstable; urgency=low * Martin Sjögren - Fix depends/provides parser (Closes: #177061). -- Martin Sjogren Fri, 17 Jan 2003 10:49:23 +0100 libdebian-installer (0.10) unstable; urgency=low * Martin Sjögren - Add di_pkg_alloc and di_pkg_free for memory management of package structs. - Add di_list_free for freeing an entire linked list. -- Martin Sjogren Sun, 29 Dec 2002 17:11:57 +0100 libdebian-installer (0.09) unstable; urgency=low * Martin Sjögren - Add di_pkg_toposort_{list,arr} to be used by anna and main-menu. -- Martin Sjogren Sat, 7 Dec 2002 12:14:08 +0100 libdebian-installer (0.08) unstable; urgency=low * Martin Sjögren - Fix di_pkg_is_installed, now it even works! -- Tollef Fog Heen Thu, 5 Dec 2002 00:45:28 +0100 libdebian-installer (0.07) unstable; urgency=low * Martin Sjögren - Add a linked list data structure, decoupling next pointers from the node data - Add a package_dependency struct that has package name and a pointer to a package_t struct - Add functions di_pkg_find, di_pkg_provides, di_pkg_is_virtual, di_pkg_is_installed and di_pkg_resolve_deps - Change maintainer to debian-boot and set dwhedon, tfheen and sjogren as uploaders - Bump standards-version and fix copyright file so lintian shuts up -- Martin Sjogren Fri, 29 Nov 2002 16:36:45 +0100 libdebian-installer (0.06) unstable; urgency=low * Martin Sjögren - Multiple provides - Remove libd-i-pic - Priority parsing - Version number parsing and comparison -- Tollef Fog Heen Wed, 6 Nov 2002 01:46:42 +0100 libdebian-installer (0.05) unstable; urgency=low * change an fprintf to vfprintf. -- Tollef Fog Heen Thu, 24 Oct 2002 12:34:26 +0200 libdebian-installer (0.04) unstable; urgency=low * Fix up section according to override file. * Build "proper" library packages. David Kimdon - add di_prebaseconfig_append() - change my name (s/Whedon/Kimdon/g) Junichi Uekawa - require d-shlibs 0.3 or greater for build - -dev: add devlibs:Depends, require libdebian-installer ${Source-Version} - -pic: depend on exact version of -dev to avoid nasty surprises Martin Sjögren - Add 'Packages' file parsing functionality (di_pkg_parse). - Case insensitive strstr (di_stristr). Michael Cardenas - fix install target so it can be ran more than once -- Tollef Fog Heen Tue, 6 Aug 2002 16:03:45 +0200 libdebian-installer (0.03) unstable; urgency=low * Fix up postinst name. -- Tollef Fog Heen Tue, 6 Aug 2002 15:13:39 +0200 libdebian-installer (0.02) unstable; urgency=low * New name, which will hopefully be accepted by ftp-master. * Removed emacs cruft from changelog. * Add di_snprintfcat, courtesy of thomas poindessous -- Tollef Fog Heen Mon, 20 May 2002 23:21:24 +0200 libd-i (0.01) unstable; urgency=low * Initial Release. -- David Whedon Thu, 8 Feb 2001 21:54:45 -0800 libdebian-installer/doc/0000755000000000000000000000000012054430476012422 5ustar libdebian-installer/doc/Makefile.am0000644000000000000000000000063011515541630014451 0ustar docdir = $(datadir)/doc/$(PACKAGE)$(LIBRARY_VERSION_MAJOR)-dev doc html: $(DOXYGEN) install-data-local: @if [ -e html ]; then \ $(MAKE) install-real-html; \ fi clean-local: rm -rf html latex install-real-html: html $(mkinstalldirs) $(DESTDIR)$(docdir)/html @for p in html/*; do \ echo " $(INSTALL_DATA) $$p $(DESTDIR)$(docdir)/$$p"; \ $(INSTALL_DATA) $$p $(DESTDIR)$(docdir)/$$p; \ done libdebian-installer/doc/libdebian-installer0000644000000000000000000000232011515541630016242 0ustar /** @defgroup di_exec Exec functions */ /** @defgroup di_hash Hash functions @{ */ /** @defgroup di_hash_table Simple hash table */ /** @} */ /** @defgroup di_list Double-linked list */ /** @defgroup di_slist Single-linked list */ /** @defgroup di_log Logging */ /** @defgroup di_mem Memory management @{ */ /** @defgroup di_mem_chunk Memory chunk allocer */ /** @} */ /** @defgroup di_package Package @{ */ /** @defgroup di_package_parser Parser */ /** @} */ /** @defgroup di_packages Packages file @{ */ /** @defgroup di_packages_parser Parser */ /** @} */ /** @defgroup di_parser Generic Parser @{ */ /** @defgroup di_parser_rfc822 RFC822 parser */ /** @} */ /** @defgroup di_release Release file @{ */ /** @defgroup di_release_parser Parser */ /** @} */ /** @defgroup di_string String */ /** @defgroup di_types Type definitions */ /** @defgroup di_utils Utils */ /** @defgroup di_system System @{ */ /** @defgroup di_system_dpkg DPKG */ /** @defgroup di_system_devfs DevFS */ /** @defgroup di_system_packages Packages */ /** @defgroup di_system_prebaseconfig Prebaseconfig */ /** @defgroup di_system_subarch Subarchitecture detection */ /** @defgroup di_system_utils Utils */ /** @} */ libdebian-installer/doc/Doxyfile.in0000644000000000000000000012525111515541630014537 0ustar # Doxyfile 1.3.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = libdebian-installer # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = . # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, # Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en # (Japanese with English messages), Korean, Norwegian, Polish, Portuguese, # Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited # members of a class in the documentation of that class as if those members were # ordinary class members. Constructors, destructors and assignment operators of # the base classes will not be shown. INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. It is allowed to use relative paths in the argument list. STRIP_FROM_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explict @brief command for a brief description. JAVADOC_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources # only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = NO #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = @top_srcdir@/doc/libdebian-installer @top_srcdir@/include/ @top_srcdir@/src/ # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories # that are symbolic links (a Unix filesystem feature) are excluded from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. INPUT_FILTER = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = YES # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output dir. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = YES # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimised for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assigments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_PREDEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = ../include/ # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = *.h # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse the # parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::addtions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or # super classes. Setting the tag to NO turns the diagrams off. Note that this # option is superceded by the HAVE_DOT option below. This is only a fallback. It is # recommended to install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similiar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found on the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes that # lay further from the root node will be omitted. Note that setting this option to # 1 or 2 may greatly reduce the computation time needed for large code bases. Also # note that a graph may be further truncated if the graph's image dimensions are # not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT). # If 0 is used for the depth value (the default), the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::addtions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO libdebian-installer/configure.ac0000644000000000000000000000630711515541630014145 0ustar AC_INIT([libdebian-installer],m4_esyscmd(dpkg-parsechangelog | perl -ne 'print $1 if m/^Version: (.*)$/;')) AM_INIT_AUTOMAKE([]) AM_MAINTAINER_MODE AC_PROG_CC AC_PROG_LIBTOOL AC_CHECK_FUNCS(memrchr) AC_CHECK_PROGS(DOXYGEN, doxygen, true) LIBRARY_VERSION_MAJOR=4 LIBRARY_VERSION_MINOR=0 LIBRARY_VERSION_REVISION=7 LIBRARY_VERSION="$LIBRARY_VERSION_MAJOR.$LIBRARY_VERSION_MINOR.$LIBRARY_VERSION_REVISION" LIBRARY_VERSION_LIBTOOL="$LIBRARY_VERSION_MAJOR:$LIBRARY_VERSION_MINOR:$LIBRARY_VERSION_REVISION" AC_SUBST(LIBRARY_VERSION_LIBTOOL) AC_SUBST(LIBRARY_VERSION_MAJOR) AC_DEFINE_UNQUOTED(LIBDI_VERSION_MAJOR,$LIBRARY_VERSION_MAJOR,[Library version - major]) AC_DEFINE_UNQUOTED(LIBDI_VERSION_MINOR,$LIBRARY_VERSION_MINOR,[Library version - minor]) AC_DEFINE_UNQUOTED(LIBDI_VERSION_REVISION,$LIBRARY_VERSION_REVISION,[Library version - revision]) AC_DEFINE_UNQUOTED(LIBDI_VERSION,$LIBRARY_VERSION,[Library version]) AC_CACHE_CHECK([whether $CC supports __attribute__((alias))],di_cv_support_cc_attribute_alias, AC_TRY_COMPILE(,[ void test_alias() __attribute__ ((alias("test"))); ],[di_cv_support_cc_attribute_alias=yes],[di_cv_support_cc_attribute_alias=no])) if test $di_cv_support_cc_attribute_alias = yes; then HAVE_ATTRIBUTE_ALIAS=1 AC_DEFINE_UNQUOTED(HAVE_ATTRIBUTE_ALIAS,1,[Define to 1 if compiler supports __attribute__((alias))]) fi AH_VERBATIM([PATH_MAX], [/* Define PATH_MAX if missing. */ #ifndef PATH_MAX # undef PATH_MAX #endif]) AC_CHECK_DECLS(PATH_MAX,[],[AC_DEFINE(PATH_MAX,4096)],[ #include ]) AC_ARG_ENABLE(extensive-debug,AS_HELP_STRING([--enable-extensive-debug],[Enable extensive debugging output])) if test "$enable_extensive_debug" = yes; then AC_DEFINE_UNQUOTED(ENABLE_EXTENSIVE_DEBUG,1,[Define to 1 to enable extensive debugging output]) fi AC_MSG_CHECKING([Debian CPU name]) DEB_HOST_ARCH_CPU="`dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null`" # Take account of old dpkg-architecture output. if test -z "$DEB_HOST_ARCH_CPU"; then DEB_HOST_ARCH_CPU="`dpkg-architecture -qDEB_HOST_GNU_CPU`" if test "$DEB_HOST_ARCH_CPU" = x86_64; then DEB_HOST_ARCH_CPU=amd64 fi fi AC_MSG_RESULT([$DEB_HOST_ARCH_CPU]) AC_MSG_CHECKING([Debian system name]) DEB_HOST_ARCH_OS="`dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null`" # Take account of old dpkg-architecture output. if test -z "$DEB_HOST_ARCH_OS"; then DEB_HOST_ARCH_OS="`dpkg-architecture -qDEB_HOST_GNU_SYSTEM | sed 's/-gnu//g'`" if test "$DEB_HOST_ARCH_OS" = gnu; then DEB_HOST_ARCH_OS=hurd fi fi AC_MSG_RESULT([$DEB_HOST_ARCH_OS]) if test -f "$srcdir/src/system/subarch-$DEB_HOST_ARCH_CPU-$DEB_HOST_ARCH_OS.c"; then SUBARCH_SYSTEM="subarch-$DEB_HOST_ARCH_CPU-$DEB_HOST_ARCH_OS.lo" elif (test "$DEB_HOST_ARCH_CPU" = i386 || test "$DEB_HOST_ARCH_CPU" = amd64) && test -f "$srcdir/src/system/subarch-x86-$DEB_HOST_ARCH_OS.c"; then SUBARCH_SYSTEM="subarch-x86-$DEB_HOST_ARCH_OS.lo" else SUBARCH_SYSTEM="subarch-generic.lo" fi AC_SUBST(SUBARCH_SYSTEM) AC_CONFIG_HEADERS([config.h include/debian-installer/config.h]) AC_CONFIG_FILES([ Makefile doc/Doxyfile doc/Makefile include/Makefile include/debian-installer/Makefile include/debian-installer/system/Makefile src/Makefile src/system/Makefile libdebian-installer.pc libdebian-installer-extra.pc ]) AC_OUTPUT libdebian-installer/Makefile.am0000644000000000000000000000024511515541630013706 0ustar AUTOMAKE_OPTIONS = foreign SUBDIRS = doc include src pkgconfigdir = ${libdir}/pkgconfig pkgconfig_DATA = \ libdebian-installer.pc \ libdebian-installer-extra.pc libdebian-installer/libdebian-installer-extra.pc.in0000644000000000000000000000041411515541630017626 0ustar prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Debian Installer (extra) Description: Library of some extra debian-installer functions Version: @VERSION@ Requires: libdebian-installer = @VERSION@ Libs: -ldebian-installer-extra libdebian-installer/test/0000755000000000000000000000000011515541630012630 5ustar libdebian-installer/test/Packages0000644000000000000000000000310711515541630014272 0ustar Package: countrychooser Priority: standard Section: debian-installer Installed-Size: 176 Maintainer: Debian Install System Team Architecture: all Version: 0.012 Depends: cdebconf-udeb, iso-3166-udeb Filename: pool/main/c/countrychooser/countrychooser_0.012_all.udeb Size: 38000 MD5sum: 1da99401d9c16fc1e9b029d6092b891d Description: Choose country This package provides a country chooser for the Debian installer. installer-menu-item: 11 Package: cdebconf-udeb Priority: standard Section: debian-installer Installed-Size: 204 Maintainer: Debian Install System Team Architecture: i386 Source: cdebconf Version: 0.57 Filename: pool/main/c/cdebconf/cdebconf-udeb_0.57_i386.udeb Size: 51956 MD5sum: d5a5a6ea63439fd24586b97a4ee9dd51 Description: Debian Configuration Management System (C-implementation) Debconf is a configuration management system for Debian packages. It is used by some packages to prompt you for information before they are installed. This is a reimplementation of the original debconf version in C. . cdebconf-udeb is a minimal cdebconf package used by the debian-installer Package: iso-3166-udeb Priority: optional Section: debian-installer Installed-Size: 24 Maintainer: Alastair McKinstry Architecture: all Source: iso-codes Version: 0.28-1 Filename: pool/main/i/iso-codes/iso-3166-udeb_0.28-1_all.udeb Size: 2780 MD5sum: a1654c55291ebf1479636b937402db50 Description: Provides iso_3166.tab file This package provides the iso_3166.tab file, which lists country names and their ISO-3166 codes. libdebian-installer/test/Makefile0000644000000000000000000000033611515541630014272 0ustar CC = gcc CFLAGS = -Wall -I/usr/include/glib-1.2 -I/usr/lib/glib/include LDFLAGS = -ldebian-installer -lau-c-unit test: test_system_packages.o test_hash.o main.o ${CC} ${LDFLAGS} -o test $^ %.o:%.c $(CC) $(CFLAGS) -c $< libdebian-installer/test/test_system_packages.c0000644000000000000000000000506311515541630017221 0ustar #include #include #include #include #include #include #include #define DOWNLOAD_PACKAGES "Packages" static di_packages *packages = NULL; static di_packages_allocator *packages_allocator = NULL; gint test_size(autounit_test_t *t) { di_slist_node *node; di_package *package; int count; count =0; for (node = (packages)->list.head; node; node = node->next) { package = node->data; count++; } au_assert(t,di_hash_table_size(packages->table) == count, "hash table size is different with the number of data inserted"); return TRUE; } gint test_dependencies(autounit_test_t *t) { di_slist_node *node; di_package *package; /* verify packages initial status_want */ for (node = (packages)->list.head; node; node = node->next) { package = node->data; au_assert(t, package->status_want == di_package_status_want_unknown, "package initial status_want is not status_want_unknown"); } /* we want to install countrychooser */ node = (packages)->list.head; package = node->data; package->status_want = di_package_status_want_install; /* check dependencies */ di_system_packages_resolve_dependencies_mark_anna(packages,NULL,NULL); /* verify packages status_want is status_want_install*/ for (node = (packages)->list.head; node; node = node->next) { package = node->data; au_assert(t, package->status_want == di_package_status_want_install, "package status_want is not status_want_install"); } return TRUE; } gint setup(autounit_test_t *t) { packages_allocator = di_system_packages_allocator_alloc(); packages = di_system_packages_read_file(DOWNLOAD_PACKAGES, packages_allocator); return TRUE; } gint teardown(autounit_test_t *t) { di_packages_free(packages); di_packages_allocator_free(packages_allocator); packages = NULL; packages_allocator = NULL; return TRUE; } autounit_test_group_t test_system_packages_tests[] = { {"test_size", test_size, TRUE, TRUE}, {"test_dependencies", test_dependencies, TRUE, TRUE}, {0, 0, FALSE, FALSE} }; int test_system_packages_run() { autounit_suite_t *c_unit_test_suite; int result; c_unit_test_suite = au_new_suite(g_string_new("test di_system_packages"), setup, teardown); au_add_test_group(c_unit_test_suite, test_system_packages_tests); result = au_run_suite(c_unit_test_suite); au_delete_suite(c_unit_test_suite); return result; }; libdebian-installer/test/test_hash.c0000644000000000000000000000256711515541630014770 0ustar #include #include #include #include #include #include #define STRING_MAX_LENGTH 10 #define KEY_VALUE_NBR 20 void get_key( const char *name, di_rstring *key) { size_t size; size = strlen (name); /* i know that is bad, but i know it is not written by the lookup */ key->string = (char *) name; key->size = size; } gint test_hash(autounit_test_t *t) { di_hash_table *table; int i,nbr_of_insert=20; char str[KEY_VALUE_NBR][STRING_MAX_LENGTH]; di_rstring key[KEY_VALUE_NBR]; table = di_hash_table_new(di_rstring_hash, di_rstring_equal); for (i=0;i extern int test_hash_run(); extern int test_system_packages_run(); static int (*func_run[])() ={ test_hash_run, test_system_packages_run, NULL }; int main() { int result=0; int i=0; for(i=0; !result && func_run[i]; i++) { result = func_run[i](); } return result; }