Skip to content

Commit

Permalink
BIGTOP-1917: Simplify gradle creating apt/yum repositories for better CI
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Boudnik <cos@apache.org>
  • Loading branch information
oflebbe authored and Konstantin Boudnik committed Aug 4, 2015
1 parent 1715e03 commit be1fbfc
Showing 1 changed file with 31 additions and 49 deletions.
80 changes: 31 additions & 49 deletions packages.gradle
Expand Up @@ -366,32 +366,6 @@ def genTasks = { target, variable ->
}
touchTargetFile(BOM_map[variable + '_TARGET_SDEB'])
}
task "$target-apt" (dependsOn: "$target-deb",
description: "Creating APT repository for $target packages",
group: PACKAGES_GROUP) << {
if (new File(BOM_map[variable + '_TARGET_APT'])?.exists()) {
println "\tNothing to do. Exiting..."
return
}
def final PKG_NAME = BOM_map[variable + '_NAME']
def final PKG_RELEASE = BOM_map[variable + '_PKG_RELEASE']
def final PKG_VERSION = BOM_map[variable + '_PKG_VERSION']
def final PKG_OUTPUT_DIR = BOM_map[variable + '_OUTPUT_DIR']
mkdir("$OUTPUT_DIR/apt/conf")
copy {
from "$REPO_DIR/apt/distributions"
into "$OUTPUT_DIR/apt/conf"
}
fileTree (PKG_OUTPUT_DIR) {
include "*.changes"
}.each { changeFile ->
exec {
workingDir BUILD_DIR
commandLine "reprepro -Vb $OUTPUT_DIR/apt include bigtop $changeFile".split(' ')
}
}
touchTargetFile(BOM_map["${variable}_TARGET_APT"])
}

// Keeping the reference to task to be used later for correct sequencing
Task trpm = task "$target-rpm" (dependsOn: ["${target}-srpm"],
Expand Down Expand Up @@ -527,19 +501,6 @@ def genTasks = { target, variable ->
group: PACKAGES_GROUP) << {
}
}
task "$target-yum" (dependsOn: "$target-rpm",
description: "Creating YUM repository for $target packages",
group: PACKAGES_GROUP) << {
if (new File(BOM_map[variable + '_TARGET_YUM'])?.exists()) {
println "\tNothing to do. Exiting..."
return
}
exec {
workingDir BUILD_DIR
commandLine "createrepo -o $OUTPUT_DIR $OUTPUT_DIR".split(' ')
}
touchTargetFile(BOM_map["${variable}_TARGET_YUM"])
}
task "$target-version" (description: "Show version of $target component", group: PACKAGES_GROUP) << {
println "Base: ${BOM_map[variable + '_BASE_VERSION']}"
}
Expand Down Expand Up @@ -571,10 +532,8 @@ def genTasks = { target, variable ->
BOM_map[variable + '_TARGET_TAR'] = BOM_map[variable + '_BUILD_DIR'] + '/.tar'
BOM_map[variable + '_TARGET_SRPM'] = BOM_map[variable + '_BUILD_DIR'] + '/.srpm'
BOM_map[variable + '_TARGET_RPM'] = BOM_map[variable + '_BUILD_DIR'] + '/.rpm'
BOM_map[variable + '_TARGET_YUM'] = BOM_map[variable + '_BUILD_DIR'] + '/.yum'
BOM_map[variable + '_TARGET_SDEB'] = BOM_map[variable + '_BUILD_DIR'] + '/.sdeb'
BOM_map[variable + '_TARGET_DEB'] = BOM_map[variable + '_BUILD_DIR'] + '/.deb'
BOM_map[variable + '_TARGET_APT'] = BOM_map[variable + '_BUILD_DIR'] + '/.apt'
BOM_map[variable + '_TARGET_RELNOTES'] = BOM_map[variable + '_BUILD_DIR'] + '/.relnotes'

if (System.getProperty(VERBOSE)) {
Expand Down Expand Up @@ -659,10 +618,6 @@ project.afterEvaluate {
description: "Build all RPM packages for the stack",
group: PACKAGES_GROUP
) << { }
task "yum" (dependsOn: tasks.findAll { alltask -> alltask.name.endsWith("-yum")}*.name,
description: "Create YUM repository for all pre-built RPM packages",
group: PACKAGES_GROUP
) << { }
task "sdeb" (dependsOn: tasks.findAll { alltask -> alltask.name.endsWith("-sdeb")}*.name,
description: "Build all SDEB packages for the stack components",
group: PACKAGES_GROUP
Expand All @@ -671,10 +626,6 @@ project.afterEvaluate {
description: "Build all DEB packages for the stack components",
group: PACKAGES_GROUP
) << { }
task "apt" (dependsOn: tasks.findAll { alltask -> alltask.name.endsWith("-apt")}*.name,
description: "Create APT repository for all pre-built DEB packages",
group: PACKAGES_GROUP
) << { }

task allclean (dependsOn: [clean, tasks.findAll { alltask -> alltask.name.endsWith("-clean")}*.name],
description: "Removing $BUILD_DIR, $OUTPUT_DIR, and $DIST_DIR.\n\t\t" +
Expand All @@ -690,3 +641,34 @@ project.afterEvaluate {
delete (DL_DIR)
}
}

task "apt" (
description: "Creating APT repository",
group: PACKAGES_GROUP) << {

delete ( "$OUTPUT_DIR/apt")
mkdir ("$OUTPUT_DIR/apt/conf")

copy {
from "$REPO_DIR/apt/distributions"
into "$OUTPUT_DIR/apt/conf"
}
fileTree (OUTPUT_DIR) {
include "*/*.changes"
}.each { changeFile ->
exec {
workingDir BUILD_DIR
commandLine "reprepro -Vb $OUTPUT_DIR/apt include bigtop $changeFile".split(' ')
}
}
}

task "yum" (
description: "Creating YUM repository",
group: PACKAGES_GROUP) << {
delete ( "$OUTPUT_DIR/repodata")
exec {
workingDir BUILD_DIR
commandLine "createrepo -o $OUTPUT_DIR $OUTPUT_DIR".split(' ')
}
}

0 comments on commit be1fbfc

Please sign in to comment.