pkgbuild

package module
Version: v0.0.0-...-1f52fd9 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: GPL-3.0 Imports: 7 Imported by: 5

README

GoDoc

goPKGBUILD

A golang package for parsing Arch Linux .SRCINFO files (PKGBUILDs).

TODO

  • Handle split PKGBUILDs like linux
  • Try to parse maintainer from top of PKGBUILD
  • Handle multiple dependency versions
  • Add support for reading a .SRCINFO file directly
  • Update to pacman 4.2

Usage

Godoc

Example usage

package main

import (
    "fmt"

    "github.com/mikkeloscar/gopkgbuild"
)

func main() {
    pkgb, err := ParseSRCINFO("/path/to/.SRCINFO")
    if err != nil {
        fmt.Println(err)
    }

    for _, subPkg := range pkgb.Pkgnames {
       fmt.Printf("Package name: %s", subPkg)
    }
}

LICENSE

Copyright (C) 2016 Mikkel Oscar Lyderik Larsen

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompleteVersion

type CompleteVersion struct {
	Version Version
	Epoch   uint8
	Pkgrel  Version
}

func NewCompleteVersion

func NewCompleteVersion(s string) (*CompleteVersion, error)

NewCompleteVersion creates a CompleteVersion including basic version, epoch and rel from string

func (*CompleteVersion) Equal

func (a *CompleteVersion) Equal(b *CompleteVersion) bool

Equal returns true if a is equal to the argument version

func (*CompleteVersion) Newer

func (a *CompleteVersion) Newer(b *CompleteVersion) bool

Newer returns true if a is newer than the argument version

func (*CompleteVersion) Older

func (a *CompleteVersion) Older(b *CompleteVersion) bool

Older returns true if a is older than the argument version

func (*CompleteVersion) Satisfies

func (version *CompleteVersion) Satisfies(dep *Dependency) bool

Satisfies tests whether or not version fits inside the bounds specified by dep

func (*CompleteVersion) String

func (c *CompleteVersion) String() string

type Dependency

type Dependency struct {
	Name   string           // dependency name
	MinVer *CompleteVersion // min version

	MaxVer *CompleteVersion // max version
	// contains filtered or unexported fields
}

Dependency describes a dependency with min and max version, if any.

func ParseDeps

func ParseDeps(deps []string) ([]*Dependency, error)

ParseDeps parses a string slice of dependencies into a slice of Dependency objects.

func (*Dependency) Restrict

func (a *Dependency) Restrict(b *Dependency) *Dependency

Restrict merges two dependencies together into a new dependency where the conditions of both a and b are met

func (*Dependency) String

func (dep *Dependency) String() string

type PKGBUILD

type PKGBUILD struct {
	Pkgnames     []string
	Pkgver       Version // required
	Pkgrel       Version // required
	Pkgdir       string
	Epoch        int
	Pkgbase      string
	Pkgdesc      string
	Arch         []string // required
	URL          string
	License      []string // recommended
	Groups       []string
	Depends      []*Dependency
	Optdepends   []string
	Makedepends  []*Dependency
	Checkdepends []*Dependency
	Provides     []string
	Conflicts    []string
	Replaces     []string
	Backup       []string
	Options      []string
	Install      string
	Changelog    string
	Source       []string
	Noextract    []string
	Md5sums      []string
	Sha1sums     []string
	Sha224sums   []string
	Sha256sums   []string
	Sha384sums   []string
	Sha512sums   []string
	B2sums       []string
	Validpgpkeys []string
}

PKGBUILD is a struct describing a parsed PKGBUILD file. Required fields are:

pkgname
pkgver
pkgrel
arch
(license) - not required but recommended

parsing a PKGBUILD file without these fields will fail

func MustParseSRCINFO

func MustParseSRCINFO(path string) *PKGBUILD

MustParseSRCINFO must parse the .SRCINFO given by path or it will panic

func ParseSRCINFO

func ParseSRCINFO(path string) (*PKGBUILD, error)

ParseSRCINFO parses .SRCINFO file given by path. This is a safe alternative to ParsePKGBUILD given that a .SRCINFO file is available

func ParseSRCINFOContent

func ParseSRCINFOContent(content []byte) (*PKGBUILD, error)

ParseSRCINFOContent parses a .SRCINFO formatted byte slice. This is a safe alternative to ParsePKGBUILD given that the .SRCINFO content is available

func (*PKGBUILD) BuildDepends

func (p *PKGBUILD) BuildDepends() []*Dependency

BuildDepends is Depends, MakeDepends and CheckDepends combined.

func (*PKGBUILD) CompleteVersion

func (p *PKGBUILD) CompleteVersion() CompleteVersion

CompleteVersion returns a Complete version struct including version, rel and epoch.

func (*PKGBUILD) IsDevel

func (p *PKGBUILD) IsDevel() bool

IsDevel returns true if package contains devel packages (-{bzr,git,svn,hg}) TODO: more robust check.

func (*PKGBUILD) Newer

func (p *PKGBUILD) Newer(p2 *PKGBUILD) bool

Newer is true if p has a higher version number than p2

func (*PKGBUILD) Older

func (p *PKGBUILD) Older(p2 *PKGBUILD) bool

Older is true if p has a smaller version number than p2

func (*PKGBUILD) Version

func (p *PKGBUILD) Version() string

Version returns the full version of the PKGBUILD (including epoch and rel)

type Version

type Version string

Version string

Jump to

Keyboard shortcuts

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