Skip to content

BIGTOP-4357 apply diff patches files sequence error using text sequ… #1327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions packages.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,22 @@ def genTasks = { target ->
changelog.close()

// Move patches and create "series"
def patches = new File( "$DEB_BLD_DIR/debian").list({ d, f -> f ==~ /patch.*diff/}).sort()
def patches = new File( "$DEB_BLD_DIR/debian").list({ d, f -> f ==~ /patch.*diff/})

// sort patches files in numberic sequence
def fileListWithNumbers = patches.collect { fileName ->
def matcher = (fileName =~ /patch(\d+)-.*/)
if (matcher.find()) {
return [fileName: fileName, number: matcher.group(1).toInteger()]
} else {
return [fileName: fileName, number: 0]
}
}
def sortedPatches = fileListWithNumbers.sort { a, b ->
a.number <=> b.number
}.collect { it.fileName }
patches = sortedPatches

if (patches.size() > 0) {
mkdir("$DEB_BLD_DIR/debian/patches")
def seriesWriter = new File("$DEB_BLD_DIR/debian/patches/series").newWriter()
Expand Down Expand Up @@ -686,7 +701,22 @@ def genTasks = { target ->
def specTmpFileName = "${PKG_BUILD_DIR}/rpm/SPECS/tmp_${NAME}.spec"
def specFile = new File(specFileName)
def specWriter = new File(specTmpFileName).newWriter()
def patches = new File("${PKG_BUILD_DIR}/rpm/SOURCES").list({ d, f -> f ==~ /patch.*diff/}).sort()
def patches = new File("${PKG_BUILD_DIR}/rpm/SOURCES").list({ d, f -> f ==~ /patch.*diff/})

// sort patches files in numberic sequence
def fileListWithNumbers = patches.collect { fileName ->
def matcher = (fileName =~ /patch(\d+)-.*/)
if (matcher.find()) {
return [fileName: fileName, number: matcher.group(1).toInteger()]
} else {
return [fileName: fileName, number: 0]
}
}
def sortedPatches = fileListWithNumbers.sort { a, b ->
a.number <=> b.number
}.collect { it.fileName }
patches = sortedPatches

specFile.eachLine { line ->
if (line.startsWith("#BIGTOP_PATCH_FILES")) {
def patchNum = 0
Expand Down