Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Release Engineering
Public
srpmproc
Commits
5591a21e
Commit
5591a21e
authored
Dec 16, 2020
by
Mustafa Gezen
🏗
Browse files
support patches that create new files
parent
11ad88bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
internal/process.go
View file @
5591a21e
...
...
@@ -266,7 +266,7 @@ func ProcessRPM(pd *ProcessData) {
srcPath
=
filepath
.
Join
(
"SOURCES"
,
patchedFile
.
NewName
)
}
var
output
bytes
.
Buffer
if
!
patchedFile
.
IsDelete
{
if
!
patchedFile
.
IsDelete
&&
!
patchedFile
.
IsNew
{
patchSubjectFile
,
err
:=
w
.
Filesystem
.
Open
(
srcPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not open patch subject: %v"
,
err
)
...
...
@@ -282,7 +282,21 @@ func ProcessRPM(pd *ProcessData) {
_
=
w
.
Filesystem
.
Remove
(
oldName
)
_
=
w
.
Filesystem
.
Remove
(
srcPath
)
if
!
patchedFile
.
IsDelete
{
if
patchedFile
.
IsNew
{
newFile
,
err
:=
w
.
Filesystem
.
Create
(
srcPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not create new file: %v"
,
err
)
}
_
,
err
=
newFile
.
Write
(
output
.
Bytes
())
if
err
!=
nil
{
log
.
Fatalf
(
"could not write post-patch file: %v"
,
err
)
}
_
,
err
=
w
.
Add
(
srcPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not add file %s to git: %v"
,
srcPath
,
err
)
}
log
.
Printf
(
"git add %s"
,
srcPath
)
}
else
if
!
patchedFile
.
IsDelete
{
newFile
,
err
:=
w
.
Filesystem
.
Create
(
srcPath
)
if
err
!=
nil
{
log
.
Fatalf
(
"could not create post-patch file: %v"
,
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment