Skip to content

package #

package

This module handles both parsing the published Arch tarballs & the contents of their .PKGINFO files, as well as generating the contents of the database archives' desc & files files.

fn format_entry #

fn format_entry(key string, value string) string

format_entry returns a string properly formatted to be added to a desc file.

fn parse_pkg_info_string #

fn parse_pkg_info_string(pkg_info_str &string) !PkgInfo

parse_pkg_info_string parses a PkgInfo object from a string

fn read_pkg_archive #

pub fn read_pkg_archive(pkg_path string) !Pkg

read_pkg_archive extracts the file list & .PKGINFO contents from an archive NOTE: this command only supports zstd-, xz- & gzip-compressed tarballs.

struct PkgInfo #

struct PkgInfo {
pub mut:
// Single values
	name        string
	base        string
	version     string
	description string
	size        i64
	csize       i64
	url         string
	arch        string
	build_date  i64
	packager    string
// md5sum      string
// sha256sum   string
	pgpsig     string
	pgpsigsize i64
// Array values
	groups       []string
	licenses     []string
	replaces     []string
	depends      []string
	conflicts    []string
	provides     []string
	optdepends   []string
	makedepends  []string
	checkdepends []string
}

Represents the contents of a .PKGINFO file

struct Pkg #

pub struct Pkg {
pub:
	path        string   [required]
	info        PkgInfo  [required]
	files       []string [required]
	compression int      [required]
}

Represents a read archive

fn (Pkg) checksum #

pub fn (p &Pkg) checksum() !string

checksum calculates the sha256 hash of the package

fn (Pkg) filename #

pub fn (pkg &Pkg) filename() string

filename returns the correct filename of the package file

fn (Pkg) full_name #

pub fn (pkg &Pkg) full_name() string

full_name returns the properly formatted name for the package, including version & architecture

fn (Pkg) to_desc #

pub fn (pkg &Pkg) to_desc() !string

to_desc returns a desc file valid string representation

fn (Pkg) to_files #

pub fn (pkg &Pkg) to_files() string

to_files returns a files file valid string representation