Faster binary package unpacking, see the NEWS file for info.
This commit is contained in:
parent
bffff1a00d
commit
e46dd09127
8
NEWS
8
NEWS
@ -1,5 +1,13 @@
|
|||||||
xbps-0.11.0 (???):
|
xbps-0.11.0 (???):
|
||||||
|
|
||||||
|
* Faster binary package unpacking. Only files and symlinks are now
|
||||||
|
extracted from binary packages, thus directories are not extracted
|
||||||
|
anymore. The package builder is responsible to create required
|
||||||
|
directories where appropiate and set correct permissions.
|
||||||
|
While being here, some stuff is skipped now if a package uses the
|
||||||
|
"preserve" keyword or package is being installed, resulting in a
|
||||||
|
faster operation.
|
||||||
|
|
||||||
* Implemented "New repository scheme and configuration file" from issue 16.
|
* Implemented "New repository scheme and configuration file" from issue 16.
|
||||||
The plist index file has been renamed to "index.plist", version bumped
|
The plist index file has been renamed to "index.plist", version bumped
|
||||||
to 1.3. The configuration file (repositories.plist) now expect the full
|
to 1.3. The configuration file (repositories.plist) now expect the full
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
*/
|
*/
|
||||||
#define XBPS_PKGINDEX_VERSION "1.3"
|
#define XBPS_PKGINDEX_VERSION "1.3"
|
||||||
|
|
||||||
#define XBPS_API_VERSION "20111107"
|
#define XBPS_API_VERSION "20111109"
|
||||||
#define XBPS_VERSION "0.11.0"
|
#define XBPS_VERSION "0.11.0"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +161,7 @@ unpack_archive(prop_dictionary_t pkg_repod,
|
|||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
size_t nmetadata = 0, entry_idx = 0;
|
size_t nmetadata = 0, entry_idx = 0;
|
||||||
const char *entry_pname, *transact;
|
const char *entry_pname, *transact;
|
||||||
char *buf;
|
char *buf = NULL, *pkgfilesd = NULL;
|
||||||
int rv, flags;
|
int rv, flags;
|
||||||
bool preserve, update, replace;
|
bool preserve, update, replace;
|
||||||
|
|
||||||
@ -204,14 +204,22 @@ unpack_archive(prop_dictionary_t pkg_repod,
|
|||||||
entry_statp = archive_entry_stat(entry);
|
entry_statp = archive_entry_stat(entry);
|
||||||
entry_pname = archive_entry_pathname(entry);
|
entry_pname = archive_entry_pathname(entry);
|
||||||
flags = set_extract_flags();
|
flags = set_extract_flags();
|
||||||
|
/*
|
||||||
|
* Ignore directories from archive.
|
||||||
|
*/
|
||||||
|
if (S_ISDIR(entry_statp->st_mode)) {
|
||||||
|
archive_read_data_skip(ar);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Prepare unpack callback ops.
|
||||||
|
*/
|
||||||
if (xhp->xbps_unpack_cb != NULL) {
|
if (xhp->xbps_unpack_cb != NULL) {
|
||||||
xhp->xucd->entry = entry_pname;
|
xhp->xucd->entry = entry_pname;
|
||||||
xhp->xucd->entry_size = archive_entry_size(entry);
|
xhp->xucd->entry_size = archive_entry_size(entry);
|
||||||
xhp->xucd->entry_is_metadata = false;
|
xhp->xucd->entry_is_metadata = false;
|
||||||
xhp->xucd->entry_is_conf = false;
|
xhp->xucd->entry_is_conf = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp("./INSTALL", entry_pname) == 0) {
|
if (strcmp("./INSTALL", entry_pname) == 0) {
|
||||||
/*
|
/*
|
||||||
* Extract the INSTALL script first to execute
|
* Extract the INSTALL script first to execute
|
||||||
@ -409,67 +417,81 @@ unpack_archive(prop_dictionary_t pkg_repod,
|
|||||||
pkgname, version, strerror(rv));
|
pkgname, version, strerror(rv));
|
||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
if (xhp->flags & XBPS_FLAG_VERBOSE)
|
xbps_warn_printf("ignoring existing "
|
||||||
xbps_warn_printf("ignoring existing "
|
"entry: %s\n", entry_pname);
|
||||||
"entry: %s\n", entry_pname);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xhp->xucd->entry_extract_count++;
|
xhp->xucd->entry_extract_count++;
|
||||||
RUN_PROGRESS_CB();
|
RUN_PROGRESS_CB();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if ((rv = archive_errno(ar)) == 0) {
|
* If there was any error extracting files from archive, error out.
|
||||||
buf = xbps_xasprintf(".%s/metadata/%s/%s",
|
*/
|
||||||
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
|
if ((rv = archive_errno(ar)) != 0) {
|
||||||
if (buf == NULL) {
|
xbps_dbg_printf("%s-%s: error extracting pkg files: %s\n",
|
||||||
rv = ENOMEM;
|
pkgname, version, archive_errno(ar));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Check if files.plist exists and pkg is NOT marked as
|
* On pkgs that set the preserve keyword or while installing
|
||||||
* preserve, in that case we need to check for obsolete files
|
* new packages, do not check for obsolete files.
|
||||||
* and remove them if necessary.
|
*/
|
||||||
*/
|
pkgfilesd = xbps_xasprintf(".%s/metadata/%s/%s",
|
||||||
if (!preserve) {
|
XBPS_META_PATH, pkgname, XBPS_PKGFILES);
|
||||||
old_filesd =
|
if (pkgfilesd == NULL) {
|
||||||
prop_dictionary_internalize_from_zfile(buf);
|
rv = ENOMEM;
|
||||||
if (old_filesd) {
|
goto out;
|
||||||
rv = xbps_remove_obsoletes(old_filesd, filesd);
|
}
|
||||||
if (rv != 0) {
|
if (preserve || !update)
|
||||||
prop_object_release(old_filesd);
|
goto out1;
|
||||||
free(buf);
|
/*
|
||||||
rv = errno;
|
* Check for obsolete files.
|
||||||
goto out;
|
*/
|
||||||
}
|
old_filesd = prop_dictionary_internalize_from_zfile(pkgfilesd);
|
||||||
prop_object_release(old_filesd);
|
if (prop_object_type(old_filesd) == PROP_TYPE_DICTIONARY) {
|
||||||
|
if ((rv = xbps_remove_obsoletes(old_filesd, filesd)) != 0) {
|
||||||
} else if (errno && errno != ENOENT) {
|
prop_object_release(old_filesd);
|
||||||
free(buf);
|
rv = errno;
|
||||||
rv = errno;
|
goto out;
|
||||||
goto out;
|
}
|
||||||
}
|
prop_object_release(old_filesd);
|
||||||
}
|
} else if (errno && errno != ENOENT) {
|
||||||
/*
|
rv = errno;
|
||||||
* Now that all files were successfully unpacked, we
|
goto out;
|
||||||
* can safely externalize files.plist because the path
|
}
|
||||||
* is reachable.
|
out1:
|
||||||
*/
|
/*
|
||||||
if (!prop_dictionary_externalize_to_zfile(filesd, buf)) {
|
* Create pkg metadata directory.
|
||||||
rv = errno;
|
*/
|
||||||
xbps_error_printf("failed to extract metadata %s file"
|
buf = xbps_xasprintf(".%s/metadata/%s", XBPS_META_PATH, pkgname);
|
||||||
"for `%s-%s': %s\n", XBPS_PKGFILES, pkgname,
|
if (buf == NULL) {
|
||||||
version, strerror(rv));
|
rv = ENOMEM;
|
||||||
free(buf);
|
goto out;
|
||||||
goto out;
|
}
|
||||||
}
|
if (xbps_mkpath(buf, 0755) == -1) {
|
||||||
free(buf);
|
xbps_dbg_printf("%s-%s: failed to create pkg metadir: %s\n",
|
||||||
|
pkgname, version, strerror(errno));
|
||||||
|
rv = errno;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Externalize XBPS_PKGFILES into pkg metadata directory.
|
||||||
|
*/
|
||||||
|
if (!prop_dictionary_externalize_to_zfile(filesd, pkgfilesd)) {
|
||||||
|
rv = errno;
|
||||||
|
xbps_error_printf("failed to extract metadata %s file"
|
||||||
|
"for `%s-%s': %s\n", XBPS_PKGFILES, pkgname,
|
||||||
|
version, strerror(rv));
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (filesd)
|
if (pkgfilesd != NULL)
|
||||||
|
free(pkgfilesd);
|
||||||
|
if (buf != NULL)
|
||||||
|
free(buf);
|
||||||
|
if (prop_object_type(filesd) == PROP_TYPE_DICTIONARY)
|
||||||
prop_object_release(filesd);
|
prop_object_release(filesd);
|
||||||
if (propsd)
|
if (prop_object_type(propsd) == PROP_TYPE_DICTIONARY)
|
||||||
prop_object_release(propsd);
|
prop_object_release(propsd);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
Loading…
Reference in New Issue
Block a user