Repository package index format 1.2.
The pkg index now stores all package objects from props.plist, so that xbps-repo(8) doesn't have to access the target binpkg anymore.
This commit is contained in:
parent
604b315cfa
commit
cfa637db48
6
NEWS
6
NEWS
@ -1,3 +1,9 @@
|
|||||||
|
xbps-0.8.2 (???):
|
||||||
|
|
||||||
|
* Improved repository package index format (v1.2). The index now contains all
|
||||||
|
package objects, so that it's not necessary to fetch info from binpkgs.
|
||||||
|
The file will also be a bit bigger, but not to worry about.
|
||||||
|
|
||||||
xbps-0.8.1 (2011-05-27):
|
xbps-0.8.1 (2011-05-27):
|
||||||
|
|
||||||
* xbps-bin(8)/xbps-repo(8): more meaningful messages when a package couldn't
|
* xbps-bin(8)/xbps-repo(8): more meaningful messages when a package couldn't
|
||||||
|
@ -55,8 +55,7 @@ void fetch_file_progress_cb(void *);
|
|||||||
|
|
||||||
/* From util.c */
|
/* From util.c */
|
||||||
int show_pkg_files(prop_dictionary_t);
|
int show_pkg_files(prop_dictionary_t);
|
||||||
void show_pkg_info(prop_dictionary_t, bool);
|
void show_pkg_info(prop_dictionary_t);
|
||||||
void show_pkg_info_only_repo(prop_dictionary_t);
|
|
||||||
int show_pkg_namedesc(prop_object_t, void *, bool *);
|
int show_pkg_namedesc(prop_object_t, void *, bool *);
|
||||||
int list_strings_in_array(prop_object_t, void *, bool *);
|
int list_strings_in_array(prop_object_t, void *, bool *);
|
||||||
int list_strings_sep_in_array(prop_object_t, void *, bool *);
|
int list_strings_sep_in_array(prop_object_t, void *, bool *);
|
||||||
|
@ -47,7 +47,7 @@ show_pkg_info_from_metadir(const char *pkgname)
|
|||||||
pkgpropsd = xbps_find_pkg_in_dict_by_name(regpkgd,
|
pkgpropsd = xbps_find_pkg_in_dict_by_name(regpkgd,
|
||||||
"properties", pkgname);
|
"properties", pkgname);
|
||||||
if (pkgpropsd == NULL) {
|
if (pkgpropsd == NULL) {
|
||||||
show_pkg_info(d, false);
|
show_pkg_info(d);
|
||||||
prop_object_release(d);
|
prop_object_release(d);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ show_pkg_info_from_metadir(const char *pkgname)
|
|||||||
if (prop_dictionary_get(pkgpropsd, "provides"))
|
if (prop_dictionary_get(pkgpropsd, "provides"))
|
||||||
prop_dictionary_set_bool(d, "virtual-prefer", true);
|
prop_dictionary_set_bool(d, "virtual-prefer", true);
|
||||||
|
|
||||||
show_pkg_info(d, false);
|
show_pkg_info(d);
|
||||||
prop_object_release(d);
|
prop_object_release(d);
|
||||||
out:
|
out:
|
||||||
xbps_regpkgdb_dictionary_release();
|
xbps_regpkgdb_dictionary_release();
|
||||||
|
@ -39,152 +39,109 @@
|
|||||||
struct object_info {
|
struct object_info {
|
||||||
const char *key;
|
const char *key;
|
||||||
const char *descr;
|
const char *descr;
|
||||||
const char *sep;
|
|
||||||
bool from_repo;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct object_info obj_info[] = {
|
static const struct object_info obj_info[] = {
|
||||||
|
{
|
||||||
|
.key = "repository",
|
||||||
|
.descr = "Repository: "
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.key = "filename",
|
.key = "filename",
|
||||||
.descr = "Binary package:",
|
.descr = "Binary package: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "filename-size",
|
.key = "filename-size",
|
||||||
.descr = "Binary package size",
|
.descr = "Binary package size"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "filename-sha256",
|
.key = "filename-sha256",
|
||||||
.descr = "Binary package SHA256:",
|
.descr = "Binary package SHA256: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "archive-compression-type",
|
.key = "archive-compression-type",
|
||||||
.descr = "Binary package compression type:",
|
.descr = "Binary package compression type: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "pkgname",
|
.key = "pkgname",
|
||||||
.descr = "Package:",
|
.descr = "Package: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "installed_size",
|
.key = "installed_size",
|
||||||
.descr = "Installed size",
|
.descr = "Installed size"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "maintainer",
|
.key = "maintainer",
|
||||||
.descr = "Maintainer:",
|
.descr = "Maintainer: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "architecture",
|
.key = "architecture",
|
||||||
.descr = "Architecture:",
|
.descr = "Architecture: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "version",
|
.key = "version",
|
||||||
.descr = "Version:",
|
.descr = "Version: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "homepage",
|
.key = "homepage",
|
||||||
.descr = "Upstream URL:",
|
.descr = "Upstream URL: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "license",
|
.key = "license",
|
||||||
.descr = "License(s):",
|
.descr = "License(s): "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "build_date",
|
.key = "build_date",
|
||||||
.descr = "Package build date:",
|
.descr = "Package build date: "
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "preserve",
|
.key = "preserve",
|
||||||
.descr = "Preserve files",
|
.descr = "Preserve files"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "replaces",
|
.key = "replaces",
|
||||||
.descr = "Replaces these packages:",
|
.descr = "Replaces these packages"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "provides",
|
.key = "provides",
|
||||||
.descr = "Provides virtual packages:",
|
.descr = "Provides virtual packages"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "conflicts",
|
.key = "conflicts",
|
||||||
.descr = "Conflicts with:",
|
.descr = "Conflicts with"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "hold",
|
.key = "hold",
|
||||||
.descr = "Hold update",
|
.descr = "Hold update"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "update-first",
|
.key = "update-first",
|
||||||
.descr = "Always update first",
|
.descr = "Always update first"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "virtual-prefer",
|
.key = "virtual-prefer",
|
||||||
.descr = "Virtual packages enabled",
|
.descr = "Virtual packages enabled"
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "conf_files",
|
.key = "conf_files",
|
||||||
.descr = "Configuration files:\n",
|
.descr = "Configuration files"
|
||||||
.sep = " ",
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = "short_desc",
|
.key = "short_desc",
|
||||||
.descr = "Description:",
|
.descr = "Description: "
|
||||||
.sep = NULL,
|
},
|
||||||
.from_repo = false },
|
|
||||||
{
|
{
|
||||||
.key = "long_desc",
|
.key = "long_desc",
|
||||||
.descr = " ",
|
.descr = "",
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.key = NULL,
|
.key = NULL,
|
||||||
.descr = NULL,
|
.descr = NULL
|
||||||
.sep = NULL,
|
|
||||||
.from_repo = false
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
show_pkg_info(prop_dictionary_t dict)
|
||||||
{
|
{
|
||||||
const struct object_info *oip;
|
const struct object_info *oip;
|
||||||
prop_object_t obj;
|
prop_object_t obj;
|
||||||
@ -194,13 +151,10 @@ show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
|||||||
assert(prop_dictionary_count(dict) != 0);
|
assert(prop_dictionary_count(dict) != 0);
|
||||||
|
|
||||||
for (oip = obj_info; oip->key != NULL; oip++) {
|
for (oip = obj_info; oip->key != NULL; oip++) {
|
||||||
if (only_repo && oip->from_repo == false)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
obj = prop_dictionary_get(dict, oip->key);
|
obj = prop_dictionary_get(dict, oip->key);
|
||||||
switch (prop_object_type(obj)) {
|
switch (prop_object_type(obj)) {
|
||||||
case PROP_TYPE_STRING:
|
case PROP_TYPE_STRING:
|
||||||
printf("%s %s\n", oip->descr,
|
printf("%s%s\n", oip->descr,
|
||||||
prop_string_cstring_nocopy(obj));
|
prop_string_cstring_nocopy(obj));
|
||||||
break;
|
break;
|
||||||
case PROP_TYPE_NUMBER:
|
case PROP_TYPE_NUMBER:
|
||||||
@ -217,9 +171,9 @@ show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
|||||||
prop_bool_true(obj) ? "yes" : "no");
|
prop_bool_true(obj) ? "yes" : "no");
|
||||||
break;
|
break;
|
||||||
case PROP_TYPE_ARRAY:
|
case PROP_TYPE_ARRAY:
|
||||||
printf("%s ", oip->descr);
|
printf("%s:\n", oip->descr);
|
||||||
(void)xbps_callback_array_iter_in_dict(dict, oip->key,
|
(void)xbps_callback_array_iter_in_dict(dict, oip->key,
|
||||||
list_strings_sep_in_array, __UNCONST(oip->sep));
|
list_strings_sep_in_array, __UNCONST(" "));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2009-2010 Juan Romero Pardines.
|
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -217,17 +217,6 @@ xbps_repo_addpkg_index(prop_dictionary_t idxdict, const char *filedir,
|
|||||||
rv = errno;
|
rv = errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Remove some unneeded and large objects.
|
|
||||||
*/
|
|
||||||
prop_dictionary_remove(newpkgd, "long_desc");
|
|
||||||
prop_dictionary_remove(newpkgd, "maintainer");
|
|
||||||
prop_dictionary_remove(newpkgd, "conf_files");
|
|
||||||
prop_dictionary_remove(newpkgd, "homepage");
|
|
||||||
prop_dictionary_remove(newpkgd, "build_date");
|
|
||||||
prop_dictionary_remove(newpkgd, "license");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add dictionary into the index and update package count.
|
* Add dictionary into the index and update package count.
|
||||||
*/
|
*/
|
||||||
|
@ -240,32 +240,13 @@ out:
|
|||||||
int
|
int
|
||||||
show_pkg_info_from_repolist(const char *pkgname)
|
show_pkg_info_from_repolist(const char *pkgname)
|
||||||
{
|
{
|
||||||
prop_dictionary_t pkgd, pkg_propsd;
|
prop_dictionary_t pkgd;
|
||||||
const char *repoloc;
|
|
||||||
char *url = NULL;
|
|
||||||
|
|
||||||
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
||||||
if (pkgd == NULL)
|
if (pkgd == NULL)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
prop_dictionary_get_cstring_nocopy(pkgd, "repository", &repoloc);
|
show_pkg_info(pkgd);
|
||||||
url = xbps_get_binpkg_repo_uri(pkgd, repoloc);
|
|
||||||
if (url == NULL) {
|
|
||||||
prop_object_release(pkgd);
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
printf("Fetching info from: %s\n", repoloc);
|
|
||||||
pkg_propsd =
|
|
||||||
xbps_repository_plist_find_pkg_dict_from_url(url, XBPS_PKGPROPS);
|
|
||||||
if (pkg_propsd == NULL) {
|
|
||||||
free(url);
|
|
||||||
prop_object_release(pkgd);
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
free(url);
|
|
||||||
show_pkg_info(pkgd, true);
|
|
||||||
show_pkg_info(pkg_propsd, false);
|
|
||||||
prop_object_release(pkg_propsd);
|
|
||||||
prop_object_release(pkgd);
|
prop_object_release(pkgd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH "XBPS\-REPO" "8" "02/21/2011" "\ \&" "\ \&"
|
.TH "XBPS\-REPO" "8" "05/27/2011" "\ \&" "\ \&"
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
.\" * set default formatting
|
.\" * set default formatting
|
||||||
.\" -----------------------------------------------------------------
|
.\" -----------------------------------------------------------------
|
||||||
@ -115,7 +115,6 @@ values in repository pool\&.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Shows information about binary package
|
Shows information about binary package
|
||||||
\fIpkgname\fR\&. This will print the size it takes in filesystem, description, maintainer, architecture and other information\&. The first repository in the pool wins\&.
|
\fIpkgname\fR\&. This will print the size it takes in filesystem, description, maintainer, architecture and other information\&. The first repository in the pool wins\&.
|
||||||
\fBNOTE: if a remote repository is the winner and binary package is not available in cachedir, it will fetch remotely and \fR\fB\fIon\-the\-fly\fR\fR\fB the info\fR\&.
|
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
\fBshow\-deps \fR\fB\fIpkgname\fR\fR
|
\fBshow\-deps \fR\fB\fIpkgname\fR\fR
|
||||||
@ -129,7 +128,7 @@ Shows run time dependencies for binary package
|
|||||||
Shows the file list for a binary package
|
Shows the file list for a binary package
|
||||||
\fIpkgname\fR
|
\fIpkgname\fR
|
||||||
by searching it in repository pool\&. The first repository in the pool wins\&.
|
by searching it in repository pool\&. The first repository in the pool wins\&.
|
||||||
\fBNOTE: if a remote repository is the winner and binary package is not available in \fR\fBcachedir\fR\fB, it will fetch remotely and \fR\fB\fIon\-the\-fly\fR\fR\fB the info\fR\&.
|
\fBNOTE: if a remote repository is the winner and binary package is not available in \fR\fBcachedir\fR\fB, it will fetch remotely and \fR\fB\fIon\-the\-fly\fR\fR\fB the info\fR\& from target repository.
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
\fBsync\fR
|
\fBsync\fR
|
||||||
|
@ -49,11 +49,17 @@
|
|||||||
* This header documents the full API for the XBPS Library.
|
* This header documents the full API for the XBPS Library.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @def XBPS_PKGINDEX_VERSION
|
||||||
|
* Current version for the repository package index format.
|
||||||
|
*/
|
||||||
|
#define XBPS_PKGINDEX_VERSION "1.2"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def XBPS_RELVER
|
* @def XBPS_RELVER
|
||||||
* Current library release date.
|
* Current library release date.
|
||||||
*/
|
*/
|
||||||
#define XBPS_RELVER "20110411"
|
#define XBPS_RELVER "API: 20110411, Repository index: " XBPS_PKGINDEX_VERSION
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def XBPS_META_PATH
|
* @def XBPS_META_PATH
|
||||||
@ -97,11 +103,6 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX "pkg-index.plist"
|
#define XBPS_PKGINDEX "pkg-index.plist"
|
||||||
|
|
||||||
/**
|
|
||||||
* @def XBPS_PKGINDEX_VERSION
|
|
||||||
* Current version for the repository package index format.
|
|
||||||
*/
|
|
||||||
#define XBPS_PKGINDEX_VERSION "1.1"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @def XBPS_FLAG_VERBOSE
|
* @def XBPS_FLAG_VERBOSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user