pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/pkgsrc-2012Q1]: pkgsrc/sysutils/ruby-quota Pullup ticket #3784 - requ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/dfbb8170ddbe
branches: pkgsrc-2012Q1
changeset: 602100:dfbb8170ddbe
user: tron <tron%pkgsrc.org@localhost>
date: Mon May 14 12:26:00 2012 +0000
description:
Pullup ticket #3784 - requested by dholland
sysutils/ruby-quota: build fix
Revisions pulled up:
- sysutils/ruby-quota/distinfo 1.15
- sysutils/ruby-quota/patches/patch-aa 1.3
- sysutils/ruby-quota/patches/patch-ab 1.10
---
Module Name: pkgsrc
Committed By: dholland
Date: Sat May 12 23:10:30 UTC 2012
Modified Files:
pkgsrc/sysutils/ruby-quota: distinfo
pkgsrc/sysutils/ruby-quota/patches: patch-aa patch-ab
Log Message:
Fix build on netbsd-6 and up.
diffstat:
sysutils/ruby-quota/distinfo | 6 +-
sysutils/ruby-quota/patches/patch-aa | 17 +-
sysutils/ruby-quota/patches/patch-ab | 372 +++++++++++++++++++++++++++++++++-
3 files changed, 370 insertions(+), 25 deletions(-)
diffs (truncated from 538 to 300 lines):
diff -r eb2ba9a6fbe5 -r dfbb8170ddbe sysutils/ruby-quota/distinfo
--- a/sysutils/ruby-quota/distinfo Mon May 14 12:24:21 2012 +0000
+++ b/sysutils/ruby-quota/distinfo Mon May 14 12:26:00 2012 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.14 2010/09/10 07:58:44 taca Exp $
+$NetBSD: distinfo,v 1.14.14.1 2012/05/14 12:26:00 tron Exp $
SHA1 (ruby-quota-0.5.1.tar.gz) = 9edf6054c465af80d7a3534b8fed89fbafc01ec1
RMD160 (ruby-quota-0.5.1.tar.gz) = 85189827a256d0cfeaa0e755db37b85c625c18df
Size (ruby-quota-0.5.1.tar.gz) = 5110 bytes
-SHA1 (patch-aa) = 651521b6e9945320623f9c8abff27b705bb476b6
-SHA1 (patch-ab) = fa97c6cf71cc8b7144ee8f76ba9f00e28d0855fb
+SHA1 (patch-aa) = 6fed720916737852bcc89608708f38fe7260033b
+SHA1 (patch-ab) = 0977d6a6d14ffd69967f5d2ef280a714f8030eb5
diff -r eb2ba9a6fbe5 -r dfbb8170ddbe sysutils/ruby-quota/patches/patch-aa
--- a/sysutils/ruby-quota/patches/patch-aa Mon May 14 12:24:21 2012 +0000
+++ b/sysutils/ruby-quota/patches/patch-aa Mon May 14 12:26:00 2012 +0000
@@ -1,6 +1,10 @@
-$NetBSD: patch-aa,v 1.2 2009/10/27 15:29:33 taca Exp $
+$NetBSD: patch-aa,v 1.2.20.1 2012/05/14 12:26:00 tron Exp $
---- extconf.rb.orig 2002-03-21 03:09:14.000000000 +0900
+- need unistd.h for some things, so test for it (just in case it's not there, I guess)
+- check for statvfs.h for netbsd-3 and up
+- add support for netbsd-6 and up quotas
+
+--- extconf.rb.orig 2002-03-20 18:09:14.000000000 +0000
+++ extconf.rb
@@ -7,6 +7,8 @@
@@ -11,9 +15,14 @@
have_header("linux/quota.h") # for linux
have_header("linux/types.h")
have_header("sys/quota.h")
-@@ -16,5 +18,6 @@ have_header("sys/fs/ufs_quota.h") # for
+@@ -14,7 +16,10 @@ have_header("sys/types.h")
+
+ have_header("sys/fs/ufs_quota.h") # for solaris
- have_header("ufs/ufs/quota.h") # for *bsd
+-have_header("ufs/ufs/quota.h") # for *bsd
++have_header("quota.h") # for netbsd-6 and up
++
++have_header("ufs/ufs/quota.h") # for traditional *bsd
have_header("sys/ucred.h") # required by FreeBSD and NetBSD
+have_header("sys/statvfs.h") # required by NetBSD
diff -r eb2ba9a6fbe5 -r dfbb8170ddbe sysutils/ruby-quota/patches/patch-ab
--- a/sysutils/ruby-quota/patches/patch-ab Mon May 14 12:24:21 2012 +0000
+++ b/sysutils/ruby-quota/patches/patch-ab Mon May 14 12:26:00 2012 +0000
@@ -1,8 +1,19 @@
-$NetBSD: patch-ab,v 1.9 2010/09/10 07:58:45 taca Exp $
+$NetBSD: patch-ab,v 1.9.14.1 2012/05/14 12:26:00 tron Exp $
+
+- fix package's version number
+- remove a debug printout
+- need unistd.h for some things
+- support dragonfly
+- support linux 2.6+ with slightly different API
+- support netbsd-3+ with statvfs
+- support netbsd-6+ with libquota
+- fix solaris code
+- ruby API fixes
+- ...?
--- quota.c.orig 2002-03-30 14:59:12.000000000 +0000
+++ quota.c
-@@ -5,9 +5,13 @@
+@@ -5,17 +5,25 @@
#include "ruby.h"
@@ -18,7 +29,20 @@
# define USE_LINUX_QUOTA
#endif
#ifdef HAVE_SYS_FS_UFS_QUOTA_H /* for Solaris-2.6,7,8 */
-@@ -29,10 +33,16 @@
+ # define USE_SOLARIS_QUOTA
+ #endif
+-#ifdef HAVE_UFS_UFS_QUOTA_H /* for *BSD */
++#ifdef HAVE_QUOTA_H /* for NetBSD-6 and up */
++# define USE_NETBSD_QUOTA
++#else
++#ifdef HAVE_UFS_UFS_QUOTA_H /* for traditional *BSD */
+ # define USE_BSD_QUOTA
+ #endif
++#endif
+
+ #ifdef USE_LINUX_QUOTA
+ #ifdef HAVE_LINUX_TYPES_H
+@@ -29,10 +37,16 @@
# include <sys/quota.h>
#endif
#include <linux/version.h>
@@ -36,7 +60,20 @@
#endif
#endif
-@@ -51,6 +61,12 @@
+@@ -42,6 +56,12 @@
+ #include <sys/fs/ufs_quota.h>
+ #endif
+
++#ifdef USE_NETBSD_QUOTA
++#include <sys/types.h>
++#include <sys/mount.h>
++#include <quota.h>
++#endif
++
+ #ifdef USE_BSD_QUOTA
+ #include <sys/types.h>
+ #include <sys/fcntl.h>
+@@ -51,6 +71,12 @@
#if defined(SYS_UCRED_H)
# include <sys/ucred.h> /* required by NetBSD,FreeBSD */
#endif
@@ -49,7 +86,7 @@
#endif
static VALUE rb_mQuota;
-@@ -144,7 +160,6 @@ rb_quotactl(int cmd, char *dev, VALUE vu
+@@ -144,7 +170,6 @@ rb_quotactl(int cmd, char *dev, VALUE vu
uid_t uid;
get_uid(vuid, &uid, &is_gid);
@@ -57,7 +94,15 @@
if( is_gid ){
return quotactl(QCMD(cmd,GRPQUOTA),dev,(qid_t)uid,addr);
}
-@@ -159,7 +174,11 @@ rb_quotactl(int cmd, char *dev, VALUE vu
+@@ -152,14 +177,18 @@ rb_quotactl(int cmd, char *dev, VALUE vu
+ return quotactl(QCMD(cmd,USRQUOTA),dev,(qid_t)uid,addr);
+ };
+ };
+-#elif defined(USE_BSD_QUOTA) /* for *BSD */
++#elif defined(USE_BSD_QUOTA) /* for traditional *BSD */
+ static int
+ rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr)
+ {
char *path;
int is_gid;
uid_t uid;
@@ -69,7 +114,7 @@
int i, count, ret;
buff = 0;
-@@ -187,12 +206,16 @@ rb_quotactl(int cmd, char *dev, VALUE vu
+@@ -187,12 +216,16 @@ rb_quotactl(int cmd, char *dev, VALUE vu
static int
rb_quotactl(int cmd, char *dev, VALUE vuid, caddr_t addr)
{
@@ -87,7 +132,204 @@
switch( cmd ){
case Q_QUOTAON:
case Q_QUOTAOFF:
-@@ -230,12 +253,20 @@ rb_diskquota_get(VALUE dqb, struct dqblk
+@@ -225,17 +258,217 @@ rb_quotactl(int cmd, char *dev, VALUE vu
+ };
+ #endif
+
++#ifdef USE_NETBSD_QUOTA
++
++static struct quotahandle *
++rb_quotaopen(char *dev)
++{
++ char *path;
++#if defined(HAVE_SYS_STATVFS_H) && !defined(__DragonFly__)
++ struct statvfs *buff;
++#else
++ struct statfs *buff;
++#endif
++ int i, count;
++
++ buff = 0;
++ path = dev;
++ count = getmntinfo(&buff, MNT_WAIT);
++ for( i=0; i<count; i++ ){
++ if( strcmp(buff[i].f_mntfromname, dev) == 0 ){
++ path = buff[i].f_mntonname;
++ break;
++ };
++ };
++
++ return quota_open(path);
++}
++
++static int
++rb_quotaget(char *dev, VALUE vuid, struct quotaval *blocks, struct quotaval *files)
++{
++ struct quotahandle *qh;
++
++ int is_gid;
++ uid_t uid;
++ int ret;
++ struct quotakey qk;
++
++ get_uid(vuid, &uid, &is_gid);
++ qk.qk_idtype = is_gid ? QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER;
++ qk.qk_id = uid;
++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
++
++ qh = rb_quotaopen(dev);
++ if (qh == NULL) {
++ return -1;
++ }
++
++ ret = quota_get(qh, &qk, blocks);
++ if (ret) {
++ quota_close(qh);
++ return -1;
++ }
++
++ qk.qk_objtype = QUOTA_OBJTYPE_FILES;
++ ret = quota_get(qh, &qk, files);
++ if (ret) {
++ quota_close(qh);
++ return -1;
++ }
++
++ quota_close(qh);
++ return 0;
++};
++
++static int
++rb_quotaoff(char *dev)
++{
++ struct quotahandle *qh;
++ int ret1, ret2;
++
++ qh = rb_quotaopen(dev);
++ if (qh == NULL) {
++ return -1;
++ }
++ ret1 = quota_quotaoff(qh, QUOTA_IDTYPE_USER);
++ ret2 = quota_quotaoff(qh, QUOTA_IDTYPE_GROUP);
++ quota_close(qh);
++ if (ret1 < 0 || ret2 < 0) {
++ return -1;
++ }
++ return 0;
++}
++
++static int
++rb_quotaon(char *dev)
++{
++ struct quotahandle *qh;
++ int ret1, ret2;
++
++ qh = rb_quotaopen(dev);
++ if (qh == NULL) {
++ return -1;
++ }
++ ret1 = quota_quotaon(qh, QUOTA_IDTYPE_USER);
++ ret2 = quota_quotaon(qh, QUOTA_IDTYPE_GROUP);
++ quota_close(qh);
++ /* fail only if *both* idtypes failed */
++ if (ret1 < 0 && ret2 < 0) {
++ return -1;
++ }
++ return 0;
++}
++
++static int
++rb_quotaput(char *dev, VALUE vuid, const struct quotaval *blocks, const struct quotaval *files)
++{
++ struct quotahandle *qh;
++
++ int is_gid;
++ uid_t uid;
++ int ret;
++ struct quotakey qk;
++
++ get_uid(vuid, &uid, &is_gid);
++ qk.qk_idtype = is_gid ? QUOTA_IDTYPE_GROUP : QUOTA_IDTYPE_USER;
++ qk.qk_id = uid;
++ qk.qk_objtype = QUOTA_OBJTYPE_BLOCKS;
++
++ qh = rb_quotaopen(dev);
++ if (qh == NULL) {
++ return -1;
++ }
++
++ ret = quota_put(qh, &qk, blocks);
++ if (ret) {
++ quota_close(qh);
++ return -1;
++ }
++
++ qk.qk_objtype = QUOTA_OBJTYPE_FILES;
++ ret = quota_put(qh, &qk, files);
++ if (ret) {
++ quota_close(qh);
++ return -1;
++ }
++
++ quota_close(qh);
++ return 0;
++};
++
++#endif /* USE_NETBSD_QUOTA */
Home |
Main Index |
Thread Index |
Old Index