r74056 - in /trunk/libsysadm-install-perl: Changes META.yml README debian/changelog debian/control debian/copyright lib/Sysadm/Install.pm t/009snip.t t/010carp.t

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Fri May 6 15:00:15 UTC 2011


Author: angelabad-guest
Date: Fri May  6 14:59:38 2011
New Revision: 74056

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74056
Log:
* New upstream release
* debian/copyright: Update license stanzas
* debian/control: Remove perl (>= 5.10) | libarchive-tar-perl from
  Build-Depends-Indep and Suggests
* Bump Standards-Version to 3.9.2 (no changes)

Modified:
    trunk/libsysadm-install-perl/Changes
    trunk/libsysadm-install-perl/META.yml
    trunk/libsysadm-install-perl/README
    trunk/libsysadm-install-perl/debian/changelog
    trunk/libsysadm-install-perl/debian/control
    trunk/libsysadm-install-perl/debian/copyright
    trunk/libsysadm-install-perl/lib/Sysadm/Install.pm
    trunk/libsysadm-install-perl/t/009snip.t
    trunk/libsysadm-install-perl/t/010carp.t

Modified: trunk/libsysadm-install-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/Changes?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/Changes (original)
+++ trunk/libsysadm-install-perl/Changes Fri May  6 14:59:38 2011
@@ -1,6 +1,12 @@
 ########################################
 Revision history for Sysadm::Install
 ########################################
+
+0.36  (2011/05/01)
+    (ms) Added owner_cp() to copy uid and gid of a file or directory.
+    (ms) Added raise_error option for tap()
+    (ms) snip() now returns original string (with unprintables replaced) 
+         if the data length is shorter than $maxlen.
 
 0.35  (2010/04/13)
     (ms) [RT 54885] Merged with github fork by Thomas Lenz, fixing 

Modified: trunk/libsysadm-install-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/META.yml?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/META.yml (original)
+++ trunk/libsysadm-install-perl/META.yml Fri May  6 14:59:38 2011
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Sysadm-Install
-version:            0.35
+version:            0.36
 abstract:           Typical installation tasks for system administrators
 author:
     - Mike Schilli <m at perlmeister.com>
@@ -25,7 +25,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.50
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/libsysadm-install-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/README?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/README (original)
+++ trunk/libsysadm-install-perl/README Fri May  6 14:59:38 2011
@@ -1,5 +1,5 @@
 ######################################################################
-    Sysadm::Install 0.35
+    Sysadm::Install 0.36
 ######################################################################
 
 NAME
@@ -234,6 +234,16 @@
 
             "ls" "/tmp/$VAR" 2>/tmp/sometempfile |
 
+        Another option is "utf8" which runs the command in a terminal set to
+        UTF8.
+
+        Error handling: By default, tap() won't raise an error if the
+        command's return code is nonzero, indicating an error reported by
+        the shell. If bailing out on errors is requested to avoid return
+        code checking by the script, use the raise_error option:
+
+            tap({raise_error => 1}, "ls", "doesn't exist");
+
     "$quoted_string = qquote($string, [$metachars])"
         Put a string in double quotes and escape all sensitive characters so
         there's no unwanted interpolation. E.g., if you have something like
@@ -345,6 +355,19 @@
         Read the $src file's user permissions and modify all $dst files to
         reflect the same permissions.
 
+    "owner_cp($src, $dst, ...)"
+        Read the $src file/directory's owner uid and group gid and apply it
+        to $dst.
+
+        For example: copy uid/gid of the containing directory to a file
+        therein:
+
+            use File::Basename;
+
+            owner_cp( dirname($file), $file );
+
+        Usually requires root privileges, just like chown does.
+
     "$perms = perm_get($filename)"
         Read the $filename's user permissions and owner/group. Returns an
         array ref to be used later when calling "perm_set($filename,
@@ -404,14 +427,18 @@
         Format the data string in $data so that it's only (roughly) $maxlen
         characters long and only contains printable characters.
 
-        If $data contains unprintable character's they are replaced by "."
-        (the dot). If $data is longer than $maxlen, it will be formatted
-        like
+        If $data is longer than $maxlen, it will be formatted like
 
             (22)[abcdef[snip=11]stuvw]
 
         indicating the length of the original string, the beginning, the
         end, and the number of 'snipped' characters.
+
+        If $data is shorter than $maxlen, it will be returned unmodified
+        (except for unprintable characters replaced, see below).
+
+        If $data contains unprintable character's they are replaced by "."
+        (the dot).
 
     "password_read($prompt)"
         Reads in a password to be typed in by the user in noecho mode. A
@@ -460,7 +487,7 @@
         the CPAN modules, provides the function "def_or()" which can be used
         like
 
-            def_or($foo, $default); 
+            def_or($foo, $default);
 
         to accomplish the same as
 

