-
- if (!*raw) {
- fprintf(stderr, "%s: ERROR: Provides string is empty", __FUNCTION__);
- return -EINVAL;
- }
-
- if ( temp == NULL ) {
- fprintf(stderr, "%s: out of memory \n", __FUNCTION__);
- return -ENOMEM;
- }
-
- if (strncmp(raw, "Provides:", 9) == 0) {
- raw += 9;
- }
- while (*raw && isspace(*raw)) {
- raw++;
- }
-
- snprintf ( temp, 35, "Provides: opkg_internal_use_only, "); /* First part of the line */
- while (*raw) {
- strncat( temp, raw++, 1);
- }
- return 0;
-
-}
-
-/* Some random thoughts from Carl:
-
- This function could be considerably simplified if we just kept
- an array of all the generic string-valued field names, and looped
- through those looking for a match. Also, these fields could perhaps
- be stored in the package as an array as well, (or, probably better,
- as an nv_pair_list_t).
-
- Fields which require special parsing or storage, (such as Depends:
- and Status:) could be handled as they are now.
-*/
-/* XXX: FEATURE: The Suggests: field needs to be changed from a string
- to a dependency list. And, since we already have
- Depends/Pre-Depends and need to add Conflicts, Recommends, and
- Enhances, perhaps we could generalize all of these and save some
- code duplication.
-*/
-int pkg_parse_raw(pkg_t *pkg, char ***raw, pkg_src_t *src, pkg_dest_t *dest)
-{
- int reading_conffiles, reading_description;
- int pkg_false_provides=1;
- char ** lines;
- char * provide=NULL;
-
- pkg->src = src;
- pkg->dest = dest;
-
- reading_conffiles = reading_description = 0;
-
- for (lines = *raw; *lines; lines++) {
- /* fprintf(stderr, "PARSING %s\n", *lines);*/
- switch (**lines) {
- case 'P':
- if(isGenericFieldType("Package:", *lines))
- pkg->name = parseGenericFieldType("Package", *lines);
- else if(isGenericFieldType("Priority:", *lines))
- pkg->priority = parseGenericFieldType("Priority", *lines);
- else if(isGenericFieldType("Provides", *lines)){
-/* Here we add the internal_use to align the off by one problem between provides_str and provides */
- provide = (char * ) malloc(strlen(*lines)+ 35 ); /* Preparing the space for the new opkg_internal_use_only */
- if ( alterProvidesLine(*lines,provide) ){
- return EINVAL;
- }
- pkg->provides_str = parseDependsString( provide, &pkg->provides_count);
-/* Let's try to hack a bit here.
- The idea is that if a package has no Provides, we would add one generic, to permit the check of dependencies
- in alot of other places. We will remove it before writing down the status database */
- pkg_false_provides=0;
- free(provide);
- }
- else if(isGenericFieldType("Pre-Depends", *lines))
- pkg->pre_depends_str = parseDependsString(*lines, &pkg->pre_depends_count);
- break;
-