[pacman-dev] [PATCH 1/4] Add skeleton for hooks support

Victor Lowther victor.lowther at gmail.com
Tue Jul 27 04:42:52 EDT 2010


This begins work on adding some sort of hook infrastructure to pacman.
There has been much discussion and little code that I have seen, so I figured
I would go ahead an implement a very basic skeleton for transaction hooks
support.

---
 lib/libalpm/Makefile.am         |    1 +
 lib/libalpm/{sync.h => hooks.c} |   34 +++++++++++++++++++++++++---------
 lib/libalpm/{add.h => hooks.h}  |   19 ++++++++-----------
 3 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 3473a73..b4fdadf 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -44,6 +44,7 @@ libalpm_la_SOURCES = \
 	sync.h sync.c \
 	trans.h trans.c \
 	util.h util.c \
+	hooks.h hooks.c \
 	version.c
 
 libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
diff --git a/lib/libalpm/sync.h b/lib/libalpm/hooks.c
similarity index 65%
copy from lib/libalpm/sync.h
copy to lib/libalpm/hooks.c
index 000a09c..9630c70 100644
--- a/lib/libalpm/sync.h
+++ b/lib/libalpm/hooks.c
@@ -1,9 +1,10 @@
 /*
- *  sync.h
+ *  hooks.c
  *
  *  Copyright (c) 2006-2010 Pacman Development Team <pacman-dev at archlinux.org>
  *  Copyright (c) 2002-2006 by Judd Vinet <jvinet at zeroflux.org>
  *  Copyright (c) 2005 by Aurelien Foret <orelien at chez.com>
+ *  Copyright (c) 2005 by Christian Hamar <krics at linuxforum.hu>
  *  Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos at frugalware.org>
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,14 +20,29 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef _ALPM_SYNC_H
-#define _ALPM_SYNC_H
 
-#include "alpm.h"
-
-int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, alpm_list_t **data);
-int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data);
+#include "config.h"
 
-#endif /* _ALPM_SYNC_H */
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+#include <errno.h>
 
-/* vim: set ts=2 sw=2 noet: */
+/* libalpm */
+#include "hooks.h"
+#include "trans.h"
+#include "alpm_list.h"
+#include "package.h"
+#include "util.h"
+#include "log.h"
+#include "handle.h"
+#include "add.h"
+#include "remove.h"
+#include "sync.h"
+#include "alpm.h"
+#include "deps.h"
+#include "cache.h"
diff --git a/lib/libalpm/add.h b/lib/libalpm/hooks.h
similarity index 73%
copy from lib/libalpm/add.h
copy to lib/libalpm/hooks.h
index eb37dc7..d60b1f4 100644
--- a/lib/libalpm/add.h
+++ b/lib/libalpm/hooks.h
@@ -1,8 +1,11 @@
 /*
- *  add.h
+ *  hooks.h
  *
  *  Copyright (c) 2006-2010 Pacman Development Team <pacman-dev at archlinux.org>
  *  Copyright (c) 2002-2006 by Judd Vinet <jvinet at zeroflux.org>
+ *  Copyright (c) 2005 by Aurelien Foret <orelien at chez.com>
+ *  Copyright (c) 2005 by Christian Hamar <krics at linuxforum.hu>
+ *  Copyright (c) 2006 by Miklos Vajna <vmiklos at frugalware.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,15 +20,9 @@
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef _ALPM_ADD_H
-#define _ALPM_ADD_H
+#ifndef _ALPM_HOOKS_H
+#define _ALPM_HOOKS_H
 
-#include "db.h"
-#include "alpm_list.h"
-#include "trans.h"
+#include "alpm.h"
 
-int _alpm_upgrade_packages(pmtrans_t *trans, pmdb_t *db);
-
-#endif /* _ALPM_ADD_H */
-
-/* vim: set ts=2 sw=2 noet: */
+#endif /*ALPM_HOOKS_H */
-- 
1.7.1.1




More information about the pacman-dev mailing list