Modified: trunk/libsysadm-install-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/debian/changelog?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/debian/changelog (original)
+++ trunk/libsysadm-install-perl/debian/changelog Fri May  6 14:59:38 2011
@@ -1,3 +1,13 @@
+libsysadm-install-perl (0.36-1) unstable; urgency=low
+
+  * New upstream release
+  * debian/copyright: Update license stanzas
+  * debian/control: Remove perl (>= 5.10) | libarchive-tar-perl from
+    Build-Depends-Indep and Suggests
+  * Bump Standards-Version to 3.9.2 (no changes)
+
+ -- Angel Abad <angelabad at gmail.com>  Fri, 06 May 2011 16:59:05 +0200
+
 libsysadm-install-perl (0.35-2) UNRELEASED; urgency=low
 
   * Update my email address.

Modified: trunk/libsysadm-install-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/debian/control?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/debian/control (original)
+++ trunk/libsysadm-install-perl/debian/control Fri May  6 14:59:38 2011
@@ -2,24 +2,29 @@
 Section: perl
 Priority: optional
 Build-Depends: debhelper (>= 7.0.50)
-Build-Depends-Indep: liblog-log4perl-perl (>= 1.28), libterm-readkey-perl,
- libwww-perl, perl, perl (>= 5.10) | libarchive-tar-perl
+Build-Depends-Indep: liblog-log4perl-perl (>= 1.28),
+ libterm-readkey-perl,
+ libwww-perl,
+ perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: gregor herrmann <gregoa at debian.org>,
  Ryan Niebur <ryan at debian.org>,
- Nathan Handler <nhandler at ubuntu.com>, Jonathan Yu <jawnsy at cpan.org>,
+ Nathan Handler <nhandler at ubuntu.com>,
+ Jonathan Yu <jawnsy at cpan.org>,
  Salvatore Bonaccorso <carnil at debian.org>,
  Angel Abad <angelabad at gmail.com>
-Standards-Version: 3.8.4
+Standards-Version: 3.9.2
 Homepage: http://search.cpan.org/dist/Sysadm-Install/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libsysadm-install-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libsysadm-install-perl/
 
 Package: libsysadm-install-perl
 Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, liblog-log4perl-perl (>= 1.28),
- libterm-readkey-perl, libwww-perl
-Suggests: libexpect-perl, perl (>= 5.10) | libarchive-tar-perl
+Depends: ${misc:Depends}, ${perl:Depends},
+ liblog-log4perl-perl (>= 1.28),
+ libterm-readkey-perl,
+ libwww-perl
+Suggests: libexpect-perl
 Description: module for typical installation tasks of system administrators
  Sysadm::Install executes shell-like commands performing typical
  installation tasks: Copying files, extracting tarballs, calling make.

Modified: trunk/libsysadm-install-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/debian/copyright?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/debian/copyright (original)
+++ trunk/libsysadm-install-perl/debian/copyright Fri May  6 14:59:38 2011
@@ -15,14 +15,15 @@
  2009, Jonathan Yu <frequency at cpan.org>
  2009, Nathan Handler <nhandler at ubuntu.com>
  2009, Ryan Niebur <ryan at debian.org>
+ 2011, Angel Abad <angelabad at gmail.com>
 License: Artistic or GPL-1+
 
 License: Artistic
  This program is free software; you can redistribute it and/or modify
  it under the terms of the Artistic License, which comes with Perl.
  .
- On Debian GNU/Linux systems, the complete text of the Artistic License
- can be found in `/usr/share/common-licenses/Artistic'
+ On Debian systems, the complete text of the Artistic License can be
+ found in `/usr/share/common-licenses/Artistic'.
 
 License: GPL-1+
  This program is free software; you can redistribute it and/or modify
@@ -30,5 +31,5 @@
  the Free Software Foundation; either version 1, or (at your option)
  any later version.
  .
- On Debian GNU/Linux systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL'
+ On Debian systems, the complete text of version 1 of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL-1'.

Modified: trunk/libsysadm-install-perl/lib/Sysadm/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/lib/Sysadm/Install.pm?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/lib/Sysadm/Install.pm (original)
+++ trunk/libsysadm-install-perl/lib/Sysadm/Install.pm Fri May  6 14:59:38 2011
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '0.35';
+our $VERSION = '0.36';
 
 use File::Copy;
 use File::Path;
@@ -75,7 +75,7 @@
 cp rmf mkd cd make 
 cdback download untar 
 pie slurp blurt mv tap 
-plough qquote quote perm_cp
+plough qquote quote perm_cp owner_cp
 perm_get perm_set
 sysrun untar_in pick ask
 hammer say
@@ -956,6 +956,16 @@
 
     "ls" "/tmp/$VAR" 2>/tmp/sometempfile |
 
+Another option is "utf8" which runs the command in a terminal set to 
+UTF8.
+
+Error handling: By default, tap() won't raise an error if the command's
+return code is nonzero, indicating an error reported by the shell. If 
+bailing out on errors is requested to avoid return code checking by
+the script, use the raise_error option:
+
+    tap({raise_error => 1}, "ls", "doesn't exist");
+
 =cut
 
 ###############################################
@@ -1010,6 +1020,10 @@
 
     my $exit_code = $?;
 
+    if($opts->{raise_error}) {
+        LOGCROAK("tap $cmd | failed ($!)");
+    }
+
     my $stderr = slurp($tmpfile, $options);
 
     DEBUG "tap $cmd results: rc=$exit_code stderr=[$stderr] stdout=[$stdout]";
@@ -1193,6 +1207,51 @@
 
     my $perms = perm_get($_[0]);
     perm_set($_[1], $perms);
+}
+
+=pod
+
+=item C<owner_cp($src, $dst, ...)>
+
+Read the C<$src> file/directory's owner uid and group gid and apply
+it to $dst.
+
+For example: copy uid/gid of the containing directory to a file
+therein:
+
+    use File::Basename;
+
+    owner_cp( dirname($file), $file );
+
+Usually requires root privileges, just like chown does.
+
+=cut
+
+######################################
+sub owner_cp {
+######################################
+    my($src, @dst) = @_;
+
+    local $Log::Log4perl::caller_depth =
+          $Log::Log4perl::caller_depth + 1;
+
+    _confirm "owner_cp @_" or return 1;
+
+    LOGCROAK("usage: owner_cp src dst ...") if @_ < 2;
+
+    my($uid, $gid) = (stat($src))[4,5];
+
+    if(!defined $uid or !defined $gid ) {
+        LOGCROAK("stat of $src failed: $!");
+        return undef;
+    }
+
+    if(!chown $uid, $gid, @dst ) {
+        LOGCROAK("chown of ", join(" ", @dst), " failed: $!");
+        return undef;
+    }
+
+    return 1;
 }
 
 =pod
@@ -1514,14 +1573,19 @@
 Format the data string in C<$data> so that it's only (roughly) $maxlen
 characters long and only contains printable characters.
 
-If C<$data> contains unprintable character's they are replaced by 
-"." (the dot). If C<$data> is longer than C<$maxlen>, it will be
+If C<$data> is longer than C<$maxlen>, it will be
 formatted like
 
     (22)[abcdef[snip=11]stuvw]
 
 indicating the length of the original string, the beginning, the
 end, and the number of 'snipped' characters.
+
+If C<$data> is shorter than $maxlen, it will be returned unmodified 
+(except for unprintable characters replaced, see below).
+
+If C<$data> contains unprintable character's they are replaced by 
+"." (the dot).
 
 =cut
 
@@ -1531,7 +1595,7 @@
     my($data, $maxlen) = @_;
 
     if(length $data <= $maxlen) {
-        return lenformat($data);
+        return printable($data);
     }
 
     $maxlen = 12 if $maxlen < 12;

Modified: trunk/libsysadm-install-perl/t/009snip.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/t/009snip.t?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/t/009snip.t (original)
+++ trunk/libsysadm-install-perl/t/009snip.t Fri May  6 14:59:38 2011
@@ -2,12 +2,12 @@
 # Tests for Sysadm::Install/s fs_read/write_open
 #############################################
 
-use Test::More tests => 5;
+use Test::More tests => 7;
 
 use Sysadm::Install qw(:all);
 
 is(snip("abc", 5), 
-   "(3)[abc]", "snip full len");
+   "abc", "snip full len");
 
 is(snip("abcdefghijklmn", 11), 
    "(14)[ab[snip=10]mn]", "snip minlen");
@@ -19,4 +19,11 @@
    "(14)[a.[snip=10]m.]", "snip special char");
 
 is(snip("a\tcdefghijklm\n", 14), 
-   "(14)[a.cdefghijklm.]", "exact len match")
+   "a.cdefghijklm.", "exact len match");
+
+is(snip("abc", 5, 1), 
+   "abc", "snip full len and keep flag");
+
+is(snip("a\tc", 5), 
+   "a.c", "snip full len with unprintable chars");
+

Modified: trunk/libsysadm-install-perl/t/010carp.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libsysadm-install-perl/t/010carp.t?rev=74056&op=diff
==============================================================================
--- trunk/libsysadm-install-perl/t/010carp.t (original)
+++ trunk/libsysadm-install-perl/t/010carp.t Fri May  6 14:59:38 2011
@@ -43,7 +43,7 @@
 # cp
 #################################
 eval {
-    cp "///", "//x";
+    cp "Ill/go/crazy/if/this/whacko/directory/actually/exists", "//x";
 };
 
 if($@) {




More information about the Pkg-perl-cvs-commits mailing list