summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-04-29 12:47:02 -0400
committerDan McGee <dan@archlinux.org>2007-04-29 12:47:02 -0400
commit8bbb5dd0789db6d57f1fc365296ef0f6a35e8a1f (patch)
tree71ed3efd6fe09fdf6fed3bc795d16c68d06254de /lib/libalpm/add.c
parenta58e17a1d7a9901bb32277c9aed7edded3501767 (diff)
downloadpacman-8bbb5dd0789db6d57f1fc365296ef0f6a35e8a1f.tar.xz
libalpm util.c and util.h cleanup
* Remove some unnecessary conditional compiling in util.h- move the functions tha required it to trans.c (along with a bunch of new header includes). * Clean up util.h a bit- remove some header includes, remove universal libarchive include and only put it in the files that need it. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 49385f4f..73c84cc0 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -39,6 +39,10 @@
#include <string.h>
#include <limits.h>
+/* libarchive */
+#include <archive.h>
+#include <archive_entry.h>
+
/* libalpm */
#include "add.h"
#include "alpm_list.h"
@@ -280,6 +284,7 @@ int _alpm_add_prepare(pmtrans_t *trans, pmdb_t *db, alpm_list_t **data)
return(0);
}
+/* TODO clean up this monster 554 line function */
int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
{
int i, ret = 0, errors = 0, pkg_count = 0;
@@ -287,6 +292,9 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
struct archive_entry *entry;
char cwd[PATH_MAX] = "";
alpm_list_t *targ, *lp;
+ const int archive_flags = ARCHIVE_EXTRACT_OWNER |
+ ARCHIVE_EXTRACT_PERM |
+ ARCHIVE_EXTRACT_TIME;
ALPM_LOG_FUNC;
@@ -536,9 +544,11 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
archive_entry_set_pathname(entry, tempfile);
- if(archive_read_extract(archive, entry, ARCHIVE_EXTRACT_FLAGS) != ARCHIVE_OK) {
- _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), entryname, strerror(errno));
- alpm_logaction(_("could not extract %s (%s)"), entryname, strerror(errno));
+ if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) {
+ _alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"),
+ entryname, strerror(errno));
+ alpm_logaction(_("could not extract %s (%s)"),
+ entryname, strerror(errno));
errors++;
unlink(tempfile);
FREE(hash_orig);
@@ -686,7 +696,7 @@ int _alpm_add_commit(pmtrans_t *trans, pmdb_t *db)
archive_entry_set_pathname(entry, filename);
- if(archive_read_extract(archive, entry, ARCHIVE_EXTRACT_FLAGS) != ARCHIVE_OK) {
+ if(archive_read_extract(archive, entry, archive_flags) != ARCHIVE_OK) {
_alpm_log(PM_LOG_ERROR, _("could not extract %s (%s)"), filename, strerror(errno));
alpm_logaction(_("error: could not extract %s (%s)"), filename, strerror(errno));
errors++;