wip: add support of building multiple packages at once
This commit is contained in:
@ -34,7 +34,6 @@ import (
|
||||
_ "github.com/goreleaser/nfpm/v2/deb"
|
||||
_ "github.com/goreleaser/nfpm/v2/rpm"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"mvdan.cc/sh/v3/interp"
|
||||
"mvdan.cc/sh/v3/syntax"
|
||||
|
||||
"github.com/goreleaser/nfpm/v2"
|
||||
@ -88,7 +87,7 @@ func buildPkgMetadata(
|
||||
deps []string,
|
||||
preferedContents *[]string,
|
||||
) (*nfpm.Info, error) {
|
||||
pkgInfo := getBasePkgInfo(vars)
|
||||
pkgInfo := getBasePkgInfo(vars, info)
|
||||
pkgInfo.Description = vars.Description
|
||||
pkgInfo.Platform = "linux"
|
||||
pkgInfo.Homepage = vars.Homepage
|
||||
@ -108,8 +107,6 @@ func buildPkgMetadata(
|
||||
})
|
||||
}
|
||||
|
||||
pkgInfo.Release = overrides.ReleasePlatformSpecific(vars.Release, info)
|
||||
|
||||
if vars.Epoch != 0 {
|
||||
pkgInfo.Epoch = strconv.FormatUint(uint64(vars.Epoch), 10)
|
||||
}
|
||||
@ -249,8 +246,14 @@ func buildContents(vars *types.BuildVars, dirs types.Directories, preferedConten
|
||||
|
||||
// Функция checkForBuiltPackage пытается обнаружить ранее собранный пакет и вернуть его путь
|
||||
// и true, если нашла. Если нет, возвратит "", false, nil.
|
||||
func checkForBuiltPackage(mgr manager.Manager, vars *types.BuildVars, pkgFormat, baseDir string) (string, bool, error) {
|
||||
filename, err := pkgFileName(vars, pkgFormat)
|
||||
func checkForBuiltPackage(
|
||||
mgr manager.Manager,
|
||||
vars *types.BuildVars,
|
||||
pkgFormat,
|
||||
baseDir string,
|
||||
info *distro.OSRelease,
|
||||
) (string, bool, error) {
|
||||
filename, err := pkgFileName(vars, pkgFormat, info)
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
@ -265,20 +268,20 @@ func checkForBuiltPackage(mgr manager.Manager, vars *types.BuildVars, pkgFormat,
|
||||
return pkgPath, true, nil
|
||||
}
|
||||
|
||||
func getBasePkgInfo(vars *types.BuildVars) *nfpm.Info {
|
||||
func getBasePkgInfo(vars *types.BuildVars, info *distro.OSRelease) *nfpm.Info {
|
||||
return &nfpm.Info{
|
||||
Name: vars.Name,
|
||||
Arch: cpu.Arch(),
|
||||
Version: vars.Version,
|
||||
Release: strconv.Itoa(vars.Release),
|
||||
Release: overrides.ReleasePlatformSpecific(vars.Release, info),
|
||||
Epoch: strconv.FormatUint(uint64(vars.Epoch), 10),
|
||||
}
|
||||
}
|
||||
|
||||
// pkgFileName returns the filename of the package if it were to be built.
|
||||
// This is used to check if the package has already been built.
|
||||
func pkgFileName(vars *types.BuildVars, pkgFormat string) (string, error) {
|
||||
pkgInfo := getBasePkgInfo(vars)
|
||||
func pkgFileName(vars *types.BuildVars, pkgFormat string, info *distro.OSRelease) (string, error) {
|
||||
pkgInfo := getBasePkgInfo(vars, info)
|
||||
|
||||
packager, err := nfpm.Get(pkgFormat)
|
||||
if err != nil {
|
||||
@ -366,6 +369,7 @@ func setScripts(vars *types.BuildVars, info *nfpm.Info, scriptDir string) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Функция setVersion изменяет переменную версии в скрипте runner.
|
||||
// Она используется для установки версии на вывод функции version().
|
||||
func setVersion(ctx context.Context, r *interp.Runner, to string) error {
|
||||
@ -375,7 +379,7 @@ func setVersion(ctx context.Context, r *interp.Runner, to string) error {
|
||||
}
|
||||
return r.Run(ctx, fl)
|
||||
}
|
||||
|
||||
*/
|
||||
// Returns not installed dependencies
|
||||
func removeAlreadyInstalled(opts types.BuildOpts, dependencies []string) ([]string, error) {
|
||||
filteredPackages := []string{}
|
||||
|
Reference in New Issue
Block a user