Package: release.debian.org Severity: normal User: release.debian....@packages.debian.org Usertags: unblock
Please unblock package rt-extension-customfieldsonupdate This fixes RC bug reported at #857748, updating upstream version to satisfy the requirement of request-tracker4. I'll attach debdiff, which minimize my local changes only to: - import new upstream release - use (packaged) rt's module installer Other planned fixes are stripped off this time (It is mainly pre-excuse to Dominic, whom I will ask for sponsoring later) - d/control: updating metadata (S-V, VCS-*, etc) - patch treatment - another bug about reproducible builds unblock rt-extension-customfieldsonupdate/1.02-1 -- System Information: Debian Release: 9.0 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 4.4.44-1-pve (SMP w/8 CPU cores) Locale: LANG=C, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: sysvinit (via /sbin/init)
diff -Nru rt-extension-customfieldsonupdate-0.01/Changes rt-extension-customfieldsonupdate-1.02/Changes --- rt-extension-customfieldsonupdate-0.01/Changes 1970-01-01 09:00:00.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/Changes 2016-08-12 17:27:57.000000000 +0900 @@ -0,0 +1,11 @@ +1.01 2015-01-27 + - Fix Mandatory custom fields on 4.2 (patch from Emmanuel Lacour) + +1.00 2013-12-16 + - Packaging and documentation updates + +0.02 2014-04-07 + - 4.2 compatibility + +0.01 2013-10-22 + - Initial version diff -Nru rt-extension-customfieldsonupdate-0.01/MANIFEST rt-extension-customfieldsonupdate-1.02/MANIFEST --- rt-extension-customfieldsonupdate-0.01/MANIFEST 2011-10-20 23:56:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/MANIFEST 2016-08-12 17:31:44.000000000 +0900 @@ -1,18 +1,22 @@ +Changes html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm +inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/ReadmeFromPod.pm inc/Module/Install/RTx.pm +inc/Module/Install/RTx/Runtime.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm +inc/YAML/Tiny.pm lib/RT/Extension/CustomFieldsOnUpdate.pm Makefile.PL MANIFEST This list of files META.yml -patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch README +SIGNATURE Public-key signature (added by MakeMaker) diff -Nru rt-extension-customfieldsonupdate-0.01/META.yml rt-extension-customfieldsonupdate-1.02/META.yml --- rt-extension-customfieldsonupdate-0.01/META.yml 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/META.yml 2016-08-12 17:29:24.000000000 +0900 @@ -1,15 +1,15 @@ --- abstract: "edit ticket's custom fields on reply/comment" author: - - 'Ruslan Zakirov <r...@bestpractical.com>' + - 'Best Practical Solutions, LLC <modu...@bestpractical.com>' build_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.59 configure_requires: - ExtUtils::MakeMaker: 6.42 + ExtUtils::MakeMaker: 6.59 distribution_type: module dynamic_config: 1 -generated_by: 'Module::Install version 1.03' -license: perl +generated_by: 'Module::Install version 1.16' +license: gpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 @@ -21,5 +21,9 @@ requires: perl: 5.8.3 resources: - license: http://dev.perl.org/licenses/ -version: 0.01 + license: http://opensource.org/licenses/gpl-license.php + repository: https://github.com/bestpractical/rt-extension-customfieldsonupdate +version: '1.02' +x_module_install_rtx_version: '0.38' +x_requires_rt: 4.0.3 +x_rt_too_new: 4.6.0 diff -Nru rt-extension-customfieldsonupdate-0.01/Makefile.PL rt-extension-customfieldsonupdate-1.02/Makefile.PL --- rt-extension-customfieldsonupdate-0.01/Makefile.PL 2011-10-20 22:46:07.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/Makefile.PL 2016-08-12 17:27:57.000000000 +0900 @@ -1,8 +1,11 @@ use inc::Module::Install; RTx 'RT-Extension-CustomFieldsOnUpdate'; -all_from 'lib/RT/Extension/CustomFieldsOnUpdate.pm'; -readme_from 'lib/RT/Extension/CustomFieldsOnUpdate.pm'; +repository('https://github.com/bestpractical/rt-extension-customfieldsonupdate'); -WriteAll(); \ ファイル末尾に改行がありません +requires_rt('4.0.3'); +rt_too_new('4.6.0'); + +sign(); +WriteAll(); diff -Nru rt-extension-customfieldsonupdate-0.01/README rt-extension-customfieldsonupdate-1.02/README --- rt-extension-customfieldsonupdate-0.01/README 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/README 2016-08-12 17:29:24.000000000 +0900 @@ -3,35 +3,48 @@ reply/comment DESCRIPTION - This extension adds often requested feature - update of ticket's custom - fields on reply and comment. + This extension allows the update of tickets' custom fields on reply and + comment pages. - This is for RT 4.0.x, solutions for older versions available on the - wiki, start from CustomFieldsOnUpdate page [1]. +INSTALLATION + perl Makefile.PL + make + make install + May need root permissions - [1] http://requesttracker.wikia.com/wiki/CustomFieldsOnUpdate + Edit your /opt/rt4/etc/RT_SiteConfig.pm + If you are using RT 4.2 or greater, add this line: -INSTALLATION - It's sad but RT 4.0.0 - 4.0.2 miss a tiny feature, so you have to apply - patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch. This change - is part of RT 4.0.3. - - Otherwise installation is common: - - perl Makefile.PL - make - make install - - Register 'RT::Extension::CustomFieldsOnUpdate' in the site config; - - Set(@Plugins, qw( - RT::Extension::CustomFieldsOnUpdate - ... other plugins you may have ... - )); + Plugin('RT::Extension::CustomFieldsOnUpdate'); + + For RT 4.0, add this line: + + Set(@Plugins, qw(RT::Extension::CustomFieldsOnUpdate)); + + or add RT::Extension::CustomFieldsOnUpdate to your existing @Plugins + line. + + Clear your mason cache + rm -rf /opt/rt4/var/mason_data/obj + + Restart your webserver AUTHOR - Ruslan Zakirov <r...@bestpractical.com> + Best Practical Solutions, LLC <modu...@bestpractical.com> + +BUGS + All bugs should be reported via email to + + L<bug-rt-extension-customfieldsonupd...@rt.cpan.org|mailto:bug-rt-extension-customfieldsonupd...@rt.cpan.org> + + or via the web at + + L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-CustomFieldsOnUpdate>. + +LICENSE AND COPYRIGHT + This software is Copyright (c) 2016 by Best Practical Solutions + + This is free software, licensed under: -LICENSE - Under the same terms as perl itself. + The GNU General Public License, Version 2, June 1991 diff -Nru rt-extension-customfieldsonupdate-0.01/SIGNATURE rt-extension-customfieldsonupdate-1.02/SIGNATURE --- rt-extension-customfieldsonupdate-0.01/SIGNATURE 1970-01-01 09:00:00.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/SIGNATURE 2016-08-12 17:31:58.000000000 +0900 @@ -0,0 +1,54 @@ +This file contains message digests of all files listed in MANIFEST, +signed via the Module::Signature module, version 0.79. + +To verify the content in this distribution, first make sure you have +Module::Signature installed, then type: + + % cpansign -v + +It will check each file's integrity, as well as the signature's +validity. If "==> Signature verified OK! <==" is not displayed, +the distribution may already have been compromised, and you should +not run its Makefile.PL or Build.PL. + +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +SHA1 ad76098fc0dd40c11f1ed868d5eb555e20c25145 Changes +SHA1 2b5a66111f6fe9f7b4e37fc30ac914c36bc8c396 MANIFEST +SHA1 aec29637d79041877b2fc498cbaf0639b9fb5b68 META.yml +SHA1 7eaea8e9e49ee259e2f2de30f86bbd468142f046 Makefile.PL +SHA1 123569cbc738e2f01b6b7384f006729a2af3ae5f README +SHA1 10c32c5b8ecaeaf069450baa054efeedb08f7d5e html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked +SHA1 c297753bb40aa4e31599358aed52840be00a9947 html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate +SHA1 bce3c51bb369419603298064b78e14077b93af66 inc/Module/Install.pm +SHA1 fe220f215f645500ce8f14ff5e19d9a28692af56 inc/Module/Install/Base.pm +SHA1 b56ed8e42c600e08007d152cf0b1438a7c3b7f6e inc/Module/Install/Can.pm +SHA1 99c531a17a67ce5250df2ae151cc48c80d914cde inc/Module/Install/Fetch.pm +SHA1 3e43ac0f1912c7d202dc102f6c31ad96fbf3a044 inc/Module/Install/Include.pm +SHA1 76efdca3603159e0ae0e18f19fe72a0211a69529 inc/Module/Install/Makefile.pm +SHA1 2e33e87882d60db3913da6284dd5295e5315e18a inc/Module/Install/Metadata.pm +SHA1 20c3e601f307847362142395e404613b8266ef2b inc/Module/Install/RTx.pm +SHA1 3fdf4c0cffdb1a2e23e5cd26bf95be553f1f9590 inc/Module/Install/RTx/Runtime.pm +SHA1 9e886864978e9f9b9988e412a75a908070b54fbf inc/Module/Install/ReadmeFromPod.pm +SHA1 c830b819e61bda5eca077c6291293bba61b3b9f2 inc/Module/Install/Win32.pm +SHA1 cb52b9d6f88d512d448a6f35ed0af0d1201a134b inc/Module/Install/WriteAll.pm +SHA1 101dee5d09fc4f3cee4f866782c08409e85b7ec4 inc/YAML/Tiny.pm +SHA1 e49d46e168fd16e2aa604d2bb501c2ceb478a818 lib/RT/Extension/CustomFieldsOnUpdate.pm +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iQIcBAEBCgAGBQJXrYlwAAoJEJHs6NvKxcMFsI4QAIKxftCQROW+DjLYurkJq80p +wm3vYHDbIimWWPZZRLOX1NkJcJVij/4YCZZCRJy7qZ7lGbUiyXRQ8vc4BWmX92gy +cDn8eenS46Bnk7PDyeVDgLPgo5aiQzIpXXHkJEpUmQnYexxPDX6H1OCy9AQ3OVgv +mH60hO1nTV8R9uDmKXfYIqx5l9s12oPNA5nuQ5lTQaSN7PVhMhfTH4FdqVkVoPkX +LHUovNZv37rAnHJK3uhvfYgItIaEthgfMSGo2sA6Ps8MPJo43nsdI4JQeG/f6Bko +dIuQnjVL1cMfvxGBYbOPxWyfOt09XGoePaxh6PDEpJK6axFp71Ybn/Nnrtoc+Qk5 +NPzXu5yEzrorZYtACSFAQMQpb+p/wnlmSAQ9+q3hnMRmNLZTSUrfyYE8Ly/Emeei +rcfXxZDKIoeyGQ1Mtcvt3NMZHEmkuVei+jGd8Xy4rncNEe7tGgNbFKRIjSD1+fkl +6dd1RJ9RTWmWOYhoj1a9416PpTXSgEItPGk7sCTXKprLtSlaaAzM9xnNwLJaI3MR +u9/L6a7ev8ypESlJKOXW+7Sh/9GgpEqZtvzSbgWMHLFRg3xINgb97c5MmpmSjxj2 +JoBtXcPMDRyQg3pzRH/vYBhVWT2mVBa7uqXR6tmpXA8NIpHWLImgwcm7xduW4N4R +o5SxfBFmgKGZVba9ZPYt +=axnn +-----END PGP SIGNATURE----- diff -Nru rt-extension-customfieldsonupdate-0.01/debian/changelog rt-extension-customfieldsonupdate-1.02/debian/changelog --- rt-extension-customfieldsonupdate-0.01/debian/changelog 2016-08-22 04:08:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/debian/changelog 2017-03-26 16:34:06.000000000 +0900 @@ -1,3 +1,11 @@ +rt-extension-customfieldsonupdate (1.02-1) unstable; urgency=medium + + * New upstream version + - makes it compatible with current RT version. (Closes: #857748) + * Depends on libmodule-install-perl + + -- KURASHIKI Satoru <lur...@gmail.com> Sun, 26 Mar 2017 16:34:06 +0900 + rt-extension-customfieldsonupdate (0.01-1.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru rt-extension-customfieldsonupdate-0.01/debian/control rt-extension-customfieldsonupdate-1.02/debian/control --- rt-extension-customfieldsonupdate-0.01/debian/control 2013-12-20 14:46:35.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/debian/control 2017-03-26 16:34:06.000000000 +0900 @@ -4,6 +4,7 @@ Maintainer: KURASHIKI Satoru <lur...@gmail.com> Build-Depends: debhelper (>= 9.20120312) Build-Depends-Indep: perl + , libmodule-install-rtx-perl Standards-Version: 3.9.5 Vcs-Git: https://github.com/lurdan/rt-extension-customfieldsonupdate.git Vcs-Browser: https://github.com/lurdan/rt-extension-customfieldsonupdate/tree/dpkg diff -Nru rt-extension-customfieldsonupdate-0.01/debian/copyright rt-extension-customfieldsonupdate-1.02/debian/copyright --- rt-extension-customfieldsonupdate-0.01/debian/copyright 2013-12-20 13:45:29.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/debian/copyright 2017-03-26 16:34:06.000000000 +0900 @@ -4,11 +4,11 @@ Upstream-Name: RT-Extension-CustomFieldsOnUpdate Files: * -Copyright: 2009-2013, Best Practical Solutions, Ruslan Zakirov <r...@bestpractical.com> +Copyright: 2009-2016, Best Practical Solutions, Ruslan Zakirov <r...@bestpractical.com> License: Artistic or GPL-1+ Files: debian/* -Copyright: 2013, KURASHIKI Satoru <lur...@gmail.com> +Copyright: 2013-2017, KURASHIKI Satoru <lur...@gmail.com> License: Artistic or GPL-1+ License: Artistic diff -Nru rt-extension-customfieldsonupdate-0.01/debian/rules rt-extension-customfieldsonupdate-1.02/debian/rules --- rt-extension-customfieldsonupdate-0.01/debian/rules 2016-08-22 04:07:59.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/debian/rules 2017-03-26 16:34:06.000000000 +0900 @@ -8,7 +8,7 @@ override_dh_auto_configure: for ver in $(RT_VERSIONS); do \ export RTHOME=/usr/share/request-tracker$$ver; \ - perl -I. Makefile.PL PREFIX=$(CURDIR)/debian/rt$$ver-extension-customfieldsonupdate/usr/share/request-tracker$$ver/plugins/RT-Extension-CustomFieldsOnUpdate; \ + perl -I. Makefile.PL INSTALLDIRS=vendor; \ mv Makefile Makefile$$ver; \ done @@ -19,6 +19,7 @@ override_dh_auto_install: for ver in $(RT_VERSIONS); do \ ln -sf Makefile$$ver Makefile; \ + export PERL_INSTALL_ROOT=$(CURDIR)/debian/rt$$ver-extension-customfieldsonupdate; \ make install; \ done diff -Nru rt-extension-customfieldsonupdate-0.01/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked rt-extension-customfieldsonupdate-1.02/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked --- rt-extension-customfieldsonupdate-0.01/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked 2011-10-20 22:59:09.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/AfterWorked 2016-08-12 17:27:57.000000000 +0900 @@ -1,8 +1,17 @@ -<& /Ticket/Elements/EditCustomFields, - TicketObj => $Ticket, +<%INIT> +my $comp = '/Elements/EditCustomFields'; +my %obj_args = ( Object => $Ticket ); + +if (!$m->comp_exists('/Elements/EditCustomFields')) { + $comp = '/Ticket/Elements/EditCustomFields'; + %obj_args = ( TicketObj => $Ticket ); +} +</%INIT> +<& $comp, + %obj_args, InTable => 1, DefaultsFromTopArguments => 0, &> <%ARGS> $Ticket -</%ARGS> \ ファイル末尾に改行がありません +</%ARGS> diff -Nru rt-extension-customfieldsonupdate-0.01/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate rt-extension-customfieldsonupdate-1.02/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate --- rt-extension-customfieldsonupdate-0.01/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate 2011-10-20 23:05:14.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/html/Callbacks/CustomFieldsOnUpdate/Ticket/Update.html/BeforeUpdate 2016-08-12 17:27:57.000000000 +0900 @@ -12,6 +12,7 @@ '/Elements/ValidateCustomFields', CustomFields => $CFs, NamePrefix => "Object-RT::Ticket-". $TicketObj->id ."-CustomField-", + Object => $TicketObj, ARGSRef => $ARGSRef ); unless ( $ValidCFs ) { @@ -21,4 +22,4 @@ push @$results, loc($CF->Name) . ': ' . $msg; } } -</%INIT> \ ファイル末尾に改行がありません +</%INIT> diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Base.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Base.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Base.pm 2011-10-20 23:18:04.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Base.pm 2016-08-12 17:29:24.000000000 +0900 @@ -4,7 +4,7 @@ use strict 'vars'; use vars qw{$VERSION}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; } # Suspend handler for "redefined" warnings diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Can.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Can.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Can.pm 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Can.pm 2016-08-12 17:29:24.000000000 +0900 @@ -3,13 +3,12 @@ use strict; use Config (); -use File::Spec (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -29,7 +28,7 @@ eval { require $mod; $pkg->VERSION($ver || 0); 1 }; } -# check if we can run some command +# Check if we can run some command sub can_run { my ($self, $cmd) = @_; @@ -38,14 +37,88 @@ for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') { next if $dir eq ''; - my $abs = File::Spec->catfile($dir, $_[1]); + require File::Spec; + my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } -# can we locate a (the) C compiler +# Can our C compiler environment build XS files +sub can_xs { + my $self = shift; + + # Ensure we have the CBuilder module + $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); + + # Do we have the configure_requires checker? + local $@; + eval "require ExtUtils::CBuilder;"; + if ( $@ ) { + # They don't obey configure_requires, so it is + # someone old and delicate. Try to avoid hurting + # them by falling back to an older simpler test. + return $self->can_cc(); + } + + # Do we have a working C compiler + my $builder = ExtUtils::CBuilder->new( + quiet => 1, + ); + unless ( $builder->have_compiler ) { + # No working C compiler + return 0; + } + + # Write a C file representative of what XS becomes + require File::Temp; + my ( $FH, $tmpfile ) = File::Temp::tempfile( + "compilexs-XXXXX", + SUFFIX => '.c', + ); + binmode $FH; + print $FH <<'END_C'; +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +int main(int argc, char **argv) { + return 0; +} + +int boot_sanexs() { + return 1; +} + +END_C + close $FH; + + # Can the C compiler access the same headers XS does + my @libs = (); + my $object = undef; + eval { + local $^W = 0; + $object = $builder->compile( + source => $tmpfile, + ); + @libs = $builder->link( + objects => $object, + module_name => 'sanexs', + ); + }; + my $result = $@ ? 0 : 1; + + # Clean up all the build files + foreach ( $tmpfile, $object, @libs ) { + next unless defined $_; + 1 while unlink; + } + + return $result; +} + +# Can we locate a (the) C compiler sub can_cc { my $self = shift; my @chunks = split(/ /, $Config::Config{cc}) or return; @@ -78,4 +151,4 @@ __END__ -#line 156 +#line 236 diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Fetch.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Fetch.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Fetch.pm 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Fetch.pm 2016-08-12 17:29:24.000000000 +0900 @@ -6,7 +6,7 @@ use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Include.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Include.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Include.pm 1970-01-01 09:00:00.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Include.pm 2016-08-12 17:29:24.000000000 +0900 @@ -0,0 +1,34 @@ +#line 1 +package Module::Install::Include; + +use strict; +use Module::Install::Base (); + +use vars qw{$VERSION @ISA $ISCORE}; +BEGIN { + $VERSION = '1.16'; + @ISA = 'Module::Install::Base'; + $ISCORE = 1; +} + +sub include { + shift()->admin->include(@_); +} + +sub include_deps { + shift()->admin->include_deps(@_); +} + +sub auto_include { + shift()->admin->auto_include(@_); +} + +sub auto_include_deps { + shift()->admin->auto_include_deps(@_); +} + +sub auto_include_dependent_dists { + shift()->admin->auto_include_dependent_dists(@_); +} + +1; diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Makefile.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Makefile.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Makefile.pm 2011-10-20 23:18:04.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Makefile.pm 2016-08-12 17:29:24.000000000 +0900 @@ -8,7 +8,7 @@ use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -133,7 +133,7 @@ return $args; } -# For mm args that take multiple space-seperated args, +# For mm args that take multiple space-separated args, # append an argument to the current list. sub makemaker_append { my $self = shift; @@ -215,18 +215,22 @@ require ExtUtils::MakeMaker; if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) { - # MakeMaker can complain about module versions that include - # an underscore, even though its own version may contain one! - # Hence the funny regexp to get rid of it. See RT #35800 - # for details. - my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/; - $self->build_requires( 'ExtUtils::MakeMaker' => $v ); - $self->configure_requires( 'ExtUtils::MakeMaker' => $v ); + # This previous attempted to inherit the version of + # ExtUtils::MakeMaker in use by the module author, but this + # was found to be untenable as some authors build releases + # using future dev versions of EU:MM that nobody else has. + # Instead, #toolchain suggests we use 6.59 which is the most + # stable version on CPAN at time of writing and is, to quote + # ribasushi, "not terminally fucked, > and tested enough". + # TODO: We will now need to maintain this over time to push + # the version up as new versions are released. + $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); + $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } else { # Allow legacy-compatibility with 5.005 by depending on the # most recent EU:MM that supported 5.005. - $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 ); - $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 ); + $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 ); + $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params @@ -241,7 +245,6 @@ 'all_from' if you prefer) in Makefile.PL. EOT - $DB::single = 1; if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; @@ -412,4 +415,4 @@ __END__ -#line 541 +#line 544 diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Metadata.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Metadata.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Metadata.pm 2011-10-20 23:18:04.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Metadata.pm 2016-08-12 17:29:24.000000000 +0900 @@ -6,7 +6,7 @@ use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } @@ -347,7 +347,7 @@ ^ \s* package \s* ([\w:]+) - \s* ; + [\s|;]* /ixms ) { my ($name, $module_name) = ($1, $1); @@ -705,7 +705,7 @@ my @yaml = Parse::CPAN::Meta::LoadFile('META.yml'); my $meta = $yaml[0]; - # Overwrite the non-configure dependency hashs + # Overwrite the non-configure dependency hashes delete $meta->{requires}; delete $meta->{build_requires}; delete $meta->{recommends}; diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/RTx/Runtime.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/RTx/Runtime.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/RTx/Runtime.pm 1970-01-01 09:00:00.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/RTx/Runtime.pm 2016-08-12 17:29:24.000000000 +0900 @@ -0,0 +1,79 @@ +#line 1 +package Module::Install::RTx::Runtime; + +use base 'Exporter'; +our @EXPORT = qw/RTxDatabase RTxPlugin/; + +use strict; +use File::Basename (); + +sub _rt_runtime_load { + require RT; + + eval { RT::LoadConfig(); }; + if (my $err = $@) { + die $err unless $err =~ /^RT couldn't load RT config file/m; + my $warn = <<EOT; +This usually means that your current user cannot read the file. You +will likely need to run this installation step as root, or some user +with more permissions. +EOT + $err =~ s/This usually means.*/$warn/s; + die $err; + } +} + +sub RTxDatabase { + my ($action, $name, $version) = @_; + + _rt_runtime_load(); + + require RT::System; + my $has_upgrade = RT::System->can('AddUpgradeHistory'); + + my $lib_path = File::Basename::dirname($INC{'RT.pm'}); + my @args = ( + "-Ilib", + "-I$RT::LocalLibPath", + "-I$lib_path", + "$RT::SbinPath/rt-setup-database", + "--action" => $action, + ($action eq 'upgrade' ? () : ("--datadir" => "etc")), + (($action eq 'insert') ? ("--datafile" => "etc/initialdata") : ()), + "--dba" => $RT::DatabaseAdmin || $RT::DatabaseUser, + "--prompt-for-dba-password" => '', + ($has_upgrade ? ("--package" => $name, "--ext-version" => $version) : ()), + ); + # If we're upgrading against an RT which isn't at least 4.2 (has + # AddUpgradeHistory) then pass --package. Upgrades against later RT + # releases will pick up --package from AddUpgradeHistory. + if ($action eq 'upgrade' and not $has_upgrade) { + push @args, "--package" => $name; + } + + print "$^X @args\n"; + (system($^X, @args) == 0) or die "...returned with error: $?\n"; +} + +sub RTxPlugin { + my ($name) = @_; + + _rt_runtime_load(); + require YAML::Tiny; + my $data = YAML::Tiny::LoadFile('META.yml'); + my $name = $data->{name}; + + my @enabled = RT->Config->Get('Plugins'); + for my $required (@{$data->{x_requires_rt_plugins} || []}) { + next if grep {$required eq $_} @enabled; + + warn <<"EOT"; + +**** Warning: $name requires that the $required plugin be installed and + enabled; it is not currently in \@Plugins. + +EOT + } +} + +1; diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/RTx.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/RTx.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/RTx.pm 2011-10-20 23:18:04.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/RTx.pm 2016-08-12 17:29:24.000000000 +0900 @@ -8,104 +8,102 @@ use Module::Install::Base; use base 'Module::Install::Base'; -our $VERSION = '0.29'; +our $VERSION = '0.38'; use FindBin; use File::Glob (); use File::Basename (); -my @DIRS = qw(etc lib html bin sbin po var); +my @DIRS = qw(etc lib html static bin sbin po var); my @INDEX_DIRS = qw(lib bin sbin); sub RTx { - my ( $self, $name ) = @_; + my ( $self, $name, $extra_args ) = @_; + $extra_args ||= {}; - my $original_name = $name; - my $RTx = 'RTx'; - $RTx = $1 if $name =~ s/^(\w+)-//; + # Set up names my $fname = $name; $fname =~ s!-!/!g; - $self->name("$RTx-$name") + $self->name( $name ) unless $self->name; - $self->all_from( -e "$name.pm" ? "$name.pm" : "lib/$RTx/$fname.pm" ) + $self->all_from( "lib/$fname.pm" ) unless $self->version; - $self->abstract("RT $name Extension") + $self->abstract("$name Extension") unless $self->abstract; - - my @prefixes = (qw(/opt /usr/local /home /usr /sw )); - my $prefix = $ENV{PREFIX}; - @ARGV = grep { /PREFIX=(.*)/ ? ( ( $prefix = $1 ), 0 ) : 1 } @ARGV; - - if ($prefix) { - $RT::LocalPath = $prefix; - $INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm"; - } else { - local @INC = ( - $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (), - @INC, - map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) - } grep $_, @prefixes - ); - until ( eval { require RT; $RT::LocalPath } ) { - warn - "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n"; - $_ = $self->prompt("Path to directory containing your RT.pm:") or exit; - $_ =~ s/\/RT\.pm$//; - push @INC, $_, "$_/rt3/lib", "$_/lib/rt3", "$_/lib"; + unless ( $extra_args->{no_readme_generation} ) { + $self->readme_from( "lib/$fname.pm", + { options => [ quotes => "none" ] } ); + } + $self->add_metadata("x_module_install_rtx_version", $VERSION ); + + my $installdirs = $ENV{INSTALLDIRS}; + for ( @ARGV ) { + if ( /INSTALLDIRS=(.*)/ ) { + $installdirs = $1; } } - my $lib_path = File::Basename::dirname( $INC{'RT.pm'} ); - my $local_lib_path = "$RT::LocalPath/lib"; + # Try to find RT.pm + my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4); + $ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME}; + $ENV{RTHOME} =~ s{/lib/?$}{} if defined $ENV{RTHOME}; + my @try = $ENV{RTHOME} ? ($ENV{RTHOME}, "$ENV{RTHOME}/lib") : (); + while (1) { + my @look = @INC; + unshift @look, grep {defined and -d $_} @try; + push @look, grep {defined and -d $_} + map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes; + last if eval {local @INC = @look; require RT; $RT::LocalLibPath}; + + warn + "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @look\n"; + my $given = $self->prompt("Path to directory containing your RT.pm:") or exit; + $given =~ s{/RT\.pm$}{}; + $given =~ s{/lib/?$}{}; + @try = ($given, "$given/lib"); + } + print "Using RT configuration from $INC{'RT.pm'}:\n"; - unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath; + + my $local_lib_path = $RT::LocalLibPath; + unshift @INC, $local_lib_path; + my $lib_path = File::Basename::dirname( $INC{'RT.pm'} ); unshift @INC, $lib_path; - $RT::LocalVarPath ||= $RT::VarPath; - $RT::LocalPoPath ||= $RT::LocalLexiconPath; - $RT::LocalHtmlPath ||= $RT::MasonComponentRoot; - $RT::LocalLibPath ||= "$RT::LocalPath/lib"; - - my $with_subdirs = $ENV{WITH_SUBDIRS}; - @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 } - @ARGV; - - my %subdirs; - %subdirs = map { $_ => 1 } split( /\s*,\s*/, $with_subdirs ) - if defined $with_subdirs; - unless ( keys %subdirs ) { - $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS; - } - - # If we're running on RT 3.8 with plugin support, we really wany - # to install libs, mason templates and po files into plugin specific - # directories + # Set a baseline minimum version + unless ( $extra_args->{deprecated_rt} ) { + $self->requires_rt('4.0.0'); + } + + # Installation locations my %path; - if ( $RT::LocalPluginPath ) { - die "Because of bugs in RT 3.8.0 this extension can not be installed.\n" - ."Upgrade to RT 3.8.1 or newer.\n" if $RT::VERSION =~ /^3\.8\.0/; - $path{$_} = $RT::LocalPluginPath . "/$original_name/$_" - foreach @DIRS; + my $plugin_path; + if ( $installdirs && $installdirs eq 'vendor' ) { + $plugin_path = $RT::PluginPath; } else { - foreach ( @DIRS ) { - no strict 'refs'; - my $varname = "RT::Local" . ucfirst($_) . "Path"; - $path{$_} = ${$varname} || "$RT::LocalPath/$_"; - } - - $path{$_} .= "/$name" for grep $path{$_}, qw(etc po var); + $plugin_path = $RT::LocalPluginPath; } + $path{$_} = $plugin_path . "/$name/$_" + foreach @DIRS; + + # Copy RT 4.2.0 static files into NoAuth; insufficient for + # images, but good enough for css and js. + $path{static} = "$path{html}/NoAuth/" + unless $RT::StaticPath; + + # Delete the ones we don't need + delete $path{$_} for grep {not -d "$FindBin::Bin/$_"} keys %path; my %index = map { $_ => 1 } @INDEX_DIRS; $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS; - my $args = join ', ', map "q($_)", map { ($_, $path{$_}) } - grep $subdirs{$_}, keys %path; + my $args = join ', ', map "q($_)", map { ($_, "\$(DESTDIR)$path{$_}") } + sort keys %path; - print "./$_\t=> $path{$_}\n" for sort keys %subdirs; + printf "%-10s => %s\n", $_, $path{$_} for sort keys %path; - if ( my @dirs = map { ( -D => $_ ) } grep $subdirs{$_}, qw(bin html sbin) ) { + if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin etc) ) { my @po = map { ( -o => $_ ) } grep -f, File::Glob::bsd_glob("po/*.po"); @@ -115,12 +113,15 @@ . } + $self->include('Module::Install::RTx::Runtime') if $self->admin; + $self->include_deps( 'YAML::Tiny', 0 ) if $self->admin; my $postamble = << "."; install :: +\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxPlugin()" \t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\" . - if ( $subdirs{var} and -d $RT::MasonDataDir ) { + if ( $path{var} and -d $RT::MasonDataDir ) { my ( $uid, $gid ) = ( stat($RT::MasonDataDir) )[ 4, 5 ]; $postamble .= << "."; \t\$(NOECHO) chown -R $uid:$gid $path{var} @@ -129,103 +130,153 @@ my %has_etc; if ( File::Glob::bsd_glob("$FindBin::Bin/etc/schema.*") ) { - - # got schema, load factory module $has_etc{schema}++; - $self->load('RTxFactory'); - $self->postamble(<< "."); -factory :: -\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name))" - -dropdb :: -\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name drop))" - -. } if ( File::Glob::bsd_glob("$FindBin::Bin/etc/acl.*") ) { $has_etc{acl}++; } if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; } + if ( grep { /\d+\.\d+\.\d+.*$/ } glob('etc/upgrade/*.*.*') ) { + $has_etc{upgrade}++; + } $self->postamble("$postamble\n"); - unless ( $subdirs{'lib'} ) { - $self->makemaker_args( PM => { "" => "" }, ); - } else { + if ( $path{lib} ) { $self->makemaker_args( INSTALLSITELIB => $path{'lib'} ); $self->makemaker_args( INSTALLARCHLIB => $path{'lib'} ); + $self->makemaker_args( INSTALLVENDORLIB => $path{'lib'} ) + } else { + $self->makemaker_args( PM => { "" => "" }, ); } $self->makemaker_args( INSTALLSITEMAN1DIR => "$RT::LocalPath/man/man1" ); $self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" ); $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" ); + # INSTALLDIRS=vendor should install manpages into /usr/share/man. + # That is the default path in most distributions. Need input from + # Redhat, Centos etc. + $self->makemaker_args( INSTALLVENDORMAN1DIR => "/usr/share/man/man1" ); + $self->makemaker_args( INSTALLVENDORMAN3DIR => "/usr/share/man/man3" ); + $self->makemaker_args( INSTALLVENDORARCH => "/usr/share/man" ); + if (%has_etc) { - $self->load('RTxInitDB'); print "For first-time installation, type 'make initdb'.\n"; my $initdb = ''; $initdb .= <<"." if $has_etc{schema}; -\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema))" +\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(schema \$(NAME) \$(VERSION)))" . $initdb .= <<"." if $has_etc{acl}; -\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl))" +\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(acl \$(NAME) \$(VERSION)))" . $initdb .= <<"." if $has_etc{initialdata}; -\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert))" +\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(insert \$(NAME) \$(VERSION)))" . $self->postamble("initdb ::\n$initdb\n"); $self->postamble("initialize-database ::\n$initdb\n"); + if ($has_etc{upgrade}) { + print "To upgrade from a previous version of this extension, use 'make upgrade-database'\n"; + my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(upgrade \$(NAME) \$(VERSION)))"\n|; + $self->postamble("upgrade-database ::\n$upgradedb\n"); + $self->postamble("upgradedb ::\n$upgradedb\n"); + } } -} -sub RTxInit { - unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'}; - require RT; - RT::LoadConfig(); - RT::ConnectToDatabase(); - - die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType; } -# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8) -{ my %word = ( - a => -4, - alpha => -4, - b => -3, - beta => -3, - pre => -2, - rc => -1, - head => 9999, -); -sub cmp_version($$) { - my ($a, $b) = (@_); - my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef } - split /([^0-9]+)/, $a; - my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef } - split /([^0-9]+)/, $b; - @a > @b - ? push @b, (0) x (@a-@b) - : push @a, (0) x (@b-@a); - for ( my $i = 0; $i < @a; $i++ ) { - return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i]; - } - return 0; -}} sub requires_rt { my ($self,$version) = @_; + _load_rt_handle(); + + if ($self->is_admin) { + $self->add_metadata("x_requires_rt", $version); + my @sorted = sort RT::Handle::cmp_version $version,'4.0.0'; + $self->perl_version('5.008003') if $sorted[0] eq '4.0.0' + and (not $self->perl_version or '5.008003' > $self->perl_version); + @sorted = sort RT::Handle::cmp_version $version,'4.2.0'; + $self->perl_version('5.010001') if $sorted[0] eq '4.2.0' + and (not $self->perl_version or '5.010001' > $self->perl_version); + } + # if we're exactly the same version as what we want, silently return return if ($version eq $RT::VERSION); - my @sorted = sort cmp_version $version,$RT::VERSION; + my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION; if ($sorted[-1] eq $version) { - # should we die? - warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n"; + die <<"EOT"; + +**** Error: This extension requires RT $version. Your installed version + of RT ($RT::VERSION) is too old. + +EOT + } +} + +sub requires_rt_plugin { + my $self = shift; + my ( $plugin ) = @_; + + if ($self->is_admin) { + my $plugins = $self->Meta->{values}{"x_requires_rt_plugins"} || []; + push @{$plugins}, $plugin; + $self->add_metadata("x_requires_rt_plugins", $plugins); + } + + my $path = $plugin; + $path =~ s{\:\:}{-}g; + $path = "$RT::LocalPluginPath/$path/lib"; + if ( -e $path ) { + unshift @INC, $path; + } else { + my $name = $self->name; + warn <<"EOT"; + +**** Warning: $name requires that the $plugin plugin be installed and + enabled; it does not appear to be installed. + +EOT + } + $self->requires(@_); +} + +sub rt_too_new { + my ($self,$version,$msg) = @_; + my $name = $self->name; + $msg ||= <<EOT; + +**** Error: Your installed version of RT (%s) is too new; this extension + only works with versions older than %s. + +EOT + $self->add_metadata("x_rt_too_new", $version) if $self->is_admin; + + _load_rt_handle(); + my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION; + + if ($sorted[0] eq $version) { + die sprintf($msg,$RT::VERSION,$version); + } +} + +# RT::Handle runs FinalizeDatabaseType which calls RT->Config->Get +# On 3.8, this dies. On 4.0/4.2 ->Config transparently runs LoadConfig. +# LoadConfig requires being able to read RT_SiteConfig.pm (root) so we'd +# like to avoid pushing that on users. +# Fake up just enough Config to let FinalizeDatabaseType finish, and +# anyone later calling LoadConfig will overwrite our shenanigans. +sub _load_rt_handle { + unless ($RT::Config) { + require RT::Config; + $RT::Config = RT::Config->new; + RT->Config->Set('DatabaseType','mysql'); } + require RT::Handle; } 1; __END__ -#line 348 +#line 428 diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/ReadmeFromPod.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/ReadmeFromPod.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/ReadmeFromPod.pm 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/ReadmeFromPod.pm 2016-08-12 17:29:24.000000000 +0900 @@ -7,29 +7,165 @@ use base qw(Module::Install::Base); use vars qw($VERSION); -$VERSION = '0.12'; +$VERSION = '0.26'; + +{ + + # these aren't defined until after _require_admin is run, so + # define them so prototypes are available during compilation. + sub io; + sub capture(&;@); + +#line 28 + + my $done = 0; + + sub _require_admin { + + # do this once to avoid redefinition warnings from IO::All + return if $done; + + require IO::All; + IO::All->import( '-binary' ); + + require Capture::Tiny; + Capture::Tiny->import ( 'capture' ); + + return; + } + +} sub readme_from { my $self = shift; return unless $self->is_admin; - my $file = shift || $self->_all_from + _require_admin; + + # Input file + my $in_file = shift || $self->_all_from or die "Can't determine file to make readme_from"; - my $clean = shift; - print "Writing README from $file\n"; + # Get optional arguments + my ($clean, $format, $out_file, $options); + my $args = shift; + if ( ref $args ) { + # Arguments are in a hashref + if ( ref($args) ne 'HASH' ) { + die "Expected a hashref but got a ".ref($args)."\n"; + } else { + $clean = $args->{'clean'}; + $format = $args->{'format'}; + $out_file = $args->{'output_file'}; + $options = $args->{'options'}; + } + } else { + # Arguments are in a list + $clean = $args; + $format = shift; + $out_file = shift; + $options = \@_; + } + + # Default values; + $clean ||= 0; + $format ||= 'txt'; + + # Generate README + print "readme_from $in_file to $format\n"; + if ($format =~ m/te?xt/) { + $out_file = $self->_readme_txt($in_file, $out_file, $options); + } elsif ($format =~ m/html?/) { + $out_file = $self->_readme_htm($in_file, $out_file, $options); + } elsif ($format eq 'man') { + $out_file = $self->_readme_man($in_file, $out_file, $options); + } elsif ($format eq 'md') { + $out_file = $self->_readme_md($in_file, $out_file, $options); + } elsif ($format eq 'pdf') { + $out_file = $self->_readme_pdf($in_file, $out_file, $options); + } - require Pod::Text; - my $parser = Pod::Text->new(); - open README, '> README' or die "$!\n"; - $parser->output_fh( *README ); - $parser->parse_file( $file ); if ($clean) { - $self->clean_files('README'); + $self->clean_files($out_file); } + return 1; } + +sub _readme_txt { + my ($self, $in_file, $out_file, $options) = @_; + $out_file ||= 'README'; + require Pod::Text; + my $parser = Pod::Text->new( @$options ); + my $io = io->file($out_file)->open(">"); + my $out_fh = $io->io_handle; + $parser->output_fh( *$out_fh ); + $parser->parse_file( $in_file ); + return $out_file; +} + + +sub _readme_htm { + my ($self, $in_file, $out_file, $options) = @_; + $out_file ||= 'README.htm'; + require Pod::Html; + my ($o) = capture { + Pod::Html::pod2html( + "--infile=$in_file", + "--outfile=-", + @$options, + ); + }; + io->file($out_file)->print($o); + # Remove temporary files if needed + for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') { + if (-e $file) { + unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n"; + } + } + return $out_file; +} + + +sub _readme_man { + my ($self, $in_file, $out_file, $options) = @_; + $out_file ||= 'README.1'; + require Pod::Man; + my $parser = Pod::Man->new( @$options ); + my $io = io->file($out_file)->open(">"); + my $out_fh = $io->io_handle; + $parser->output_fh( *$out_fh ); + $parser->parse_file( $in_file ); + return $out_file; +} + + +sub _readme_pdf { + my ($self, $in_file, $out_file, $options) = @_; + $out_file ||= 'README.pdf'; + eval { require App::pod2pdf; } + or die "Could not generate $out_file because pod2pdf could not be found\n"; + my $parser = App::pod2pdf->new( @$options ); + $parser->parse_from_file($in_file); + my ($o) = capture { $parser->output }; + io->file($out_file)->print($o); + return $out_file; +} + +sub _readme_md { + my ($self, $in_file, $out_file, $options) = @_; + $out_file ||= 'README.md'; + require Pod::Markdown; + my $parser = Pod::Markdown->new( @$options ); + my $io = io->file($out_file)->open(">"); + my $out_fh = $io->io_handle; + $parser->output_fh( *$out_fh ); + $parser->parse_file( $in_file ); + return $out_file; +} + + sub _all_from { my $self = shift; return unless $self->admin->{extensions}; @@ -44,5 +180,5 @@ __END__ -#line 112 +#line 316 diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Win32.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Win32.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/Win32.pm 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/Win32.pm 2016-08-12 17:29:24.000000000 +0900 @@ -6,7 +6,7 @@ use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install/WriteAll.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install/WriteAll.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install/WriteAll.pm 2011-10-20 23:18:05.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install/WriteAll.pm 2016-08-12 17:29:24.000000000 +0900 @@ -6,7 +6,7 @@ use vars qw{$VERSION @ISA $ISCORE}; BEGIN { - $VERSION = '1.03'; + $VERSION = '1.16'; @ISA = qw{Module::Install::Base}; $ISCORE = 1; } diff -Nru rt-extension-customfieldsonupdate-0.01/inc/Module/Install.pm rt-extension-customfieldsonupdate-1.02/inc/Module/Install.pm --- rt-extension-customfieldsonupdate-0.01/inc/Module/Install.pm 2011-10-20 23:18:04.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/Module/Install.pm 2016-08-12 17:29:24.000000000 +0900 @@ -17,7 +17,7 @@ # 3. The ./inc/ version of Module::Install loads # } -use 5.005; +use 5.006; use strict 'vars'; use Cwd (); use File::Find (); @@ -31,7 +31,7 @@ # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. - $VERSION = '1.03'; + $VERSION = '1.16'; # Storage for the pseudo-singleton $MAIN = undef; @@ -156,10 +156,10 @@ sub autoload { my $self = shift; my $who = $self->_caller; - my $cwd = Cwd::cwd(); + my $cwd = Cwd::getcwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { - my $pwd = Cwd::cwd(); + my $pwd = Cwd::getcwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; @@ -239,7 +239,7 @@ # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); - unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) { + unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; @@ -338,7 +338,7 @@ if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; - foreach ( split //, $content ) { + foreach ( split /\n/, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text @@ -378,6 +378,7 @@ sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; + binmode FH; my $string = do { local $/; <FH> }; close FH or die "close($_[0]): $!"; return $string; @@ -386,6 +387,7 @@ sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; + binmode FH; my $string = do { local $/; <FH> }; close FH or die "close($_[0]): $!"; return $string; @@ -416,6 +418,7 @@ sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; + binmode FH; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } @@ -425,6 +428,7 @@ sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; + binmode FH; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } @@ -434,7 +438,7 @@ # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). -sub _version ($) { +sub _version { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { @@ -450,12 +454,12 @@ return $l + 0; } -sub _cmp ($$) { - _version($_[0]) <=> _version($_[1]); +sub _cmp { + _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS -sub _CLASS ($) { +sub _CLASS { ( defined $_[0] and @@ -467,4 +471,4 @@ 1; -# Copyright 2008 - 2011 Adam Kennedy. +# Copyright 2008 - 2012 Adam Kennedy. diff -Nru rt-extension-customfieldsonupdate-0.01/inc/YAML/Tiny.pm rt-extension-customfieldsonupdate-1.02/inc/YAML/Tiny.pm --- rt-extension-customfieldsonupdate-0.01/inc/YAML/Tiny.pm 1970-01-01 09:00:00.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/inc/YAML/Tiny.pm 2016-08-12 17:29:24.000000000 +0900 @@ -0,0 +1,874 @@ +#line 1 +use 5.008001; # sane UTF-8 support +use strict; +use warnings; +package YAML::Tiny; # git description: v1.68-2-gcc5324e +# XXX-INGY is 5.8.1 too old/broken for utf8? +# XXX-XDG Lancaster consensus was that it was sufficient until +# proven otherwise + +our $VERSION = '1.69'; + +##################################################################### +# The YAML::Tiny API. +# +# These are the currently documented API functions/methods and +# exports: + +use Exporter; +our @ISA = qw{ Exporter }; +our @EXPORT = qw{ Load Dump }; +our @EXPORT_OK = qw{ LoadFile DumpFile freeze thaw }; + +### +# Functional/Export API: + +sub Dump { + return YAML::Tiny->new(@_)->_dump_string; +} + +# XXX-INGY Returning last document seems a bad behavior. +# XXX-XDG I think first would seem more natural, but I don't know +# that it's worth changing now +sub Load { + my $self = YAML::Tiny->_load_string(@_); + if ( wantarray ) { + return @$self; + } else { + # To match YAML.pm, return the last document + return $self->[-1]; + } +} + +# XXX-INGY Do we really need freeze and thaw? +# XXX-XDG I don't think so. I'd support deprecating them. +BEGIN { + *freeze = \&Dump; + *thaw = \&Load; +} + +sub DumpFile { + my $file = shift; + return YAML::Tiny->new(@_)->_dump_file($file); +} + +sub LoadFile { + my $file = shift; + my $self = YAML::Tiny->_load_file($file); + if ( wantarray ) { + return @$self; + } else { + # Return only the last document to match YAML.pm, + return $self->[-1]; + } +} + + +### +# Object Oriented API: + +# Create an empty YAML::Tiny object +# XXX-INGY Why do we use ARRAY object? +# NOTE: I get it now, but I think it's confusing and not needed. +# Will change it on a branch later, for review. +# +# XXX-XDG I don't support changing it yet. It's a very well-documented +# "API" of YAML::Tiny. I'd support deprecating it, but Adam suggested +# we not change it until YAML.pm's own OO API is established so that +# users only have one API change to digest, not two +sub new { + my $class = shift; + bless [ @_ ], $class; +} + +# XXX-INGY It probably doesn't matter, and it's probably too late to +# change, but 'read/write' are the wrong names. Read and Write +# are actions that take data from storage to memory +# characters/strings. These take the data to/from storage to native +# Perl objects, which the terms dump and load are meant. As long as +# this is a legacy quirk to YAML::Tiny it's ok, but I'd prefer not +# to add new {read,write}_* methods to this API. + +sub read_string { + my $self = shift; + $self->_load_string(@_); +} + +sub write_string { + my $self = shift; + $self->_dump_string(@_); +} + +sub read { + my $self = shift; + $self->_load_file(@_); +} + +sub write { + my $self = shift; + $self->_dump_file(@_); +} + + + + +##################################################################### +# Constants + +# Printed form of the unprintable characters in the lowest range +# of ASCII characters, listed by ASCII ordinal position. +my @UNPRINTABLE = qw( + 0 x01 x02 x03 x04 x05 x06 a + b t n v f r x0E x0F + x10 x11 x12 x13 x14 x15 x16 x17 + x18 x19 x1A e x1C x1D x1E x1F +); + +# Printable characters for escapes +my %UNESCAPES = ( + 0 => "\x00", z => "\x00", N => "\x85", + a => "\x07", b => "\x08", t => "\x09", + n => "\x0a", v => "\x0b", f => "\x0c", + r => "\x0d", e => "\x1b", '\\' => '\\', +); + +# XXX-INGY +# I(ngy) need to decide if these values should be quoted in +# YAML::Tiny or not. Probably yes. + +# These 3 values have special meaning when unquoted and using the +# default YAML schema. They need quotes if they are strings. +my %QUOTE = map { $_ => 1 } qw{ + null true false +}; + +# The commented out form is simpler, but overloaded the Perl regex +# engine due to recursion and backtracking problems on strings +# larger than 32,000ish characters. Keep it for reference purposes. +# qr/\"((?:\\.|[^\"])*)\"/ +my $re_capture_double_quoted = qr/\"([^\\"]*(?:\\.[^\\"]*)*)\"/; +my $re_capture_single_quoted = qr/\'([^\']*(?:\'\'[^\']*)*)\'/; +# unquoted re gets trailing space that needs to be stripped +my $re_capture_unquoted_key = qr/([^:]+(?::+\S(?:[^:]*|.*?(?=:)))*)(?=\s*\:(?:\s+|$))/; +my $re_trailing_comment = qr/(?:\s+\#.*)?/; +my $re_key_value_separator = qr/\s*:(?:\s+(?:\#.*)?|$)/; + + + + + +##################################################################### +# YAML::Tiny Implementation. +# +# These are the private methods that do all the work. They may change +# at any time. + + +### +# Loader functions: + +# Create an object from a file +sub _load_file { + my $class = ref $_[0] ? ref shift : shift; + + # Check the file + my $file = shift or $class->_error( 'You did not specify a file name' ); + $class->_error( "File '$file' does not exist" ) + unless -e $file; + $class->_error( "'$file' is a directory, not a file" ) + unless -f _; + $class->_error( "Insufficient permissions to read '$file'" ) + unless -r _; + + # Open unbuffered with strict UTF-8 decoding and no translation layers + open( my $fh, "<:unix:encoding(UTF-8)", $file ); + unless ( $fh ) { + $class->_error("Failed to open file '$file': $!"); + } + + # flock if available (or warn if not possible for OS-specific reasons) + if ( _can_flock() ) { + flock( $fh, Fcntl::LOCK_SH() ) + or warn "Couldn't lock '$file' for reading: $!"; + } + + # slurp the contents + my $contents = eval { + use warnings FATAL => 'utf8'; + local $/; + <$fh> + }; + if ( my $err = $@ ) { + $class->_error("Error reading from file '$file': $err"); + } + + # close the file (release the lock) + unless ( close $fh ) { + $class->_error("Failed to close file '$file': $!"); + } + + $class->_load_string( $contents ); +} + +# Create an object from a string +sub _load_string { + my $class = ref $_[0] ? ref shift : shift; + my $self = bless [], $class; + my $string = $_[0]; + eval { + unless ( defined $string ) { + die \"Did not provide a string to load"; + } + + # Check if Perl has it marked as characters, but it's internally + # inconsistent. E.g. maybe latin1 got read on a :utf8 layer + if ( utf8::is_utf8($string) && ! utf8::valid($string) ) { + die \<<'...'; +Read an invalid UTF-8 string (maybe mixed UTF-8 and 8-bit character set). +Did you decode with lax ":utf8" instead of strict ":encoding(UTF-8)"? +... + } + + # Ensure Unicode character semantics, even for 0x80-0xff + utf8::upgrade($string); + + # Check for and strip any leading UTF-8 BOM + $string =~ s/^\x{FEFF}//; + + # Check for some special cases + return $self unless length $string; + + # Split the file into lines + my @lines = grep { ! /^\s*(?:\#.*)?\z/ } + split /(?:\015{1,2}\012|\015|\012)/, $string; + + # Strip the initial YAML header + @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines; + + # A nibbling parser + my $in_document = 0; + while ( @lines ) { + # Do we have a document header? + if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) { + # Handle scalar documents + shift @lines; + if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) { + push @$self, + $self->_load_scalar( "$1", [ undef ], \@lines ); + next; + } + $in_document = 1; + } + + if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) { + # A naked document + push @$self, undef; + while ( @lines and $lines[0] !~ /^---/ ) { + shift @lines; + } + $in_document = 0; + + # XXX The final '-+$' is to look for -- which ends up being an + # error later. + } elsif ( ! $in_document && @$self ) { + # only the first document can be explicit + die \"YAML::Tiny failed to classify the line '$lines[0]'"; + } elsif ( $lines[0] =~ /^\s*\-(?:\s|$|-+$)/ ) { + # An array at the root + my $document = [ ]; + push @$self, $document; + $self->_load_array( $document, [ 0 ], \@lines ); + + } elsif ( $lines[0] =~ /^(\s*)\S/ ) { + # A hash at the root + my $document = { }; + push @$self, $document; + $self->_load_hash( $document, [ length($1) ], \@lines ); + + } else { + # Shouldn't get here. @lines have whitespace-only lines + # stripped, and previous match is a line with any + # non-whitespace. So this clause should only be reachable via + # a perlbug where \s is not symmetric with \S + + # uncoverable statement + die \"YAML::Tiny failed to classify the line '$lines[0]'"; + } + } + }; + my $err = $@; + if ( ref $err eq 'SCALAR' ) { + $self->_error(${$err}); + } elsif ( $err ) { + $self->_error($err); + } + + return $self; +} + +sub _unquote_single { + my ($self, $string) = @_; + return '' unless length $string; + $string =~ s/\'\'/\'/g; + return $string; +} + +sub _unquote_double { + my ($self, $string) = @_; + return '' unless length $string; + $string =~ s/\\"/"/g; + $string =~ + s{\\([Nnever\\fartz0b]|x([0-9a-fA-F]{2}))} + {(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}}gex; + return $string; +} + +# Load a YAML scalar string to the actual Perl scalar +sub _load_scalar { + my ($self, $string, $indent, $lines) = @_; + + # Trim trailing whitespace + $string =~ s/\s*\z//; + + # Explitic null/undef + return undef if $string eq '~'; + + # Single quote + if ( $string =~ /^$re_capture_single_quoted$re_trailing_comment\z/ ) { + return $self->_unquote_single($1); + } + + # Double quote. + if ( $string =~ /^$re_capture_double_quoted$re_trailing_comment\z/ ) { + return $self->_unquote_double($1); + } + + # Special cases + if ( $string =~ /^[\'\"!&]/ ) { + die \"YAML::Tiny does not support a feature in line '$string'"; + } + return {} if $string =~ /^{}(?:\s+\#.*)?\z/; + return [] if $string =~ /^\[\](?:\s+\#.*)?\z/; + + # Regular unquoted string + if ( $string !~ /^[>|]/ ) { + die \"YAML::Tiny found illegal characters in plain scalar: '$string'" + if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or + $string =~ /:(?:\s|$)/; + $string =~ s/\s+#.*\z//; + return $string; + } + + # Error + die \"YAML::Tiny failed to find multi-line scalar content" unless @$lines; + + # Check the indent depth + $lines->[0] =~ /^(\s*)/; + $indent->[-1] = length("$1"); + if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) { + die \"YAML::Tiny found bad indenting in line '$lines->[0]'"; + } + + # Pull the lines + my @multiline = (); + while ( @$lines ) { + $lines->[0] =~ /^(\s*)/; + last unless length($1) >= $indent->[-1]; + push @multiline, substr(shift(@$lines), length($1)); + } + + my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n"; + my $t = (substr($string, 1, 1) eq '-') ? '' : "\n"; + return join( $j, @multiline ) . $t; +} + +# Load an array +sub _load_array { + my ($self, $array, $indent, $lines) = @_; + + while ( @$lines ) { + # Check for a new document + if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { + while ( @$lines and $lines->[0] !~ /^---/ ) { + shift @$lines; + } + return 1; + } + + # Check the indent level + $lines->[0] =~ /^(\s*)/; + if ( length($1) < $indent->[-1] ) { + return 1; + } elsif ( length($1) > $indent->[-1] ) { + die \"YAML::Tiny found bad indenting in line '$lines->[0]'"; + } + + if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) { + # Inline nested hash + my $indent2 = length("$1"); + $lines->[0] =~ s/-/ /; + push @$array, { }; + $self->_load_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); + + } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) { + shift @$lines; + unless ( @$lines ) { + push @$array, undef; + return 1; + } + if ( $lines->[0] =~ /^(\s*)\-/ ) { + my $indent2 = length("$1"); + if ( $indent->[-1] == $indent2 ) { + # Null array entry + push @$array, undef; + } else { + # Naked indenter + push @$array, [ ]; + $self->_load_array( + $array->[-1], [ @$indent, $indent2 ], $lines + ); + } + + } elsif ( $lines->[0] =~ /^(\s*)\S/ ) { + push @$array, { }; + $self->_load_hash( + $array->[-1], [ @$indent, length("$1") ], $lines + ); + + } else { + die \"YAML::Tiny failed to classify line '$lines->[0]'"; + } + + } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) { + # Array entry with a value + shift @$lines; + push @$array, $self->_load_scalar( + "$2", [ @$indent, undef ], $lines + ); + + } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) { + # This is probably a structure like the following... + # --- + # foo: + # - list + # bar: value + # + # ... so lets return and let the hash parser handle it + return 1; + + } else { + die \"YAML::Tiny failed to classify line '$lines->[0]'"; + } + } + + return 1; +} + +# Load a hash +sub _load_hash { + my ($self, $hash, $indent, $lines) = @_; + + while ( @$lines ) { + # Check for a new document + if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { + while ( @$lines and $lines->[0] !~ /^---/ ) { + shift @$lines; + } + return 1; + } + + # Check the indent level + $lines->[0] =~ /^(\s*)/; + if ( length($1) < $indent->[-1] ) { + return 1; + } elsif ( length($1) > $indent->[-1] ) { + die \"YAML::Tiny found bad indenting in line '$lines->[0]'"; + } + + # Find the key + my $key; + + # Quoted keys + if ( $lines->[0] =~ + s/^\s*$re_capture_single_quoted$re_key_value_separator// + ) { + $key = $self->_unquote_single($1); + } + elsif ( $lines->[0] =~ + s/^\s*$re_capture_double_quoted$re_key_value_separator// + ) { + $key = $self->_unquote_double($1); + } + elsif ( $lines->[0] =~ + s/^\s*$re_capture_unquoted_key$re_key_value_separator// + ) { + $key = $1; + $key =~ s/\s+$//; + } + elsif ( $lines->[0] =~ /^\s*\?/ ) { + die \"YAML::Tiny does not support a feature in line '$lines->[0]'"; + } + else { + die \"YAML::Tiny failed to classify line '$lines->[0]'"; + } + + if ( exists $hash->{$key} ) { + warn "YAML::Tiny found a duplicate key '$key' in line '$lines->[0]'"; + } + + # Do we have a value? + if ( length $lines->[0] ) { + # Yes + $hash->{$key} = $self->_load_scalar( + shift(@$lines), [ @$indent, undef ], $lines + ); + } else { + # An indent + shift @$lines; + unless ( @$lines ) { + $hash->{$key} = undef; + return 1; + } + if ( $lines->[0] =~ /^(\s*)-/ ) { + $hash->{$key} = []; + $self->_load_array( + $hash->{$key}, [ @$indent, length($1) ], $lines + ); + } elsif ( $lines->[0] =~ /^(\s*)./ ) { + my $indent2 = length("$1"); + if ( $indent->[-1] >= $indent2 ) { + # Null hash entry + $hash->{$key} = undef; + } else { + $hash->{$key} = {}; + $self->_load_hash( + $hash->{$key}, [ @$indent, length($1) ], $lines + ); + } + } + } + } + + return 1; +} + + +### +# Dumper functions: + +# Save an object to a file +sub _dump_file { + my $self = shift; + + require Fcntl; + + # Check the file + my $file = shift or $self->_error( 'You did not specify a file name' ); + + my $fh; + # flock if available (or warn if not possible for OS-specific reasons) + if ( _can_flock() ) { + # Open without truncation (truncate comes after lock) + my $flags = Fcntl::O_WRONLY()|Fcntl::O_CREAT(); + sysopen( $fh, $file, $flags ); + unless ( $fh ) { + $self->_error("Failed to open file '$file' for writing: $!"); + } + + # Use no translation and strict UTF-8 + binmode( $fh, ":raw:encoding(UTF-8)"); + + flock( $fh, Fcntl::LOCK_EX() ) + or warn "Couldn't lock '$file' for reading: $!"; + + # truncate and spew contents + truncate $fh, 0; + seek $fh, 0, 0; + } + else { + open $fh, ">:unix:encoding(UTF-8)", $file; + } + + # serialize and spew to the handle + print {$fh} $self->_dump_string; + + # close the file (release the lock) + unless ( close $fh ) { + $self->_error("Failed to close file '$file': $!"); + } + + return 1; +} + +# Save an object to a string +sub _dump_string { + my $self = shift; + return '' unless ref $self && @$self; + + # Iterate over the documents + my $indent = 0; + my @lines = (); + + eval { + foreach my $cursor ( @$self ) { + push @lines, '---'; + + # An empty document + if ( ! defined $cursor ) { + # Do nothing + + # A scalar document + } elsif ( ! ref $cursor ) { + $lines[-1] .= ' ' . $self->_dump_scalar( $cursor ); + + # A list at the root + } elsif ( ref $cursor eq 'ARRAY' ) { + unless ( @$cursor ) { + $lines[-1] .= ' []'; + next; + } + push @lines, $self->_dump_array( $cursor, $indent, {} ); + + # A hash at the root + } elsif ( ref $cursor eq 'HASH' ) { + unless ( %$cursor ) { + $lines[-1] .= ' {}'; + next; + } + push @lines, $self->_dump_hash( $cursor, $indent, {} ); + + } else { + die \("Cannot serialize " . ref($cursor)); + } + } + }; + if ( ref $@ eq 'SCALAR' ) { + $self->_error(${$@}); + } elsif ( $@ ) { + $self->_error($@); + } + + join '', map { "$_\n" } @lines; +} + +sub _has_internal_string_value { + my $value = shift; + my $b_obj = B::svref_2object(\$value); # for round trip problem + return $b_obj->FLAGS & B::SVf_POK(); +} + +sub _dump_scalar { + my $string = $_[1]; + my $is_key = $_[2]; + # Check this before checking length or it winds up looking like a string! + my $has_string_flag = _has_internal_string_value($string); + return '~' unless defined $string; + return "''" unless length $string; + if (Scalar::Util::looks_like_number($string)) { + # keys and values that have been used as strings get quoted + if ( $is_key || $has_string_flag ) { + return qq['$string']; + } + else { + return $string; + } + } + if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) { + $string =~ s/\\/\\\\/g; + $string =~ s/"/\\"/g; + $string =~ s/\n/\\n/g; + $string =~ s/[\x85]/\\N/g; + $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g; + $string =~ s/([\x7f-\x9f])/'\x' . sprintf("%X",ord($1))/ge; + return qq|"$string"|; + } + if ( $string =~ /(?:^[~!@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or + $QUOTE{$string} + ) { + return "'$string'"; + } + return $string; +} + +sub _dump_array { + my ($self, $array, $indent, $seen) = @_; + if ( $seen->{refaddr($array)}++ ) { + die \"YAML::Tiny does not support circular references"; + } + my @lines = (); + foreach my $el ( @$array ) { + my $line = (' ' x $indent) . '-'; + my $type = ref $el; + if ( ! $type ) { + $line .= ' ' . $self->_dump_scalar( $el ); + push @lines, $line; + + } elsif ( $type eq 'ARRAY' ) { + if ( @$el ) { + push @lines, $line; + push @lines, $self->_dump_array( $el, $indent + 1, $seen ); + } else { + $line .= ' []'; + push @lines, $line; + } + + } elsif ( $type eq 'HASH' ) { + if ( keys %$el ) { + push @lines, $line; + push @lines, $self->_dump_hash( $el, $indent + 1, $seen ); + } else { + $line .= ' {}'; + push @lines, $line; + } + + } else { + die \"YAML::Tiny does not support $type references"; + } + } + + @lines; +} + +sub _dump_hash { + my ($self, $hash, $indent, $seen) = @_; + if ( $seen->{refaddr($hash)}++ ) { + die \"YAML::Tiny does not support circular references"; + } + my @lines = (); + foreach my $name ( sort keys %$hash ) { + my $el = $hash->{$name}; + my $line = (' ' x $indent) . $self->_dump_scalar($name, 1) . ":"; + my $type = ref $el; + if ( ! $type ) { + $line .= ' ' . $self->_dump_scalar( $el ); + push @lines, $line; + + } elsif ( $type eq 'ARRAY' ) { + if ( @$el ) { + push @lines, $line; + push @lines, $self->_dump_array( $el, $indent + 1, $seen ); + } else { + $line .= ' []'; + push @lines, $line; + } + + } elsif ( $type eq 'HASH' ) { + if ( keys %$el ) { + push @lines, $line; + push @lines, $self->_dump_hash( $el, $indent + 1, $seen ); + } else { + $line .= ' {}'; + push @lines, $line; + } + + } else { + die \"YAML::Tiny does not support $type references"; + } + } + + @lines; +} + + + +##################################################################### +# DEPRECATED API methods: + +# Error storage (DEPRECATED as of 1.57) +our $errstr = ''; + +# Set error +sub _error { + require Carp; + $errstr = $_[1]; + $errstr =~ s/ at \S+ line \d+.*//; + Carp::croak( $errstr ); +} + +# Retrieve error +my $errstr_warned; +sub errstr { + require Carp; + Carp::carp( "YAML::Tiny->errstr and \$YAML::Tiny::errstr is deprecated" ) + unless $errstr_warned++; + $errstr; +} + + + + +##################################################################### +# Helper functions. Possibly not needed. + + +# Use to detect nv or iv +use B; + +# XXX-INGY Is flock YAML::Tiny's responsibility? +# Some platforms can't flock :-( +# XXX-XDG I think it is. When reading and writing files, we ought +# to be locking whenever possible. People (foolishly) use YAML +# files for things like session storage, which has race issues. +my $HAS_FLOCK; +sub _can_flock { + if ( defined $HAS_FLOCK ) { + return $HAS_FLOCK; + } + else { + require Config; + my $c = \%Config::Config; + $HAS_FLOCK = grep { $c->{$_} } qw/d_flock d_fcntl_can_lock d_lockf/; + require Fcntl if $HAS_FLOCK; + return $HAS_FLOCK; + } +} + + +# XXX-INGY Is this core in 5.8.1? Can we remove this? +# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this +##################################################################### +# Use Scalar::Util if possible, otherwise emulate it + +use Scalar::Util (); +BEGIN { + local $@; + if ( eval { Scalar::Util->VERSION(1.18); } ) { + *refaddr = *Scalar::Util::refaddr; + } + else { + eval <<'END_PERL'; +# Scalar::Util failed to load or too old +sub refaddr { + my $pkg = ref($_[0]) or return undef; + if ( !! UNIVERSAL::can($_[0], 'can') ) { + bless $_[0], 'Scalar::Util::Fake'; + } else { + $pkg = undef; + } + "$_[0]" =~ /0x(\w+)/; + my $i = do { no warnings 'portable'; hex $1 }; + bless $_[0], $pkg if defined $pkg; + $i; +} +END_PERL + } +} + +delete $YAML::Tiny::{refaddr}; + +1; + +# XXX-INGY Doc notes I'm putting up here. Changing the doc when it's wrong +# but leaving grey area stuff up here. +# +# I would like to change Read/Write to Load/Dump below without +# changing the actual API names. +# +# It might be better to put Load/Dump API in the SYNOPSIS instead of the +# dubious OO API. +# +# null and bool explanations may be outdated. + +__END__ + +#line 1489 diff -Nru rt-extension-customfieldsonupdate-0.01/lib/RT/Extension/CustomFieldsOnUpdate.pm rt-extension-customfieldsonupdate-1.02/lib/RT/Extension/CustomFieldsOnUpdate.pm --- rt-extension-customfieldsonupdate-0.01/lib/RT/Extension/CustomFieldsOnUpdate.pm 2011-10-20 23:18:01.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/lib/RT/Extension/CustomFieldsOnUpdate.pm 2016-08-12 17:29:12.000000000 +0900 @@ -4,7 +4,7 @@ package RT::Extension::CustomFieldsOnUpdate; -our $VERSION = '0.01'; +our $VERSION = '1.02'; =head1 NAME @@ -12,42 +12,62 @@ =head1 DESCRIPTION -This extension adds often requested feature - update of ticket's custom fields on -reply and comment. +This extension allows the update of tickets' custom fields on reply and +comment pages. -This is for RT 4.0.x, solutions for older versions available on the wiki, -start from CustomFieldsOnUpdate page [1]. +=head1 INSTALLATION -[1] http://requesttracker.wikia.com/wiki/CustomFieldsOnUpdate +=over -=head1 INSTALLATION +=item C<perl Makefile.PL> -It's sad but RT 4.0.0 - 4.0.2 miss a tiny feature, so you have to apply -F<patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch>. This change -is part of RT 4.0.3. - -Otherwise installation is common: - - perl Makefile.PL - make - make install - -Register 'RT::Extension::CustomFieldsOnUpdate' in the site config; - - Set(@Plugins, qw( - RT::Extension::CustomFieldsOnUpdate - ... other plugins you may have ... - )); +=item C<make> -=cut +=item C<make install> + +May need root permissions + +=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm> + +If you are using RT 4.2 or greater, add this line: + + Plugin('RT::Extension::CustomFieldsOnUpdate'); + +For RT 4.0, add this line: + + Set(@Plugins, qw(RT::Extension::CustomFieldsOnUpdate)); + +or add C<RT::Extension::CustomFieldsOnUpdate> to your existing C<@Plugins> line. + +=item Clear your mason cache + + rm -rf /opt/rt4/var/mason_data/obj + +=item Restart your webserver + +=back =head1 AUTHOR -Ruslan Zakirov E<lt>r...@bestpractical.come<gt> +Best Practical Solutions, LLC E<lt>modu...@bestpractical.come<gt> + +=head1 BUGS + +All bugs should be reported via email to + + L<bug-rt-extension-customfieldsonupd...@rt.cpan.org|mailto:bug-rt-extension-customfieldsonupd...@rt.cpan.org> + +or via the web at + + L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-CustomFieldsOnUpdate>. + +=head1 LICENSE AND COPYRIGHT + +This software is Copyright (c) 2016 by Best Practical Solutions -=head1 LICENSE +This is free software, licensed under: -Under the same terms as perl itself. + The GNU General Public License, Version 2, June 1991 =cut diff -Nru rt-extension-customfieldsonupdate-0.01/patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch rt-extension-customfieldsonupdate-1.02/patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch --- rt-extension-customfieldsonupdate-0.01/patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch 2011-10-20 22:35:59.000000000 +0900 +++ rt-extension-customfieldsonupdate-1.02/patches/RT-4.0.0-2-edit-ticket-custom-fields-in-table.patch 1970-01-01 09:00:00.000000000 +0900 @@ -1,48 +0,0 @@ -diff --git a/share/html/Ticket/Elements/EditCustomFields b/share/html/Ticket/Elements/EditCustomFields -index b4c36d4..d4e2f73 100755 ---- a/share/html/Ticket/Elements/EditCustomFields -+++ b/share/html/Ticket/Elements/EditCustomFields -@@ -46,7 +46,9 @@ - %# - %# END BPS TAGGED BLOCK }}} - % $m->callback( %ARGS, CallbackName => 'BeforeCustomFields' ); --<div class="edit-custom-fields"> -+% if ( $WRAP ) { -+<<% $WRAP %> class="edit-custom-fields"> -+% } - % while ( my $CustomField = $CustomFields->Next ) { - % next unless $CustomField->CurrentUserHasRight('ModifyCustomField'); - % my $Type = $CustomField->Type || 'Unknown'; -@@ -73,7 +75,9 @@ - </<% $FIELD %>> - % } - --</div> -+% if ( $WRAP ) { -+</<% $WRAP %>> -+% } - % $m->callback( %ARGS, CallbackName => 'AfterCustomFields', TicketObj => $TicketObj, QueueObj => $QueueObj ); - <%INIT> - my $CustomFields; -@@ -88,8 +92,15 @@ if ($TicketObj && !$OnCreate) { - - $m->callback( %ARGS, CallbackName => 'MassageCustomFields', CustomFields => $CustomFields ); - -+$AsTable ||= $InTable; - my $FIELD = $AsTable ? 'tr' : 'div'; - my $CELL = $AsTable ? 'td' : 'div'; -+my $WRAP = ''; -+if ( $AsTable ) { -+ $WRAP = 'table' unless $InTable; -+} else { -+ $WRAP = 'div'; -+} - - </%INIT> - <%ARGS> -@@ -99,4 +110,5 @@ $QueueObj => undef - $OnCreate => undef - $DefaultsFromTopArguments => 1 - $AsTable => 0 -+$InTable => 0 - </%ARGS>