summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysutils/p5-Quota/DESCR7
-rw-r--r--sysutils/p5-Quota/Makefile16
-rw-r--r--sysutils/p5-Quota/distinfo8
-rw-r--r--sysutils/p5-Quota/patches/patch-aa35
-rw-r--r--sysutils/p5-Quota/patches/patch-ab35
-rw-r--r--sysutils/p5-Quota/patches/patch-ac152
6 files changed, 253 insertions, 0 deletions
diff --git a/sysutils/p5-Quota/DESCR b/sysutils/p5-Quota/DESCR
new file mode 100644
index 00000000000..afdd20640b1
--- /dev/null
+++ b/sysutils/p5-Quota/DESCR
@@ -0,0 +1,7 @@
+The Quota module provides access to file system quotas.
+
+The quotactl system call or ioctl or libquota is used to query or set
+quotas on the local host, or queries are submitted via RPC to a remote
+host. Mount tables can be parsed with getmntent and paths can be
+translated to device files (or whatever the actual quotactl
+implementations needs as argument) of the according file system.
diff --git a/sysutils/p5-Quota/Makefile b/sysutils/p5-Quota/Makefile
new file mode 100644
index 00000000000..92a3f011e04
--- /dev/null
+++ b/sysutils/p5-Quota/Makefile
@@ -0,0 +1,16 @@
+# $NetBSD: Makefile,v 1.1 2012/08/14 14:24:20 dholland Exp $
+
+DISTNAME= Quota-1.6.7
+PKGNAME= p5-${DISTNAME}
+CATEGORIES= sysutils perl5
+MASTER_SITES= ${MASTER_SITE_PERL_CPAN:=Quota/}
+
+COMMENT= Perl interface to filesystem quotas
+LICENSE= ${PERL5_LICENSE}
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+PERL5_PACKLIST= auto/Quota/.packlist
+
+.include "../../lang/perl5/module.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/p5-Quota/distinfo b/sysutils/p5-Quota/distinfo
new file mode 100644
index 00000000000..0d1aae9adfd
--- /dev/null
+++ b/sysutils/p5-Quota/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2012/08/14 14:24:20 dholland Exp $
+
+SHA1 (Quota-1.6.7.tar.gz) = b81f4df0f159d2fc807ff403bd4946acdb6a2b4f
+RMD160 (Quota-1.6.7.tar.gz) = 188fa10cd739797a404e2b57e534710bf565344d
+Size (Quota-1.6.7.tar.gz) = 48631 bytes
+SHA1 (patch-aa) = 8f413ca8ed6d3c0c7bf94285ea4fa16805f3d39d
+SHA1 (patch-ab) = c1645e1c9e8a8c59373b7041f0b9fe8e19e5cda3
+SHA1 (patch-ac) = 61ce522f305948584590289b55c30063a20496fc
diff --git a/sysutils/p5-Quota/patches/patch-aa b/sysutils/p5-Quota/patches/patch-aa
new file mode 100644
index 00000000000..bba5ef5c671
--- /dev/null
+++ b/sysutils/p5-Quota/patches/patch-aa
@@ -0,0 +1,35 @@
+$NetBSD: patch-aa,v 1.1 2012/08/14 14:24:20 dholland Exp $
+
+Teach Makefile.PL about libquota.
+
+--- Makefile.PL.orig 2011-11-13 16:21:52.000000000 +0100
++++ Makefile.PL 2012-05-14 16:21:37.000000000 +0200
+@@ -33,6 +33,7 @@
+ warn "WARNING: No appropriate hints found for this OS: '$os - see INSTALL'\n";
+ }
+
++my $extralibs = "";
+
+ # check whether the Andrew File System (AFS) is installed and running
+
+@@ -42,7 +43,7 @@
+ $hasafs = '-DAFSQUOTA';
+ $AFSHOME = -d "/usr/afsws" ? "/usr/afsws" : "/usr";
+ $extrainc = "-I$AFSHOME/include -I$AFSHOME/include/afs";
+- $extralibs = "-L$AFSHOME/lib -L$AFSHOME/lib/afs -lsys -lrx -lrxkad -llwp";
++ $extralibs .= " -L$AFSHOME/lib -L$AFSHOME/lib/afs -lsys -lrx -lrxkad -llwp";
+ $afsquota = "afsquota.o";
+ }
+ }
+@@ -60,6 +61,11 @@
+ # }
+ }
+
++# check whether wee are using the NetBSD quota library
++if ( ($os =~ /^NetBSD 6/) or ($os =~ /^NetBSD 5\.99\.(\d\d)/ and $1 >= 59) ) {
++ $extralibs .= " -lquota";
++}
++
+ #-----------------------------------------------------------------------------#
+
+ use ExtUtils::MakeMaker;
diff --git a/sysutils/p5-Quota/patches/patch-ab b/sysutils/p5-Quota/patches/patch-ab
new file mode 100644
index 00000000000..a2908f0373f
--- /dev/null
+++ b/sysutils/p5-Quota/patches/patch-ab
@@ -0,0 +1,35 @@
+$NetBSD: patch-ab,v 1.1 2012/08/14 14:24:20 dholland Exp $
+
+Extend hints/bsd.h to define NETBSD_LIBQUOTA and include <quota.h> on
+NetBSD >= 5.99.59.
+
+--- hints/bsd.h.orig 2007-11-24 14:49:43.000000000 +0100
++++ hints/bsd.h 2012-05-14 15:52:47.000000000 +0200
+@@ -9,6 +9,7 @@
+ * and Jon Schewe <schewe@tcfreenet.org>
+ * NetBSD mods and merge of *BSD-related hints provided by
+ * Jaromir Dolecek <jdolecek@NetBSD.org>
++ * NetBSD libquota mods by David Holland <dholland@netbsd.org>
+ */
+
+ /* See hints/none.h for a complete list of options with explanations */
+@@ -16,7 +17,19 @@
+ #include <sys/param.h>
+ #include <sys/mount.h>
+ #include <fstab.h>
++
++#if defined(__NetBSD__) && __NetBSD_Version__ >= 599004800 && __NetBSD_Version__ < 599005900
++#error "NetBSD 5.99 proplib-based quotas not supported"
++#endif
++
++#if defined(__NetBSD__) && (__NetBSD_Version__ >= 599005900) /* NetBSD 5.99.59 */
++#include <quota.h>
++/* struct qblk needed for the way the XS handles NFS quota */
++#include <ufs/ufs/quota1.h>
++#define NETBSD_LIBQUOTA
++#else
+ #include <ufs/ufs/quota.h>
++#endif
+
+ #if defined(__NetBSD__) && (__NetBSD_Version__ >= 299000900) /* NetBSD 2.99.9 */
+ /* NetBSD 3.0 has no statfs anymore */
diff --git a/sysutils/p5-Quota/patches/patch-ac b/sysutils/p5-Quota/patches/patch-ac
new file mode 100644
index 00000000000..230b18af0f5
--- /dev/null
+++ b/sysutils/p5-Quota/patches/patch-ac
@@ -0,0 +1,152 @@
+$NetBSD: patch-ac,v 1.1 2012/08/14 14:24:20 dholland Exp $
+
+Extend Quota.xs to use the new NetBSD 6 libquota interface.
+
+--- Quota.xs.orig 2011-01-02 18:25:40.000000000 +0100
++++ Quota.xs 2012-05-15 12:00:50.000000000 +0200
+@@ -331,6 +331,12 @@
+ struct dqblk dqblk;
+ char *p = NULL;
+ int err;
++ int pushed = 0;
++#ifdef NETBSD_LIBQUOTA
++ struct quotahandle *qh;
++ struct quotakey qk;
++ struct quotaval qv;
++#endif
+ #ifdef USE_IOCTL
+ struct quotactl qp;
+ int fd = -1;
+@@ -411,6 +417,35 @@
+ #endif /* NO_RPC */
+ }
+ else {
++#ifdef NETBSD_LIBQUOTA
++ err = 0;
++ qh = quota_open(dev);
++ if (qh != NULL) {
++ qk.qk_idtype = kind ? QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER;
++ qk.qk_id = uid;
++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
++ if (quota_get(qh, &qk, &qv) >= 0) {
++ pushed = 1;
++ EXTEND(SP, 4);
++ PUSHs(sv_2mortal(newSViv(Q_DIV(qv.qv_usage))));
++ PUSHs(sv_2mortal(newSViv(Q_DIV(qv.qv_softlimit))));
++ PUSHs(sv_2mortal(newSViv(Q_DIV(qv.qv_hardlimit))));
++ PUSHs(sv_2mortal(newSViv(qv.qv_expiretime)));
++ qk.qk_objtype = QUOTA_OBJTYPE_FILES;
++ if (quota_get(qh, &qk, &qv) >= 0) {
++ EXTEND(SP, 4);
++ PUSHs(sv_2mortal(newSViv(qv.qv_usage)));
++ PUSHs(sv_2mortal(newSViv(qv.qv_softlimit)));
++ PUSHs(sv_2mortal(newSViv(qv.qv_hardlimit)));
++ PUSHs(sv_2mortal(newSViv(qv.qv_expiretime)));
++ }
++ else err = -1;
++ }
++ else err = -1;
++ quota_close(qh);
++ }
++ else err = -1;
++#else /* not NETBSD_LIBQUOTA */
+ #ifdef USE_IOCTL
+ qp.op = Q_GETQUOTA;
+ qp.uid = uid;
+@@ -457,8 +492,9 @@
+ #endif /* not Q_CTL_V2 */
+ #endif /* Q_CTL_V3 */
+ #endif /* not USE_IOCTL */
++#endif /* not NETBSD_LIBQUOTA */
+ }
+- if(!err) {
++ if(!err && !pushed) {
+ EXTEND(SP, 8);
+ PUSHs(sv_2mortal(newSViv(Q_DIV(dqblk.QS_BCUR))));
+ PUSHs(sv_2mortal(newSViv(Q_DIV(dqblk.QS_BSOFT))));
+@@ -479,15 +515,21 @@
+ setqlim(dev,uid,bs,bh,fs,fh,timelimflag=0,kind=0)
+ char * dev
+ int uid
+- long bs
+- long bh
+- long fs
+- long fh
++ double bs
++ double bh
++ double fs
++ double fh
+ int timelimflag
+ int kind
+ CODE:
+ {
++#ifdef NETBSD_LIBQUOTA
++ struct quotahandle *qh;
++ struct quotakey qk;
++ struct quotaval qv;
++#else /* not NETBSD_LIBQUOTA */
+ struct dqblk dqblk;
++#endif /* NETBSD_LIBQUOTA */
+ #ifdef USE_IOCTL
+ struct quotactl qp;
+ int fd;
+@@ -563,6 +605,33 @@
+ else
+ #endif /* HAVE_JFS2 */
+ {
++#ifdef NETBSD_LIBQUOTA
++ qh = quota_open(dev);
++ if (qh != NULL) {
++ qk.qk_idtype = kind ? QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER;
++ qk.qk_id = uid;
++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
++
++ qv.qv_usage = 0;
++ qv.qv_hardlimit = Q_MUL(bh);
++ qv.qv_softlimit = Q_MUL(bs);
++ qv.qv_expiretime = timelimflag;
++ qv.qv_grace = 0; /* XXX should be able to manipulate this */
++ if (quota_put(qh, &qk, &qv) >= 0) {
++ qk.qk_objtype = QUOTA_OBJTYPE_FILES;
++
++ qv.qv_usage = 0;
++ qv.qv_hardlimit = fh;
++ qv.qv_softlimit = fs;
++ qv.qv_expiretime = timelimflag;
++ qv.qv_grace = 0; /* XXX should be able to manipulate this */
++ if (quota_put(qh, &qk, &qv) >= 0) {
++ RETVAL = 0;
++ } else RETVAL = -1;
++ } else RETVAL = -1;
++ quota_close(qh);
++ } else RETVAL = -1;
++#else /* not NETBSD_LIBQUOTA */
+ memset(&dqblk, 0, sizeof(dqblk));
+ dqblk.QS_BSOFT = Q_MUL(bs);
+ dqblk.QS_BHARD = Q_MUL(bh);
+@@ -588,6 +657,7 @@
+ #endif
+ #endif
+ #endif
++#endif /* NETBSD_LIBQUOTA */
+ }
+ }
+ OUTPUT:
+@@ -616,6 +686,9 @@
+ }
+ else
+ #endif
++#ifdef NETBSD_LIBQUOTA
++ RETVAL = 0;
++#else /* not NETBSD_LIBQUOTA */
+ #ifdef USE_IOCTL
+ {
+ struct quotactl qp;
+@@ -698,6 +771,7 @@
+ #endif
+ }
+ #endif
++#endif /* NETBSD_LIBQUOTA */
+ OUTPUT:
+ RETVAL
+