*: import paths and a README
This will make the packaages/components individually more consumable Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
b52074c355
commit
9a67c61b15
37 changed files with 65 additions and 54 deletions
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
pkg/ is a collection of utility packages started by the Docker project without being specific to its internals.
|
||||||
|
|
||||||
|
Utility packages are kept separate from the docker core codebase to keep it as small and concise as possible.
|
||||||
|
If some utilities grow larger and their APIs stabilize, they may be moved to their own repository under the
|
||||||
|
Docker organization, to facilitate re-use by other projects. However that is not the priority.
|
||||||
|
|
||||||
|
The `pkg` name is after the same directory in the camlistore project. Since Brad is a core
|
||||||
|
Go maintainer, we thought it made sense to copy his methods for organizing Go code :) Thanks Brad!
|
||||||
|
|
||||||
|
Because utility packages are small and neatly separated from the rest of the codebase, they are a good
|
||||||
|
place to start for aspiring maintainers and contributors. Get in touch if you want to help maintain them!
|
|
@ -18,12 +18,12 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/fileutils"
|
"github.com/containers/pkg/fileutils"
|
||||||
"github.com/containers/storage/pkg/idtools"
|
"github.com/containers/pkg/idtools"
|
||||||
"github.com/containers/storage/pkg/ioutils"
|
"github.com/containers/pkg/ioutils"
|
||||||
"github.com/containers/storage/pkg/pools"
|
"github.com/containers/pkg/pools"
|
||||||
"github.com/containers/storage/pkg/promise"
|
"github.com/containers/pkg/promise"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
|
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fixVolumePathPrefix does platform specific processing to ensure that if
|
// fixVolumePathPrefix does platform specific processing to ensure that if
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCanonicalTarNameForPath(t *testing.T) {
|
func TestCanonicalTarNameForPath(t *testing.T) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/longpath"
|
"github.com/containers/pkg/longpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fixVolumePathPrefix does platform specific processing to ensure that if
|
// fixVolumePathPrefix does platform specific processing to ensure that if
|
||||||
|
|
|
@ -14,9 +14,9 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/idtools"
|
"github.com/containers/pkg/idtools"
|
||||||
"github.com/containers/storage/pkg/pools"
|
"github.com/containers/pkg/pools"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ChangeType represents the change type.
|
// ChangeType represents the change type.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// walker is used to implement collectFileInfoForChanges on linux. Where this
|
// walker is used to implement collectFileInfoForChanges on linux. Where this
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func collectFileInfoForChanges(oldDir, newDir string) (*FileInfo, *FileInfo, error) {
|
func collectFileInfoForChanges(oldDir, newDir string) (*FileInfo, *FileInfo, error) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func max(x, y int) int {
|
func max(x, y int) int {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package archive
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Errors used or returned by this file.
|
// Errors used or returned by this file.
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/idtools"
|
"github.com/containers/pkg/idtools"
|
||||||
"github.com/containers/storage/pkg/pools"
|
"github.com/containers/pkg/pools"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be
|
// UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/ioutils"
|
"github.com/containers/pkg/ioutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApplyLayerInvalidFilenames(t *testing.T) {
|
func TestApplyLayerInvalidFilenames(t *testing.T) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/idtools"
|
"github.com/containers/pkg/idtools"
|
||||||
)
|
)
|
||||||
|
|
||||||
var chrootArchiver = &archive.Archiver{Untar: Untar}
|
var chrootArchiver = &archive.Archiver{Untar: Untar}
|
||||||
|
|
|
@ -13,9 +13,9 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/reexec"
|
"github.com/containers/pkg/reexec"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -12,8 +12,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/reexec"
|
"github.com/containers/pkg/reexec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// untar is the entry-point for storage-untar on re-exec. This is not used on
|
// untar is the entry-point for storage-untar on re-exec. This is not used on
|
||||||
|
|
|
@ -3,8 +3,8 @@ package chrootarchive
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/longpath"
|
"github.com/containers/pkg/longpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// chroot is not supported by Windows
|
// chroot is not supported by Windows
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/mount"
|
"github.com/containers/pkg/mount"
|
||||||
)
|
)
|
||||||
|
|
||||||
// chroot on linux uses pivot_root instead of chroot
|
// chroot on linux uses pivot_root instead of chroot
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package chrootarchive
|
package chrootarchive
|
||||||
|
|
||||||
import "github.com/containers/storage/pkg/archive"
|
import "github.com/containers/pkg/archive"
|
||||||
|
|
||||||
// ApplyLayer parses a diff in the standard layer format from `layer`,
|
// ApplyLayer parses a diff in the standard layer format from `layer`,
|
||||||
// and applies it to the directory `dest`. The stream `layer` can only be
|
// and applies it to the directory `dest`. The stream `layer` can only be
|
||||||
|
|
|
@ -12,9 +12,9 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/reexec"
|
"github.com/containers/pkg/reexec"
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
type applyLayerResponse struct {
|
type applyLayerResponse struct {
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/archive"
|
"github.com/containers/pkg/archive"
|
||||||
"github.com/containers/storage/pkg/longpath"
|
"github.com/containers/pkg/longpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// applyLayerHandler parses a diff in the standard layer format from `layer`, and
|
// applyLayerHandler parses a diff in the standard layer format from `layer`, and
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/reexec"
|
"github.com/containers/pkg/reexec"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int, mkAll, chownExisting bool) error {
|
func mkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int, mkAll, chownExisting bool) error {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package idtools
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/system"
|
"github.com/containers/pkg/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Platforms such as Windows do not support the UID/GID concept. So make this
|
// Platforms such as Windows do not support the UID/GID concept. So make this
|
||||||
|
|
|
@ -15,7 +15,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/stringutils"
|
"github.com/containers/pkg/stringutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetExitCode returns the ExitStatus of the specified error if its type is
|
// GetExitCode returns the ExitStatus of the specified error if its type is
|
||||||
|
|
|
@ -5,7 +5,7 @@ package ioutils
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/longpath"
|
"github.com/containers/pkg/longpath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format.
|
// TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
flag "github.com/containers/storage/pkg/mflag"
|
flag "github.com/containers/pkg/mflag"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
// Define flags using flag.String(), Bool(), Int(), etc.
|
// Define flags using flag.String(), Bool(), Int(), etc.
|
||||||
//
|
//
|
||||||
// This declares an integer flag, -f or --flagname, stored in the pointer ip, with type *int.
|
// This declares an integer flag, -f or --flagname, stored in the pointer ip, with type *int.
|
||||||
// import "flag /github.com/containers/storage/pkg/mflag"
|
// import "flag /github.com/containers/pkg/mflag"
|
||||||
// var ip = flag.Int([]string{"f", "-flagname"}, 1234, "help message for flagname")
|
// var ip = flag.Int([]string{"f", "-flagname"}, 1234, "help message for flagname")
|
||||||
// If you like, you can bind the flag to a variable using the Var() functions.
|
// If you like, you can bind the flag to a variable using the Var() functions.
|
||||||
// var flagvar int
|
// var flagvar int
|
||||||
|
@ -92,7 +92,7 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/homedir"
|
"github.com/containers/pkg/homedir"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
|
// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/storage/pkg/plugins/transport"
|
"github.com/containers/pkg/plugins/transport"
|
||||||
"github.com/docker/go-connections/sockets"
|
"github.com/docker/go-connections/sockets"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/plugins/transport"
|
"github.com/containers/pkg/plugins/transport"
|
||||||
"github.com/docker/go-connections/tlsconfig"
|
"github.com/docker/go-connections/tlsconfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
|
|
||||||
aliasedio "io"
|
aliasedio "io"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/plugins/pluginrpc-gen/fixtures/otherfixture"
|
"github.com/containers/pkg/plugins/pluginrpc-gen/fixtures/otherfixture"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/ioutils"
|
"github.com/containers/pkg/ioutils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/random"
|
"github.com/containers/pkg/random"
|
||||||
)
|
)
|
||||||
|
|
||||||
const shortLen = 12
|
const shortLen = 12
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/storage/pkg/random"
|
"github.com/containers/pkg/random"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.
|
// GenerateRandomAlphaOnlyString generates an alphabetical random string with length n.
|
||||||
|
|
Loading…
Reference in a new issue