summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTucker Boniface2018-08-13 11:44:11 -0700
committerTucker Boniface2018-08-13 11:45:43 -0700
commit3dfc92d6f8063027738b7fb6f4130aff57d18692 (patch)
treef51dfaa9ecb16d1da59d49c60d32ef271a1e8c63
downloadaur-3dfc92d6f8063027738b7fb6f4130aff57d18692.tar.gz
Initial commit
-rw-r--r--.SRCINFO146
-rw-r--r--CVE-2016-2381_duplicate_env.diff104
-rw-r--r--PKGBUILD239
-rw-r--r--detect-old-perl-modules.hook10
-rw-r--r--detect-old-perl-modules.sh36
-rwxr-xr-xgenerate-rebuild-list.sh11
-rwxr-xr-xpatchprov260
-rw-r--r--perlbin.csh15
-rw-r--r--perlbin.fish10
-rwxr-xr-xperlbin.sh18
-rw-r--r--upgpkg4
11 files changed, 853 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..b58347603dd
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,146 @@
+pkgbase = perl-git
+ pkgdesc = A highly capable, feature-rich programming language (development version)
+ pkgver = 5.29.1.r86.g48ae8dc39c
+ pkgrel = 1
+ url = http://www.perl.org
+ arch = x86_64
+ license = GPL
+ license = PerlArtistic
+ makedepends = git
+ depends = gdbm
+ depends = db
+ depends = glibc
+ provides = perlarchive-tar=2.30
+ provides = perlattribute-handlers=1.01
+ provides = perlautodie=2.29
+ provides = perlautoloader=5.74
+ provides = perlautouse=1.11
+ provides = perlb-debug=1.26
+ provides = perlbase=2.27
+ provides = perlbignum=0.50
+ provides = perlcarp=1.50
+ provides = perlcompress-raw-bzip2=2.081
+ provides = perlcompress-raw-zlib=2.081
+ provides = perlconfig-perl-v=0.30
+ provides = perlconstant=1.33
+ provides = perlcpan-meta-requirements=2.140
+ provides = perlcpan-meta-yaml=0.018
+ provides = perlcpan-meta=2.150010
+ provides = perlcpan=2.20
+ provides = perldata-dumper=2.171
+ provides = perldb_file=1.842
+ provides = perldevel-ppport=3.42
+ provides = perldevel-selfstubber=1.06
+ provides = perldigest-md5=2.55
+ provides = perldigest-sha=6.02
+ provides = perldigest=1.17_01
+ provides = perldumpvalue=1.18
+ provides = perlencode=2.97
+ provides = perlencoding-warnings=0.13
+ provides = perlenv=1.04
+ provides = perlexperimental=0.020
+ provides = perlexporter=5.73
+ provides = perlextutils-cbuilder=0.280230
+ provides = perlextutils-constant=0.25
+ provides = perlextutils-install=2.14
+ provides = perlextutils-makemaker=7.34
+ provides = perlextutils-manifest=1.71
+ provides = perlextutils-parsexs=3.39
+ provides = perlfile-fetch=0.56
+ provides = perlfile-path=2.15
+ provides = perlfile-temp=0.2308
+ provides = perlfilter-simple=0.95
+ provides = perlfilter-util-call=1.59
+ provides = perlgetopt-long=2.5
+ provides = perlhttp-tiny=0.076
+ provides = perli18n-collate=1.02
+ provides = perli18n-langtags=0.43
+ provides = perlif=0.0608
+ provides = perlio-compress=2.081
+ provides = perlio-socket-ip=0.39
+ provides = perlio-zlib=1.10
+ provides = perlio=1.39
+ provides = perlipc-cmd=1.02
+ provides = perlipc-sysv=2.07
+ provides = perljson-pp=2.97001
+ provides = perllib=0.64
+ provides = perllibnet=3.11
+ provides = perllocale-codes=3.57
+ provides = perllocale-maketext-simple=0.21_01
+ provides = perllocale-maketext=1.29
+ provides = perlmath-bigint-fastcalc=0.5007
+ provides = perlmath-bigint=1.999813
+ provides = perlmath-bigrat=0.2614
+ provides = perlmath-complex=1.5901
+ provides = perlmemoize=1.03_01
+ provides = perlmime-base64=3.15
+ provides = perlmodule-corelist=5.20180820
+ provides = perlmodule-load-conditional=0.68
+ provides = perlmodule-load=0.32
+ provides = perlmodule-loaded=0.08
+ provides = perlmodule-metadata=1.000033
+ provides = perlnet-ping=2.62
+ provides = perlparams-check=0.38
+ provides = perlparent=0.237
+ provides = perlpathtools=3.75
+ provides = perlperl-ostype=1.010
+ provides = perlperlfaq=5.20180605
+ provides = perlperlio-via-quotedprint=0.08
+ provides = perlpod-checker=1.73
+ provides = perlpod-escapes=1.07
+ provides = perlpod-parser=1.63
+ provides = perlpod-perldoc=3.2801
+ provides = perlpod-simple=3.35
+ provides = perlpod-usage=1.69
+ provides = perlpodlators=5.006
+ provides = perlsafe=2.40
+ provides = perlscalar-list-utils=1.50
+ provides = perlsearch-dict=1.07
+ provides = perlselfloader=1.25
+ provides = perlsocket=2.027
+ provides = perlstorable=3.12
+ provides = perlsys-syslog=0.35
+ provides = perlterm-ansicolor=4.06
+ provides = perlterm-cap=1.17
+ provides = perlterm-complete=1.403
+ provides = perlterm-readline=1.17
+ provides = perltest-harness=3.42
+ provides = perltest-simple=1.302138
+ provides = perltest=1.31
+ provides = perltext-abbrev=1.02
+ provides = perltext-balanced=2.03
+ provides = perltext-parsewords=3.30
+ provides = perltext-tabs=2013.0523
+ provides = perlthread-queue=3.13
+ provides = perlthread-semaphore=2.13
+ provides = perlthreads-shared=1.58
+ provides = perlthreads=2.22
+ provides = perltie-file=1.02
+ provides = perltie-refhash=1.39
+ provides = perltime-hires=1.9760
+ provides = perltime-local=1.28
+ provides = perltime-piece=1.3204
+ provides = perlunicode-collate=1.25
+ provides = perlunicode-normalize=1.26
+ provides = perlversion=0.9924
+ provides = perlxsloader=0.30
+ provides = perl
+ conflicts = perl
+ options = makeflags
+ options = !purge
+ options = emptydirs
+ source = perl::git+https://perl5.git.perl.org/perl.git
+ source = perlbin.sh
+ source = perlbin.csh
+ source = perlbin.fish
+ source = detect-old-perl-modules.sh
+ source = detect-old-perl-modules.hook
+ sha512sums = SKIP
+ sha512sums = 46724344828e7f86e016f9c8d588bf52b2e764e65e0acc1a38899a530c99bc6e4fd8b46fa0d4bbd685aa2074dd5bcbf9029ac3bb3f2d0ee9adfc4f6c0745f373
+ sha512sums = fc1344a02c741d61af6f6b5967f29cc6f43c2059761522b150261924dd7e1989da5254c03ffa0627accd9af01bc152edd24e84a6b59579acb9ee1900b6ce9383
+ sha512sums = 881e2efe05ba818cd7300f126800b56bb0685cb5c9c5fb7e67ef6aaf5abd17d2391a979d5d16d109c5111f4b35504ba83d19b0e6eda4431e8421fcbea19d2f1a
+ sha512sums = bd48af7a6209f2ad51aa1747a7238ecb11607a53f61460d873202bf14b55c3b7dd6f66f4a9f2cac8a24240313789a9a44dbc81b73587de46a6b1866bdfca5e26
+ sha512sums = 6b5b2ba606d443da22c6c1a754829abd36f3fdfef1089bcf06c8f9db0217f2c2f02ebc14958ffa7afe618c9a80bd1025e76704f67466c0c3db7d40ef2c0e56b3
+
+pkgname = perl-git
+
diff --git a/CVE-2016-2381_duplicate_env.diff b/CVE-2016-2381_duplicate_env.diff
new file mode 100644
index 00000000000..80adf62d2c2
--- /dev/null
+++ b/CVE-2016-2381_duplicate_env.diff
@@ -0,0 +1,104 @@
+From 83e7ebed7afa79a2f50eca6b6330eae7c3a02d36 Mon Sep 17 00:00:00 2001
+From: Tony Cook <tony@develop-help.com>
+Date: Wed, 27 Jan 2016 11:52:15 +1100
+Subject: remove duplicate environment variables from environ
+
+If we see duplicate environment variables while iterating over
+environ[]:
+
+a) make sure we use the same value in %ENV that getenv() returns.
+
+Previously on a duplicate, %ENV would have the last entry for the name
+from environ[], but a typical getenv() would return the first entry.
+
+Rather than assuming all getenv() implementations return the first entry
+explicitly call getenv() to ensure they agree.
+
+b) remove duplicate entries from environ
+
+Previously if there was a duplicate definition for a name in environ[]
+setting that name in %ENV could result in an unsafe value being passed
+to a child process, so ensure environ[] has no duplicates.
+
+Patch-Name: fixes/CVE-2016-2381_duplicate_env.diff
+---
+ perl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ 1 file changed, 49 insertions(+), 2 deletions(-)
+
+diff --git a/perl.c b/perl.c
+index 80a76c2..ed25429 100644
+--- a/perl.c
++++ b/perl.c
+@@ -4303,23 +4303,70 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env)
+ }
+ if (env) {
+ char *s, *old_var;
++ STRLEN nlen;
+ SV *sv;
++ HV *dups = newHV();
++
+ for (; *env; env++) {
+ old_var = *env;
+
+ if (!(s = strchr(old_var,'=')) || s == old_var)
+ continue;
++ nlen = s - old_var;
+
+ #if defined(MSDOS) && !defined(DJGPP)
+ *s = '\0';
+ (void)strupr(old_var);
+ *s = '=';
+ #endif
+- sv = newSVpv(s+1, 0);
+- (void)hv_store(hv, old_var, s - old_var, sv, 0);
++ if (hv_exists(hv, old_var, nlen)) {
++ const char *name = savepvn(old_var, nlen);
++
++ /* make sure we use the same value as getenv(), otherwise code that
++ uses getenv() (like setlocale()) might see a different value to %ENV
++ */
++ sv = newSVpv(PerlEnv_getenv(name), 0);
++
++ /* keep a count of the dups of this name so we can de-dup environ later */
++ if (hv_exists(dups, name, nlen))
++ ++SvIVX(*hv_fetch(dups, name, nlen, 0));
++ else
++ (void)hv_store(dups, name, nlen, newSViv(1), 0);
++
++ Safefree(name);
++ }
++ else {
++ sv = newSVpv(s+1, 0);
++ }
++ (void)hv_store(hv, old_var, nlen, sv, 0);
+ if (env_is_not_environ)
+ mg_set(sv);
+ }
++ if (HvKEYS(dups)) {
++ /* environ has some duplicate definitions, remove them */
++ HE *entry;
++ hv_iterinit(dups);
++ while ((entry = hv_iternext_flags(dups, 0))) {
++ STRLEN nlen;
++ const char *name = HePV(entry, nlen);
++ IV count = SvIV(HeVAL(entry));
++ IV i;
++ SV **valp = hv_fetch(hv, name, nlen, 0);
++
++ assert(valp);
++
++ /* try to remove any duplicate names, depending on the
++ * implementation used in my_setenv() the iteration might
++ * not be necessary, but let's be safe.
++ */
++ for (i = 0; i < count; ++i)
++ my_setenv(name, 0);
++
++ /* and set it back to the value we set $ENV{name} to */
++ my_setenv(name, SvPV_nolen(*valp));
++ }
++ }
++ SvREFCNT_dec_NN(dups);
+ }
+ #endif /* USE_ENVIRON_ARRAY */
+ #endif /* !PERL_MICRO */
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..04f095f28d2
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,239 @@
+# Maintainer: Tucker Boniface <tucker@boniface.tech>
+
+_pkgname=perl
+pkgname=perl-git
+pkgver=5.29.1.r86.g48ae8dc39c
+_baseversion="${pkgver%.*.*}"
+pkgrel=1
+pkgdesc="A highly capable, feature-rich programming language (development version)"
+arch=(x86_64)
+license=('GPL' 'PerlArtistic')
+url="http://www.perl.org"
+depends=('gdbm' 'db' 'glibc')
+makedepends=('git')
+# NOTE: This array is automatically generated by `./patchprov`.
+# If you want to add entries, do so in the next array.
+provides=('perlarchive-tar=2.30'
+ 'perlattribute-handlers=1.01'
+ 'perlautodie=2.29'
+ 'perlautoloader=5.74'
+ 'perlautouse=1.11'
+ 'perlb-debug=1.26'
+ 'perlbase=2.27'
+ 'perlbignum=0.50'
+ 'perlcarp=1.50'
+ 'perlcompress-raw-bzip2=2.081'
+ 'perlcompress-raw-zlib=2.081'
+ 'perlconfig-perl-v=0.30'
+ 'perlconstant=1.33'
+ 'perlcpan-meta-requirements=2.140'
+ 'perlcpan-meta-yaml=0.018'
+ 'perlcpan-meta=2.150010'
+ 'perlcpan=2.20'
+ 'perldata-dumper=2.171'
+ 'perldb_file=1.842'
+ 'perldevel-ppport=3.42'
+ 'perldevel-selfstubber=1.06'
+ 'perldigest-md5=2.55'
+ 'perldigest-sha=6.02'
+ 'perldigest=1.17_01'
+ 'perldumpvalue=1.18'
+ 'perlencode=2.97'
+ 'perlencoding-warnings=0.13'
+ 'perlenv=1.04'
+ 'perlexperimental=0.020'
+ 'perlexporter=5.73'
+ 'perlextutils-cbuilder=0.280230'
+ 'perlextutils-constant=0.25'
+ 'perlextutils-install=2.14'
+ 'perlextutils-makemaker=7.34'
+ 'perlextutils-manifest=1.71'
+ 'perlextutils-parsexs=3.39'
+ 'perlfile-fetch=0.56'
+ 'perlfile-path=2.15'
+ 'perlfile-temp=0.2308'
+ 'perlfilter-simple=0.95'
+ 'perlfilter-util-call=1.59'
+ 'perlgetopt-long=2.5'
+ 'perlhttp-tiny=0.076'
+ 'perli18n-collate=1.02'
+ 'perli18n-langtags=0.43'
+ 'perlif=0.0608'
+ 'perlio-compress=2.081'
+ 'perlio-socket-ip=0.39'
+ 'perlio-zlib=1.10'
+ 'perlio=1.39'
+ 'perlipc-cmd=1.02'
+ 'perlipc-sysv=2.07'
+ 'perljson-pp=2.97001'
+ 'perllib=0.64'
+ 'perllibnet=3.11'
+ 'perllocale-codes=3.57'
+ 'perllocale-maketext-simple=0.21_01'
+ 'perllocale-maketext=1.29'
+ 'perlmath-bigint-fastcalc=0.5007'
+ 'perlmath-bigint=1.999813'
+ 'perlmath-bigrat=0.2614'
+ 'perlmath-complex=1.5901'
+ 'perlmemoize=1.03_01'
+ 'perlmime-base64=3.15'
+ 'perlmodule-corelist=5.20180820'
+ 'perlmodule-load-conditional=0.68'
+ 'perlmodule-load=0.32'
+ 'perlmodule-loaded=0.08'
+ 'perlmodule-metadata=1.000033'
+ 'perlnet-ping=2.62'
+ 'perlparams-check=0.38'
+ 'perlparent=0.237'
+ 'perlpathtools=3.75'
+ 'perlperl-ostype=1.010'
+ 'perlperlfaq=5.20180605'
+ 'perlperlio-via-quotedprint=0.08'
+ 'perlpod-checker=1.73'
+ 'perlpod-escapes=1.07'
+ 'perlpod-parser=1.63'
+ 'perlpod-perldoc=3.2801'
+ 'perlpod-simple=3.35'
+ 'perlpod-usage=1.69'
+ 'perlpodlators=5.006'
+ 'perlsafe=2.40'
+ 'perlscalar-list-utils=1.50'
+ 'perlsearch-dict=1.07'
+ 'perlselfloader=1.25'
+ 'perlsocket=2.027'
+ 'perlstorable=3.12'
+ 'perlsys-syslog=0.35'
+ 'perlterm-ansicolor=4.06'
+ 'perlterm-cap=1.17'
+ 'perlterm-complete=1.403'
+ 'perlterm-readline=1.17'
+ 'perltest-harness=3.42'
+ 'perltest-simple=1.302138'
+ 'perltest=1.31'
+ 'perltext-abbrev=1.02'
+ 'perltext-balanced=2.03'
+ 'perltext-parsewords=3.30'
+ 'perltext-tabs=2013.0523'
+ 'perlthread-queue=3.13'
+ 'perlthread-semaphore=2.13'
+ 'perlthreads-shared=1.58'
+ 'perlthreads=2.22'
+ 'perltie-file=1.02'
+ 'perltie-refhash=1.39'
+ 'perltime-hires=1.9760'
+ 'perltime-local=1.28'
+ 'perltime-piece=1.3204'
+ 'perlunicode-collate=1.25'
+ 'perlunicode-normalize=1.26'
+ 'perlversion=0.9924'
+ 'perlxsloader=0.30')
+# Add your own provides here
+provides=(${provides[@]}
+ 'perl')
+conflicts=('perl')
+source=(perl::git+https://perl5.git.perl.org/perl.git
+ perlbin.sh
+ perlbin.csh
+ perlbin.fish
+ detect-old-perl-modules.sh
+ detect-old-perl-modules.hook)
+options=('makeflags' '!purge' 'emptydirs')
+sha512sums=('SKIP'
+ '46724344828e7f86e016f9c8d588bf52b2e764e65e0acc1a38899a530c99bc6e4fd8b46fa0d4bbd685aa2074dd5bcbf9029ac3bb3f2d0ee9adfc4f6c0745f373'
+ 'fc1344a02c741d61af6f6b5967f29cc6f43c2059761522b150261924dd7e1989da5254c03ffa0627accd9af01bc152edd24e84a6b59579acb9ee1900b6ce9383'
+ '881e2efe05ba818cd7300f126800b56bb0685cb5c9c5fb7e67ef6aaf5abd17d2391a979d5d16d109c5111f4b35504ba83d19b0e6eda4431e8421fcbea19d2f1a'
+ 'bd48af7a6209f2ad51aa1747a7238ecb11607a53f61460d873202bf14b55c3b7dd6f66f4a9f2cac8a24240313789a9a44dbc81b73587de46a6b1866bdfca5e26'
+ '6b5b2ba606d443da22c6c1a754829abd36f3fdfef1089bcf06c8f9db0217f2c2f02ebc14958ffa7afe618c9a80bd1025e76704f67466c0c3db7d40ef2c0e56b3')
+# https://www.cpan.org/src/5.0/perl-$pkgver.tar.xz.sha256.txt
+
+pkgver() {
+ cd "$srcdir/${_pkgname}"
+ git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd ${srcdir}/${_pkgname}
+
+ # test broken with gdbm 1.15. See: https://rt.perl.org/Public/Bug/Display.html?id=133295
+ sed -i 's|BEGIN {|BEGIN { plan(skip_all => "fatal test unsupported with gdbm 1.15");|' ext/GDBM_File/t/fatal.t
+
+}
+
+build() {
+ cd ${srcdir}/${_pkgname}
+
+ if [ "${CARCH}" = "x86_64" ]; then
+ # for x86_64
+ arch_opts="-Dcccdlflags='-fPIC'"
+ else
+ # for i686
+ arch_opts=""
+ fi
+
+ ./Configure -des -Dusethreads -Duseshrplib -Doptimize="${CFLAGS}" \
+ -Dprefix=/usr -Dvendorprefix=/usr \
+ -Dprivlib=/usr/share/perl5/core_perl \
+ -Darchlib=/usr/lib/perl5/$_baseversion/core_perl \
+ -Dsitelib=/usr/share/perl5/site_perl \
+ -Dsitearch=/usr/lib/perl5/$_baseversion/site_perl \
+ -Dvendorlib=/usr/share/perl5/vendor_perl \
+ -Dvendorarch=/usr/lib/perl5/$_baseversion/vendor_perl \
+ -Dscriptdir=/usr/bin/core_perl \
+ -Dsitescript=/usr/bin/site_perl \
+ -Dvendorscript=/usr/bin/vendor_perl \
+ -Dinc_version_list=none -Dusedevel \
+ -Dman1ext=1perl -Dman3ext=3perl ${arch_opts} \
+ -Dlddlflags="-shared ${LDFLAGS}" -Dldflags="${LDFLAGS}"
+ make
+}
+
+#check() {
+ #cd ${srcdir}/${_pkgname}
+ #TEST_JOBS=$(echo $MAKEFLAGS | sed 's/.*-j\([0-9][0-9]*\).*/\1/') make test_harness
+ #make test
+#}
+
+package() {
+ cd ${srcdir}/${_pkgname}
+ make DESTDIR="$pkgdir" install
+
+ ### Perl Settings ###
+ # Change man page extensions for site and vendor module builds.
+ # Set no mail address since bug reports should go to the bug tracker
+ # and not someone's email.
+ sed -e '/^man1ext=/ s/1perl/1p/' -e '/^man3ext=/ s/3perl/3pm/' \
+ -e "/^cf_email=/ s/'.*'/''/" \
+ -e "/^perladmin=/ s/'.*'/''/" \
+ -i ${pkgdir}/usr/lib/perl5/$_baseversion/core_perl/Config_heavy.pl
+
+ ### CPAN Settings ###
+ # Set CPAN default config to use the site directories.
+ #sed -e '/(makepl_arg =>/ s/""/"INSTALLDIRS=site"/' \
+ # -e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
+ # -i ${pkgdir}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
+
+ # Profile script to set paths to perl scripts.
+ install -D -m644 ${srcdir}/perlbin.sh \
+ ${pkgdir}/etc/profile.d/perlbin.sh
+ # Profile script to set paths to perl scripts on csh. (FS#22441)
+ install -D -m644 ${srcdir}/perlbin.csh \
+ ${pkgdir}/etc/profile.d/perlbin.csh
+ # Profile script to set paths to perl scripts on fish. (FS#51191)
+ install -D -m 755 "$srcdir/perlbin.fish" \
+ "$pkgdir/usr/share/fish/vendor_conf.d/perlbin.fish"
+
+ # Add the dirs so new installs will already have them in PATH once they
+ # install their first perl programm
+ install -d -m755 "$pkgdir/usr/bin/vendor_perl"
+ install -d -m755 "$pkgdir/usr/bin/site_perl"
+
+ . ${srcdir}/${_pkgname}/config.sh
+ (cd ${pkgdir}/usr/bin; mv perl${version} perl)
+ #rm "$pkgdir/usr/bin/perl$pkgver"
+
+ install -D -m755 -t "$pkgdir/usr/share/libalpm/scripts" "$srcdir/detect-old-perl-modules.sh"
+ install -D -m644 -t "$pkgdir/usr/share/libalpm/hooks" "$srcdir/detect-old-perl-modules.hook"
+
+ find $pkgdir -name perllocal.pod -delete
+ find $pkgdir -name .packlist -delete
+}
diff --git a/detect-old-perl-modules.hook b/detect-old-perl-modules.hook
new file mode 100644
index 00000000000..5ff80d1b470
--- /dev/null
+++ b/detect-old-perl-modules.hook
@@ -0,0 +1,10 @@
+[Trigger]
+Operation = Install
+Operation = Upgrade
+Type = File
+Target = usr/lib/perl5/*/
+
+[Action]
+Description = Warn about old perl modules
+When = PostTransaction
+Exec = /usr/share/libalpm/scripts/detect-old-perl-modules.sh
diff --git a/detect-old-perl-modules.sh b/detect-old-perl-modules.sh
new file mode 100644
index 00000000000..cdc8df3a526
--- /dev/null
+++ b/detect-old-perl-modules.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+basedir=/usr/lib/perl5
+perlver=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
+
+dir_empty() {
+ local dir=$1
+ [[ $(find $dir -maxdepth 0 -empty -exec echo empty \;) = "empty" ]] && return 0 || return 1
+}
+
+print_unowned_files() {
+ local dir=$1
+ LC_ALL=C find "$dir" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\1/p'
+}
+
+for dir in "$basedir/"*; do
+ if [[ "${dir##*/}" != "$perlver" ]]; then
+ if [[ -d "$dir" ]] && ! dir_empty "$dir"; then
+ pkgcount=$(pacman -Qqo "$dir" | wc -l)
+ if ((pkgcount > 0)); then
+ printf "WARNING: '%s' contains data from at least %d packages which will NOT be used by the installed perl interpreter.\n" "$dir" "$pkgcount"
+ printf " -> Run the following command to get a list of affected packages: pacman -Qqo '%s'\n" "$dir"
+ fi
+
+ unowned_count=$(print_unowned_files "$dir" | wc -l)
+ if ((unowned_count > 0)); then
+ printf "WARNING: %d file(s) in %s are not tracked by pacman and need to be rebuilt.\n" "$unowned_count" "$dir"
+ printf " -> These were most likely installed directly by cpan or a similar tool.\n"
+ printf " Run the following command to get a list of these files:\n"
+ printf " LC_ALL=C find \"%s\" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\\\1/p'\n" "$dir"
+ fi
+ fi
+ fi
+done
+
+
diff --git a/generate-rebuild-list.sh b/generate-rebuild-list.sh
new file mode 100755
index 00000000000..0ea6a93f28b
--- /dev/null
+++ b/generate-rebuild-list.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+echo "vim"
+
+pkgfile -rd "^/usr/lib/perl5/" | sed 's#^.*/##' | sort -u
+
+pkgfile -r "^/usr/lib/perl5/vendor_perl/auto/.*\.so$" | sed 's#^.*/##' | sort -u
+ssh soyuz.archlinux.org PATH=/usr/local/bin:\$PATH\; /home/bluewind/bin/sogrep-all libperl.so
+
+# this one is optional
+#pkgfile -r '^/usr/share/perl5/' | sed 's#^.*/##' | sort -u
diff --git a/patchprov b/patchprov
new file mode 100755
index 00000000000..dadcbc04b13
--- /dev/null
+++ b/patchprov
@@ -0,0 +1,260 @@
+#!/usr/bin/perl
+##
+## Name:
+## patchprov
+##
+## Description:
+## Patch the provides list in the perl package PKGBUILD. Scan the appropriate
+## directories under the perl source tree for directories containing dists
+## similar to CPAN dists. Search the files in the distributions for VERSION
+## strings, which are perl expressions. Filters these version strings through
+## the perl interpreter, then transform the dist. names and versions into
+## package names and versions. Finally, we cut out the "provides" array from the
+## PKGBUILD and replace it with the newer version.
+##
+## Usage:
+## patchprov [path to perl source tree] [path to PKGBUILD]
+##
+## Caveats:
+## The path code is not platform independent and will only work in POSIX.
+##
+## Changelog:
+## 06/10/14 JD Rewrite from scratch for perl 5.20.0 and ArchLinux.
+##
+## Authors:
+## Justin "juster" Davis <jrcd83@gmail.com>
+##
+
+use warnings;
+use strict;
+
+sub err
+{
+ print STDERR "patchprov: error: @_\n";
+ exit 1;
+}
+
+## Extract the dist. name from its containing directory.
+sub path_dist
+{
+ my($path) = @_;
+ $path =~ s{^.*/}{};
+ return $path;
+}
+
+## Create a path like $path/lib/Foo/Bar.pm for Foo::Bar.
+sub lib_modpath
+{
+ my($path, $modname) = @_;
+ $modname =~ s{::}{/}g;
+ return "$path/lib/$modname.pm";
+}
+
+## Create a path to a file in the containing directory, named after
+## the last segment of the module name, with suffix attached.
+sub dumb_modpath
+{
+ my($path, $modname, $suffix) = @_;
+ $modname =~ s{^.*::}{};
+ return "$path/$modname$suffix";
+}
+
+## Find a source file contained in the directory that we can scrape the
+## perl versions string from.
+my %distmods = (
+ 'PathTools' => 'Cwd',
+ 'Scalar-List-Utils' => 'List::Util',
+ 'IO-Compress' => 'IO::Compress::Gzip',
+);
+sub dist_srcpath
+{
+ my($path) = @_;
+ my $distname = path_dist($path);
+ my $modname;
+ if(exists $distmods{$distname}){
+ $modname = $distmods{$distname};
+ }else{
+ $modname = $distname;
+ $modname =~ s/-/::/g;
+ }
+ my @srcpaths = (
+ lib_modpath($path, $modname),
+ dumb_modpath($path, $modname, '.pm'),
+ dumb_modpath($path, $modname, '_pm.PL'),
+ dumb_modpath($path, '__'.$modname.'__', '.pm'),
+ "$path/VERSION", # for podlators
+ );
+ for my $src (@srcpaths){
+ return $src if(-f $src);
+ }
+ return undef;
+}
+
+## Scrape the version string for the module file or Makefile.PL.
+sub scrape_verln
+{
+ my($srcpath) = @_;
+ open my $fh, '<', $srcpath or die "open: $!";
+ while(my $ln = <$fh>){
+ if($ln =~ s/^.*VERSION *=>? *//){
+ close $fh;
+ return $ln;
+ }
+ }
+ close $fh;
+ err("failed to find VERSION in $srcpath");
+}
+
+## Scrape the version string from the module source file.
+sub scrape_modver
+{
+ my($srcpath) = @_;
+ return scrape_verln($srcpath);
+}
+
+## Scrape the version string from the Makefile.PL. (for libnet)
+sub scrape_mkplver
+{
+ my($srcpath) = @_;
+ my $verln = scrape_verln($srcpath);
+ $verln =~ s/,/;/;
+ return $verln;
+}
+
+## Scrape the version string from a file inside the dist dir.
+sub distpath_ver
+{
+ my($distpath) = @_;
+ my $srcpath = dist_srcpath($distpath);
+ my $mkplpath = "$distpath/Makefile.PL";
+ if(defined $srcpath){
+ return scrape_modver($srcpath);
+ }elsif(-f $mkplpath){
+ return scrape_mkplver($mkplpath);
+ }else{
+ err("failed to scrape version from $distpath");
+ }
+}
+
+## Search the base path for the dist dirs and extract their respective
+## version strings.
+sub find_distvers
+{
+ my($basepath) = @_;
+ opendir my $dh, $basepath or die "opendir: $!";
+ my @dirs = grep { -d $_ } map { "$basepath/$_" } grep { !/^[.]/ } readdir $dh;
+ closedir $dh;
+
+ my @distvers;
+ for my $dpath (@dirs){
+ push @distvers, [ path_dist($dpath), distpath_ver($dpath) ];
+ }
+ return @distvers;
+}
+
+## Maps an aref of dist name/perl version strings (perl expressions) to
+## a package name and version string suitable for a PKGBUILD.
+sub pkgspec
+{
+ my($dist, $ver) = @$_;
+ $dist =~ tr/A-Z/a-z/;
+ $ver = eval $ver;
+ return "perl$dist=$ver";
+}
+
+## Searches the perl source dir provided for a list of packages which
+## correspond to the core distributions bundled within in.
+sub perlcorepkgs
+{
+ my($perlpath) = @_;
+ my @dirs = ("$perlpath/cpan", "$perlpath/dist");
+ my @provs;
+ for my $d (@dirs){
+ if(!-d $d){
+ err("$d is not a valid directory");
+ }
+ push @provs, map pkgspec, find_distvers($d);
+ }
+ return @provs;
+}
+
+## Formats the provided lines into a neatly formatted bash array. The first arg
+## is the name of the bash variable to assign it to.
+sub basharray
+{
+ my $vname = shift;
+
+ ## Sort entries and surround with quotes.
+ my @lns = sort map { qq{'$_'} } @_;
+ $lns[0] = "$vname=($lns[0]";
+
+ ## Indent lines for OCD geeks.
+ if(@lns > 1){
+ my $ind = length($vname) + 2;
+ splice @lns, 1, @lns-1,
+ map { (' ' x $ind) . $_ } @lns[1 .. $#lns];
+ }
+
+ $lns[$#lns] .= ')';
+ return map { "$_\n" } @lns;
+}
+
+## Patch the PKGBUILD at the given path with a new provides array, overwriting
+## the old one.
+sub patchpb
+{
+ my $pbpath = shift;
+ open my $fh, '<', $pbpath or die "open: $!";
+ my @lines = <$fh>;
+ close $fh;
+
+ my($i, $j);
+ for($i = 0; $i < @lines; $i++){
+ last if($lines[$i] =~ /^provides=/);
+ }
+ if($i == @lines){
+ err("failed to find provides array in PKGBUILD");
+ }
+ for($j = $i; $j < @lines; $j++){
+ last if($lines[$j] =~ /[)]/);
+ }
+ if($j == @lines){
+ err("failed to find end of provides array");
+ }
+
+ splice @lines, $i, $j-$i+1,
+ basharray('provides', grep { !/win32|next/ } @_);
+
+ ## Avoid corrupting the existing PKGBUILD in case of a crash, etc.
+ if(-f "$pbpath.$$"){
+ err("pbpath.$$ temporary file already exists, please remove it.");
+ }
+ open $fh, '>', "$pbpath.$$" or die "open: $!";
+ print $fh @lines;
+ close $fh or die "close: $!";
+ rename "$pbpath.$$", "$pbpath" or die "rename: $!";
+
+ return;
+}
+
+## Program entrypoint.
+sub main
+{
+ if(@_ < 2){
+ print STDERR "usage: $0 [perl source path] [PKGBUILD path]\n";
+ exit 2;
+ }
+ my($perlpath, $pbpath) = @_;
+ if(!-f $pbpath){
+ err("$pbpath is not a valid file.");
+ }elsif(!-d $perlpath){
+ err("$perlpath is not a valid directory.");
+ }else{
+ patchpb($pbpath, perlcorepkgs($perlpath));
+ }
+ exit 0;
+}
+
+main(@ARGV);
+
+# EOF
diff --git a/perlbin.csh b/perlbin.csh
new file mode 100644
index 00000000000..fccecbdf5f5
--- /dev/null
+++ b/perlbin.csh
@@ -0,0 +1,15 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && setenv PATH ${PATH}:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && setenv PATH ${PATH}:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && setenv PATH ${PATH}:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && setenv PATH ${PATH}:/usr/bin/core_perl
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
diff --git a/perlbin.fish b/perlbin.fish
new file mode 100644
index 00000000000..b9cff07a42a
--- /dev/null
+++ b/perlbin.fish
@@ -0,0 +1,10 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts
+
+if status --is-login
+ for perldir in /usr/bin/site_perl /usr/bin/vendor_perl /usr/bin/core_perl
+ if test -d $perldir; and not contains $perldir $PATH
+ set PATH $PATH $perldir
+ end
+ end
+end
diff --git a/perlbin.sh b/perlbin.sh
new file mode 100755
index 00000000000..7e38f2047a5
--- /dev/null
+++ b/perlbin.sh
@@ -0,0 +1,18 @@
+# Set path to perl scriptdirs if they exist
+# https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts
+# Added /usr/bin/*_perl dirs for scripts
+# Remove /usr/lib/perl5/*_perl/bin in next release
+
+[ -d /usr/bin/site_perl ] && PATH=$PATH:/usr/bin/site_perl
+[ -d /usr/lib/perl5/site_perl/bin ] && PATH=$PATH:/usr/lib/perl5/site_perl/bin
+
+[ -d /usr/bin/vendor_perl ] && PATH=$PATH:/usr/bin/vendor_perl
+[ -d /usr/lib/perl5/vendor_perl/bin ] && PATH=$PATH:/usr/lib/perl5/vendor_perl/bin
+
+[ -d /usr/bin/core_perl ] && PATH=$PATH:/usr/bin/core_perl
+
+export PATH
+
+# If you have modules in non-standard directories you can add them here.
+#export PERLLIB=dir1:dir2
+
diff --git a/upgpkg b/upgpkg
new file mode 100644
index 00000000000..fe8be8bd0a7
--- /dev/null
+++ b/upgpkg
@@ -0,0 +1,4 @@
+upgpkg_build() {
+ makepkg -o
+ ./patchprov src/perl PKGBUILD
+}