Documentation ¶
Overview ¶
This module provides an API to access and programmatically process Debian `.deb` archives on disk.
Debian files, at a high level, are `ar(1)` archives, which contain a few sections, most notably the `control` member, which contains information about the Debian package itself, and the `data` member, which contains the actual contents of the files, as they should be written out on disk.
Here's a trivial example, which will print out the Package name for a `.deb` archive given on the command line:
package main import ( "log" "os" "github.com/cinello/go-debian/deb" ) func main() { path := os.Args[1] fd, err := os.Open(path) if err != nil { panic(err) } defer fd.Close() debFile, err := deb.Load(fd, path) if err != nil { panic(err) } log.Printf("Package: %s\n", debFile.Control.Package) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ar ¶
type Ar struct {
// contains filtered or unexported fields
}
This struct encapsulates a Debian .deb flavored `ar(1)` archive.
type ArEntry ¶
type ArEntry struct { Name string Timestamp int64 OwnerID int64 GroupID int64 FileMode string Size int64 Data io.Reader }
Container type to access the different parts of a Debian `ar(1)` Archive.
The most interesting parts of this are the `Name` attribute, Data `io.Reader`, and the Tarfile helpers. This will allow the developer to programmatically inspect the information inside without forcing her to unpack the .deb to the filesystem.
func (*ArEntry) IsTarfile ¶
Check to see if the given ArEntry is, in fact, a Tarfile. This method will return `true` for `control.tar.*` and `data.tar.*` files.
This will return `false` for the `debian-binary` file. If this method returns `true`, the `.Tarfile()` method will be around to give you a tar.Reader back.
type Control ¶
type Control struct { control.Paragraph Package string `required:"true"` Source string Version version.Version `required:"true"` Architecture dependency.Arch `required:"true"` Maintainer string `required:"true"` InstalledSize int `control:"Installed-Size"` MultiArch string `control:"Multi-Arch"` Depends dependency.Dependency Recommends dependency.Dependency Suggests dependency.Dependency Breaks dependency.Dependency Replaces dependency.Dependency BuiltUsing dependency.Dependency `control:"Built-Using"` Section string Priority string Homepage string Description string `required:"true"` }
Binary Control format, as exists in the Control section of the `.deb` archive, as defined in Debian Policy, section 5.3, entitled "Binary package control files -- DEBIAN/control".
func (Control) SourceName ¶
type Deb ¶
Container struct to encapsulate a `.deb` file on disk. This contains information about what exactly we're looking at. When loaded. information regarding the Control file is read from the control section of the .deb, and Unmarshaled into the `Control` member of the Struct.
type DecompressorFunc ¶
func DecompressorFor ¶
func DecompressorFor(ext string) DecompressorFunc
DecompressorFn returns a decompressing reader for the specified reader and its corresponding file extension ext.