Skip to content

Commit

Permalink
remove rpm dir from combustion
Browse files Browse the repository at this point in the history
  • Loading branch information
dbw7 committed Oct 31, 2023
1 parent 8a56a02 commit 41fb255
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
7 changes: 0 additions & 7 deletions pkg/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type Builder struct {
eibBuildDir string
combustionDir string
combustionScripts []string
rpmBuildDir string
rpmFileNames []string
rpmSourceDir string
}
Expand Down Expand Up @@ -93,18 +92,12 @@ func (b *Builder) prepareBuildDir() error {
b.eibBuildDir = b.buildConfig.BuildDir
}
b.combustionDir = filepath.Join(b.eibBuildDir, "combustion")
b.rpmBuildDir = filepath.Join(b.combustionDir, "rpms")

err := os.MkdirAll(b.combustionDir, os.ModePerm)
if err != nil {
return fmt.Errorf("creating the build directory structure for combustion: %w", err)
}

err = os.MkdirAll(b.rpmBuildDir, os.ModePerm)
if err != nil {
return fmt.Errorf("creating the build directory structure for rpms: %w", err)
}

return nil
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/build/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func (b *Builder) getRPMFileNames() error {
for _, rpmFile := range rpms {
b.rpmFileNames = append(b.rpmFileNames, rpmFile.Name())
}

return nil
}

Expand All @@ -29,7 +30,7 @@ func (b *Builder) copyRPMs() error {

for _, rpm := range b.rpmFileNames {
sourcePath := filepath.Join(b.rpmSourceDir, rpm)
destPath := filepath.Join(b.rpmBuildDir, rpm)
destPath := filepath.Join(b.combustionDir, rpm)

sourceFile, err := os.Open(sourcePath)
if err != nil {
Expand All @@ -48,5 +49,6 @@ func (b *Builder) copyRPMs() error {
return fmt.Errorf("copying rpm: %w", err)
}
}

return nil
}
4 changes: 2 additions & 2 deletions pkg/build/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func TestCopyRPMs(t *testing.T) {
// Verify
require.NoError(t, err)

_, err = os.Stat(filepath.Join(builder.rpmBuildDir, "rpm1.rpm"))
_, err = os.Stat(filepath.Join(builder.combustionDir, "rpm1.rpm"))
require.NoError(t, err)

_, err = os.Stat(filepath.Join(builder.rpmBuildDir, "rpm2.rpm"))
_, err = os.Stat(filepath.Join(builder.combustionDir, "rpm2.rpm"))
require.NoError(t, err)
}

0 comments on commit 41fb255

Please sign in to comment.