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-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 */
|
||||
int show_pkg_files(prop_dictionary_t);
|
||||
void show_pkg_info(prop_dictionary_t, bool);
|
||||
void show_pkg_info_only_repo(prop_dictionary_t);
|
||||
void show_pkg_info(prop_dictionary_t);
|
||||
int show_pkg_namedesc(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 *);
|
||||
|
@ -47,7 +47,7 @@ show_pkg_info_from_metadir(const char *pkgname)
|
||||
pkgpropsd = xbps_find_pkg_in_dict_by_name(regpkgd,
|
||||
"properties", pkgname);
|
||||
if (pkgpropsd == NULL) {
|
||||
show_pkg_info(d, false);
|
||||
show_pkg_info(d);
|
||||
prop_object_release(d);
|
||||
goto out;
|
||||
}
|
||||
@ -58,7 +58,7 @@ show_pkg_info_from_metadir(const char *pkgname)
|
||||
if (prop_dictionary_get(pkgpropsd, "provides"))
|
||||
prop_dictionary_set_bool(d, "virtual-prefer", true);
|
||||
|
||||
show_pkg_info(d, false);
|
||||
show_pkg_info(d);
|
||||
prop_object_release(d);
|
||||
out:
|
||||
xbps_regpkgdb_dictionary_release();
|
||||
|
@ -39,152 +39,109 @@
|
||||
struct object_info {
|
||||
const char *key;
|
||||
const char *descr;
|
||||
const char *sep;
|
||||
bool from_repo;
|
||||
};
|
||||
|
||||
static const struct object_info obj_info[] = {
|
||||
{
|
||||
.key = "repository",
|
||||
.descr = "Repository: "
|
||||
},
|
||||
{
|
||||
.key = "filename",
|
||||
.descr = "Binary package:",
|
||||
.sep = NULL,
|
||||
.from_repo = true
|
||||
.descr = "Binary package: "
|
||||
},
|
||||
{
|
||||
.key = "filename-size",
|
||||
.descr = "Binary package size",
|
||||
.sep = NULL,
|
||||
.from_repo = true
|
||||
.descr = "Binary package size"
|
||||
},
|
||||
{
|
||||
.key = "filename-sha256",
|
||||
.descr = "Binary package SHA256:",
|
||||
.sep = NULL,
|
||||
.from_repo = true
|
||||
.descr = "Binary package SHA256: "
|
||||
},
|
||||
{
|
||||
.key = "archive-compression-type",
|
||||
.descr = "Binary package compression type:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Binary package compression type: "
|
||||
},
|
||||
{
|
||||
.key = "pkgname",
|
||||
.descr = "Package:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Package: "
|
||||
},
|
||||
{
|
||||
.key = "installed_size",
|
||||
.descr = "Installed size",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Installed size"
|
||||
},
|
||||
{
|
||||
.key = "maintainer",
|
||||
.descr = "Maintainer:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Maintainer: "
|
||||
},
|
||||
{
|
||||
.key = "architecture",
|
||||
.descr = "Architecture:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Architecture: "
|
||||
},
|
||||
{
|
||||
.key = "version",
|
||||
.descr = "Version:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Version: "
|
||||
},
|
||||
{
|
||||
.key = "homepage",
|
||||
.descr = "Upstream URL:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Upstream URL: "
|
||||
},
|
||||
{
|
||||
.key = "license",
|
||||
.descr = "License(s):",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "License(s): "
|
||||
},
|
||||
{
|
||||
.key = "build_date",
|
||||
.descr = "Package build date:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Package build date: "
|
||||
},
|
||||
{
|
||||
.key = "preserve",
|
||||
.descr = "Preserve files",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Preserve files"
|
||||
},
|
||||
{
|
||||
.key = "replaces",
|
||||
.descr = "Replaces these packages:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Replaces these packages"
|
||||
},
|
||||
{
|
||||
.key = "provides",
|
||||
.descr = "Provides virtual packages:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Provides virtual packages"
|
||||
},
|
||||
{
|
||||
.key = "conflicts",
|
||||
.descr = "Conflicts with:",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Conflicts with"
|
||||
},
|
||||
{
|
||||
.key = "hold",
|
||||
.descr = "Hold update",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Hold update"
|
||||
},
|
||||
{
|
||||
.key = "update-first",
|
||||
.descr = "Always update first",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Always update first"
|
||||
},
|
||||
{
|
||||
.key = "virtual-prefer",
|
||||
.descr = "Virtual packages enabled",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "Virtual packages enabled"
|
||||
},
|
||||
{
|
||||
.key = "conf_files",
|
||||
.descr = "Configuration files:\n",
|
||||
.sep = " ",
|
||||
.from_repo = false
|
||||
.descr = "Configuration files"
|
||||
},
|
||||
{
|
||||
.key = "short_desc",
|
||||
.descr = "Description:",
|
||||
.sep = NULL,
|
||||
.from_repo = false },
|
||||
.descr = "Description: "
|
||||
},
|
||||
{
|
||||
.key = "long_desc",
|
||||
.descr = " ",
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = "",
|
||||
},
|
||||
{
|
||||
.key = NULL,
|
||||
.descr = NULL,
|
||||
.sep = NULL,
|
||||
.from_repo = false
|
||||
.descr = NULL
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
||||
show_pkg_info(prop_dictionary_t dict)
|
||||
{
|
||||
const struct object_info *oip;
|
||||
prop_object_t obj;
|
||||
@ -194,13 +151,10 @@ show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
||||
assert(prop_dictionary_count(dict) != 0);
|
||||
|
||||
for (oip = obj_info; oip->key != NULL; oip++) {
|
||||
if (only_repo && oip->from_repo == false)
|
||||
continue;
|
||||
|
||||
obj = prop_dictionary_get(dict, oip->key);
|
||||
switch (prop_object_type(obj)) {
|
||||
case PROP_TYPE_STRING:
|
||||
printf("%s %s\n", oip->descr,
|
||||
printf("%s%s\n", oip->descr,
|
||||
prop_string_cstring_nocopy(obj));
|
||||
break;
|
||||
case PROP_TYPE_NUMBER:
|
||||
@ -217,9 +171,9 @@ show_pkg_info(prop_dictionary_t dict, bool only_repo)
|
||||
prop_bool_true(obj) ? "yes" : "no");
|
||||
break;
|
||||
case PROP_TYPE_ARRAY:
|
||||
printf("%s ", oip->descr);
|
||||
printf("%s:\n", oip->descr);
|
||||
(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;
|
||||
default:
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*-
|
||||
* Copyright (c) 2009-2010 Juan Romero Pardines.
|
||||
* Copyright (c) 2009-2011 Juan Romero Pardines.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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;
|
||||
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.
|
||||
*/
|
||||
|
@ -240,32 +240,13 @@ out:
|
||||
int
|
||||
show_pkg_info_from_repolist(const char *pkgname)
|
||||
{
|
||||
prop_dictionary_t pkgd, pkg_propsd;
|
||||
const char *repoloc;
|
||||
char *url = NULL;
|
||||
prop_dictionary_t pkgd;
|
||||
|
||||
pkgd = xbps_repository_pool_find_pkg(pkgname, false, false);
|
||||
if (pkgd == NULL)
|
||||
return errno;
|
||||
|
||||
prop_dictionary_get_cstring_nocopy(pkgd, "repository", &repoloc);
|
||||
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);
|
||||
show_pkg_info(pkgd);
|
||||
prop_object_release(pkgd);
|
||||
|
||||
return 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
.TH "XBPS\-REPO" "8" "02/21/2011" "\ \&" "\ \&"
|
||||
.TH "XBPS\-REPO" "8" "05/27/2011" "\ \&" "\ \&"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
@ -115,7 +115,6 @@ values in repository pool\&.
|
||||
.RS 4
|
||||
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\&.
|
||||
\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
|
||||
.PP
|
||||
\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
|
||||
\fIpkgname\fR
|
||||
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
|
||||
.PP
|
||||
\fBsync\fR
|
||||
|
@ -49,11 +49,17 @@
|
||||
* 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
|
||||
* Current library release date.
|
||||
*/
|
||||
#define XBPS_RELVER "20110411"
|
||||
#define XBPS_RELVER "API: 20110411, Repository index: " XBPS_PKGINDEX_VERSION
|
||||
|
||||
/**
|
||||
* @def XBPS_META_PATH
|
||||
@ -97,11 +103,6 @@
|
||||
*/
|
||||
#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
|
||||
|
Loading…
Reference in New Issue
Block a user