(#17260) Include link to information about deprecation

Previously the deprecation warning did link the user to any additional
information about the warning. This adds a link that can be followed to
get a better explanation of the issue and how to resolve it.
Replace dashes with dots for gem version

When switching out to using git-describe for versioning from
source, gem versioning breaks because dashes are not allowed.
This simple fix replaces the dashes with dots, which are.
Note that in a merge-up to 3.0.x, this commit will conflict.
Default to 'ours' in a merge-up, this file does not even exist
in 3.0.x and shouldn't.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Preserve timestamps when installing files

Without the preserve option, ruby's FileUtils.install method uses the
current time for all installed files.  For backup systems, package
installs, and general pedantic sysadmins, preserving timestamps makes a
small improvement in the world.
Merge pull request #1247 from MosesMendoza/maint/2.7.x/preserve_timestamps_install.rb

Preserve timestamps when installing files
Merge pull request #1254 from MosesMendoza/maint/2.7.x/fixup_gem_task

Replace dashes with dots for gem version
Fix build targets for 2.7.x

This commit revises the lists of cows and mocks to build against to remove
redundant and unnecessary targets given Puppet is noarch.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
rm packaging artifacts in rpm spec, debian rules

The 2.7.x packaging will include misc packaging artifacts we shouldn't
ship. This commit removes them in packaging.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #1255 from MosesMendoza/maint/2.7.x/packaging_fixes

Maint/2.7.x/packaging fixes
(#7422) Support arrow syntax with metaparams

Attempts to combine the arrow syntax with
metaparams lead to the following error message:

Error: undefined method `<<' for {}:Hash

For example, the following code:

  Notify['one'] -> Notify['three']

  notify { 'one':
    before => Notify['two']
  }
  notify { 'two': }

  notify { ['three', 'four']: }

Causes this issue. This is because relationships
appended with the -> syntax assume that the current
list of dependencies are an array.

Given that, it is not surprising that the following
code is valid at the moment:

  Notify['one'] -> Notify['three']

  notify { 'one':
    before => Notify['two', 'four']
  }
  notify { 'two': }

  notify { ['three', 'four']: }

In this case, the dependency resources are already
expressed as an array before the arrow syntax appends
the additional dep.

This commit converts everything to an array before
trying to append additional relationships to that
array. The fact that the second code snippet already
works demonstrates that Puppet already supports
appending additional refs to an array of refs.
Merge branch 'fix/2.7.x/7422_fix_relationship_append' into 2.7.x

* fix/2.7.x/7422_fix_relationship_append:
  (#7422) Support arrow syntax with metaparams
(#17458) Load 'puppet' at the right time

Previously the Puppet::Util.which method tried to compensate for the
puppet.rb file not being loaded at the right time by trying to load it
itself. When a performance improvement was added (commit 20efe94) to
check if this needed to be done it broke the codepath for executing
external puppet-* commands.

This commit fixes this by requiring 'puppet' at the right place in the
entry point (Puppet::Util::CommandLine) and removing the workaround in
Puppet::Util.which.

Paired-with: Josh Cooper <josh@puppetlabs.com>
Merge branch 'issue/2.7.x/17458-puppet-fall-down-go-boom' of git://github.com/zaphod42/puppet into 2.7.x

* 'issue/2.7.x/17458-puppet-fall-down-go-boom' of git://github.com/zaphod42/puppet:
  (#17458) Load 'puppet' at the right time
Revert "(#17458) Load 'puppet' at the right time"

Commit b5ed15baadffb22b789cebfab7a76e2ab43c7d14 attempted to require
'puppet' at the right time, but failed. The command_line required puppet
before the application was required and its run_mode determined. As a
result, `puppet master` was using the default :user run_mode, causing
its pidfile to be named 'agent.pid' among other things.

This comit reverts b5ed15ba.
(#17458) Partial revert of "don't rebuild regexp every time"

In commit, 20efe94, a change was made to Puppet::Util.absolute_path? to
require the Puppet module only if necessary. This was done as an
optimization since re-requiring a file is much slower than checking if a
constant is defined.

However, defined?(Puppet) is always true when called within the
Puppet::Util.absolute_path? method, so effectively, absolute_path? would
never require the Puppet module, when previously it used to, in certain
exceptional flows.

In the normal flow, it wasn't an issue, because when puppet runs an
internal subcommand (Application), the app requires the Puppet module,
which loads features, which creates an autoloader, which calls the
absolute_path?  method.  At this point, requiring puppet is not needed.

However, if an external subcommand was specified, e.g.  `puppet foo`,
where `puppet-foo` is an external executable, or if no subcommand was
specified, e.g.  `puppet`, the CommandLine would attempt to resolve the
external subcommand using Puppet::Util.which, which calls absolute_path?
at a time when the Puppet module and features haven't been loaded,
causing #17458.

Ideally, the exceptional cases should be requiring puppet rather than
relying on the absolute_path?  method to do so.  However, in 3.x, this
entire logic has been reworked.  In 3.x, the default confdir/vardir
locations are solely based on whether we're running as root or not, and
not the application's run_mode setting.  As a result, we can and do
require puppet early on.

For 2.7.x, the safest thing is to revert the change in the require
'puppet' behavior.
(#17458) Add acceptance test for executing external subcommands

Commit 20efe94 broke running `puppet` and `puppet-*` external
subcommands. This adds an acceptance test to make sure puppet doesn't
blow up when given an unknown external subcommand.

Paired-with: Josh Cooper <josh@puppetlabs.com>
Merge pull request #1271 from joshcooper/ticket/2.7.x/17458-undo-performance-fix

(#17458) Undo minor performance change in 2.7.x
Update lib/puppet/version.rb for 2.7.20-rc1
Update lib/puppet/version.rb for 2.7.20
(#17820) Avoid allocating and copying hashes unnecessarily

Commit 737c2f66 was implemented to ensure portability with ruby 1.8.5,
but in doing so, it caused severe performance problems, likely due to
allocating a hash, and then merging that, and returning a copy of the
merged hashes.

This commit eliminates the performance issue by not attempting to
merge the hashes, while maintaining compatibility with ruby 1.8.5.

The original code implemented in commit 7002eff7 should be restored in
3.x as that is even faster than this commit, but does not maintain
compatibility with ruby 1.8.5.

Reviewed-by: Josh Cooper <josh@puppetlabs.com>
Merge branch 'ticket/2.7.x/17820-slow-eval-generate' into 2.7.x

* ticket/2.7.x/17820-slow-eval-generate:
  (#17820) Avoid allocating and copying hashes unnecessarily