Documentation ¶
Index ¶
Constants ¶
const ( // TypeFile is the type of a regular file. This is also the type that is // implied when no type is specified. TypeFile = "file" // TypeDir is the type of a directory that is explicitly added in order to // declare ownership or non-standard permission. TypeDir = "dir" /// TypeImplicitDir is the type of a directory that is implicitly added as a //parent of a file. TypeImplicitDir = "implicit dir" // TypeTree is the type of a whole directory tree structure. TypeTree = "tree" // TypeSymlink is the type of a symlink that is created at the destination // path and points to the source path. TypeSymlink = "symlink" // TypeConfig is the type of a configuration file that may be changed by the // user of the package. TypeConfig = "config" // TypeConfigNoReplace is like TypeConfig with an added noreplace directive // that is respected by RPM-based distributions. For all other packages it // is handled exactly like TypeConfig. TypeConfigNoReplace = "config|noreplace" // TypeGhost is the type of an RPM ghost file which is ignored by other packagers. TypeRPMGhost = "ghost" // TypeRPMDoc is the type of an RPM doc file which is ignored by other packagers. TypeRPMDoc = "doc" // TypeRPMLicence is the type of an RPM licence file which is ignored by other packagers. TypeRPMLicence = "licence" // TypeRPMLicense a different spelling of TypeRPMLicence. TypeRPMLicense = "license" // TypeRPMReadme is the type of an RPM readme file which is ignored by other packagers. TypeRPMReadme = "readme" // TypeDebChangelog is the type of a Debian changelog archive file which is // ignored by other packagers. This type should never be set for a content // entry as it is automatically added when a changelog is configred. TypeDebChangelog = "debian changelog" )
Variables ¶
var ErrContentCollision = fmt.Errorf("content collision")
Functions ¶
func AsExplicitRelativePath ¶ added in v2.27.0
As relative path converts a path to an explicitly relative path starting with a dot (e.g. it converts /foo -> ./foo).
func AsRelativePath ¶ added in v2.27.0
AsRelativePath converts a path to a relative path without a "./" prefix. This function leaves trailing slashes to indicate that the path refers to a directory.
func NormalizeAbsoluteDirPath ¶ added in v2.27.0
normalizeFirPath is linke NormalizeAbsoluteFilePath with a trailing slash.
func NormalizeAbsoluteFilePath ¶ added in v2.27.0
NormalizeAbsoluteFilePath returns an absolute cleaned path separated by slashes.
Types ¶
type Content ¶
type Content struct { Source string `yaml:"src,omitempty" json:"src,omitempty"` Destination string `yaml:"dst" json:"dst"` Type string `` /* 148-byte string literal not displayed */ Packager string `yaml:"packager,omitempty" json:"packager,omitempty"` FileInfo *ContentFileInfo `yaml:"file_info,omitempty" json:"file_info,omitempty"` }
Content describes the source and destination of one file to copy into a package.
func (*Content) WithFileInfoDefaults ¶
type ContentFileInfo ¶
type ContentFileInfo struct { Owner string `yaml:"owner,omitempty" json:"owner,omitempty"` Group string `yaml:"group,omitempty" json:"group,omitempty"` Mode os.FileMode `yaml:"mode,omitempty" json:"mode,omitempty"` MTime time.Time `yaml:"mtime,omitempty" json:"mtime,omitempty"` Size int64 `yaml:"-" json:"-"` }
type Contents ¶
type Contents []*Content
Contents list of Content to process.
func PrepareForPackager ¶ added in v2.27.0
func PrepareForPackager(rawContents Contents, packager string, disableGlobbing bool) (Contents, error)
PrepareForPackager performs the following steps to prepare the contents for the provided packager:
- It filters out content that is irrelevant for the specified packager
- It expands globs (if enabled) and file trees
- It adds implicit directories (parent directories of files)
- It adds ownership and other file information if not specified directly
- It normalizes content source paths to be unix style paths
- It normalizes content destination paths to be absolute paths with a trailing slash if the entry is a directory
If no packager is specified, only the files that are relevant for any packager are considered.