diff options
author | baude <bbaude@redhat.com> | 2018-04-25 13:26:52 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-04-27 20:51:07 +0000 |
commit | a824186ac9803ef5f7548df790988a4ebd2d9c07 (patch) | |
tree | 63c64e9be4d9c44bd160dd974b740231497eabcd /libpod/buildah/util.go | |
parent | 4e468ce83d69e9748e80eb98a6f5bd3c5114cc7d (diff) | |
download | podman-a824186ac9803ef5f7548df790988a4ebd2d9c07.tar.gz podman-a824186ac9803ef5f7548df790988a4ebd2d9c07.tar.bz2 podman-a824186ac9803ef5f7548df790988a4ebd2d9c07.zip |
Use buildah commit and bud in podman
Vendor in buildah and use as much of commit and bug as possible for podman
build and commit.
Resolves #586
Signed-off-by: baude <bbaude@redhat.com>
Closes: #681
Approved by: mheon
Diffstat (limited to 'libpod/buildah/util.go')
-rw-r--r-- | libpod/buildah/util.go | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/libpod/buildah/util.go b/libpod/buildah/util.go deleted file mode 100644 index 96f9ebf86..000000000 --- a/libpod/buildah/util.go +++ /dev/null @@ -1,67 +0,0 @@ -package buildah - -import ( - "github.com/containers/image/docker/reference" - "github.com/containers/storage" - "github.com/containers/storage/pkg/reexec" - "github.com/pkg/errors" -) - -// InitReexec is a wrapper for reexec.Init(). It should be called at -// the start of main(), and if it returns true, main() should return -// immediately. -func InitReexec() bool { - return reexec.Init() -} - -func copyStringStringMap(m map[string]string) map[string]string { - n := map[string]string{} - for k, v := range m { - n[k] = v - } - return n -} - -func copyStringSlice(s []string) []string { - t := make([]string, len(s)) - copy(t, s) - return t -} - -// AddImageNames adds the specified names to the specified image. -func AddImageNames(store storage.Store, image *storage.Image, addNames []string) error { - names, err := ExpandNames(addNames) - if err != nil { - return err - } - err = store.SetNames(image.ID, append(image.Names, names...)) - if err != nil { - return errors.Wrapf(err, "error adding names (%v) to image %q", names, image.ID) - } - return nil -} - -// ExpandNames takes unqualified names, parses them as image names, and returns -// the fully expanded result, including a tag. Names which don't include a registry -// name will be marked for the most-preferred registry (i.e., the first one in our -// configuration). -func ExpandNames(names []string) ([]string, error) { - expanded := make([]string, 0, len(names)) - for _, n := range names { - name, err := reference.ParseNormalizedNamed(n) - if err != nil { - return nil, errors.Wrapf(err, "error parsing name %q", n) - } - name = reference.TagNameOnly(name) - tag := "" - digest := "" - if tagged, ok := name.(reference.NamedTagged); ok { - tag = ":" + tagged.Tag() - } - if digested, ok := name.(reference.Digested); ok { - digest = "@" + digested.Digest().String() - } - expanded = append(expanded, name.Name()+tag+digest) - } - return expanded, nil -} |