Subject: [alpine-aports] [PATCH] testing/cloc: new aport

From: Sören Tempel <[email-masked]>
Date: Fri, 14 Aug 2015 11:12:38 +0200

---
 testing/cloc/APKBUILD      | 44 +++++++++++++++++++++++++++++
 testing/cloc/perl522.patch | 70 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)
 create mode 100644 testing/cloc/APKBUILD
 create mode 100644 testing/cloc/perl522.patch

diff --git a/testing/cloc/APKBUILD b/testing/cloc/APKBUILD
new file mode 100644
index 0000000..0198c15
--- /dev/null
+++ b/testing/cloc/APKBUILD
@@ -0,0 +1,44 @@
+# Contributor: Sören Tempel <[email-masked]>
+# Maintainer: Sören Tempel <[email-masked]>
+pkgname=cloc
+pkgver=1.64
+pkgrel=0
+pkgdesc="Count Lines of Code"
+url="http://cloc.sourceforge.net/"
+arch="noarch"
+license="GPL"
+depends="perl"
+depends_dev=""
+makedepends=""
+install=""
+subpackages="$pkgname-doc"
+source="http://downloads.sourceforge.net/project/${pkgname}/${pkgname}/v${pkgver}/${pkgname}-${pkgver}.tar.gz
+	perl522.patch" # See https://sourceforge.net/p/cloc/bugs/135/
+
+_builddir="$srcdir"/$pkgname-$pkgver
+prepare() {
+	cd "$_builddir"
+
+	local i=
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1 ;;
+		esac
+	done
+}
+
+build () {
+	make -C "$_builddir" || return 1
+}
+
+package() {
+	make DESTDIR="$pkgdir" -C "$_builddir" \
+		install || return 1
+}
+
+md5sums="ef5bac179f64bb2af1a6d67c2b0f7194  cloc-1.64.tar.gz
+3d43994945cc7304cdcb27614d7a11a3  perl522.patch"
+sha256sums="309701142f54ee5b244307dec2d07848b71af9b9fee01437d3f7440193f975f0  cloc-1.64.tar.gz
+5600b8b5a03add484079d8a22cd6f8ae80e29c44a8583e3f4302ad3730513036  perl522.patch"
+sha512sums="2532c8f57a5d9b10a03fe8056708b79f7eb588831dec4b89ac85f354049cdf1e150a0a0c1add359831a1d89a0ed8ac56092ff31e54f4ccfb9491c21b50a960b6  cloc-1.64.tar.gz
+3f4f421db0cfac693eab632dc143fe6ee70dd189164a93b2d2a919b0147923d6caa9dc1c553bffa9e8adb7b65b7765508306540ac4f11290013ef7617e966d7a  perl522.patch"
diff --git a/testing/cloc/perl522.patch b/testing/cloc/perl522.patch
new file mode 100644
index 0000000..31af1bc
--- /dev/null
+++ b/testing/cloc/perl522.patch
@@ -0,0 +1,70 @@
+--- cloc-1.64.orig/cloc
++++ cloc-1.64/cloc
+@@ -1281,8 +1281,8 @@
+                 $not_Filters_by_Language_Lang_LR = 1;
+             }
+         } else {
+-            if (!defined(@{$Filters_by_Language{$Lang_L} }) or
+-                !defined(@{$Filters_by_Language{$Lang_R} })) {
++            if (!(@{$Filters_by_Language{$Lang_L} }) or
++                !(@{$Filters_by_Language{$Lang_R} })) {
+                 $not_Filters_by_Language_Lang_LR = 1;
+             }
+         }
+@@ -1618,7 +1618,7 @@
+         $Ignored{$file} = "--exclude-lang=$Language{$file}";
+         next;
+     }
+-    my $Filters_by_Language_Language_file = !defined @{$Filters_by_Language{$Language{$file}} };
++    my $Filters_by_Language_Language_file = !@{$Filters_by_Language{$Language{$file}} };
+     if ($Filters_by_Language_Language_file) {
+         if ($Language{$file} eq "(unknown)") {
+             $Ignored{$file} = "language unknown (#1)";
+@@ -1759,7 +1759,7 @@
+                     if ($PERL_516) {
+                         next unless         @{$rhaa_Filters_by_Language->{$1}};
+                     } else {
+-                        next unless defined @{$rhaa_Filters_by_Language->{$1}};
++                        next unless @{$rhaa_Filters_by_Language->{$1}};
+                     }
+                     # above test necessary to avoid trying to sum reports
+                     # of reports (which have no language breakdown).
+@@ -3259,7 +3259,7 @@
+ } # 1}}}
+ sub print_language_filters {                 # {{{1
+     my ($language,) = @_;
+-    if (!defined @{$Filters_by_Language{$language}}) {
++    if (!@{$Filters_by_Language{$language}}) {
+         warn "Unknown language: $language\n";
+         warn "Use --show-lang to list all defined languages.\n";
+         return;
+@@ -4623,7 +4623,7 @@
+ 
+   open (FILE, $file);
+   while (<FILE>) {
+-    if (m/^\\begin{code}/) { close FILE; return 2; }
++    if (m/^\\begin\{code}/) { close FILE; return 2; }
+     if (m/^>\s/) { close FILE; return 1; }
+   }
+ 
+@@ -4652,9 +4652,9 @@
+             if (!s/^>//) { s/.*//; }
+         } elsif ($literate == 2) {
+             if ($inlitblock) {
+-                if (m/^\\end{code}/) { s/.*//; $inlitblock = 0; }
++                if (m/^\\end\{code}/) { s/.*//; $inlitblock = 0; }
+             } elsif (!$inlitblock) {
+-                if (m/^\\begin{code}/) { s/.*//; $inlitblock = 1; }
++                if (m/^\\begin\{code}/) { s/.*//; $inlitblock = 1; }
+                 else { s/.*//; }
+             }
+         }
+@@ -6582,7 +6582,7 @@
+         my $language = $rh_Language_by_Extension->{$ext};
+         next if defined $extension_collisions{$language};
+         next if $seen_it{$language};
+-        if (!defined @{$rhaa_Filters_by_Language->{$language}}) {
++        if (!@{$rhaa_Filters_by_Language->{$language}}) {
+             $OK = 0;
+             warn "Missing language filter for $language\n";
+         }
-- 
2.5.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---