Module: Pkg::Util::Windows

Defined in:
lib/packaging/util/windows.rb

Class Method Summary collapse

Class Method Details



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/packaging/util/windows.rb', line 7

def add_msi_links(local_source_directory)
  {
    'windows' => ['x86', 'x64'],
    'windowsfips' => ['x64']
  }.each_pair do |platform, archs|
    packages = Dir["#{local_source_directory}/#{platform}/*"]

    archs.each do |arch|
      package_version = Pkg::Util::Git.describe.tr('-', '.')
      package_filename = File.join(
        local_source_directory, platform,
        "#{Pkg::Config.project}-#{package_version}-#{arch}.msi"
      )
      link_filename = File.join(
        local_source_directory,
        platform,
        "#{Pkg::Config.project}-#{arch}.msi"
      )

      next unless !packages.include?(link_filename) && packages.include?(package_filename)

      # Dear future code spelunkers:
      # Using symlinks instead of hard links causes failures when we try
      # to set these files to be immutable. Also be wary of whether the
      # linking utility you're using expects the source path to be relative
      # to the link target or pwd.
      FileUtils.ln(package_filename, link_filename)
    end
  end
end