aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlaf Flebbe <of@ofleb.be>2016-02-23 20:57:54 +0100
committerOlaf Flebbe <of@ofleb.be>2016-02-25 20:53:20 +0100
commit0bdf43735f299428915fe79e0cc526c1909db75f (patch)
tree52b8f5c758e1575fa2a49b5ace039fbb31829230
parent510ac7b5e0c0be81450d6886adfa377fe4838adf (diff)
BIGTOP-2346: Do not use gradle delete() for sources and build directories
-rw-r--r--packages.gradle24
1 files changed, 15 insertions, 9 deletions
diff --git a/packages.gradle b/packages.gradle
index c29c5c18..9e045d87 100644
--- a/packages.gradle
+++ b/packages.gradle
@@ -71,6 +71,12 @@ def ifExists = { url ->
URLConnection uCon = new URL(url).openConnection()
return (uCon as HttpURLConnection).responseCode == 200
}
+def safeDelete = { fileName ->
+ exec {
+ workingDir '.'
+ commandLine 'rm', '-rf', fileName
+ }
+}
def getDate() {
new Date().format('E, dd MMM yyyy HH:mm:ss Z')
}
@@ -226,7 +232,7 @@ def genTasks = { target ->
def final DOWNLOAD_DST = config.bigtop.components[target].downloaddst ?: ""
def final SEED_TAR = config.bigtop.components[target].seedtar
- delete(TAR_DIR); mkdir(TAR_DIR)
+ safeDelete(TAR_DIR); mkdir(TAR_DIR)
if (TARBALL_SRC.isEmpty() || TARBALL_SRC.endsWith('.zip')) {
if (TARBALL_SRC.isEmpty()) {
@@ -250,7 +256,7 @@ def genTasks = { target ->
(f != "." && f != "..")}).each { f ->
new File("$TAR_DIR/$TOP_LEVEL_DIR/$f").renameTo("$TAR_DIR/$f")
}
- delete(TOP_LEVEL_DIR)
+ safeDelete(TOP_LEVEL_DIR)
}
}
// create SEED_TAR
@@ -388,7 +394,7 @@ def genTasks = { target ->
fileTree (dir: "$DEB_PKG_DIR/..", includes: ['*.dsc', '*.diff.gz', '*.debian.tar.gz', '*.debian.tar.xz', "*_source.changes", "*.orig.tar.gz" ]).copy {
into PKG_OUTPUT_DIR
}
- delete (BUILD_DIR)
+ safeDelete(BUILD_DIR)
touchTargetFile(config.bigtop.components[target].targetsdeb)
}
@@ -450,7 +456,7 @@ def genTasks = { target ->
def final PKG_VERSION = config.bigtop.components[target].version.pkg
def final BASE_VERSION = config.bigtop.components[target].version.base
def final PKG_OUTPUT_DIR = config.bigtop.components[target].outputdir
- delete ("$PKG_BUILD_DIR/rpm")
+ safeDelete ("$PKG_BUILD_DIR/rpm")
['INSTALL','SOURCES','BUILD','SRPMS','RPMS'].each { rpmdir ->
mkdir("$PKG_BUILD_DIR/rpm/$rpmdir")
}
@@ -592,8 +598,8 @@ def genTasks = { target ->
task "$target-clean" (dependsOn: "${target}_vardefines",
description: "Removing $target component build and output directories",
group: PACKAGES_GROUP) << {
- delete(config.bigtop.components[target].builddir)
- delete(config.bigtop.components[target].outputdir)
+ safeDelete(config.bigtop.components[target].builddir)
+ safeDelete(config.bigtop.components[target].outputdir)
}
task "$target-help" (description: "List of available tasks for $target", group: PACKAGES_GROUP) << {
println (target + "\n\t[" + tasks.findAll { alltask -> alltask.name.startsWith(target)}*.name.join(", ") + "]")
@@ -649,9 +655,9 @@ project.afterEvaluate {
description: "Removing $BUILD_DIR, $OUTPUT_DIR, and $DIST_DIR.\n\t\t" +
"Cleaning all components' build and output directories.",
group: PACKAGES_GROUP) << {
- delete (BUILD_DIR)
- delete (OUTPUT_DIR)
- delete (DIST_DIR)
+ safeDelete(BUILD_DIR)
+ safeDelete(OUTPUT_DIR)
+ safeDelete(DIST_DIR)
}
task realclean (dependsOn: allclean,
description: "Removing $BUILD_DIR, $OUTPUT_DIR, $DIST_DIR, and $DL_DIR",