[arch-commits] Commit in ls++/repos (4 files)

Levente Polyak anthraxx at archlinux.org
Sat Nov 12 23:17:40 UTC 2016


    Date: Saturday, November 12, 2016 @ 23:17:39
  Author: anthraxx
Revision: 195473

archrelease: copy trunk to community-any

Added:
  ls++/repos/community-any/
  ls++/repos/community-any/PKGBUILD
    (from rev 195472, ls++/trunk/PKGBUILD)
  ls++/repos/community-any/fix-user-group-align.patch
    (from rev 195472, ls++/trunk/fix-user-group-align.patch)
  ls++/repos/community-any/make-destdir.patch
    (from rev 195472, ls++/trunk/make-destdir.patch)

----------------------------+
 PKGBUILD                   |   45 +++++++++++++
 fix-user-group-align.patch |  148 +++++++++++++++++++++++++++++++++++++++++++
 make-destdir.patch         |   31 +++++++++
 3 files changed, 224 insertions(+)

Copied: ls++/repos/community-any/PKGBUILD (from rev 195472, ls++/trunk/PKGBUILD)
===================================================================
--- community-any/PKGBUILD	                        (rev 0)
+++ community-any/PKGBUILD	2016-11-12 23:17:39 UTC (rev 195473)
@@ -0,0 +1,45 @@
+# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
+# Contributor: JokerBoy <jokerboy at punctweb dot ro>
+
+pkgname=ls++
+pkgver=0.348
+_gitcommit=47c63f357a5de80f9cbcfb7214cd6e82f88156d8
+pkgrel=1
+pkgdesc='Colorized LS on steroids'
+url='https://github.com/trapd00r/ls--/'
+arch=('any')
+license=('GPL2')
+depends=('perl-term-extendedcolor')
+makedepends=('git')
+backup=('etc/ls++.conf')
+options=('!emptydirs')
+source=(${pkgname}::"git+https://github.com/trapd00r/ls--#commit=${_gitcommit}"
+        fix-user-group-align.patch
+        make-destdir.patch)
+sha512sums=('SKIP'
+            '80123d9e11e55643c96ac5e2866cca75ae4197023a16719671d55251ed74cca95f4970c0b07ca0f049edbd96aec6c1c8a6bdbff4b44b4697ee8afb79d8777e28'
+            'b4fff9fff1233130dca795ec9a0d7abf1bddb8cc94b2e5ed2b6784e6379ae15d12094a9cfe2b21e8d98f68278903f7726f98d0b3d9861c9e75224de631ea049f')
+
+prepare() {
+  cd ${pkgname}
+  patch -p1 < "${srcdir}/fix-user-group-align.patch"
+  patch -p1 < "${srcdir}/make-destdir.patch"
+}
+
+build() {
+  cd ${pkgname}
+  PERL_MM_USE_DEFAULT=1 \
+    PERL_AUTOINSTALL=--skipdeps \
+    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='${pkgdir}'" \
+    PERL_MB_OPT="--installdirs vendor --destdir '${pkgdir}'" \
+    MODULEBUILDRC=/dev/null \
+    perl Makefile.PL
+  make
+}
+
+package() {
+  cd ${pkgname}
+  make PREFIX=/ DESTDIR="${pkgdir}" install
+}
+
+# vim: ts=2 sw=2 et:

