Re: [NEW] devel/p5-Sys-MemInfo

2019-11-03 Thread Jeremie Courreges-Anglas
On Fri, Oct 18 2019, Charlene Wendling  wrote:
> On Thu, 17 Oct 2019 21:21:14 +0100
> Stuart Henderson wrote:
>
>> On 2019/10/17 10:01, Henry Jensen wrote:
>> > On Wed, 16 Oct 2019 16:07:34 +0100
>> > Stuart Henderson  wrote:
>> > 
>> > > On 2019/10/16 09:04, Henry Jensen wrote:
>> > > > Ping
>> > > > 
>> > > > On Wed, 9 Oct 2019 15:08:00 +0200
>> > > > Henry Jensen  wrote:
>> > > >   
>> > > > > Greetings,
>> > > > > 
>> > > > > attached is a new port for the perl module Sys::MemInfo.
>> > > > > Sys::MemInfo returns the total amount of free and used
>> > > > > physical memory in bytes in totalmem and freemem variables.
>> > > > > Tested on -current amd64.  
>> > > 
>> > > Please format Makefile and DESCR a bit nicer. Look at other ports
>> > > in the tree for examples.
>> > 
>> > Actually, I used one of the p5-* ports as template. I made minor
>> > modifications now (honoring the 72 character per line limit) and
>> > compared the formatting to other ports.
>> 
>> That's better, this one is okay sthen@ if someone would like to
>> import.
>
> Sorry, but this module is broken because it badly computes totalmem,
> see [0], where i have 16 gigs actually. I've modified Makefile.PL, so
> we use the same code as NetBSD, this fixes the issue.


I'd prefer the diff below which involves less hardcoding.
What do you think?  ok?


Index: Makefile
===
RCS file: /cvs/ports/sysutils/p5-Sys-MemInfo/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile19 Oct 2019 11:00:17 -  1.1.1.1
+++ Makefile3 Nov 2019 11:32:34 -
@@ -3,6 +3,7 @@
 COMMENT =  return the total amount of free and used physical memory
 
 DISTNAME = Sys-MemInfo-0.99
+REVISION = 0
 CATEGORIES =   sysutils
 
 # Perl
Index: patches/patch-Makefile_PL
===
RCS file: /cvs/ports/sysutils/p5-Sys-MemInfo/patches/patch-Makefile_PL,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 patch-Makefile_PL
--- patches/patch-Makefile_PL   19 Oct 2019 11:00:17 -  1.1.1.1
+++ patches/patch-Makefile_PL   3 Nov 2019 11:32:34 -
@@ -6,15 +6,17 @@ https://rt.cpan.org/Public/Bug/Display.h
 Index: Makefile.PL
 --- Makefile.PL.orig
 +++ Makefile.PL
