This repository has been archived on 2022-01-17. You can view files and clone it, but cannot push or open issues/pull-requests.
packaging/src/backends/pkgutils.cr

24 lines
778 B
Crystal

require "../backends.cr"
require "baguette-crystal-base"
# This packaging backend only helps to create a package containing the data.
# This serves as the simplest example of packaging system:
# no extra data nor structure in the final archive.
class Package::Backend::Packaging::Pkgutils < Package::Backend::Packaging
def initialize
@name = "pkgutils"
end
def package(pkgdir : String, architecture : String, package : ::Package::Package) : Bool
package_file = pkgdir + "/" + architecture + "/"
package_file += "#{package.name}-#{package.version}-#{package.release}.pkg.tar.xz"
::Baguette::Log.info "#{package.fake_root_directory} -> #{package_file}"
pp! r = Do.run package.fake_root_directory, "tar", ["cJf", package_file, "."]
r.exit_status == 0
end
end