Documentation
¶
Overview ¶
Package pseudoapt creates rootfs from APT repositories
It is quite limited:
- it does not check package versions
- it does not support multiarch
- it does not resolve virtual packages
- it does not resolve dependencies with alternatives
- it has no support for Conflicts, Replaces and other fields indispensable for long-living Debian/Ubuntu installations.
- it does not run maintainer scripts
However for the limited use-case "populate this rootfs with shared libraries needed by this C++ binary" it works well enough.
It supports caching downloaded files. It supports package filters to cut down optional/unneded dependencies. It supports path filters to cut down unneeded files.
Typical usage:
destDir := "my-rootfs"
cacheDir := "my-cache"
// Load repositories metadata
repo, err := pseudoapt.Load(ctx, cacheDir, apt.Repo{
BaseURL: "https://deb.debian.org/debian",
Distribution: "trixie",
Components: []string{"main"},
Archs: []string{"amd64", "all"},
Keyring: `-----BEGIN PGP PUBLIC KEY BLOCK-----...`,
}, apt.Repo{
BaseURL: "https://security.debian.org/debian-security",
Distribution: "trixie-security",
Components: []string{"main"},
Archs: []string{"amd64", "all"},
Keyring: `-----BEGIN PGP PUBLIC KEY BLOCK-----...`,
}))
// Resolve packages to get the full set
packages, err := pseudoapt.DependenciesClosure(repo, []string{
// Packages
"libc-bin", // ld.so.conf
"bash", // target package
}, []string{
// Excludes
"awk", // Virtual package, used only by maintainer scripts
"debianutils", // Used only by maintainer scripts
}
// Install the packages into destDir
err = Copy(ctx, repo, packages, destDir, ContainerExcludes)
// ... Populate rootfs from other sources
// Perform finalizations
err = Finalize(destDir)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ContainerExcludes = []string{
"usr/share/common-licenses",
"usr/share/doc",
"usr/share/doc-base",
"usr/share/info",
"usr/share/man",
"usr/share/locale",
"usr/share/X11/locale",
"etc/default",
"etc/pam.d",
"etc/skel",
"etc/ufw",
"usr/share/applications",
"usr/share/apport",
"usr/share/base-files",
"usr/share/gcc/python",
"usr/share/gdb",
"usr/share/debianutils",
"usr/share/lintian",
"usr/share/menu",
"usr/share/pixmaps",
"etc/init.d",
"etc/runit",
"etc/sv",
"etc/update-motd.d",
"usr/lib/sysusers.d",
"usr/lib/tmpfiles.d",
"usr/lib/systemd",
"usr/share/runit",
"var/log",
}
ContainerExcludes is a set of excludes that match files unneeded in containers
Functions ¶
func Copy ¶
func Copy(ctx context.Context, repos *Repos, packages []string, destDir string, excludes []string) error
Copy copies a set of packages from the repository to the destdir
func DependenciesClosure ¶
func DependenciesClosure(repos *Repos, seedPackages []string, skipPackages []string) ([]string, error)
DependenciesClosure adds to the seed packages all their dependencies
The resolution is not complete, see the package documentation.
Packages from skipPackages are skipped, this allows one to cut down dependency trees for optional functionality.
Types ¶
type Repos ¶
type Repos struct {
// contains filtered or unexported fields
}
Repos contains APT repositories
Directories
¶
| Path | Synopsis |
|---|---|
|
Package debversion is a pure-go implementation of dpkg version string functions (parsing, comparison) which is compatible with dpkg(1).
|
Package debversion is a pure-go implementation of dpkg version string functions (parsing, comparison) which is compatible with dpkg(1). |