Subject: pkg/36655: pkgtools/pkg_install: fails to build on linux
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <yx@x.ua>
List: pkgsrc-bugs
Date: 07/16/2007 10:40:00
>Number: 36655
>Category: pkg
>Synopsis: pkgtools/pkg_install: fails to build on linux
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 16 10:40:00 +0000 2007
>Originator: Yakovetsky Vladimir
>Release: NetBSD 4.99.19
>Organization:
Yakovetsky Vladimir
>Environment:
System: NetBSD lrou.x.ua 4.99.19 NetBSD 4.99.19 (lrou-1.825) #0: Mon May 7 16:00:07 EEST 2007 yx@lrou.x.ua:/sys/arch/i386/compile/lrou i386
Architecture: i386
Machine: i386
>Description:
pkg_install-20070715 fails to build on linux
>How-To-Repeat:
% uname -sr
Linux 2.6.21.5
% cd /usr/pkgsrc/pkgtools/pkg_install
% bmake
...
gcc -DHAVE_CONFIG_H -DDEF_UMASK=022 -DPREFIX="\"/usr/pkg\"" -DSYSCONFDIR="\"/usr/pkg/etc\"" -I/usr/obj/pkgtools/pkg_install/work/libnbcompat -DHOST=\"i386-debian-linux-gnu\" -DPKGSRC -I. -I../lib -O2 -march=pentium3 -finline-functions -fomit-frame-pointer -ffast-math -Wall -c audit-packages.c -o audit-packages.o
In file included from audit-packages.c:52:
/usr/obj/pkgtools/pkg_install/work/libnbcompat/nbcompat/sha2.h:57: error: expected specifier-qualifier-list before 'uint32_t'
/usr/obj/pkgtools/pkg_install/work/libnbcompat/nbcompat/sha2.h:62: error: expected specifier-qualifier-list before 'uint64_t'
audit-packages.c: In function 'old_pvfile':
audit-packages.c:771: error: 'struct stat' has no member named 'st_ctimespec'
*** Error code 1
Stop.
bmake: stopped in /usr/obj/pkgtools/pkg_install/work/pkg_install-20070715/audit-packages
*** Error code 1
>Fix:
--- pkg_install-20070715/audit-packages/audit-packages.c.orig
+++ pkg_install-20070715/audit-packages/audit-packages.c
@@ -47,6 +47,10 @@
#include <sys/stat.h>
#include <sys/time.h>
+#ifdef linux
+#include <stdint.h>
+#endif
+
/* depending where we are being built pull in crypto support */
#ifdef PKGSRC
#include <nbcompat/sha2.h>
@@ -73,6 +77,11 @@
# define PKGPREFIX PREFIX
#endif
+#ifdef linux
+/* use GNU extensions */
+# define __USE_GNU
+#endif
+
/* macros */
#define STRIP(c) ((c) == '\n' || (c) == '\'' || (c) == '\"' || \
(c) == '\t' || (c) == ' ' || (c) == '=')
@@ -768,7 +777,11 @@
} else {
/* difference between the file and now */
t_current = now_time.tv_sec;
+#ifdef __USE_GNU
+ t_pvfile = pvstat.st_ctime;
+#else
t_pvfile = pvstat.st_ctimespec.tv_sec;
+#endif
t_diff = (((((float) t_current - (float) t_pvfile) / 60) / 60) / 24);
if (t_diff >= 7)