rpmpack

package module
v0.0.0-...-cfc46b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

README

rpmpack (tar2rpm) - package rpms the easy way

Disclaimer

This is not an official Google product, it is just code that happens to be owned by Google.

Overview

tar2rpm is a tool that takes a tar and outputs an rpm. rpmpack is a golang library to create rpms. Both are written in pure go, without using rpmbuild or spec files. API documentation for rpmpack can be found in GoDoc.

Installation

$ go get -u github.com/google/rpmpack/...

This will make the tar2rpm tool available in ${GOPATH}/bin, which by default means ~/go/bin.

Usage

tar2rpm takes a tar file (from stdin or a specified filename), and outputs an rpm.

Usage:
  tar2rpm [OPTION] [FILE]
Options:
  -file FILE
        write rpm to FILE instead of stdout
  -name string
        the package name
  -release string
        the rpm release
  -version string
        the package version

Features

  • You put files into the rpm, so that rpm/yum will install them on a host.
  • Simple.
  • No spec files.
  • Does not build anything.
  • Does not try to auto-detect dependencies.
  • Does not try to magically deduce on which computer architecture you run.
  • Does not require any rpm database or other state, and does not use the filesystem.

Downsides

  • Is not related to the team the builds rpmlib.
  • May easily wreak havoc on rpm based systems. It is surprisingly easy to cause rpm to segfault on corrupt rpm files.
  • Many features are missing.
  • All of the artifactes are stored in memory, sometimes more than once.
  • Less backwards compatible than rpmbuild.

Philosophy

Sometimes you just want files to make it to hosts, and be managed by the package manager. rpmbuild can use a spec file, together with a specific directory layout and local database, to build/install/package your files. But you don't need all that. You want something similar to tar.

As the project progresses, we must maintain the complexity/value ratio. This includes both code complexity and interface complexity.

Disclaimer

This is not an official Google product, it is just code that happens to be owned by Google.

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

This section is empty.

Variables

View Source
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 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 FromTar

func FromTar(inp io.Reader, md RPMMetaData) (*RPM, error)

FromTar reads a tar file and creates an rpm stuct.

func NewRPM

func NewRPM(m RPMMetaData) (*RPM, error)

NewRPM creates and returns a new RPM struct.

func (*RPM) AddFile

func (r *RPM) AddFile(f RPMFile) error

AddFile adds an RPMFile to an existing rpm.

func (*RPM) Write

func (r *RPM) Write(w io.Writer) error

Write closes the rpm and writes the whole rpm to an io.Writer

type RPMFile

type RPMFile struct {
	Name  string
	Body  []byte
	Mode  uint
	Owner string
	Group string
	MTime uint32
}

RPMFile contains a particular file's entry and data.

type RPMMetaData

type RPMMetaData struct {
	Name    string
	Version string
	Release string
}

RPMMetaData contains meta info about the whole package.

Directories

Path Synopsis
cmd
rpmsample
rpmsample creates an rpm file with some known files, which can be used to test rpmpack's output against other rpm implementations.
rpmsample creates an rpm file with some known files, which can be used to test rpmpack's output against other rpm implementations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL