# File lib/fpm/package/pacman.rb, line 241
  def output(output_path)
    output_check(output_path)

    # Copy all files from staging to BUILD dir
    Find.find(staging_path) do |path|
      src = path.gsub(/^#{staging_path}/, '')
      dst = build_path(src)
      copy_entry(path, dst, preserve=true, remove_destination=true)
      copy_metadata(path, dst)
    end

    # This value is used later in the template for PKGINFO
    size = safesystemout("du", "-sk", build_path).split(/\s+/)[0].to_i * 1024
    builddate = Time.new.to_i

    pkginfo = template("pacman.erb").result(binding)
    pkginfo_file = build_path(".PKGINFO")
    File.write(pkginfo_file, pkginfo)

    if script?(:before_install) or script?(:after_install) or \
        script?(:before_upgrade) or script?(:after_upgrade) or \
        script?(:before_remove) or script?(:after_remove)
      install_script = template("pacman/INSTALL.erb").result(binding)
      install_script_file = build_path(".INSTALL")
      File.write(install_script_file, install_script)
    end

    generate_mtree

    File.expand_path(output_path).tap do |path|
      ::Dir.chdir(build_path) do
        safesystem(*([tar_cmd,
                      compression_option,
                      "-cf",
                      path] + data_tar_flags + \
                      ::Dir.entries(".").reject{|entry| entry =~ /^\.{1,2}$/ }))
      end
    end
  end