Documentation
¶
Overview ¶
Package rpmpack packs files to rpm files. It is designed to be simple to use and deploy, not requiring any filesystem access to create rpm files.
Index ¶
- Constants
- Variables
- type FileType
- type IndexEntry
- func EntryBytes(value []byte) IndexEntry
- func EntryInt16(value []int16) IndexEntry
- func EntryInt32(value []int32) IndexEntry
- func EntryString(value string) IndexEntry
- func EntryStringSlice(value []string) IndexEntry
- func EntryUint16(value []uint16) IndexEntry
- func EntryUint32(value []uint32) IndexEntry
- type RPM
- func (r *RPM) AddCustomSig(tag int, e IndexEntry)
- func (r *RPM) AddCustomTag(tag int, e IndexEntry)
- func (r *RPM) AddFile(f RPMFile)
- func (r *RPM) AddPostin(s string)
- func (r *RPM) AddPosttrans(s string)
- func (r *RPM) AddPostun(s string)
- func (r *RPM) AddPrein(s string)
- func (r *RPM) AddPretrans(s string)
- func (r *RPM) AddPreun(s string)
- func (r *RPM) AllowListDirs(allowList map[string]bool)
- func (r *RPM) FullVersion() string
- func (r *RPM) SetPGPSigner(f func([]byte) ([]byte, error))
- func (r *RPM) Write(w io.Writer) error
- type RPMFile
- type RPMMetaData
- type Relation
- type Relations
Constants ¶
const ( SenseAny rpmSense = 0 SenseLess = 1 << iota SenseGreater SenseEqual )
SenseAny (0) specifies no specific version compare SenseLess (2) specifies less then the specified version SenseGreater (4) specifies greater then the specified version SenseEqual (8) specifies equal to the specified version
Variables ¶
var ( // ErrWriteAfterClose is returned when a user calls Write() on a closed rpm. ErrWriteAfterClose = errors.New("rpm write after close") // ErrWrongFileOrder is returned when files are not sorted by name. ErrWrongFileOrder = errors.New("wrong file addition order") )
Functions ¶
This section is empty.
Types ¶
type FileType ¶
type FileType int32
FileType is the type of a file inside a RPM package.
const ( // GenericFile is just a basic file in an RPM GenericFile FileType = 1 << iota >> 1 // ConfigFile is a configuration file, and an existing file should be saved during a // package upgrade operation and not removed during a package removal operation. ConfigFile // DocFile is a file that contains documentation. DocFile // DoNotUseFile is reserved for future use; conforming packages may not use this flag. DoNotUseFile // MissingOkFile need not exist on the installed system. MissingOkFile // NoReplaceFile similar to the ConfigFile, this flag indicates that during an upgrade operation // the original file on the system should not be altered. NoReplaceFile // SpecFile is the package specification file. SpecFile // GhostFile is not actually included in the payload, but should still be considered as a part of the package. // For example, a log file generated by the application at run time. GhostFile // LicenseFile contains the license conditions. LicenseFile // ReadmeFile contains high level notes about the package. ReadmeFile // ExcludeFile is not a part of the package, and should not be installed. ExcludeFile )
https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/pkgformat.html#AEN27560 The RPMFile.Type tag value shall identify various characteristics of the file in the payload that it describes. It shall be an INT32 value consisting of either the value GenericFile (0) or the bitwise inclusive or of one or more of the following values. Some of these combinations may make no sense
type IndexEntry ¶
type IndexEntry struct {
// contains filtered or unexported fields
}
func EntryBytes ¶
func EntryBytes(value []byte) IndexEntry
func EntryInt16 ¶
func EntryInt16(value []int16) IndexEntry
func EntryInt32 ¶
func EntryInt32(value []int32) IndexEntry
func EntryString ¶
func EntryString(value string) IndexEntry
func EntryStringSlice ¶
func EntryStringSlice(value []string) IndexEntry
func EntryUint16 ¶
func EntryUint16(value []uint16) IndexEntry
func EntryUint32 ¶
func EntryUint32(value []uint32) IndexEntry
type RPM ¶
type RPM struct { RPMMetaData // contains filtered or unexported fields }
RPM holds the state of a particular rpm file. Please use NewRPM to instantiate it.
func (*RPM) AddCustomSig ¶
func (r *RPM) AddCustomSig(tag int, e IndexEntry)
AddCustomSig adds or overwrites a signature tag value.
func (*RPM) AddCustomTag ¶
func (r *RPM) AddCustomTag(tag int, e IndexEntry)
AddCustomTag adds or overwrites a tag value in the index.
func (*RPM) AddPosttrans ¶
AddPosttrans adds a posttrans scriptlet
func (*RPM) AllowListDirs ¶
AllowListDirs removes all directories which are not explicitly allowlisted.
func (*RPM) FullVersion ¶
FullVersion properly combines version and release fields to a version string
func (*RPM) SetPGPSigner ¶
SetPGPSigner registers a function that will accept the header and payload as bytes, and return a signature as bytes. The function should simulate what gpg does, probably by using golang.org/x/crypto/openpgp or by forking a gpg process.
type RPMFile ¶
type RPMFile struct { Name string Body []byte Mode uint Owner string Group string MTime uint32 Type FileType FullName string }
RPMFile contains a particular file's entry and data.
type RPMMetaData ¶
type RPMMetaData struct { Name, Summary, Description, Version, Release, Arch, OS, Vendor, URL, Packager, Group, License, BuildHost, Compressor string Epoch uint32 BuildTime time.Time Provides, Obsoletes, Suggests, Recommends, Requires, Conflicts Relations }
RPMMetaData contains meta info about the whole package.
type Relation ¶
Relation is the structure of rpm sense relationships
func NewRelation ¶
NewRelation parse a string into a Relation
type Relations ¶
type Relations []*Relation
Relations is a slice of Relation pointers
func (*Relations) AddToIndex ¶
AddToIndex add the relations to the specified category on the index
func (*Relations) Set ¶
Set parse a string into a Relation and append it to the Relations slice if it is missing this is used by the flag package