Skip to content

Commit 6f84fbe

Browse files
authored
Revert "fix: change spec-add-tag to add to the beginning of a section to avoid bad interactions with ifs and other issues (#448)" (#455)
This reverts commit cfb9893.
1 parent cfb9893 commit 6f84fbe

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

internal/app/azldev/core/sources/overlays_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ func TestApplySpecOverlay(t *testing.T) {
102102
spec: `Name: name
103103
BuildRequires: existing-package
104104
`,
105-
result: `BuildRequires: added-package
106-
Name: name
105+
result: `Name: name
107106
BuildRequires: existing-package
107+
BuildRequires: added-package
108108
`,
109109
},
110110
{

internal/rpm/spec/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (s *Spec) AddTag(packageName string, tag string, value string) (err error)
164164
sectionName = "%package"
165165
}
166166

167-
return s.PrependLinesToSection(sectionName, packageName, []string{fmt.Sprintf("%s: %s", tag, value)})
167+
return s.AppendLinesToSection(sectionName, packageName, []string{fmt.Sprintf("%s: %s", tag, value)})
168168
}
169169

170170
// PrependLinesToSection prepends the given lines to the start of the specified section, placing

internal/rpm/spec/edit_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func TestSetTag(t *testing.T) {
3838
input: `OtherTag: other-value
3939
`,
4040
expectedFailure: false,
41-
expectedOutput: `Name: value
42-
OtherTag: other-value
41+
expectedOutput: `OtherTag: other-value
42+
Name: value
4343
`,
4444
packageName: "",
4545
tag: "Name",
@@ -72,8 +72,8 @@ OtherTag: other-value
7272
input: `# Name: old
7373
`,
7474
expectedFailure: false,
75-
expectedOutput: `Name: value
76-
# Name: old
75+
expectedOutput: `# Name: old
76+
Name: value
7777
`,
7878
packageName: "",
7979
tag: "Name",
@@ -98,8 +98,8 @@ Name: value
9898
input: `# Name: old
9999
`,
100100
expectedFailure: false,
101-
expectedOutput: `Name: value
102-
# Name: old
101+
expectedOutput: `# Name: old
102+
Name: value
103103
`,
104104
packageName: "",
105105
tag: "Name",
@@ -430,8 +430,8 @@ func TestAddTag(t *testing.T) {
430430
input: `OtherTag: other-value
431431
`,
432432
expectedFailure: false,
433-
expectedOutput: `BuildRequires: value
434-
OtherTag: other-value
433+
expectedOutput: `OtherTag: other-value
434+
BuildRequires: value
435435
`,
436436
packageName: "",
437437
tag: "BuildRequires",
@@ -442,8 +442,8 @@ OtherTag: other-value
442442
input: `BuildRequires: old
443443
`,
444444
expectedFailure: false,
445-
expectedOutput: `BuildRequires: value
446-
BuildRequires: old
445+
expectedOutput: `BuildRequires: old
446+
BuildRequires: value
447447
`,
448448
packageName: "",
449449
tag: "BuildRequires",
@@ -480,8 +480,8 @@ BuildRequires: old
480480
Some description
481481
482482
%package -n test-package
483-
BuildRequires: value
484483
BuildRequires: old
484+
BuildRequires: value
485485
`,
486486
packageName: "test-package",
487487
tag: "BuildRequires",

0 commit comments

Comments
 (0)