There's no need to overwrite files while unpacking.
--HG-- extra : convert_revision : 0af6a384b869b752a47e33e95cacb0c33521ee53
This commit is contained in:
parent
db5b069a23
commit
bf01da5dcf
3 changed files with 12 additions and 16 deletions
|
@ -32,7 +32,7 @@ int xbps_install_binary_pkg(const char *, bool);
|
||||||
int xbps_install_binary_pkg_fini(prop_dictionary_t, prop_dictionary_t,
|
int xbps_install_binary_pkg_fini(prop_dictionary_t, prop_dictionary_t,
|
||||||
bool);
|
bool);
|
||||||
int xbps_register_pkg(prop_dictionary_t, bool, bool);
|
int xbps_register_pkg(prop_dictionary_t, bool, bool);
|
||||||
int xbps_unpack_binary_pkg(prop_dictionary_t, prop_dictionary_t, bool);
|
int xbps_unpack_binary_pkg(prop_dictionary_t, prop_dictionary_t);
|
||||||
int xbps_requiredby_pkg_add(prop_array_t, prop_dictionary_t, bool);
|
int xbps_requiredby_pkg_add(prop_array_t, prop_dictionary_t, bool);
|
||||||
int xbps_requiredby_pkg_remove(const char *);
|
int xbps_requiredby_pkg_remove(const char *);
|
||||||
int xbps_find_deps_in_pkg(prop_dictionary_t);
|
int xbps_find_deps_in_pkg(prop_dictionary_t);
|
||||||
|
|
|
@ -80,7 +80,7 @@ xbps_install_binary_pkg_fini(prop_dictionary_t repo, prop_dictionary_t pkgrd,
|
||||||
}
|
}
|
||||||
(void)fflush(stdout);
|
(void)fflush(stdout);
|
||||||
|
|
||||||
rv = xbps_unpack_binary_pkg(repo, pkgrd, update);
|
rv = xbps_unpack_binary_pkg(repo, pkgrd);
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
rv = xbps_register_pkg(pkgrd, update, automatic);
|
rv = xbps_register_pkg(pkgrd, update, automatic);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
|
|
24
lib/unpack.c
24
lib/unpack.c
|
@ -35,12 +35,11 @@
|
||||||
|
|
||||||
#include <xbps_api.h>
|
#include <xbps_api.h>
|
||||||
|
|
||||||
static int unpack_archive_init(prop_dictionary_t, const char *, bool);
|
static int unpack_archive_init(prop_dictionary_t, const char *);
|
||||||
static int unpack_archive_fini(struct archive *, prop_dictionary_t, bool);
|
static int unpack_archive_fini(struct archive *, prop_dictionary_t);
|
||||||
|
|
||||||
int
|
int
|
||||||
xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg)
|
||||||
bool update)
|
|
||||||
{
|
{
|
||||||
prop_string_t filename, repoloc, arch;
|
prop_string_t filename, repoloc, arch;
|
||||||
char *binfile, *path;
|
char *binfile, *path;
|
||||||
|
@ -70,14 +69,14 @@ xbps_unpack_binary_pkg(prop_dictionary_t repo, prop_dictionary_t pkg,
|
||||||
}
|
}
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
rv = unpack_archive_init(pkg, binfile, update);
|
rv = unpack_archive_init(pkg, binfile);
|
||||||
free(binfile);
|
free(binfile);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unpack_archive_init(prop_dictionary_t pkg, const char *binfile, bool update)
|
unpack_archive_init(prop_dictionary_t pkg, const char *binfile)
|
||||||
{
|
{
|
||||||
struct archive *ar;
|
struct archive *ar;
|
||||||
int pkg_fd, rv;
|
int pkg_fd, rv;
|
||||||
|
@ -105,7 +104,7 @@ unpack_archive_init(prop_dictionary_t pkg, const char *binfile, bool update)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = unpack_archive_fini(ar, pkg, update);
|
rv = unpack_archive_fini(ar, pkg);
|
||||||
/*
|
/*
|
||||||
* If installation of package was successful, make sure the package
|
* If installation of package was successful, make sure the package
|
||||||
* is really on storage (if possible).
|
* is really on storage (if possible).
|
||||||
|
@ -122,10 +121,10 @@ unpack_archive_init(prop_dictionary_t pkg, const char *binfile, bool update)
|
||||||
/*
|
/*
|
||||||
* Flags for extracting files in binary packages.
|
* Flags for extracting files in binary packages.
|
||||||
*/
|
*/
|
||||||
#define INSTALL_EFLAGS ARCHIVE_EXTRACT_NO_OVERWRITE | \
|
|
||||||
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
|
|
||||||
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
#define EXTRACT_FLAGS ARCHIVE_EXTRACT_SECURE_NODOTDOT | \
|
||||||
ARCHIVE_EXTRACT_SECURE_SYMLINKS
|
ARCHIVE_EXTRACT_SECURE_SYMLINKS | \
|
||||||
|
ARCHIVE_EXTRACT_NO_OVERWRITE | \
|
||||||
|
ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER
|
||||||
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
|
#define FEXTRACT_FLAGS ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | \
|
||||||
ARCHIVE_EXTRACT_TIME | EXTRACT_FLAGS
|
ARCHIVE_EXTRACT_TIME | EXTRACT_FLAGS
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ unpack_archive_init(prop_dictionary_t pkg, const char *binfile, bool update)
|
||||||
* the consumer.
|
* the consumer.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg, bool update)
|
unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg)
|
||||||
{
|
{
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -166,9 +165,6 @@ unpack_archive_fini(struct archive *ar, prop_dictionary_t pkg, bool update)
|
||||||
else
|
else
|
||||||
lflags = EXTRACT_FLAGS;
|
lflags = EXTRACT_FLAGS;
|
||||||
|
|
||||||
if (update == false)
|
|
||||||
lflags |= INSTALL_EFLAGS;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This length is '.%s/metadata/%s/INSTALL' + NULL.
|
* This length is '.%s/metadata/%s/INSTALL' + NULL.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue