Commit Graph

11 Commits

Author SHA1 Message Date
Jason Hall
363f2c392c Derive cpuinfo as needed, instead of at init-time
This changes platforms.Parse to hit /proc to look up CPU info only when
it's needed, instead of in init(). This makes the package a bit easier
for other packages to consume, especially clients that don't call
platforms.Parse or need to lookup CPU info.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-01-19 14:10:39 -05:00
Shengjing Zhu
90cd777a6c platforms: fill default arm variant when parse platform specifier
arm has been supported, but something is missing, causes test failure

    --- FAIL: TestParseSelector/linux (0.00s)
        platforms_test.go:292: arm support not fully implemented: not implemented
    --- FAIL: TestParseSelector/macOS (0.00s)
        platforms_test.go:292: arm support not fully implemented: not implemented

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2020-01-08 13:35:49 +08:00
chentanjun
92a5b08a68 fix-grammar-mistake
Signed-off-by: chentanjun <2799194073@qq.com>
2019-08-28 16:10:08 +08:00
Ian Campbell
c83f9773bc platforms: Add MustParse
This function is analogous to `regexp.MustCompile` and can simplify production
of a `Platform` from a hard-coded strings, e.g. for global variable
initialisation.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2018-08-15 11:30:46 +01:00
Derek McGowan
db3c5afc6d
Normalize arm64 to an empty variant
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-06-23 16:35:46 -07:00
Derek McGowan
37ab93e2c8
Fix arm platform matching
The normalization was being inconsistently applied causing a
failure to match some platforms in manifest lists.
Fix the matcher and normalization to be more consistent and
add changes to parser to prevent the defaulted variants from being
set in the platform structure.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-06-21 17:07:58 -07:00
Jess Valarezo
ac8008437a update platforms Parse to return platform spec, decouple matcher
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2018-02-27 14:21:49 -08:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Stephen J Day
775f7cea47
platforms: update format for platform specifier
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-13 11:41:45 -07:00
Stephen J Day
94f6be5f10
platforms: implement matcher support
Matching support is now implemented in the platforms package. The
`Parse` function now returns a matcher object that can be used to
match OCI platform specifications. We define this as an interface to
allow the creation of helpers oriented around platform selection.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-08 19:22:29 -07:00
Stephen J Day
fb0688362c
platforms: define selectors for platforms
For supporting selection of images and runtimes in the containerized
world, there is thin support for selecting objects by platform. This
package defines a syntax to display to users that can express specific
platforms in addition to wild cards for matching platforms.

The plan is to extend this to provide support for parsing flag
arguments and displaying platform types for images. This package will
also provide a configurable matcher to allow match of platforms against
arbitrary targets, invariant to the Go compilation.

The internals are based the OCI Image Spec model.

This changeset is being submitted for feedback on the approach before
this gets larger. Specifically, review the unit tests and raise any
concerns.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-08 15:05:21 -07:00