Copied: ls++/repos/community-any/fix-user-group-align.patch (from rev 195472, ls++/trunk/fix-user-group-align.patch)
===================================================================
--- community-any/fix-user-group-align.patch	                        (rev 0)
+++ community-any/fix-user-group-align.patch	2016-11-12 23:17:39 UTC (rev 195473)
@@ -0,0 +1,148 @@
+From 9409b8c338da096088c97e5658a3aeab8b167a56 Mon Sep 17 00:00:00 2001
+From: anthraxx <levente at leventepolyak.net>
+Date: Sat, 12 Nov 2016 23:44:20 +0100
+Subject: [PATCH] properly align user and group when listing mixed directories
+
+- this also fixes other small issues listed in the issues section
+---
+ ls++ | 64 ++++++++++++++++++++++++++++++++++++++++++----------------------
+ 1 file changed, 42 insertions(+), 22 deletions(-)
+
+diff --git a/ls++ b/ls++
+index 7a8c91c..d80e20e 100755
+--- a/ls++
++++ b/ls++
+@@ -118,30 +118,36 @@ ls();
+ sub ls {
+   my $view = shift // 'perm_size_file';
+   my($perm, $hlink, $user, $group, $size, $seconds, $file, $rel);
++  my($userpad, $grouppad, $sizelen);
+   my($second, $minute, $hour, $time, $month, $day, $year, %mon2num); #for Mac OS
+ 
+   open(my $ls, '-|', "$ls @ls_opts @ls_where")
+     or die("Cant popen $ls: $!");
+ 
+-  while(my $line = <$ls>) {
+-    #total 1.7M
+-    next if $line =~ /^total/;
+-
+-
++  local $/=undef;
++  foreach my $sub (split(/\n\n/, <$ls>)) {
++  $sizelen = get_max_size_len($sub);
++  foreach my $line (split(/^/, $sub . "\n")) {
++    if ($line =~ /^\n$/) {
++      print();
++      next;
++    }
+     # Assume GNU coreutils
+     if($^O eq 'linux') {
+-      ($perm, $hlink, $user, $group, $size, $seconds) = split(/\s+/, $line)
++      ($perm, $hlink, $user, $group, $size, $seconds, $file) = split(/\s+/, $line, 7)
+         unless $line =~ /^\s/;
++        chop($file);
+ 
+-      ($file) = $line =~ m/.* \d{6,}? (.+)/;
++      ($userpad, $grouppad) = $line =~ m/\d+\s+\S+\s(\s*)\S+(\s*)\s.{$sizelen}\s/;
+     }
+     elsif( ($^O eq 'darwin') or ($^O =~ /.+bsd$/) ) {
+-        ($perm, $hlink, $user, $group, $size, $month, $day, $time, $year) = split(/\s+/, $line);
++        ($perm, $hlink, $user, $group, $size, $month, $day, $time, $year, $file) = split(/\s+/, $line, 10);
++        chop($file);
+         if( (!$day) ) {
+           printf("%s", $line);
+           next;
+         }
+-        ($file) = $line =~ m/.*\d{2,}? (.*)/;
++        $file = uncolor($file);
+ 
+         $perm =~ s/(?:\+|\@)$//g; # MacOS 'special extended attributes'
+ 
+@@ -158,11 +164,13 @@ sub ls {
+ 
+ 
+     if( (!$file) ) {
+-        if ($line =~ /(.*):/){
+-            printf("Dir: %s/\n", $1);
+-        } else {
+-          next;
++      if( $line =~ /(.*):/ ) {
++        printf("\n%s:\n", fg($c[9], fg('bold', $1)));
++      }
++      elsif( $line =~ /^total (.*)/ ) {
++        printf("%s %s\n", fg($c[1], 'total'), ($size = size($1)) =~ s/\s+//gr);
+       }
++      next;
+     }
+     $file = add_ls_color($file) unless(!$ENV{DISPLAY});
+ 
+@@ -206,7 +214,7 @@ sub ls {
+       $size =~ s/^\s{3}(.+)/$1 /;
+     }
+ 
+-    my $user = owner($user, $group);
++    my $user = owner($userpad . $user, $group . $grouppad);
+ 
+     if($opt->{perm_file}) {
+       perm_file($perm, $file);
+@@ -229,6 +237,19 @@ sub ls {
+       next;
+     }
+   }
++  }
++}
++
++sub get_max_size_len {
++  my($out) = @_;
++  my($perm, $hlink, $user, $group, $size, $max, $cur);
++  $max = 0;
++  foreach my $line (split(/^/, $out)) {
++    ($perm, $hlink, $user, $group, $size) = split(/\s+/, $line);
++    $cur = length($size);
++    $max = ($max, $cur)[$max < $cur];
++  }
++  return $max;
+ }
+ 
+ sub add_ls_color {
+@@ -366,30 +387,29 @@ sub owner {
+ 
+ sub size {
+   my ($size) = @_;
+-
+   #FIXME
+   if($colors > 16) {
+     #$size =~ s/(\S+)(K)/$c[2]$1\e[0m$c[4]$2\e[0m/gi;# and print "AA\n";
+     if($size =~ m/^(\S+)(K)/) {
+-      $size = sprintf("% 27s",
+-        fg($c[7], sprintf("% 4g", $1))
++      $size = sprintf("%27s",
++        fg($c[7], sprintf("%4g", $1))
+           . fg($c[2], fg('bold', $2))
+         );
+     }
+     elsif($size =~ m/^(\S+)(M)/) {
+-      $size = sprintf("% 29s",
+-        fg($c[7], sprintf("% 4g", $1))
++      $size = sprintf("%29s",
++        fg($c[7], sprintf("%4g", $1))
+           . fg($c[4], fg('bold', $2))
+         );
+     }
+     elsif($size =~ m/^(\S+)(G)/) {
+-      $size = sprintf("% 27s",
+-        fg($c[7], sprintf("% 4g", $1))
++      $size = sprintf("%27s",
++        fg($c[7], sprintf("%4g", $1))
+           . fg($c[3], fg('bold', $2))
+         );
+     }
+     elsif($size =~ m/^(\d+)/) {
+-      $size = sprintf("% 27s",
++      $size = sprintf("%27s",
+         fg($c[7], sprintf("%4d", $1))
+           . fg($c[14], fg('bold', 'B'))
+         );
+-- 
+2.10.2
+

Copied: ls++/repos/community-any/make-destdir.patch (from rev 195472, ls++/trunk/make-destdir.patch)
===================================================================
--- community-any/make-destdir.patch	                        (rev 0)
+++ community-any/make-destdir.patch	2016-11-12 23:17:39 UTC (rev 195473)
@@ -0,0 +1,31 @@
+From e0f396148123d3babf22f91ff18e1db1903b6a24 Mon Sep 17 00:00:00 2001
+From: anthraxx <levente at leventepolyak.net>
+Date: Sat, 12 Nov 2016 23:48:54 +0100
+Subject: [PATCH] support standard DESTDIR for packaging into a subdirectory
+
+This is required for creating a package for a distribution as they
+distribute the files in a sourcedir to create the tarball.
+However the DESTDIR should not influence the runtime itself, therefor
+PREFIX is the only variable considered in the $(sysconfdir_scripts)
+---
+ Makefile.PL | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index 9b2651c..6affbbf 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -70,8 +70,8 @@ sysconfdir:
+ 	$(PERL) -pi -e "s|\"/etc/ls\+\+\.conf|\"$(PREFIX)/etc/ls++.conf|g" $(sysconfdir_scripts)
+ 
+ install_vendor :: ls++.conf
+-	[ ! -d $(PREFIX)/etc ] && mkdir -p $(PREFIX)/etc
+-	[ ! -f $(PREFIX)/etc/ls++.conf ] && cp ls++.conf $(PREFIX)/etc/ls++.conf
++	[ ! -d $(DESTDIR)/$(PREFIX)/etc ] && mkdir -p $(DESTDIR)/$(PREFIX)/etc
++	[ ! -f $(DESTDIR)/$(PREFIX)/etc/ls++.conf ] && cp ls++.conf $(DESTDIR)/$(PREFIX)/etc/ls++.conf
+ 
+ install :: install_vendor
+ }
+-- 
+2.10.2
+



More information about the arch-commits mailing list