Skip to content

Commit

Permalink
remove libc flavor flag, disable empty linter
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <jason@chainguard.dev>
  • Loading branch information
imjasonh committed Jan 31, 2025
1 parent 318f0fe commit 6144d4f
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 70 deletions.
85 changes: 42 additions & 43 deletions docs/md/melange_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,48 @@ melange build [flags]
### Options

```
--apk-cache-dir string directory used for cached apk packages (default is system-defined cache directory)
--arch strings architectures to build for (e.g., x86_64,ppc64le,arm64) -- default is all, unless specified in config
--build-date string date used for the timestamps of the files inside the image
--cache-dir string directory used for cached inputs (default "./melange-cache/")
--cache-source string directory or bucket used for preloading the cache
--cleanup when enabled, the temp dir used for the guest will be cleaned up after completion (default true)
--cpu string default CPU resources to use for builds
--cpumodel string default memory resources to use for builds
--create-build-log creates a package.log file containing a list of packages that were built by the command
--debug enables debug logging of build pipelines
--debug-runner when enabled, the builder pod will persist after the build succeeds or fails
--dependency-log string log dependencies to a specified file
--disk string disk size to use for builds
--empty-workspace whether the build workspace should be empty
--env-file string file to use for preloaded environment variables
--generate-index whether to generate APKINDEX.tar.gz (default true)
--git-commit string commit hash of the git repository containing the build config file (defaults to detecting HEAD)
--git-repo-url string URL of the git repository containing the build config file (defaults to detecting from configured git remotes)
--guest-dir string directory used for the build environment guest
-h, --help help for build
--ignore-signatures ignore repository signature verification
-i, --interactive when enabled, attaches stdin with a tty to the pod on failure
-k, --keyring-append strings path to extra keys to include in the build environment keyring
--license string license to use for the build config file itself (default "NOASSERTION")
--lint-require strings linters that must pass (default [dev,infodir,tempdir,varempty])
--lint-warn strings linters that will generate warnings (default [empty,object,opt,pkgconf,python/docs,python/multiple,python/test,setuidgid,srv,strip,usrlocal,usrmerge,worldwrite])
--memory string default memory resources to use for builds
--namespace string namespace to use in package URLs in SBOM (eg wolfi, alpine) (default "unknown")
--out-dir string directory where packages will be output (default "./packages/")
--overlay-binsh string use specified file as /bin/sh overlay in build environment
--override-host-triplet-libc-substitution-flavor string override the flavor of libc for ${{host.triplet.*}} substitutions (e.g. gnu,musl) -- default is gnu (default "gnu")
--package-append strings extra packages to install for each of the build environments
--pipeline-dir string directory used to extend defined built-in pipelines
-r, --repository-append strings path to extra repositories to include in the build environment
--rm clean up intermediate artifacts (e.g. container images, temp dirs) (default true)
--runner string which runner to use to enable running commands, default is based on your platform. Options are ["bubblewrap" "docker" "qemu"]
--signing-key string key to use for signing
--source-dir string directory used for included sources
--strip-origin-name whether origin names should be stripped (for bootstrap)
--timeout duration default timeout for builds
--trace string where to write trace output
--vars-file string file to use for preloaded build configuration variables
--workspace-dir string directory used for the workspace at /home/build
--apk-cache-dir string directory used for cached apk packages (default is system-defined cache directory)
--arch strings architectures to build for (e.g., x86_64,ppc64le,arm64) -- default is all, unless specified in config
--build-date string date used for the timestamps of the files inside the image
--cache-dir string directory used for cached inputs (default "./melange-cache/")
--cache-source string directory or bucket used for preloading the cache
--cleanup when enabled, the temp dir used for the guest will be cleaned up after completion (default true)
--cpu string default CPU resources to use for builds
--cpumodel string default memory resources to use for builds
--create-build-log creates a package.log file containing a list of packages that were built by the command
--debug enables debug logging of build pipelines
--debug-runner when enabled, the builder pod will persist after the build succeeds or fails
--dependency-log string log dependencies to a specified file
--disk string disk size to use for builds
--empty-workspace whether the build workspace should be empty
--env-file string file to use for preloaded environment variables
--generate-index whether to generate APKINDEX.tar.gz (default true)
--git-commit string commit hash of the git repository containing the build config file (defaults to detecting HEAD)
--git-repo-url string URL of the git repository containing the build config file (defaults to detecting from configured git remotes)
--guest-dir string directory used for the build environment guest
-h, --help help for build
--ignore-signatures ignore repository signature verification
-i, --interactive when enabled, attaches stdin with a tty to the pod on failure
-k, --keyring-append strings path to extra keys to include in the build environment keyring
--license string license to use for the build config file itself (default "NOASSERTION")
--lint-require strings linters that must pass (default [dev,infodir,tempdir,varempty])
--lint-warn strings linters that will generate warnings (default [object,opt,pkgconf,python/docs,python/multiple,python/test,setuidgid,srv,strip,usrlocal,usrmerge,worldwrite])
--memory string default memory resources to use for builds
--namespace string namespace to use in package URLs in SBOM (eg wolfi, alpine) (default "unknown")
--out-dir string directory where packages will be output (default "./packages/")
--overlay-binsh string use specified file as /bin/sh overlay in build environment
--package-append strings extra packages to install for each of the build environments
--pipeline-dir string directory used to extend defined built-in pipelines
-r, --repository-append strings path to extra repositories to include in the build environment
--rm clean up intermediate artifacts (e.g. container images, temp dirs) (default true)
--runner string which runner to use to enable running commands, default is based on your platform. Options are ["bubblewrap" "docker" "qemu"]
--signing-key string key to use for signing
--source-dir string directory used for included sources
--strip-origin-name whether origin names should be stripped (for bootstrap)
--timeout duration default timeout for builds
--trace string where to write trace output
--vars-file string file to use for preloaded build configuration variables
--workspace-dir string directory used for the workspace at /home/build
```