-@@ -38,9 +38,9 @@ for ($^O) {
+@@ -38,12 +38,7 @@ for ($^O) {
  }
} elsif (/bsd/) {
  copy ('arch/bsd.xs', 'MemInfo.xs');
 -if (/netbsd/) {
-+if (/netbsd/ or /openbsd/) {
-   $define = '-DNETBSD';
+-  $define = '-DNETBSD';
 -  print "Sys::MemInfo for NetBSD\n";
-+  print "Sys::MemInfo for NetBSD and OpenBSD\n";
- } else {
-   print "Sys::MemInfo for *BSD\n";
- }
+-} else {
+-  print "Sys::MemInfo for *BSD\n";
+-}
++print "Sys::MemInfo for *BSD\n";
+   } elsif (/hpux/) {
+ copy ('arch/hpux.xs', 'MemInfo.xs');
+ $define ='-D_XOPEN_SOURCE_EXTENDED';
Index: patches/patch-arch_bsd_xs
===
RCS file: patches/patch-arch_bsd_xs
diff -N patches/patch-arch_bsd_xs
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-arch_bsd_xs   3 Nov 2019 11:32:34 -
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Fix totalmem computation, see
+https://rt.cpan.org/Public/Bug/Display.html?id=130740
+
+Index: arch/bsd.xs
+--- arch/bsd.xs.orig
 arch/bsd.xs
+@@ -22,13 +22,14 @@ double
+ totalmem()
+   PROTOTYPE: DISABLE
+   CODE:
+-  unsigned long long ret = 0;
+-  size_t len = sizeof (ret);
+-#ifdef NETBSD
++#ifdef HW_PHYSMEM64
++  long long ret = 0;
+   static int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+ #else
++  int ret = 0;
+   static int mib[2] = { CTL_HW, HW_PHYSMEM };
+ #endif
++  size_t len = sizeof (ret);
+ 
+   if (sysctl (mib, 2, , , NULL, 0) != -1) {
+   RETVAL = (double) (ret);

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: [NEW] devel/p5-Sys-MemInfo

2019-11-03 Thread Charlene Wendling
On Sun, 03 Nov 2019 12:44:31 +0100
Jeremie Courreges-Anglas wrote:

> On Fri, Oct 18 2019, Charlene Wendling  wrote:
> > On Thu, 17 Oct 2019 21:21:14 +0100
> > Stuart Henderson wrote:
> >
> >> On 2019/10/17 10:01, Henry Jensen wrote:
> >> > On Wed, 16 Oct 2019 16:07:34 +0100
> >> > Stuart Henderson  wrote:
> >> > 
> >> > > On 2019/10/16 09:04, Henry Jensen wrote:
> >> > > > Ping
> >> > > > 
> >> > > > On Wed, 9 Oct 2019 15:08:00 +0200
> >> > > > Henry Jensen  wrote:
> >> > > >   
> >> > > > > Greetings,
> >> > > > > 
> >> > > > > attached is a new port for the perl module Sys::MemInfo.
> >> > > > > Sys::MemInfo returns the total amount of free and used
> >> > > > > physical memory in bytes in totalmem and freemem variables.
> >> > > > > Tested on -current amd64.  
> >> > > 
> >> > > Please format Makefile and DESCR a bit nicer. Look at other
> >> > > ports in the tree for examples.
> >> > 
> >> > Actually, I used one of the p5-* ports as template. I made minor
> >> > modifications now (honoring the 72 character per line limit) and
> >> > compared the formatting to other ports.
> >> 
> >> That's better, this one is okay sthen@ if someone would like to
> >> import.
> >
> > Sorry, but this module is broken because it badly computes totalmem,
> > see [0], where i have 16 gigs actually. I've modified Makefile.PL,
> > so we use the same code as NetBSD, this fixes the issue.
> 
> 
> I'd prefer the diff below which involves less hardcoding.
> What do you think?  ok?

This is an extra patch for us, but i feel like upstream would prefer
this one :)

It works fine here, OK cwen@

 
> Index: Makefile
> ===
> RCS file: /cvs/ports/sysutils/p5-Sys-MemInfo/Makefile,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 Makefile
> --- Makefile  19 Oct 2019 11:00:17 -  1.1.1.1
> +++ Makefile  3 Nov 2019 11:32:34 -
> @@ -3,6 +3,7 @@
>  COMMENT =return the total amount of free and used physical
> memory 
>  DISTNAME =   Sys-MemInfo-0.99
> +REVISION =   0
>  CATEGORIES = sysutils
>  
>  # Perl
> Index: patches/patch-Makefile_PL
> ===
> RCS
> file: /cvs/ports/sysutils/p5-Sys-MemInfo/patches/patch-Makefile_PL,v
> retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-Makefile_PL
> --- patches/patch-Makefile_PL 19 Oct 2019 11:00:17
> - 1.1.1.1 +++ patches/patch-Makefile_PL   3 Nov 2019
> 11:32:34 - @@ -6,15 +6,17 @@
> https://rt.cpan.org/Public/Bug/Display.h Index: Makefile.PL
>  --- Makefile.PL.orig
>  +++ Makefile.PL
> -@@ -38,9 +38,9 @@ for ($^O) {
> +@@ -38,12 +38,7 @@ for ($^O) {
>   }
> } elsif (/bsd/) {
>   copy ('arch/bsd.xs', 'MemInfo.xs');
>  -if (/netbsd/) {
> -+if (/netbsd/ or /openbsd/) {
> -   $define = '-DNETBSD';
> +-  $define = '-DNETBSD';
>  -  print "Sys::MemInfo for NetBSD\n";
> -+  print "Sys::MemInfo for NetBSD and OpenBSD\n";
> - } else {
> -   print "Sys::MemInfo for *BSD\n";
> - }
> +-} else {
> +-  print "Sys::MemInfo for *BSD\n";
> +-}
> ++print "Sys::MemInfo for *BSD\n";
> +   } elsif (/hpux/) {
> + copy ('arch/hpux.xs', 'MemInfo.xs');
> + $define ='-D_XOPEN_SOURCE_EXTENDED';
> Index: patches/patch-arch_bsd_xs
> ===
> RCS file: patches/patch-arch_bsd_xs
> diff -N patches/patch-arch_bsd_xs
> --- /dev/null 1 Jan 1970 00:00:00 -
> +++ patches/patch-arch_bsd_xs 3 Nov 2019 11:32:34 -
> @@ -0,0 +1,26 @@
> +$OpenBSD$
> +
> +Fix totalmem computation, see
> +https://rt.cpan.org/Public/Bug/Display.html?id=130740
> +
> +Index: arch/bsd.xs
> +--- arch/bsd.xs.orig
>  arch/bsd.xs
> +@@ -22,13 +22,14 @@ double
> + totalmem()
> + PROTOTYPE: DISABLE
> + CODE:
> +-unsigned long long ret = 0;
> +-size_t len = sizeof (ret);
> +-#ifdef NETBSD
> ++#ifdef HW_PHYSMEM64
> ++long long ret = 0;
> + static int mib[2] = { CTL_HW, HW_PHYSMEM64 };
> + #else
> ++int ret = 0;
> + static int mib[2] = { CTL_HW, HW_PHYSMEM };
> + #endif
> ++size_t len = sizeof (ret);
> + 
> + if (sysctl (mib, 2, , , NULL, 0) != -1) {
> + RETVAL = (double) (ret);
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE
> 1524 E7EE



Re: [NEW] devel/p5-Sys-MemInfo

2019-10-18 Thread Charlene Wendling
On Fri, 18 Oct 2019 20:31:36 +0100
Stuart Henderson wrote:

> Oh could you move it to sysutils/ please, it makes more sense than
> devel. Otherwise OK

It's committed -- i've reported the issue upstream as well:

https://rt.cpan.org/Public/Bug/Display.html?id=130740



Re: [NEW] devel/p5-Sys-MemInfo

2019-10-18 Thread Stuart Henderson
Oh could you move it to sysutils/ please, it makes more sense than devel.
Otherwise OK


On 2019/10/18 17:58, Charlene Wendling wrote:
> On Thu, 17 Oct 2019 21:21:14 +0100
> Stuart Henderson wrote:
> 
> > On 2019/10/17 10:01, Henry Jensen wrote:
> > > On Wed, 16 Oct 2019 16:07:34 +0100
> > > Stuart Henderson  wrote:
> > > 
> > > > On 2019/10/16 09:04, Henry Jensen wrote:
> > > > > Ping
> > > > > 
> > > > > On Wed, 9 Oct 2019 15:08:00 +0200
> > > > > Henry Jensen  wrote:
> > > > >   
> > > > > > Greetings,
> > > > > > 
> > > > > > attached is a new port for the perl module Sys::MemInfo.
> > > > > > Sys::MemInfo returns the total amount of free and used
> > > > > > physical memory in bytes in totalmem and freemem variables.
> > > > > > Tested on -current amd64.  
> > > > 
> > > > Please format Makefile and DESCR a bit nicer. Look at other ports
> > > > in the tree for examples.
> > > 
> > > Actually, I used one of the p5-* ports as template. I made minor
> > > modifications now (honoring the 72 character per line limit) and
> > > compared the formatting to other ports.
> > 
> > That's better, this one is okay sthen@ if someone would like to
> > import.
> 
> Sorry, but this module is broken because it badly computes totalmem,
> see [0], where i have 16 gigs actually. I've modified Makefile.PL, so
> we use the same code as NetBSD, this fixes the issue.
> 
> Also there was a trailing whitespace in DESCR. 
> 
> It works fine on macppc as well. 
> 
> I'm attaching a modified tarball.
> 
> Charlène.
> 
> 
> [0] https://bin.charlenew.xyz/meminfo.failing.log
> 
> 




Re: [NEW] devel/p5-Sys-MemInfo

2019-10-18 Thread Charlene Wendling
On Thu, 17 Oct 2019 21:21:14 +0100
Stuart Henderson wrote:

> On 2019/10/17 10:01, Henry Jensen wrote:
> > On Wed, 16 Oct 2019 16:07:34 +0100
> > Stuart Henderson  wrote:
> > 
> > > On 2019/10/16 09:04, Henry Jensen wrote:
> > > > Ping
> > > > 
> > > > On Wed, 9 Oct 2019 15:08:00 +0200
> > > > Henry Jensen  wrote:
> > > >   
> > > > > Greetings,
> > > > > 
> > > > > attached is a new port for the perl module Sys::MemInfo.
> > > > > Sys::MemInfo returns the total amount of free and used
> > > > > physical memory in bytes in totalmem and freemem variables.
> > > > > Tested on -current amd64.  
> > > 
> > > Please format Makefile and DESCR a bit nicer. Look at other ports
> > > in the tree for examples.
> > 
> > Actually, I used one of the p5-* ports as template. I made minor
> > modifications now (honoring the 72 character per line limit) and
> > compared the formatting to other ports.
> 
> That's better, this one is okay sthen@ if someone would like to
> import.

Sorry, but this module is broken because it badly computes totalmem,
see [0], where i have 16 gigs actually. I've modified Makefile.PL, so
we use the same code as NetBSD, this fixes the issue.

Also there was a trailing whitespace in DESCR. 

It works fine on macppc as well. 

I'm attaching a modified tarball.

Charlène.


[0] https://bin.charlenew.xyz/meminfo.failing.log




p5-Sys-MemInfo.tgz
Description: Binary data


Re: [NEW] devel/p5-Sys-MemInfo

2019-10-17 Thread Stuart Henderson
On 2019/10/17 10:01, Henry Jensen wrote:
> On Wed, 16 Oct 2019 16:07:34 +0100
> Stuart Henderson  wrote:
> 
> > On 2019/10/16 09:04, Henry Jensen wrote:
> > > Ping
> > > 
> > > On Wed, 9 Oct 2019 15:08:00 +0200
> > > Henry Jensen  wrote:
> > >   
> > > > Greetings,
> > > > 
> > > > attached is a new port for the perl module Sys::MemInfo.  Sys::MemInfo
> > > > returns the total amount of free and used physical memory in bytes in
> > > > totalmem and freemem variables. Tested on -current amd64.  
> > 
> > Please format Makefile and DESCR a bit nicer. Look at other ports in the
> > tree for examples.
> 
> Actually, I used one of the p5-* ports as template. I made minor
> modifications now (honoring the 72 character per line limit) and
> compared the formatting to other ports.

That's better, this one is okay sthen@ if someone would like to import.

> > 
> > > > This will be needed for an updated version of mail/imapsync.
> > > > 
> > > > Comments?   
> > 
> > I fail to see why an imap syncer would need to pull in an otherwise
> > unnecessary dependency just to print how much memory is free, but that's
> > not the only thing puzzling about imapsync ;)
> > 
> 
> If there is a tool with fewer dependencies in ports, which does the
> same job, I would be happy to learn about it :)

Not exactly the same job, as it wants Dovecot at the local end rather
than any random server, but Dovecot's sync tool can do backups/migrations
(including incremental) from other servers by fetching over IMAP; in
cases where it's a match for the task it's generally quite robust.

imapsync has more use cases than that, but it's quite an unusual
design and code layout and isn't usually my first choice if I can find
something else for the job :)



