-/* pkg_parse.c - the itsy package management system
+/* pkg_parse.c - the opkg package management system
Steven M. Ayer
General Public License for more details.
*/
-#include "opkg.h"
+#include "includes.h"
#include <errno.h>
#include <ctype.h>
int parseVersion(pkg_t *pkg, char *raw)
{
char *colon, *eepochcolon;
-#ifdef USE_DEBVERSION
char *hyphen;
-#endif
unsigned long epoch;
if (!*raw) {
}
pkg->revision = "";
- pkg->familiar_revision = "";
+ if (!pkg->version)
+ {
pkg->version= malloc(strlen(raw)+1);
if ( pkg->version == NULL ) {
fprintf(stderr, "%s: out of memory \n", __FUNCTION__);
return ENOMEM;
}
strcpy(pkg->version, raw);
+ }
-#ifdef USE_DEBVERSION
hyphen= strrchr(pkg->version,'-');
if (hyphen) {
*hyphen++= 0;
- if (strncmp("fam", hyphen, 3) == 0) {
- pkg->familiar_revision=hyphen+3;
- hyphen= strrchr(pkg->version,'-');
- if (hyphen) {
- *hyphen++= 0;
- pkg->revision = hyphen;
- }
- } else {
pkg->revision = hyphen;
- }
}
-#endif
-
-/*
- fprintf(stderr,"Parsed version: %lu, %s, %s, %s\n",
- pkg->epoch,
- pkg->version,
- pkg->revision,
- pkg->familiar_revision);
-*/
-
+
return 0;
}
pkg->suggests_str = parseDependsString(*lines, &pkg->suggests_count);
break;
+ case 'T':
+ if(isGenericFieldType("Tags:", *lines))
+ pkg->tags = parseGenericFieldType("Tags", *lines);
+ break;
+
case 'M':
if(isGenericFieldType("MD5sum:", *lines))
pkg->md5sum = parseGenericFieldType("MD5sum", *lines);
else if(isGenericFieldType("Installed-Time:", *lines)) {
char *time_str = parseGenericFieldType("Installed-Time", *lines);
pkg->installed_time = strtoul(time_str, NULL, 0);
+ free (time_str);
}
break;
*raw = lines;
/* If the ipk has not a Provides line, we insert our false line */
if ( pkg_false_provides==1)
- pkg->provides_str = parseDependsString ((char *)"Provides: opkg_internal_use_only ", &pkg->provides_count);
+ {
+ pkg->provides_count = 1;
+ pkg->provides_str = malloc (sizeof (char*));
+ pkg->provides_str[0] = strdup ("opkg_internal_use_only");
+ }
if (pkg->name) {
return 0;