mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 13:53:22 +02:00
Upgrading STF for security reasons (#813)
* Upgrading STF for security reasons Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update semaphore files Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * upgrading STF for security reasons v2 Signed-off-by: Denis barbaron <denis.barbaron@orange.com> * update yarn.lock file Signed-off-by: Denis barbaron <denis.barbaron@orange.com> --------- Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
/**
|
||||
* Copyright © 2024 contains code contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
var syrup = require('@devicefarmer/stf-syrup')
|
||||
var Promise = require('bluebird')
|
||||
var _ = require('lodash')
|
||||
|
||||
var logger = require('../../../util/logger')
|
||||
const util = require('util')
|
||||
const adbkit = require('@devicefarmer/adbkit')
|
||||
|
||||
module.exports = syrup.serial()
|
||||
.dependency(require('../support/adb'))
|
||||
@@ -38,7 +41,7 @@ module.exports = syrup.serial()
|
||||
throw new Error(util.format('Cleanup %s is not allowed!', folder))
|
||||
}
|
||||
})
|
||||
log.debug('Cleanup folders: %j', options.cleanupFolder)
|
||||
log.info('Cleanup folders: %j', options.cleanupFolder)
|
||||
|
||||
function listPackages() {
|
||||
return adb.getPackages(options.serial)
|
||||
@@ -56,14 +59,14 @@ module.exports = syrup.serial()
|
||||
return adb
|
||||
// get file size
|
||||
.shell(options.serial, util.format('du -h "%s"', filename))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
.then(function(output) {
|
||||
// output is in format: size filename. extract size;
|
||||
var size = output.toString().split('\t')[0]
|
||||
log.info('Removing %s (%s)', filename, size)
|
||||
return adb
|
||||
.shell(options.serial, util.format('rm -rf "%s"', filename))
|
||||
.then(adbkit.util.readAll)
|
||||
.then(adb.util.readAll)
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.warn(util.format('Unable to clean %s folder', filename), err)
|
||||
@@ -149,7 +152,7 @@ module.exports = syrup.serial()
|
||||
, plugin.disableBluetooth
|
||||
, plugin.cleanFolders
|
||||
, function() {
|
||||
log.debug('Cleanup done')
|
||||
log.info('Cleanup done')
|
||||
}
|
||||
], function(fn) {
|
||||
return fn()
|
||||
|
||||
Reference in New Issue
Block a user