Re: [NEW] devel/p5-Sys-MemInfo

2019-10-17 Thread Henry Jensen
On Wed, 16 Oct 2019 16:07:34 +0100
Stuart Henderson  wrote:

> On 2019/10/16 09:04, Henry Jensen wrote:
> > Ping
> > 
> > On Wed, 9 Oct 2019 15:08:00 +0200
> > Henry Jensen  wrote:
> >   
> > > Greetings,
> > > 
> > > attached is a new port for the perl module Sys::MemInfo.  Sys::MemInfo
> > > returns the total amount of free and used physical memory in bytes in
> > > totalmem and freemem variables. Tested on -current amd64.  
> 
> Please format Makefile and DESCR a bit nicer. Look at other ports in the
> tree for examples.

Actually, I used one of the p5-* ports as template. I made minor
modifications now (honoring the 72 character per line limit) and
compared the formatting to other ports.

> 
> > > This will be needed for an updated version of mail/imapsync.
> > > 
> > > Comments?   
> 
> I fail to see why an imap syncer would need to pull in an otherwise
> unnecessary dependency just to print how much memory is free, but that's
> not the only thing puzzling about imapsync ;)
> 

If there is a tool with fewer dependencies in ports, which does the
same job, I would be happy to learn about it :)



p5-Sys-MemInfo.tar.gz
Description: application/gzip


