[pacman-dev] [PATCH 0/3] FreeBSD compile fixes
Pacman no longer compiles on FreeBSD (tried with version 8.2). * FreeBSD ships with libarchive 2.7.0 that has slightly fewer macros * diskspace.c does not have strict enough #ifdef's (for statfs/statvfs) * util.c does not include <limits.h> for PATH_MAX constant (that's what `man limits.h` and the POSIX spec say at least) The following patches fix compilation on FreeBSD (and do not break the testsuite on Archlinux). Note the additional dependencies for the testsuite: * fakeroot * python 2.6 or 2.7 * GNU make (due to wildcard usage in testsuite's Makefile.am) To apply on branch 'maint'. Rémy Oudompheng (3): Fix compatibility with older versions of libarchive. util.c: include limits.h for PATH_MAX macro diskspace: add the actually used statfs type in ifdefs acinclude.m4 | 8 ++++++-- lib/libalpm/be_sync.c | 2 ++ lib/libalpm/diskspace.c | 4 ++-- lib/libalpm/util.c | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) -- 1.7.4.2
There is no reason to not support versions of libarchive that lack ARCHIVE_COMPRESSION_UU. Distributions should work properly without this. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- lib/libalpm/be_sync.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index ef8517e..c2c62aa 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -197,9 +197,11 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive) case ARCHIVE_COMPRESSION_XZ: per_package = 143; break; +#ifdef ARCHIVE_COMPRESSION_UU case ARCHIVE_COMPRESSION_UU: per_package = 3543; break; +#endif default: /* assume it is at least somewhat compressed */ per_package = 200; -- 1.7.4.2
On Fri, Apr 1, 2011 at 5:35 PM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote:
There is no reason to not support versions of libarchive that lack ARCHIVE_COMPRESSION_UU. Distributions should work properly without this.
Signed-off-by: Rémy Oudompheng <remy@archlinux.org> Thanks, applied to maint.
--- lib/libalpm/be_sync.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index ef8517e..c2c62aa 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -197,9 +197,11 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive) case ARCHIVE_COMPRESSION_XZ: per_package = 143; break; +#ifdef ARCHIVE_COMPRESSION_UU case ARCHIVE_COMPRESSION_UU: per_package = 3543; break; +#endif default: /* assume it is at least somewhat compressed */ per_package = 200; -- 1.7.4.2
Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- lib/libalpm/util.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 11e6904..430da92 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -34,6 +34,7 @@ #include <time.h> #include <syslog.h> #include <errno.h> +#include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> -- 1.7.4.2
On Fri, Apr 1, 2011 at 5:36 PM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote:
Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Applied to maint.
--- lib/libalpm/util.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 11e6904..430da92 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -34,6 +34,7 @@ #include <time.h> #include <syslog.h> #include <errno.h> +#include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> -- 1.7.4.2
Some systems, like FreeBSD might define both statfs and statvfs: however if statvfs exists whereas getmntinfo() uses a statfs struct, the current ifdefs would select the wrong line of code. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- acinclude.m4 | 8 ++++++-- lib/libalpm/diskspace.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7309d73..1e51e92 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -115,8 +115,12 @@ AC_DEFUN([FS_STATS_TYPE], extern int getmntinfo (struct statfs **, int); ]], [])], - [fs_stats_cv_type="struct statfs"], - [fs_stats_cv_type="struct statvfs"])], + [fs_stats_cv_type="struct statfs" + AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.]) + ], + [fs_stats_cv_type="struct statvfs" + AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.]) + ])], [AC_CHECK_FUNC(getmntent, [fs_stats_cv_type="struct statvfs"])] )] diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 281173a..066107d 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -112,9 +112,9 @@ static alpm_list_t *mount_point_list(void) mp->mount_dir = strdup(fsp->f_mntonname); mp->mount_dir_len = strlen(mp->mount_dir); memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE)); -#if defined HAVE_STRUCT_STATVFS_F_FLAG +#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG) mp->read_only = fsp->f_flag & ST_RDONLY; -#elif defined HAVE_STRUCT_STATFS_F_FLAGS +#elif defined(HAVE_GETMNTINFO_STATFS) && defined(HAVE_STRUCT_STATFS_F_FLAGS) mp->read_only = fsp->f_flags & MNT_RDONLY; #endif -- 1.7.4.2
On Fri, Apr 1, 2011 at 5:36 PM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote:
Some systems, like FreeBSD might define both statfs and statvfs: however if statvfs exists whereas getmntinfo() uses a statfs struct, the current ifdefs would select the wrong line of code.
Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- acinclude.m4 | 8 ++++++-- lib/libalpm/diskspace.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4 index 7309d73..1e51e92 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -115,8 +115,12 @@ AC_DEFUN([FS_STATS_TYPE], extern int getmntinfo (struct statfs **, int); ]], [])], - [fs_stats_cv_type="struct statfs"], - [fs_stats_cv_type="struct statvfs"])], + [fs_stats_cv_type="struct statfs" + AC_DEFINE([HAVE_GETMNTINFO_STATFS], 1, [Define if getmntinfo() uses statfs.]) + ], + [fs_stats_cv_type="struct statvfs" + AC_DEFINE([HAVE_GETMNTINFO_STATVFS], 1, [Define if getmntinfo() uses statvfs.]) + ])], [AC_CHECK_FUNC(getmntent, [fs_stats_cv_type="struct statvfs"])] )] diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 281173a..066107d 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -112,9 +112,9 @@ static alpm_list_t *mount_point_list(void) mp->mount_dir = strdup(fsp->f_mntonname); mp->mount_dir_len = strlen(mp->mount_dir); memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE)); -#if defined HAVE_STRUCT_STATVFS_F_FLAG +#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG) mp->read_only = fsp->f_flag & ST_RDONLY; -#elif defined HAVE_STRUCT_STATFS_F_FLAGS +#elif defined(HAVE_GETMNTINFO_STATFS) && defined(HAVE_STRUCT_STATFS_F_FLAGS) mp->read_only = fsp->f_flags & MNT_RDONLY; #endif
configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...): suspicious presence of an AC_DEFINE in the second argument, where no actions should be taken ../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from... acinclude.m4:105: FS_STATS_TYPE is expanded from... configure.ac:196: the top level cd . && /bin/sh /home/dmcgee/projects/pacman-maint/missing --run automake-1.11 --foreign configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...): suspicious presence of an AC_DEFINE in the second argument, where no actions should be taken ../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from... acinclude.m4:105: FS_STATS_TYPE is expanded from... configure.ac:196: the top level CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /home/dmcgee/projects/pacman-maint/missing --run autoconf configure.ac:196: warning: AC_CACHE_VAL(fs_stats_cv_type, ...): suspicious presence of an AC_DEFINE in the second argument, where no actions should be taken ../../lib/autoconf/general.m4:2032: AC_CACHE_VAL is expanded from... ../../lib/autoconf/general.m4:2053: AC_CACHE_CHECK is expanded from... acinclude.m4:105: FS_STATS_TYPE is expanded from... configure.ac:196: the top level
A non-GNU version of awk may not support the (|...) syntax for an optional group and require '()' to match an empty string. The (...)? syntax is more appropriate for this usage. Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- Problem arises when trying to use makepkg with FreeBSD's awk. scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 193a185..6d78887 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1275,7 +1275,7 @@ check_sanity() { done local optdepends_list=() - eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \ + eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \ sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//") for i in "${optdepends_list[@]}"; do local pkg=${i%%:*} -- 1.7.4.2
On Sat, Apr 2, 2011 at 5:31 AM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote:
A non-GNU version of awk may not support the (|...) syntax for an optional group and require '()' to match an empty string. The (...)? syntax is more appropriate for this usage.
Signed-off-by: Rémy Oudompheng <remy@archlinux.org> --- Problem arises when trying to use makepkg with FreeBSD's awk. I'll let Allan take a look at this and sign off, eval and awk scare me too much. :)
scripts/makepkg.sh.in | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 193a185..6d78887 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1275,7 +1275,7 @@ check_sanity() { done
local optdepends_list=() - eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \ + eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \ sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//") for i in "${optdepends_list[@]}"; do local pkg=${i%%:*} -- 1.7.4.2
On 03/04/11 04:13, Dan McGee wrote:
On Sat, Apr 2, 2011 at 5:31 AM, Rémy Oudompheng <remyoudompheng@gmail.com> wrote:
A non-GNU version of awk may not support the (|...) syntax for an optional group and require '()' to match an empty string. The (...)? syntax is more appropriate for this usage.
Signed-off-by: Rémy Oudompheng<remy@archlinux.org> --- Problem arises when trying to use makepkg with FreeBSD's awk. I'll let Allan take a look at this and sign off, eval and awk scare me too much. :)
Signoff. Allan
participants (3)
-
Allan McRae
-
Dan McGee
-
Rémy Oudompheng