README
¶
createrepo
Package createrepo implements methods for creating and maintaing an RPM repo.
Installation
The recommended way to install createrepo
go get github.com/stianwa/createrepo
Examples
// Package main implements the CLI of createrepo - a program used for
// creating RPM repositories on a local file system.
package main
import (
"createrepo/internal/createrepo"
"flag"
"fmt"
"os"
)
var opt struct {
Group string
Verbose bool
Expunge int64
}
func init() {
flag.String("", "", "Path to repo base")
flag.StringVar(&opt.Group, "g", "", "Comps group `file`")
flag.BoolVar(&opt.Verbose, "v", false, "Verbose output")
flag.Int64Var(&opt.Expunge, "e", 172800, "Expunge dead meta data older than `n` seconds.")
flag.Parse()
}
func main() {
config := &createrepo.Config{WriteConfig: true, CompsFile: opt.Group, ExpungeOldMetadata: opt.Expunge}
for _, arg := range flag.Args() {
r, err := createrepo.NewRepo(arg, config)
if err != nil {
abortProgram("new repo: %v", err)
}
summary, err := r.Create()
if err != nil {
abortProgram("create repo: %v", err)
}
fmt.Println(summary)
}
return
}
func abortProgram(format string, a ...any) {
fmt.Fprintf(os.Stderr, format + "\n", a...)
os.Exit(-1)
}
State
The createrepo module is currently under development. Do not use for production.
License
GPLv3, see LICENSE.md
Documentation
¶
Overview ¶
Package createrepo provides methods for creating and maintaining an RPM repository.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // CompressAlgo specifies which compression algorithm to be // used for compressing the meta files. Supported algorithms // are: xz (default) and gz. CompressAlgo string `yaml:"compressAlgo"` // CompsFile specifies a path to a comps group (yumgroup) // file, if used. CompsFile string `yaml:"compsFile"` // XattrCache specifies whether or not to use XATTRS for // caching RPM meta data. The default is true. XattrCache bool `yaml:"xattrCache"` // ExpungeOldMetadata specifies the time in seconds when old // metadata should be deleted from disk and history. The // default is 172800 (48 hours). ExpungeOldMetadata int64 `yaml:"expungeOldMetadata"` // WriteConfig writes this Config to disk. WriteConfig bool `yaml:"-"` }
Config represents a configuration for repo.
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo represents the repo handler.
Click to show internal directories.
Click to hide internal directories.