Re: [NEW] devel/p5-Sys-MemInfo

2019-10-16 Thread Stuart Henderson
On 2019/10/16 09:04, Henry Jensen wrote:
> Ping
> 
> On Wed, 9 Oct 2019 15:08:00 +0200
> Henry Jensen  wrote:
> 
> > Greetings,
> > 
> > attached is a new port for the perl module Sys::MemInfo.  Sys::MemInfo
> > returns the total amount of free and used physical memory in bytes in
> > totalmem and freemem variables. Tested on -current amd64.

Please format Makefile and DESCR a bit nicer. Look at other ports in the
tree for examples.

> > This will be needed for an updated version of mail/imapsync.
> > 
> > Comments? 

I fail to see why an imap syncer would need to pull in an otherwise
unnecessary dependency just to print how much memory is free, but that's
not the only thing puzzling about imapsync ;)



Re: [NEW] devel/p5-Sys-MemInfo

2019-10-16 Thread Henry Jensen
Ping

On Wed, 9 Oct 2019 15:08:00 +0200
Henry Jensen  wrote:

> Greetings,
> 
> attached is a new port for the perl module Sys::MemInfo.  Sys::MemInfo
> returns the total amount of free and used physical memory in bytes in
> totalmem and freemem variables. Tested on -current amd64.
> 
> This will be needed for an updated version of mail/imapsync.
> 
> Comments? 
> 
> If OK, someone is needed to push it to CVS.
> 
> Kind regards,
> 
> Henry
> 
> 



[NEW] devel/p5-Sys-MemInfo

2019-10-09 Thread Henry Jensen
Greetings,

attached is a new port for the perl module Sys::MemInfo.  Sys::MemInfo
returns the total amount of free and used physical memory in bytes in
totalmem and freemem variables. Tested on -current amd64.

This will be needed for an updated version of mail/imapsync.

Comments? 

If OK, someone is needed to push it to CVS.

Kind regards,

Henry




p5-Sys-MemInfo.tar.gz
Description: application/gzip