Ejemplo n.º 1
0
	"github.com/Sirupsen/logrus"

	"github.com/andrew-d/sbuild/builder"
	"github.com/andrew-d/sbuild/logmgr"
	"github.com/andrew-d/sbuild/recipes/templates"
	"github.com/andrew-d/sbuild/types"
	"github.com/andrew-d/sbuild/util"
)

type IconvRecipe struct {
	*templates.BaseRecipe
}

var (
	log = logmgr.NewLogger("sbuild/recipes/libiconv")
)

func init() {
	builder.RegisterRecipe(&IconvRecipe{})
}

func (r *IconvRecipe) Info() *types.RecipeInfo {
	return &types.RecipeInfo{
		Name:    "libiconv",
		Version: "1.14",
		Sources: []string{
			"http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${version}.tar.gz",
		},
		Sums: []string{
			"72b24ded17d687193c3366d0ebe7cde1e6b18f0df8c55438ac95be39e8a30613",
Ejemplo n.º 2
0
import (
	"os"

	"github.com/Sirupsen/logrus"
	flag "github.com/ogier/pflag"

	"github.com/andrew-d/sbuild/builder"
	"github.com/andrew-d/sbuild/config"
	"github.com/andrew-d/sbuild/logmgr"

	_ "github.com/andrew-d/sbuild/recipes"
)

var (
	log = logmgr.NewLogger("main")

	flagPlatform string
	flagArch     string
	flagBuildDir string
	flagVerbose  bool
)

func init() {
	flag.StringVarP(&flagPlatform, "platform", "p", "linux",
		"the platform to build for")
	flag.StringVarP(&flagArch, "arch", "a", "amd64",
		"the architecture to build for")
	flag.StringVar(&flagBuildDir, "build-dir", "/tmp/sbuild",
		"the directory to use as a build directory")
	flag.BoolVarP(&flagVerbose, "verbose", "v", false, "be verbose")
Ejemplo n.º 3
0
)

const DETERMINISTIC = false

// Keeps information about a single build.
type context struct {
	rootEnv *env.Env
	config  *config.BuildConfig
	cache   *sourceCache

	// Map of package --> environment variable map
	packageEnv map[string]map[string]string
}

var (
	log = logmgr.NewLogger("sbuild/builder")
)

// Build will run a build for the recipe with the given name and using the
// provided configuration.
func Build(recipes []string, config *config.BuildConfig) error {
	log.WithField("recipes", recipes).Info("Starting build")
	cacheDir := filepath.Join(config.BuildDir, ".cache")

	// Ensure build, output, and cache directories exist.
	for _, dir := range []string{config.BuildDir, config.OutputDir, cacheDir} {
		log.WithField("dir", dir).Debug("Ensuring directory exists")
		if err := os.Mkdir(dir, 0700); err != nil {
			if !os.IsExist(err) {
				log.WithFields(logrus.Fields{
					"dir": dir,