mpkg

package
v0.0.0-...-b514afd Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Copyright © 2022 Isteevan Shetoo <isteevan.shetoo@is-info.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2022 Isteevan Shetoo <isteevan.shetoo@is-info.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2022 Isteevan Shetoo <isteevan.shetoo@is-info.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright © 2022 Isteevan Shetoo <isteevan.shetoo@is-info.fr>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

View Source
var FileTypes = map[string]string{
	"PREFIX/lib/pkgconfig":   "data",
	"PREFIX/lib64/pkgconfig": "data",
	"PREFIX/lib32/pkgconfig": "data",
	"PREFIX/libexec":         "executable",
	"PREFIX/lib":             "library",
	"PREFIX/share/info":      "info",
	"PREFIX/share/man":       "man",
	"PREFIX/share/doc":       "doc",
	"PREFIX/share/help":      "doc",
	"PREFIX/share/gtk-doc":   "doc",
	"PREFIX/share/locale":    "localedata",
	"PREFIX/include":         "header",
	"PREFIX/bin":             "executable",
	"/bin":                   "executable",
	"PREFIX/sbin":            "executable",
	"/sbin":                  "executable",
	"/etc":                   "config",
}

FileTypes find the type of a file based on its path

View Source
var Macros = map[string]string{
	"$configure":    "./configure ${CONF_OPTS}",
	"$make":         "make -j${NBJOBS-1} ${MAKE_OPTS}",
	"$make_install": "make install DESTDIR=${INSTALL_DIR-${prefix}} ${MAKE_INSTALL_OPTS}",
}
View Source
var PkgConfigDirs = []string{
	"/lib/pkgconfig",
	"/lib64/pkgconfig",
	"/lib32/pkgconfig",
}

PkgConfigDirs the valid path of pkgconfig files

Functions

func CreateDirIfNotExist

func CreateDirIfNotExist(dir string) error

func DeleteEmptyFolder

func DeleteEmptyFolder(folder string) error

func GeFileBaseName

func GeFileBaseName(fileName string) string

func GetCommand

func GetCommand(command string) string

func GetFileType

func GetFileType(path string) string

func GetHash

func GetHash(filepath string) (hash.Hash, error)

func GetHashString

func GetHashString(filepath string) (string, error)

func GetStepsFromMacros

func GetStepsFromMacros(steps []string) ([]string, error)

func IsExit

func IsExit(path string) bool

func IsNotExist

func IsNotExist(path string) bool

func IsPkgConfig

func IsPkgConfig(fpath string) bool

IsPkgConfig check if the file is a package config

func UpdateLineInFile

func UpdateLineInFile(fpath, oldLine, newLine string) error

todo check file why is no readying

func WritePackageXMLFile

func WritePackageXMLFile(rootPath, prefix string) error

Types

type File

type File struct {
	XMLName xml.Name `xml:"File"`
	Path    string   `xml:"Path"`
	Type    string   `xml:"Type"`
	UID     int      `xml:"Uid"`
	GID     int      `xml:"Gid"`
	Mode    string   `xml:"Mode"`
	Hash    string   `xml:"Hash"`
}

File is the description of file within the archive. The archive represent compiled tarball

func NewPackageFile

func NewPackageFile(path, hash, mode, ftype string) *File

NewPackageFile

type PackageDesc

type PackageDesc struct {
	Name        string   `yaml:"name"`
	Version     string   `yaml:"version"`
	Release     string   `yaml:"release"`
	Source      Source   `yaml:"source"`
	Licence     string   `yaml:"licence"`
	HomePage    string   `yaml:"homePage"`
	Summary     string   `yaml:"summary"`
	Description string   `yaml:"description"`
	Setup       []string `yaml:"setup"`
	Build       []string `yaml:"build"`
	Install     []string `yaml:"install"`
}

func (*PackageDesc) Archive

func (s *PackageDesc) Archive(installDir, dest, prefix string) error

func (*PackageDesc) BuildStep

func (s *PackageDesc) BuildStep(shell *Shell, dir string) error

func (*PackageDesc) GetFullName

func (s *PackageDesc) GetFullName() string

func (*PackageDesc) InstallStep

func (s *PackageDesc) InstallStep(shell *Shell, dir string) error

func (*PackageDesc) SetupStep

func (s *PackageDesc) SetupStep(shell *Shell, dir string) error

type Set

type Set struct {
	XMLName xml.Name `xml:"Files"`
	Files   []File   `xml:"File"`
}

Set is the list of file inside the compiled tarball (package)

func CreatePackageXMLFile

func CreatePackageXMLFile(rootPath, prefix string) (*Set, error)

func UnmarshalFilesXML

func UnmarshalFilesXML(rootPath string) (*Set, error)

func (*Set) VerifyIntegrity

func (s *Set) VerifyIntegrity() error

type Shell

type Shell struct {
	Commands []string
}

func NewShell

func NewShell() *Shell

func (*Shell) AddArgs

func (c *Shell) AddArgs(args string)

func (*Shell) Exec

func (c *Shell) Exec(dir string, args []string) error

type Source

type Source struct {
	URI          string `yaml:"uri"`
	Sha256       string `yaml:"sha256"`
	Decompressed bool   `yaml:"decompressed"`
}

Source contains uri and sha256 of the tarball

func (*Source) Download

func (s *Source) Download(filepath string) error

Download Download the tarball

func (*Source) DownloadIfNoCache

func (s *Source) DownloadIfNoCache(filepath string) error

func (*Source) Unpack

func (s *Source) Unpack(filepath string, dest string) error

Unpack unpacks the given compressed file to destination

func (*Source) Verify

func (s *Source) Verify(filepath string) error

Verify verify the sha256 of a file, return error if mismatch

Jump to

Keyboard shortcuts

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