### Options inherited from parent commands
Expand Down
2 changes: 1 addition & 1 deletion docs/md/melange_lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ melange lint [flags]
```
-h, --help help for lint
--lint-require strings linters that must pass (default [dev,infodir,tempdir,varempty])
--lint-warn strings linters that will generate warnings (default [empty,object,opt,pkgconf,python/docs,python/multiple,python/test,setuidgid,srv,strip,usrlocal,usrmerge,worldwrite])
--lint-warn strings linters that will generate warnings (default [object,opt,pkgconf,python/docs,python/multiple,python/test,setuidgid,srv,strip,usrlocal,usrmerge,worldwrite])
```

### Options inherited from parent commands
Expand Down
10 changes: 0 additions & 10 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ type Build struct {
EmptyWorkspace bool
OutDir string
Arch apko_types.Architecture
Libc string
ExtraKeys []string
ExtraRepos []string
ExtraPackages []string
Expand Down Expand Up @@ -1090,15 +1089,6 @@ func (b *Build) summarize(ctx context.Context) {
b.SummarizePaths(ctx)
}

// buildFlavor determines if a build context uses glibc or musl, it returns
// "gnu" for GNU systems, and "musl" for musl systems.
func (b *Build) buildFlavor() string {
if b.Libc == "" {
return "gnu"
}
return b.Libc
}

func (b *Build) buildWorkspaceConfig(ctx context.Context) *container.Config {
log := clog.FromContext(ctx)
if b.isBuildLess() {
Expand Down
8 changes: 0 additions & 8 deletions pkg/build/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,6 @@ func WithAuth(domain, user, pass string) Option {
}
}

// WithLibcFlavorOverride sets the libc flavor for the build.
func WithLibcFlavorOverride(libc string) Option {
return func(b *Build) error {
b.Libc = libc
return nil
}
}

// WithIgnoreIndexSignatures sets whether to ignore repository signature verification.
func WithIgnoreSignatures(ignore bool) Option {
return func(b *Build) error {
Expand Down
3 changes: 0 additions & 3 deletions pkg/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func buildCmd() *cobra.Command {
var cpu, cpumodel, memory, disk string
var timeout time.Duration
var extraPackages []string
var libc string
var lintRequire, lintWarn []string
var ignoreSignatures bool
var cleanup bool
Expand Down Expand Up @@ -184,7 +183,6 @@ func buildCmd() *cobra.Command {
build.WithDisk(disk),
build.WithMemory(memory),
build.WithTimeout(timeout),
build.WithLibcFlavorOverride(libc),
build.WithIgnoreSignatures(ignoreSignatures),
build.WithConfigFileRepositoryCommit(configFileGitCommit),
build.WithConfigFileRepositoryURL(configFileGitRepoURL),
Expand Down Expand Up @@ -237,7 +235,6 @@ func buildCmd() *cobra.Command {
cmd.Flags().StringVar(&overlayBinSh, "overlay-binsh", "", "use specified file as /bin/sh overlay in build environment")
cmd.Flags().StringVar(&purlNamespace, "namespace", "unknown", "namespace to use in package URLs in SBOM (eg wolfi, alpine)")
cmd.Flags().StringSliceVar(&archstrs, "arch", nil, "architectures to build for (e.g., x86_64,ppc64le,arm64) -- default is all, unless specified in config")
cmd.Flags().StringVar(&libc, "override-host-triplet-libc-substitution-flavor", "gnu", "override the flavor of libc for ${{host.triplet.*}} substitutions (e.g. gnu,musl) -- default is gnu")
cmd.Flags().StringVar(&runner, "runner", "", fmt.Sprintf("which runner to use to enable running commands, default is based on your platform. Options are %q", build.GetAllRunners()))
cmd.Flags().StringSliceVarP(&extraKeys, "keyring-append", "k", []string{}, "path to extra keys to include in the build environment keyring")
cmd.Flags().StringSliceVarP(&extraRepos, "repository-append", "r", []string{}, "path to extra repositories to include in the build environment")
Expand Down
4 changes: 0 additions & 4 deletions pkg/config/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,6 @@
"replaces-priority": {
"type": "string",
"description": "Optional: An integer string compared against other equal package provides used to\ndetermine priority of file replacements"
},
"install-if": {
"type": "string",
"description": "Optional: Expression indicating conditions under which to also install this package."
}
},
"additionalProperties": false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/linter/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ var linterMap = map[string]linter{
"empty": {
LinterFunc: emptyLinter,
Explain: "Verify that this package is supposed to be empty; if it is, disable this linter; otherwise check the build",
defaultBehavior: Warn,
defaultBehavior: Ignore, // TODO: Needs to ignore packages that specify no-provides.
},
"python/docs": {
LinterFunc: pythonDocsLinter,
Expand Down
Binary file modified pkg/sca/testdata/generated/x86_64/shbang-test-1-r1.apk
Binary file not shown.

0 comments on commit 6144d4f

Please sign in to comment.