pack

package
v0.0.0-...-0376054 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

README

Pack

This library provides API's for pack specific operations, that can't be done with pacman. It has 4 main functions:

  • Build() - for package builds
  • Open() - starts pack registry registry
  • Push() - pushes packages to pack registry
  • Sync() - syncronizes packages with pack registries

Examples:


import "fmnx.su/core/pack/pack"

func main() {
    err := pack.Sync(args(), pack.SyncParameters{
        Quick:     true,
        Refresh:   true,
        Stdout:    os.Stdout,
        Stderr:    os.Stderr,
        Stdin:     os.Stdin,
        ...
    })
}


import "fmnx.su/core/pack/pack"

func main() {
    err := pack.Push(args(), pack.SyncParameters{
        Directory: opts.Dir,
        Protocol:  opts.Protocol,
        Endpoint:  opts.Endpoint,
        ...
    })
}


import "fmnx.su/core/pack/pack"

func main() {
    err := pack.Open(args(), pack.SyncParameters{
        Stdout:   os.Stdout,
        Stderr:   os.Stderr,
        Stdin:    os.Stdin,
        Endpoint: "/custom/endpoint",
        Dir:      "/pkg/cache/dir",
        Name:     "domain.su",
        Port:     "80",
        Cert:     "/path/to/cert.pem",
        Key:      "/path/to/key.pem",
        GpgDir:   "/custom/gpg/dir",
    })
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assist

func Assist(args []string, prms ...AssistParameters) error

func Build

func Build(args []string, prms ...BuildParameters) error

Build package in current directory with provided arguements.

func CachePackage

func CachePackage(src, dst string) error

Move package and signature files to cache location defined by user.

func CheckGnuPG

func CheckGnuPG() error

Ensure, that user have created gnupg keys for package signing before package is built and cached.

func CloneOrPullDir

func CloneOrPullDir(outw, errw io.Writer, repo string) (string, error)

This function will clone provided repository to cache directory and return name of that directory.

func EjectLastPathArg

func EjectLastPathArg(s string) string

Eject last name from directory or link.

func Export

func Export(o io.Writer, e io.Writer) error

Export public GPG key, which can be added to gitea/gitlab/github.

func FilterFilenames

func FilterFilenames(filenames []string, pkg string) ([]string, error)

Filter filenames related to required package.

func Fix

func Fix() error

Check/Fix compatability of identities in git, gpg and makepkg.

func FlutterTemplate

func FlutterTemplate() error

Function generates project template for flutter desktop application based on current directory name and identity in GnuPG.

func GnuPGidentity

func GnuPGidentity() (string, error)

Returns name and email from GnuPG. Error, if did not succeed.

func GoCliTemplate

func GoCliTemplate() error

Function generates project template for go cli utility based on current directory name and identity in GnuPG.

func Push

func Push(args []string, prms ...PushParameters) error

Push your package to registry.

func Query

func Query(args []string, prms ...QueryParameters) error

func Remove

func Remove(args []string, prms ...RemoveParameters) error

func Sync

func Sync(args []string, prms ...SyncParameters) error

Syncronize provided packages with provided parameters.

func ValidateGitUser

func ValidateGitUser() error

func ValidatePackager

func ValidatePackager() error

Validate, that packager defined in /etc/makepkg.conf matches signer authority in GnuPG.

Types

type AssistParameters

type AssistParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Export existing GnuPG key armored string.
	Export bool
	// Check compatability of identities across git, gpg and makepkg.
	Fix bool
	// Generate flutter template.
	Flutter bool
	// Generate go cli utility template.
	Gocli bool
}

Parameters for util.

type BuildParameters

type BuildParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Directory where resulting package and signature will be moved.
	Dir string
	// Do not ask for any confirmation on build/installation.
	Quick bool
	// Syncronize/reinstall package after build.
	Syncbuild bool
	// Remove dependencies after successful build.
	Rmdeps bool
	// Do not clean workspace before and after build.
	Garbage bool
}

Parameters that can be used to build packages.

type PackageMetadata

type PackageMetadata struct {
	Name     string
	FileName string
	Addr     string
	Owner    string
}

type PushParameters

type PushParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Directory to read package files and signatures.
	Directory string
	// Which protocol to use for connection.
	Insecure bool
	// Custom distribution for which package is built.
	Distro string
}

Parameters that will be used to execute push command.

type QueryParameters

type QueryParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// List outdated packages.
	Outdated bool
	// Get information about package.
	Info []bool
	// List package files.
	List []bool
}

Parameters that will be used to execute push command.

type RemoveParameters

type RemoveParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Ask for confirmation when deleting package.
	Confirm bool
	// Leave package dependencies in the system (removed by default).
	Norecursive bool
	// Leave package configs in the system (removed by default).
	Nocfgs bool
	// Remove packages and all packages that depend on them.
	Cascade bool
	// Use insecure connection for remote deletions.
	Insecure bool
}

type SyncParameters

type SyncParameters struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader

	// Download fresh package databases from the server (-yy force)
	Refresh []bool
	// Upgrade installed packages (-uu enables downgrade)
	Upgrade []bool
	// Don't ask for any confirmation (--noconfirm)
	Quick bool
	// Reinstall up to date targets
	Force bool
	// Use HTTP instead of https
	Insecure bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL