@@ -26,12 +26,14 @@ type ComponentBuilder interface {
2626 // BuildBinaryPackage builds a binary package for the given component from the provided source package
2727 // and returns the paths to the built binary packages.
2828 BuildBinaryPackage (
29- ctx context.Context , component components.Component , sourcePackagePath string , outputDir string , runChecks bool ,
29+ ctx context.Context ,
30+ component components.Component , sourcePackagePath string , localRepoPaths []string ,
31+ outputDir string , runChecks bool ,
3032 ) (packagePaths []string , err error )
3133
3234 // BuildSourcePackage builds a source package for the given component and returns the path to the
3335 // built source package.
34- BuildSourcePackage (ctx context.Context , component components.Component , outputDir string ,
36+ BuildSourcePackage (ctx context.Context , component components.Component , localRepoPaths [] string , outputDir string ,
3537 ) (packagePath string , err error )
3638}
3739
@@ -66,9 +68,9 @@ func New(
6668}
6769
6870func (b * Builder ) BuildSourcePackage (
69- ctx context.Context , component components.Component , outputDir string ,
71+ ctx context.Context , component components.Component , localRepoPaths [] string , outputDir string ,
7072) (packagePath string , err error ) { // NOTE: We intentionally name the returns for better self-documentation.
71- packagePath , err = b .buildSRPM (ctx , component , b .buildEnv , outputDir )
73+ packagePath , err = b .buildSRPM (ctx , component , b .buildEnv , localRepoPaths , outputDir )
7274 if err != nil {
7375 return packagePath , fmt .Errorf ("failed to build source package for component %#q:\n %w" , component .GetName (), err )
7476 }
@@ -78,9 +80,10 @@ func (b *Builder) BuildSourcePackage(
7880
7981func (b * Builder ) BuildBinaryPackage (
8082 ctx context.Context ,
81- component components.Component , sourcePackagePath , outputDir string , runChecks bool ,
83+ component components.Component , sourcePackagePath string , localRepoPaths []string ,
84+ outputDir string , runChecks bool ,
8285) (packagePaths []string , err error ) { // NOTE: We intentionally name the returns for better self-documentation.
83- packagePaths , err = b .buildRPM (ctx , component , sourcePackagePath , b .buildEnv , outputDir , runChecks )
86+ packagePaths , err = b .buildRPM (ctx , component , sourcePackagePath , b .buildEnv , localRepoPaths , outputDir , runChecks )
8487 if err != nil {
8588 return packagePaths , fmt .Errorf ("failed to build binary package for component %#q:\n %w" , component .GetName (), err )
8689 }
@@ -89,14 +92,16 @@ func (b *Builder) BuildBinaryPackage(
8992}
9093
9194func (b * Builder ) buildSRPM (
92- ctx context.Context , component components.Component , buildEnv buildenv.RPMAwareBuildEnv , outputDir string ,
95+ ctx context.Context , component components.Component , buildEnv buildenv.RPMAwareBuildEnv ,
96+ localRepoPaths []string ,
97+ outputDir string ,
9398) (outputSRPMPath string , err error ) { // NOTE: We intentionally name the returns for better self-documentation.
9499 preparedSourcesDir , err := b .prepSourcesForSRPM (ctx , component )
95100 if err != nil {
96101 return "" , fmt .Errorf ("failed to prepare sources for SRPM:\n %w" , err )
97102 }
98103
99- tempSRPMOutputDir , err := b .buildSRPMFromPreparedSources (ctx , component , preparedSourcesDir , buildEnv )
104+ tempSRPMOutputDir , err := b .buildSRPMFromPreparedSources (ctx , component , preparedSourcesDir , buildEnv , localRepoPaths )
100105 if err != nil {
101106 return "" , fmt .Errorf ("failed to build SRPM from prepared sources:\n %w" , err )
102107 }
@@ -129,7 +134,7 @@ func (b *Builder) prepSourcesForSRPM(
129134func (b * Builder ) buildSRPMFromPreparedSources (
130135 ctx context.Context ,
131136 component components.Component , preparedSourcesDir string ,
132- buildEnv buildenv.RPMAwareBuildEnv ,
137+ buildEnv buildenv.RPMAwareBuildEnv , localRepoPaths [] string ,
133138) (srpmOutputDir string , err error ) {
134139 preparedSpecPath := path .Join (preparedSourcesDir , component .GetName ()+ ".spec" )
135140
@@ -145,14 +150,14 @@ func (b *Builder) buildSRPMFromPreparedSources(
145150
146151 defer srpmEvent .End ()
147152
148- componentConfig := component . GetConfig ()
149-
153+ // Since we've already applied the macros, with, and without values, we don't need the builder
154+ // to apply them; we leave them blank.
150155 srpmOptions := buildenv.SRPMBuildOptions {
151156 CommonBuildOptions : mock.CommonBuildOptions {
152- With : componentConfig . Build . With ,
153- Without : componentConfig . Build . Without ,
154- Defines : componentConfig . Build . Defines ,
155- LocalRepoPaths : [] string {} ,
157+ With : [] string {} ,
158+ Without : [] string {} ,
159+ Defines : map [ string ] string {} ,
160+ LocalRepoPaths : localRepoPaths ,
156161 },
157162 }
158163
@@ -195,7 +200,7 @@ func (b *Builder) copySRPMToOutputDir(inputSRPMDir, outputSRPMDir string) (strin
195200func (b * Builder ) buildRPM (
196201 ctx context.Context ,
197202 component components.Component ,
198- srpmPath string , buildEnv buildenv.RPMAwareBuildEnv ,
203+ srpmPath string , buildEnv buildenv.RPMAwareBuildEnv , localRepoPaths [] string ,
199204 outputDir string , runChecks bool ,
200205) (outputRPMPaths []string , err error ) { // NOTE: We intentionally name the returns for better self-documentation.
201206 var tempRPMDir string
@@ -211,15 +216,15 @@ func (b *Builder) buildRPM(
211216
212217 defer rpmEvent .End ()
213218
214- componentConfig := component .GetConfig ()
215-
216219 // Compose RPM build options, based on our parameters and the component's default configuration.
220+ // Since we've already applied the macros, with, and without values, we don't need the builder
221+ // to apply them; we leave them blank.
217222 rpmOptions := buildenv.RPMBuildOptions {
218223 CommonBuildOptions : mock.CommonBuildOptions {
219- With : componentConfig . Build . With ,
220- Without : componentConfig . Build . Without ,
221- Defines : componentConfig . Build . Defines ,
222- LocalRepoPaths : [] string {} ,
224+ With : [] string {} ,
225+ Without : [] string {} ,
226+ Defines : map [ string ] string {} ,
227+ LocalRepoPaths : localRepoPaths ,
223228 },
224229 RunChecks : runChecks ,
225230 ForceRebuild : false , // Could be added to config if needed
0 commit comments