FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 04-10-2008, 02:24 AM
"K. Piche"
 
Default Add some tracing and move some variables in add.c

>From 8f27d437dd27617969403a7113c178e8ccfa89c2 Mon Sep 17 00:00:00 2001
From: K. Piche <kevin@archlinux.org>
Date: Tue, 8 Apr 2008 23:14:21 -0400
Subject: [PATCH] Added some tracing and improved some variable locality.

Signed-off-by: K. Piche <kevin@archlinux.org>
---
lib/libalpm/add.c | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 05935a7..a4ed175 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -195,6 +195,9 @@ static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t
*newpkg, pmtrans_t *trans, pm
* with the type PM_TRANS_TYPE_REMOVEUPGRADE. TODO: kill this weird
* behavior. */
pmtrans_t *tr = _alpm_trans_new();
+
+ ALPM_LOG_FUNC;
+
_alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)
",
oldpkg->name, oldpkg->version);

@@ -285,6 +288,8 @@ static int extract_single_file(struct archive
*archive,
ARCHIVE_EXTRACT_TIME;
int errors = 0;

+ ALPM_LOG_FUNC;
+
strncpy(entryname, archive_entry_pathname(entry), PATH_MAX);
entrymode = archive_entry_mode(entry);

@@ -631,14 +636,13 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
pkg_current, int pkg_count,
pmtrans_t *trans, pmdb_t *db)
{
int i, ret = 0, errors = 0;
- struct archive *archive;
- struct archive_entry *entry;
- char cwd[PATH_MAX] = "";
char scriptlet[PATH_MAX+1];
int is_upgrade = 0;
double percent = 0.0;
pmpkg_t *oldpkg = NULL;

+ ALPM_LOG_FUNC;
+
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path,
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));

@@ -693,6 +697,10 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
pkg_current, int pkg_count,
if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
_alpm_log(PM_LOG_DEBUG, "extracting files
");

+ struct archive *archive;
+ struct archive_entry *entry;
+ char cwd[PATH_MAX] = "";
+
if ((archive = archive_read_new()) == NULL) {
RET_ERR(PM_ERR_LIBARCHIVE, -1);
}
@@ -700,6 +708,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
pkg_current, int pkg_count,
archive_read_support_compression_all(archive);
archive_read_support_format_all(archive);

+ _alpm_log(PM_LOG_DEBUG, "archive: %s
", newpkg->origin_data.file);
if(archive_read_open_filename(archive, newpkg->origin_data.file,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
RET_ERR(PM_ERR_PKG_OPEN, -1);
--
1.5.4.5


--
K. Piche <kpiche@rogers.com>


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 04-14-2008, 10:10 PM
"Dan McGee"
 
Default Add some tracing and move some variables in add.c

On Wed, Apr 9, 2008 at 9:24 PM, K. Piche <kpiche@rogers.com> wrote:
> >From 8f27d437dd27617969403a7113c178e8ccfa89c2 Mon Sep 17 00:00:00 2001
> From: K. Piche <kevin@archlinux.org>
> Date: Tue, 8 Apr 2008 23:14:21 -0400
> Subject: [PATCH] Added some tracing and improved some variable locality.
>
> Signed-off-by: K. Piche <kevin@archlinux.org>
> ---
> lib/libalpm/add.c | 15 ++++++++++++---
> 1 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
> index 05935a7..a4ed175 100644
> --- a/lib/libalpm/add.c
> +++ b/lib/libalpm/add.c
> @@ -195,6 +195,9 @@ static int upgrade_remove(pmpkg_t *oldpkg, pmpkg_t
> *newpkg, pmtrans_t *trans, pm
> * with the type PM_TRANS_TYPE_REMOVEUPGRADE. TODO: kill this weird
> * behavior. */
> pmtrans_t *tr = _alpm_trans_new();
> +
> + ALPM_LOG_FUNC;
> +
> _alpm_log(PM_LOG_DEBUG, "removing old package first (%s-%s)
",
> oldpkg->name, oldpkg->version);
>
> @@ -285,6 +288,8 @@ static int extract_single_file(struct archive
> *archive,
> ARCHIVE_EXTRACT_TIME;
> int errors = 0;
>
> + ALPM_LOG_FUNC;
> +

I think I'm goign to drop this one as I don't want to put too many
traces in static functions that could have a ton of calls- we had this
problem with alpm_depcmp.

> strncpy(entryname, archive_entry_pathname(entry), PATH_MAX);
> entrymode = archive_entry_mode(entry);
>
> @@ -631,14 +636,13 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
> pkg_current, int pkg_count,
> pmtrans_t *trans, pmdb_t *db)
> {
> int i, ret = 0, errors = 0;
> - struct archive *archive;
> - struct archive_entry *entry;
> - char cwd[PATH_MAX] = "";
> char scriptlet[PATH_MAX+1];
> int is_upgrade = 0;
> double percent = 0.0;
> pmpkg_t *oldpkg = NULL;
>
> + ALPM_LOG_FUNC;
> +
> snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", db->path,
> alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
>
> @@ -693,6 +697,10 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
> pkg_current, int pkg_count,
> if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) {
> _alpm_log(PM_LOG_DEBUG, "extracting files
");
>
> + struct archive *archive;
> + struct archive_entry *entry;
> + char cwd[PATH_MAX] = "";
> +
> if ((archive = archive_read_new()) == NULL) {
> RET_ERR(PM_ERR_LIBARCHIVE, -1);
> }
> @@ -700,6 +708,7 @@ static int commit_single_pkg(pmpkg_t *newpkg, int
> pkg_current, int pkg_count,
> archive_read_support_compression_all(archive);
> archive_read_support_format_all(archive);
>
> + _alpm_log(PM_LOG_DEBUG, "archive: %s
", newpkg->origin_data.file);
> if(archive_read_open_filename(archive, newpkg->origin_data.file,
> ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
> RET_ERR(PM_ERR_PKG_OPEN, -1);
> --

Rest looks pretty good. Thanks!

-Dan

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 07:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org