Skip to content

Commit

Permalink
mkdir -p /var/cache/melange even if --cache-dir isn't found
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Hall <[email protected]>
  • Loading branch information
imjasonh committed Oct 21, 2022
1 parent 3b96ad7 commit 8f135a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pipelines/fetch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pipeline:
bn=$(basename ${{inputs.uri}})
ls /var/cache/melange ## TODO(jason): Remove this; this just tests that the dir exists.
if [ ! "${{inputs.expected-sha256}}" == "" ]; then
fn="/var/cache/melange/sha256:${{inputs.expected-sha256}}"
printf "Looking for $fn in cache"
Expand Down
7 changes: 6 additions & 1 deletion pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,13 @@ func (ctx *Context) PopulateCache() error {

fsys := apkofs.DirFS(ctx.CacheDir)

// mkdir /var/cache/melange
if err := os.MkdirAll("/var/cache/melange", 0o755); err != nil {
return err
}

// --cache-dir doesn't exist, nothing to do.
if _, err := fs.Stat(fsys, "."); errors.Is(err, fs.ErrNotExist) {
// --cache-dir doesn't exist, skip it.
return nil
}

Expand Down

0 comments on commit 8f135a4

Please sign in to comment.