godeb

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gz

tar zcvf demo.tar.gz com.deepin.appstore

bz2

tar jcvf demo.tar.bz2 com.deepin.appstore

xz

tar Jcvf demo.tar.xz com.deepin.appstore

lzma

tar -cvpf demo.tar.lzma com.deepin.appstore --lzma
sudo tar --lzma -cvpf demo.tar.lzma com.deepin.appstore

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDeb = errors.New("header doesn't look right, mybe not archive")
)

Functions

func LoadAr

func LoadAr(in Reader) (map[string]*ArItem, error)

LoadAr 加载ar归档返回map[string]*ArItem

Types

type ArItem

type ArItem struct {
	Name   string            `json:"name"`
	Ext    string            `json:"ext"`
	Data   *io.SectionReader `json:"-"`
	Offset int64             `json:"offset"`
	Size   int64             `json:"size"`
}

ArItem ar归档中的条目

func (*ArItem) TarFile

func (ar *ArItem) TarFile() (*tar.Reader, io.Closer, error)

TarFile 将ArItem转换成tar实例,以便迭代读取压缩包内容

type Control

type Control = Package

Control Package别名

type Deb

type Deb struct {
	Control    *Control
	Data       *ArItem
	ControlExt string `json:"control_ext"`
	DataExt    string `json:"data_ext"`
	ArItem     map[string]*ArItem
}

Deb deb包结构

func LoadDeb

func LoadDeb(in Reader) (*Deb, error)

LoadDeb 加载deb包,返回*Deb结构

type DecompressFunc

type DecompressFunc func(io.Reader) (io.ReadCloser, error)

DecompressFunc 解压函数

func Decompress

func Decompress(ext string) (DecompressFunc, error)

Decompress 解压器

type Package

type Package struct {
	Package       string            `json:"package" field:"Package"` //mandatory
	Source        string            `json:"source,omitempty" field:"Source"`
	Version       string            `json:"version" field:"Version"`           //mandatory
	Section       string            `json:"section" field:"Section"`           //recommended
	Priority      string            `json:"priority" field:"Priority"`         //recommended
	Architecture  string            `json:"architecture" field:"Architecture"` //mandatory
	Essential     string            `json:"essential,omitempty" field:"Essential"`
	Depends       string            `json:"depends,omitempty" field:"Depends"`
	Recommends    string            `json:"recommends,omitempty" field:"Recommends"`
	Suggests      string            `json:"suggests,omitempty" field:"Suggests"`
	Enhances      string            `json:"enhances,omitempty" field:"Enhances"`
	PreDepends    string            `json:"pre_depends,omitempty" field:"Pre-Depends"`
	InstalledSize int64             `json:"installed_size,omitempty" field:"Installed-Size"`
	Maintainer    string            `json:"maintainer" field:"Maintainer"`   //mandatory
	Description   string            `json:"description" field:"Description"` //mandatory
	Homepage      string            `json:"homepage,omitempty" field:"Homepage"`
	Opts          string            `json:"opts,omitempty" field:"-"`
	Raw           map[string]string `json:"raw,omitempty" field:"-"`
	RawText       string            `json:"-" field:"-"`
}

Package 包头Control解析, 解析为 <key> <-> <value>字典后转换为Package结构体 未识别的字段保存在Opts中, Raw为原始数据 该方法保证不出错地且不校验语法地解析出所有字段 其<key>和<value>均删除了收尾空格(如果有)

func Parse

func Parse(r io.Reader) (*Package, error)

Parse 解析包头Control

type Reader

type Reader interface {
	io.Reader
	io.ReaderAt
}

Jump to

Keyboard shortcuts

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