@@ -64,10 +64,6 @@ var bundleValidateCommand = cli.Command{
6464 var spec rspec.Spec
6565 if err = json .NewDecoder (sf ).Decode (& spec ); err != nil {
6666 logrus .Fatal (err )
67- } else {
68- if spec .Platform .OS != "linux" {
69- logrus .Fatalf ("Operation system '%s' of the bundle is not supported yet." , spec .Platform .OS )
70- }
7167 }
7268
7369 rootfsPath := path .Join (inputPath , spec .Root .Path )
@@ -89,6 +85,7 @@ var bundleValidateCommand = cli.Command{
8985func bundleValidate (spec rspec.Spec , rootfs string ) {
9086 checkMandatoryField (spec )
9187 checkSemVer (spec .Version )
88+ checkPlatform (spec .Platform )
9289 checkProcess (spec .Process , rootfs )
9390 checkMounts (spec .Mounts , rootfs )
9491 checkLinux (spec .Linux , rootfs )
@@ -112,6 +109,30 @@ func checkMounts(mounts []rspec.Mount, rootfs string) {
112109 }
113110}
114111
112+ func checkPlatform (platform rspec.Platform ) {
113+ validCombins := map [string ][]string {
114+ "darwin" : {"386" , "amd64" , "arm" , "arm64" },
115+ "dragonfly" : {"amd64" },
116+ "freebsd" : {"386" , "amd64" , "arm" },
117+ "linux" : {"386" , "amd64" , "arm" , "arm64" , "ppc64" , "ppc64le" , "mips64" , "mips64le" },
118+ "netbsd" : {"386" , "amd64" , "arm" },
119+ "openbsd" : {"386" , "amd64" , "arm" },
120+ "plan9" : {"386" , "amd64" },
121+ "solaris" : {"amd64" },
122+ "windows" : {"386" , "amd64" }}
123+ for os , archs := range validCombins {
124+ if os == platform .OS {
125+ for _ , arch := range archs {
126+ if arch == platform .Arch {
127+ return
128+ }
129+ }
130+ logrus .Fatalf ("Combination of '%s' and '%s' is invalid." , platform .OS , platform .Arch )
131+ }
132+ }
133+ logrus .Fatalf ("Operation system '%s' of the bundle is not supported yet." , platform .OS )
134+ }
135+
115136func checkProcess (process rspec.Process , rootfs string ) {
116137 for index := 0 ; index < len (process .Capabilities ); index ++ {
117138 capability := process .Capabilities [index ]
0 commit comments