summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-03-05 23:13:33 +0100
committerDan McGee <dan@archlinux.org>2007-03-05 23:13:33 +0100
commit869e81e1cf115e835040d0ecadb6108880103abe (patch)
tree2c67f7f304e27cfab2b9d7b1fd48f8b15a914dd4
parentfacb99098d8d28f7bd3ac1aeb02ab0e158f9cff2 (diff)
downloadpacman-869e81e1cf115e835040d0ecadb6108880103abe.tar.gz
pacman-869e81e1cf115e835040d0ecadb6108880103abe.tar.xz
This commit looks much more monumental than it is. Almost all just #include
reordering and adding ones that were forgotten (noticed when trying to compile after reordering). * Updated the HACKING file to include information on #include usage. * print -> vprint in "making dir" function in pactest.
-rw-r--r--HACKING34
-rw-r--r--lib/libalpm/add.c6
-rw-r--r--lib/libalpm/alpm.c10
-rw-r--r--lib/libalpm/alpm_list.c3
-rw-r--r--lib/libalpm/backup.c7
-rw-r--r--lib/libalpm/be_files.c7
-rw-r--r--lib/libalpm/cache.c8
-rw-r--r--lib/libalpm/conflict.c15
-rw-r--r--lib/libalpm/conflict.h3
-rw-r--r--lib/libalpm/db.c16
-rw-r--r--lib/libalpm/deps.c9
-rw-r--r--lib/libalpm/error.c6
-rw-r--r--lib/libalpm/group.c8
-rw-r--r--lib/libalpm/handle.c8
-rw-r--r--lib/libalpm/handle.h4
-rw-r--r--lib/libalpm/log.c6
-rw-r--r--lib/libalpm/md5.c1
-rw-r--r--lib/libalpm/md5driver.c4
-rw-r--r--lib/libalpm/package.c6
-rw-r--r--lib/libalpm/provide.c8
-rw-r--r--lib/libalpm/remove.c19
-rw-r--r--lib/libalpm/server.c5
-rw-r--r--lib/libalpm/sha1.c16
-rw-r--r--lib/libalpm/sync.c8
-rw-r--r--lib/libalpm/trans.c7
-rw-r--r--lib/libalpm/util.c18
-rw-r--r--lib/libalpm/versioncmp.c8
-rwxr-xr-xpactest/util.py2
-rw-r--r--src/pacman/add.c5
-rw-r--r--src/pacman/conf.c5
-rw-r--r--src/pacman/deptest.c4
-rw-r--r--src/pacman/downloadprog.c4
-rw-r--r--src/pacman/log.c2
-rw-r--r--src/pacman/package.c5
-rw-r--r--src/pacman/pacman.c2
-rw-r--r--src/pacman/query.c5
-rw-r--r--src/pacman/remove.c5
-rw-r--r--src/pacman/sync.c12
-rw-r--r--src/pacman/trans.c4
-rw-r--r--src/pacman/upgrade.c7
-rw-r--r--src/pacman/util.c5
-rw-r--r--src/util/testpkg.c2
-rw-r--r--src/util/vercmp.c4
43 files changed, 219 insertions, 104 deletions
diff --git a/HACKING b/HACKING
index 9d8681cc..ea8936db 100644
--- a/HACKING
+++ b/HACKING
@@ -1,8 +1,8 @@
Contributing to pacman
======================
-Please read 'submitting-patches' and 'translation-help' in the same directory as
-this file.
+Please read 'submitting-patches' and 'translation-help' in the same directory
+as this file.
Coding style
------------
@@ -62,4 +62,34 @@ Coding style
NOT
sizeof(*mylist);
+Other Concerns
+--------------
+
+Currently our #include usage is in messy shape, but this is no reason to
+continue down this messy path. When adding an include to a file, follow this
+general pattern, including blank lines:
+
+#include "config.h"
+
+#include <standardheader.h>
+#include <another.h>
+#include <...>
+
+Follow this with some more headers, depending on whether the file is in libalpm
+or pacman proper. For libalpm:
+
+/* libalpm */
+#include "yourfile.h"
+#include "alpm_list.h"
+#include "anythingelse.h"
+
+For pacman:
+
+#include <alpm.h>
+#include <alpm_list.h>
+
+/* pacman */
+#include "yourfile.h"
+#include "anythingelse.h"
+
vim: set ts=2 sw=2 et:
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 97d1ea72..450b9c16 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -31,6 +31,7 @@
#endif
#include "config.h"
+
#include <stdlib.h>
#include <errno.h>
#include <time.h>
@@ -38,7 +39,9 @@
#include <string.h>
#include <limits.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "add.h"
#include "alpm_list.h"
#include "trans.h"
#include "util.h"
@@ -54,7 +57,6 @@
#include "provide.h"
#include "conflict.h"
#include "deps.h"
-#include "add.h"
#include "remove.h"
#include "handle.h"
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 8553c558..d4833199 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -22,6 +22,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
@@ -36,14 +38,15 @@
#include <limits.h> /* PATH_MAX */
#include <stdarg.h>
#include <libintl.h>
-/* pacman */
-#include "config.h"
+
+/* libalpm */
+#include "alpm.h"
+#include "alpm_list.h"
#include "log.h"
#include "error.h"
#include "versioncmp.h"
#include "md5.h"
#include "sha1.h"
-#include "alpm_list.h"
#include "package.h"
#include "group.h"
#include "util.h"
@@ -58,7 +61,6 @@
#include "handle.h"
#include "provide.h"
#include "server.h"
-#include "alpm.h"
#define min(X, Y) ((X) < (Y) ? (X) : (Y))
diff --git a/lib/libalpm/alpm_list.c b/lib/libalpm/alpm_list.c
index 0737fc89..324c7d08 100644
--- a/lib/libalpm/alpm_list.c
+++ b/lib/libalpm/alpm_list.c
@@ -20,11 +20,12 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <assert.h>
+/* libalpm */
#include "alpm_list.h"
#include "util.h"
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index 751d0937..aeb0dea7 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -23,11 +23,14 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <string.h>
-/* pacman */
-#include "log.h"
+
+/* libalpm */
#include "backup.h"
+#include "alpm_list.h"
+#include "log.h"
#include "util.h"
/* Look for a filename in a pmpkg_t.backup list. If we find it,
diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index f8e73fbb..6e2f4c4f 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -21,6 +21,7 @@
*/
#include "config.h"
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -36,10 +37,12 @@
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
-/* pacman */
+
+/* libalpm */
+#include "db.h"
+#include "alpm_list.h"
#include "log.h"
#include "util.h"
-#include "db.h"
#include "alpm.h"
#include "error.h"
#include "handle.h"
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index 75100283..f441af31 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -27,16 +28,17 @@
#include <string.h>
#include <sys/stat.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "cache.h"
+#include "alpm_list.h"
#include "log.h"
#include "alpm.h"
-#include "alpm_list.h"
#include "util.h"
#include "error.h"
#include "package.h"
#include "group.h"
#include "db.h"
-#include "cache.h"
/* Returns a new package cache from db.
* It frees the cache if it already exists.
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index 76e76901..80490233 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -23,28 +23,29 @@
* USA.
*/
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#endif
-
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <limits.h>
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#endif
#include <sys/stat.h>
#include <libintl.h>
-/* pacman */
-#include "handle.h"
+
+/* libalpm */
+#include "conflict.h"
#include "alpm_list.h"
+#include "handle.h"
#include "trans.h"
#include "util.h"
#include "error.h"
#include "log.h"
#include "cache.h"
#include "deps.h"
-#include "conflict.h"
/** See if potential conflict 'name' matches package 'pkg'.
diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h
index 44507f72..8928de86 100644
--- a/lib/libalpm/conflict.h
+++ b/lib/libalpm/conflict.h
@@ -21,8 +21,9 @@
#ifndef _ALPM_CONFLICT_H
#define _ALPM_CONFLICT_H
-#include "db.h"
#include "alpm.h"
+#include "db.h"
+#include "package.h"
#define CONFLICT_FILE_LEN 512
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index a6ef0528..451f40d6 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -23,30 +23,32 @@
* USA.
*/
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#include <sys/stat.h>
-#endif
-
#include "config.h"
+
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#include <sys/stat.h>
+#endif
#include <dirent.h>
#include <libintl.h>
#include <regex.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
#endif
-/* pacman */
+
+/* libalpm */
+#include "db.h"
+#include "alpm_list.h"
#include "log.h"
#include "util.h"
#include "error.h"
#include "server.h"
-#include "db.h"
#include "handle.h"
#include "cache.h"
#include "alpm.h"
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index a84d8b2a..247d9ff3 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -21,6 +21,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -29,16 +31,17 @@
#endif
#include <libintl.h>
#include <math.h>
-/* pacman */
+
+/* libalpm */
+#include "deps.h"
+#include "alpm_list.h"
#include "util.h"
#include "log.h"
#include "error.h"
-#include "alpm_list.h"
#include "package.h"
#include "db.h"
#include "cache.h"
#include "provide.h"
-#include "deps.h"
#include "versioncmp.h"
#include "handle.h"
diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c
index 8befd560..ece8a521 100644
--- a/lib/libalpm/error.c
+++ b/lib/libalpm/error.c
@@ -22,10 +22,16 @@
* USA.
*/
+#include "config.h"
+
#include <libintl.h>
+
+/* libalpm */
+#include "error.h"
#include "util.h"
#include "alpm.h"
+/* TODO does this really need a file all on its own? */
char SYMEXPORT *alpm_strerror(int err)
{
switch(err) {
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 98b331f3..cce05213 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -20,16 +20,18 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "group.h"
+#include "alpm_list.h"
#include "util.h"
#include "error.h"
#include "log.h"
-#include "group.h"
-#include "alpm_list.h"
#include "alpm.h"
pmgrp_t *_alpm_grp_new()
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index b044adcb..417339dc 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -22,6 +22,7 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -30,15 +31,16 @@
#include <syslog.h>
#include <libintl.h>
#include <time.h>
-/* pacman */
+
+/* libalpm */
+#include "handle.h"
+#include "alpm_list.h"
#include "util.h"
#include "log.h"
-#include "alpm_list.h"
#include "error.h"
#include "trans.h"
#include "alpm.h"
#include "server.h"
-#include "handle.h"
pmhandle_t *_alpm_handle_new()
{
diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h
index bd75a370..35e5eb23 100644
--- a/lib/libalpm/handle.h
+++ b/lib/libalpm/handle.h
@@ -21,9 +21,11 @@
#ifndef _ALPM_HANDLE_H
#define _ALPM_HANDLE_H
+#include <stdio.h>
+
+#include "alpm_list.h"
#include "db.h"
#include "log.h"
-#include "alpm_list.h"
#include "alpm.h"
#include "trans.h"
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c
index c1d2aa6a..b59ec64e 100644
--- a/lib/libalpm/log.c
+++ b/lib/libalpm/log.c
@@ -20,12 +20,14 @@
*/
#include "config.h"
+
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
-/* pacman */
-#include "alpm.h"
+
+/* libalpm */
#include "log.h"
+#include "alpm.h"
void _alpm_log(pmloglevel_t flag, char *fmt, ...)
{
diff --git a/lib/libalpm/md5.c b/lib/libalpm/md5.c
index 7e4fd677..6d5aa6a3 100644
--- a/lib/libalpm/md5.c
+++ b/lib/libalpm/md5.c
@@ -24,6 +24,7 @@ documentation and/or software.
*/
#include <string.h>
+
#include "md5.h"
/* Constants for MD5Transform routine.
diff --git a/lib/libalpm/md5driver.c b/lib/libalpm/md5driver.c
index 968caed8..60144fee 100644
--- a/lib/libalpm/md5driver.c
+++ b/lib/libalpm/md5driver.c
@@ -19,10 +19,14 @@ documentation and/or software.
*/
#define MD MD5
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libintl.h>
+
+/* libalpm */
#include "alpm.h"
#include "log.h"
#include "util.h"
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 1faf2f2d..340dc525 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -23,6 +23,7 @@
*/
#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
@@ -33,12 +34,13 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-/* pacman */
+
+/* libalpm */
#include "package.h"
+#include "alpm_list.h"
#include "log.h"
#include "util.h"
#include "error.h"
-#include "alpm_list.h"
#include "db.h"
#include "cache.h"
#include "provide.h"
diff --git a/lib/libalpm/provide.c b/lib/libalpm/provide.c
index 3b563365..df600be7 100644
--- a/lib/libalpm/provide.c
+++ b/lib/libalpm/provide.c
@@ -20,14 +20,16 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <string.h>
-/* pacman */
-#include "cache.h"
+
+/* libalpm */
+#include "provide.h"
#include "alpm_list.h"
+#include "cache.h"
#include "db.h"
#include "log.h"
-#include "provide.h"
/* return a alpm_list_t of packages in "db" that provide "package"
*/
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index 9c57334b..fed86b0c 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -23,24 +23,26 @@
* USA.
*/
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#endif
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
-#include <sys/stat.h>
-#endif
-
#include "config.h"
+
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <fcntl.h>
#include <string.h>
#include <limits.h>
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#endif
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
+#include <sys/stat.h>
+#endif
#include <unistd.h>
#include <errno.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "remove.h"
#include "alpm_list.h"
#include "trans.h"
#include "util.h"
@@ -55,7 +57,6 @@
#include "cache.h"
#include "deps.h"
#include "provide.h"
-#include "remove.h"
#include "handle.h"
#include "alpm.h"
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index b426ccb5..fb3c4147 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -29,8 +31,9 @@
#include <time.h>
#include <download.h>
-/* pacman */
+/* libalpm */
#include "server.h"
+#include "alpm_list.h"
#include "error.h"
#include "log.h"
#include "alpm.h"
diff --git a/lib/libalpm/sha1.c b/lib/libalpm/sha1.c
index 956e87a9..d9a9118d 100644
--- a/lib/libalpm/sha1.c
+++ b/lib/libalpm/sha1.c
@@ -22,20 +22,18 @@
Robert Klep <robert@ilse.nl> -- Expansion function fix
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include "config.h"
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
#include <libintl.h>
+/* libalpm */
+#include "sha1.h"
#include "alpm.h"
#include "log.h"
#include "util.h"
-#include "sha1.h"
-
-#include <sys/types.h>
-
-#include <stdlib.h>
-#include <string.h>
/*
Not-swap is a macro that does an endian swap on architectures that are
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 337e350a..f3a0ee06 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -23,6 +23,7 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
@@ -33,10 +34,12 @@
#endif
#include <dirent.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "sync.h"
+#include "alpm_list.h"
#include "log.h"
#include "error.h"
-#include "alpm_list.h"
#include "package.h"
#include "db.h"
#include "cache.h"
@@ -45,7 +48,6 @@
#include "provide.h"
#include "trans.h"
#include "util.h"
-#include "sync.h"
#include "versioncmp.h"
#include "handle.h"
#include "util.h"
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index b4677079..f22697dd 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -23,16 +23,19 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "trans.h"
+#include "alpm_list.h"
#include "error.h"
#include "package.h"
#include "util.h"
#include "log.h"
-#include "alpm_list.h"
#include "handle.h"
#include "add.h"
#include "remove.h"
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index c526ed8e..be9eeb31 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -23,14 +23,8 @@
* USA.
*/
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#endif
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
-#include <sys/stat.h>
-#endif
-
#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#ifdef __sun__
@@ -45,6 +39,12 @@
#include <time.h>
#include <syslog.h>
#include <sys/wait.h>
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#endif
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun__)
+#include <sys/stat.h>
+#endif
#include <libintl.h>
#ifdef CYGWIN
#include <limits.h> /* PATH_MAX */
@@ -54,12 +54,12 @@
#include <mntent.h>
#endif
-/* pacman */
+/* libalpm */
+#include "util.h"
#include "alpm_list.h"
#include "log.h"
#include "trans.h"
#include "sync.h"
-#include "util.h"
#include "error.h"
#include "package.h"
#include "alpm.h"
diff --git a/lib/libalpm/versioncmp.c b/lib/libalpm/versioncmp.c
index ad628866..67fe5ba4 100644
--- a/lib/libalpm/versioncmp.c
+++ b/lib/libalpm/versioncmp.c
@@ -22,17 +22,19 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <libintl.h>
-/* pacman */
+
+/* libalpm */
+#include "versioncmp.h"
+#include "alpm_list.h"
#include "alpm.h"
#include "log.h"
#include "util.h"
-#include "alpm_list.h"
-#include "versioncmp.h"
#ifndef HAVE_STRVERSCMP
/* GNU's strverscmp() function, taken from glibc 2.3.2 sources
diff --git a/pactest/util.py b/pactest/util.py
index 1cdb4018..e445605e 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -255,7 +255,7 @@ def mkdir(dir):
else:
parent, thisdir = os.path.split(dir)
if parent: mkdir(parent) #recurse to make all parents
- print "making dir %s" % thisdir
+ vprint("making dir %s" % thisdir)
if thisdir: os.mkdir(dir)
if __name__ == "__main__":
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 40a4bc2d..2adf8681 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -26,11 +28,12 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
+#include "add.h"
#include "log.h"
#include "downloadprog.h"
#include "trans.h"
-#include "add.h"
#include "conf.h"
#include "util.h"
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 4c0381cf..a770fd47 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -26,12 +28,13 @@
#include <libintl.h>
#include <alpm.h>
+
/* pacman */
+#include "conf.h"
#include "util.h"
#include "log.h"
#include "sync.h"
#include "downloadprog.h"
-#include "conf.h"
config_t *config_new()
{
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index f8bf513d..a7c913d9 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -25,14 +25,16 @@
#include <stdio.h>
#include <string.h>
#include <libintl.h>
+
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
+#include "deptest.h"
#include "util.h"
#include "conf.h"
#include "log.h"
#include "sync.h"
-#include "deptest.h"
extern config_t *config;
diff --git a/src/pacman/downloadprog.c b/src/pacman/downloadprog.c
index 0d5a9b22..6ce8e2f5 100644
--- a/src/pacman/downloadprog.c
+++ b/src/pacman/downloadprog.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
@@ -32,10 +33,11 @@
#include <math.h>
#include <alpm.h>
+
/* pacman */
+#include "downloadprog.h"
#include "util.h"
#include "log.h"
-#include "downloadprog.h"
#include "conf.h"
/* progress bar */
diff --git a/src/pacman/log.c b/src/pacman/log.c
index 501f32d2..1b65e28d 100644
--- a/src/pacman/log.c
+++ b/src/pacman/log.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
@@ -28,6 +29,7 @@
#include <libintl.h>
#include <alpm.h>
+
/* pacman */
#include "log.h"
#include "conf.h"
diff --git a/src/pacman/package.c b/src/pacman/package.c
index d5a3d04e..091ed9ed 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -28,10 +30,11 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
+#include "package.h"
#include "log.h"
#include "util.h"
-#include "package.h"
/* Display the content of an installed package
*
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index e2a5eec9..a26d34c7 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
@@ -44,6 +45,7 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
#include "util.h"
#include "log.h"
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 2ce36ac4..2964a7cb 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
@@ -28,9 +30,10 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
-#include "package.h"
#include "query.h"
+#include "package.h"
#include "log.h"
#include "conf.h"
#include "sync.h"
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 0b48410c..9989f8e5 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -26,11 +28,12 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
+#include "remove.h"
#include "util.h"
#include "log.h"
#include "trans.h"
-#include "remove.h"
#include "conf.h"
extern config_t *config;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 8db1d9ac..4245b964 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -19,16 +19,15 @@
* USA.
*/
-#if defined(__APPLE__) || defined(__OpenBSD__)
-#include <sys/syslimits.h>
-#include <sys/stat.h>
-#endif
-
#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#if defined(__APPLE__) || defined(__OpenBSD__)
+#include <sys/syslimits.h>
+#endif
#include <unistd.h>
#include <dirent.h>
#include <libintl.h>
@@ -41,13 +40,14 @@
#include <download.h> /* downloadLastErrString */
/* TODO remove above download.h inclusion once we abstract more, and also
* remove it from Makefile.am on the pacman side */
+
/* pacman */
+#include "sync.h"
#include "util.h"
#include "log.h"
#include "downloadprog.h"
#include "package.h"
#include "trans.h"
-#include "sync.h"
#include "conf.h"
extern config_t *config;
diff --git a/src/pacman/trans.c b/src/pacman/trans.c
index 55b40413..23efadf6 100644
--- a/src/pacman/trans.c
+++ b/src/pacman/trans.c
@@ -20,6 +20,7 @@
*/
#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -30,10 +31,11 @@
#include <wchar.h>
#include <alpm.h>
+
/* pacman */
+#include "trans.h"
#include "util.h"
#include "log.h"
-#include "trans.h"
#include "conf.h"
#define LOG_STR_LEN 256
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 5b803353..a4c94bb7 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -19,15 +19,16 @@
* USA.
*/
+#include "config.h"
+
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
-#include "add.h"
#include "upgrade.h"
+#include "add.h"
#include "conf.h"
extern config_t *config;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 96eb621e..76bbc189 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -19,16 +19,16 @@
* USA.
*/
+#include "config.h"
+
#if defined(__APPLE__) || defined(__OpenBSD__)
#include <sys/syslimits.h>
#include <sys/stat.h>
#endif
-
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
-#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -44,6 +44,7 @@
#include <alpm.h>
#include <alpm_list.h>
+
/* pacman */
#include "util.h"
#include "conf.h"
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index fdee6708..a64e6b34 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -19,6 +19,8 @@
* USA.
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/util/vercmp.c b/src/util/vercmp.c
index 75972532..cc951988 100644
--- a/src/util/vercmp.c
+++ b/src/util/vercmp.c
@@ -19,14 +19,18 @@
* USA.
*/
+#include "config.h"
+
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <limits.h>
+/* TODO this is probably not the best way to do this */
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
+
#include <alpm.h>
int main(int argc, char *argv[])