Skip to content

Commit

Permalink
Fix a couple issues with remotefs (#2975)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari authored Nov 22, 2023
1 parent 06412aa commit 8bdbec1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.4.0-beta.5
17.4.0-beta.6
11 changes: 8 additions & 3 deletions src/core/subrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ func (s *Subrepo) FS() iofs.FS {
// Must be an architecture subrepo
return fs.HostFS
}
if s.Target == nil || s.Target.Local || s.State.RemoteClient == nil {
return os.DirFS(s.Root)
if s.IsRemoteSubrepo() {
return s.State.RemoteClient.SubrepoFS(s.Target, s.Root)
}
return s.State.RemoteClient.SubrepoFS(s.Target, s.Root)
return os.DirFS(s.Root)
}

// IsRemoteSubrepo returns true when the subrepo sources are remote i.e. not downloaded to plz-out
func (s *Subrepo) IsRemoteSubrepo() bool {
return s.Root != "" && s.Target != nil && !s.Target.Local && s.State.RemoteClient != nil
}

// SubrepoForArch creates a new subrepo for the given architecture.
Expand Down
8 changes: 2 additions & 6 deletions src/fs/glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Glob(fs iofs.FS, buildFileNames []string, rootPath string, includes, exclud
// it isn't safe for use in concurrent goroutines.
type Globber struct {
buildFileNames []string
fs iofs.ReadDirFS
fs iofs.FS
walkedDirs map[string]walkedDir
}

Expand All @@ -90,13 +90,9 @@ func Match(glob, path string) (bool, error) {

// NewGlobber creates a new Globber. You should call this rather than creating one directly (or use Glob() if you don't care).
func NewGlobber(fs iofs.FS, buildFileNames []string) *Globber {
rdfs, ok := fs.(iofs.ReadDirFS)
if !ok {
log.Fatalf("NewGlobber must be constructed with a ReadDirFS")
}
return &Globber{
buildFileNames: buildFileNames,
fs: rdfs,
fs: fs,
walkedDirs: map[string]walkedDir{},
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/remote/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (c *Client) uploadInputDir(ch chan<- *uploadinfo.Entry, target *core.BuildT
}
continue
}
if i, ok := input.(core.SubrepoFileLabel); ok && !target.Local {
if i, ok := input.(core.SubrepoFileLabel); ok && target.Subrepo.IsRemoteSubrepo() {
for _, p := range i.Paths(c.state.Graph) {
subrepoPath, err := filepath.Rel(target.Subrepo.PackageRoot, p)
if err != nil {
Expand Down

0 comments on commit 8bdbec1

Please sign in to comment.