Documentation ¶
Overview ¶
Package apt provides utilities for Debian repository indices.
Index ¶
- func ExtractFileInfo(p string, r io.Reader) ([]*FileInfo, Paragraph, error)
- func IsMeta(p string) bool
- func IsSupported(p string) bool
- func SupportByHash(d Paragraph) bool
- type FileInfo
- func (fi *FileInfo) AddPrefix(prefix string) *FileInfo
- func (fi *FileInfo) CalcChecksums(data []byte)
- func (fi *FileInfo) GetLastModified() time.Time
- func (fi *FileInfo) HasChecksum() bool
- func (fi *FileInfo) MD5SumPath() string
- func (fi *FileInfo) MarshalJSON() ([]byte, error)
- func (fi *FileInfo) Path() string
- func (fi *FileInfo) SHA1Path() string
- func (fi *FileInfo) SHA256Path() string
- func (fi *FileInfo) Same(t *FileInfo) bool
- func (fi *FileInfo) SetLastModified(t time.Time)
- func (fi *FileInfo) Size() uint64
- func (fi *FileInfo) UnmarshalJSON(data []byte) error
- type Paragraph
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractFileInfo ¶
ExtractFileInfo parses debian repository index files such as Release, Packages, or Sources and return a list of *FileInfo listed in the file.
If the index is Release, InRelease, or Index, this function also returns non-nil Paragraph data of the index.
p is the relative path of the file.
func IsMeta ¶
IsMeta returns true if p points a debian repository index file containing checksums for other files.
func IsSupported ¶
IsSupported returns true if the meta data is compressed that can be decompressed by ExtractFileInfo.
func SupportByHash ¶
SupportByHash returns true if paragraph from Release indicates support for indices acquisition via hash values (by-hash). See https://wiki.debian.org/DebianRepository/Format#indices_acquisition_via_hashsums_.28by-hash.29
Types ¶
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is a set of meta data of a file.
func CopyWithFileInfo ¶
CopyWithFileInfo copies from src to dst until either EOF is reached on src or an error occurs, and returns FileInfo calculated while copying.
func MakeFileInfoNoChecksum ¶
MakeFileInfoNoChecksum constructs a FileInfo without calculating checksums.
func (*FileInfo) CalcChecksums ¶
CalcChecksums calculates checksums and stores them in fi.
func (*FileInfo) GetLastModified ¶
GetLastModified returns the time when the file was last modified.
func (*FileInfo) HasChecksum ¶
HasChecksum returns true if fi has checksums.
func (*FileInfo) MD5SumPath ¶
MD5SumPath returns the filepath for "by-hash" with md5 checksum. If fi has no checksum, an empty string will be returned.
func (*FileInfo) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*FileInfo) SHA1Path ¶
SHA1Path returns the filepath for "by-hash" with sha1 checksum. If fi has no checksum, an empty string will be returned.
func (*FileInfo) SHA256Path ¶
SHA256Path returns the filepath for "by-hash" with sha256 checksum. If fi has no checksum, an empty string will be returned.
func (*FileInfo) SetLastModified ¶
SetLastModified sets the time when the file was last modified.
func (*FileInfo) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type Paragraph ¶
Paragraph is a mapping between field names and values.
Values are a list of strings. For simple fields, the list has only one element. Newlines are stripped from (multiline) strings. Folded fields are treated just the same as multiline fields.