WIP: Some refactoring
This commit is contained in:
@ -81,10 +81,13 @@ func DiffReleases(src, dest release.Releases) (*Diff, error) {
|
||||
func (diff *Diff) Resolve(repositories repository.Repositories, path string) (lockfile.LockFile, error) {
|
||||
lockfile := lockfile.LockFile{}
|
||||
reposWished := repository.Repositories{}
|
||||
|
||||
for _, p := range diff.PreservedReleases {
|
||||
logrus.Infof("preserving %s", p.Release)
|
||||
lockfile = append(lockfile, p.LockEntry())
|
||||
reposWished = append(reposWished, p.RepositoryObj)
|
||||
}
|
||||
|
||||
for _, a := range diff.AddedReleases {
|
||||
logrus.Infof("adding %s", a.Release)
|
||||
lockfile = append(lockfile, a.LockEntry())
|
||||
@ -97,7 +100,11 @@ func (diff *Diff) Resolve(repositories repository.Repositories, path string) (lo
|
||||
reposWished = append(reposWished, u.RepositoryObj)
|
||||
}
|
||||
|
||||
// Repo Wished is the list of all repos that are required by the current setup, we need to
|
||||
for _, d := range diff.DeletedReleases {
|
||||
logrus.Infof("removing %s", d.Release)
|
||||
}
|
||||
|
||||
// Repo Wished is the list of all repos that are required by the current setup
|
||||
|
||||
// Existing repos are all the repos in the lockfile
|
||||
for _, repoExisting := range repositories {
|
||||
|
@ -5,7 +5,6 @@ import "os"
|
||||
func CreateWorkdir(path string) (workdir string, err error) {
|
||||
if len(path) > 0 {
|
||||
// Create a dir using the path
|
||||
// It should not be removed after the execution
|
||||
if err := os.Mkdir(path, 0777); err != nil {
|
||||
return path, err
|
||||
}
|
||||
@ -13,7 +12,6 @@ func CreateWorkdir(path string) (workdir string, err error) {
|
||||
workdir = path
|
||||
} else {
|
||||
// Create a temporary dir
|
||||
// It should be removed after the execution
|
||||
workdir, err = os.MkdirTemp("", "shoebill")
|
||||
if err != nil {
|
||||
return workdir, err
|
||||
|
Reference in New Issue
Block a user