packaging: merge packaging repository

git-subtree-dir: tools/packaging
git-subtree-mainline: f818b46a41
git-subtree-split: 1f22d72d5d

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao
2020-06-23 22:49:04 -07:00
645 changed files with 292694 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// Copyright (c) 2019 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0
//
package main
import (
"fmt"
"io/ioutil"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
func yamlUnmarshal(yamlFile string, cfg interface{}) error {
source, err := ioutil.ReadFile(yamlFile)
if err != nil {
return err
}
err = yaml.Unmarshal(source, cfg)
if err != nil {
return errors.Wrapf(err, fmt.Sprintf("cannot unmarshal %s", yamlFile))
}
return nil
}