pkg: add origin, maintainer, build_time and commit id to index
Parse these fields from .PKGINFO, and write them to index.cute-signatures
parent
0cc2086e27
commit
5a9d8323a0
|
@ -83,10 +83,12 @@ struct apk_package {
|
||||||
struct apk_name *name;
|
struct apk_name *name;
|
||||||
struct apk_installed_package *ipkg;
|
struct apk_installed_package *ipkg;
|
||||||
apk_blob_t *version, *arch, *license;
|
apk_blob_t *version, *arch, *license;
|
||||||
char *url, *description;
|
apk_blob_t *origin, *maintainer;
|
||||||
|
char *url, *description, *commit;
|
||||||
char *filename;
|
char *filename;
|
||||||
struct apk_dependency_array *depends, *install_if;
|
struct apk_dependency_array *depends, *install_if;
|
||||||
size_t installed_size, size;
|
size_t installed_size, size;
|
||||||
|
time_t build_time;
|
||||||
unsigned repos;
|
unsigned repos;
|
||||||
struct apk_checksum csum;
|
struct apk_checksum csum;
|
||||||
};
|
};
|
||||||
|
|
|
@ -659,6 +659,18 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg,
|
||||||
case 'i':
|
case 'i':
|
||||||
apk_deps_parse(db, &pkg->install_if, value);
|
apk_deps_parse(db, &pkg->install_if, value);
|
||||||
break;
|
break;
|
||||||
|
case 'o':
|
||||||
|
pkg->origin = apk_blob_atomize_dup(value);
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
pkg->maintainer = apk_blob_atomize_dup(value);
|
||||||
|
break;
|
||||||
|
case 't':
|
||||||
|
pkg->build_time = apk_blob_pull_uint(&value, 10);
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
pkg->commit = apk_blob_cstr(value);
|
||||||
|
break;
|
||||||
case 'F': case 'M': case 'R': case 'Z':
|
case 'F': case 'M': case 'R': case 'Z':
|
||||||
/* installed db entries which are handled in database.c */
|
/* installed db entries which are handled in database.c */
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -691,6 +703,10 @@ static int read_info_line(void *ctx, apk_blob_t line)
|
||||||
{ "arch", 'A' },
|
{ "arch", 'A' },
|
||||||
{ "depend", 'D' },
|
{ "depend", 'D' },
|
||||||
{ "install_if", 'i' },
|
{ "install_if", 'i' },
|
||||||
|
{ "origin", 'o' },
|
||||||
|
{ "maintainer", 'm' },
|
||||||
|
{ "builddate", 't' },
|
||||||
|
{ "commit", 'c' },
|
||||||
};
|
};
|
||||||
struct read_info_ctx *ri = (struct read_info_ctx *) ctx;
|
struct read_info_ctx *ri = (struct read_info_ctx *) ctx;
|
||||||
apk_blob_t l, r;
|
apk_blob_t l, r;
|
||||||
|
@ -800,6 +816,8 @@ void apk_pkg_free(struct apk_package *pkg)
|
||||||
free(pkg->url);
|
free(pkg->url);
|
||||||
if (pkg->description)
|
if (pkg->description)
|
||||||
free(pkg->description);
|
free(pkg->description);
|
||||||
|
if (pkg->commit)
|
||||||
|
free(pkg->commit);
|
||||||
free(pkg);
|
free(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -968,6 +986,22 @@ int apk_pkg_write_index_entry(struct apk_package *info,
|
||||||
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->url));
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->url));
|
||||||
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nL:"));
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nL:"));
|
||||||
apk_blob_push_blob(&bbuf, *info->license);
|
apk_blob_push_blob(&bbuf, *info->license);
|
||||||
|
if (info->origin) {
|
||||||
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\no:"));
|
||||||
|
apk_blob_push_blob(&bbuf, *info->origin);
|
||||||
|
}
|
||||||
|
if (info->maintainer) {
|
||||||
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nm:"));
|
||||||
|
apk_blob_push_blob(&bbuf, *info->maintainer);
|
||||||
|
}
|
||||||
|
if (info->build_time) {
|
||||||
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nt:"));
|
||||||
|
apk_blob_push_uint(&bbuf, info->build_time, 10);
|
||||||
|
}
|
||||||
|
if (info->commit) {
|
||||||
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\nc:"));
|
||||||
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR(info->commit));
|
||||||
|
}
|
||||||
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n"));
|
apk_blob_push_blob(&bbuf, APK_BLOB_STR("\n"));
|
||||||
|
|
||||||
if (APK_BLOB_IS_NULL(bbuf))
|
if (APK_BLOB_IS_NULL(bbuf))
|
||||||
|
|
Loading…
Reference in New Issue