Skip to content

Commit 7c5aede

Browse files
committed
remove container list only if not locked
1 parent df36c1e commit 7c5aede

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

bioconda-backup/index.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ const getRepoFiles = function(dirPath, arrayOfFiles) {
5151
}
5252

5353
function save_tags(container, tags, kind) {
54-
let dest = `/${config.meta.path}/${container}_tags.json`
54+
if(!fs.existsSync(config.meta.path)) {
55+
console.debug('meta path does not exists, skipping save_tags')
56+
return
57+
}
58+
let dest = `${config.meta.path}/${container}_tags.json`
5559
let data = {
5660
name: container,
5761
docker: [],
@@ -112,7 +116,8 @@ async function repoFiles(kind='biocontainers', do_scan=false) {
112116
let bc = await existingRepo.getBranchCommit('master');
113117
lastCommit = bc.sha();
114118
console.log('existing, last commit', kind, lastCommit);
115-
fs.rmSync(destDir, {recursive: true});
119+
fs.rmdirSync(destDir, {recursive: true, force: true})
120+
//fs.rmSync(destDir, {recursive: true});
116121
}
117122
let repoUrl = kind == 'biocontainers' ? biocontainers : bioconda;
118123
await Git.Clone(repoUrl, destDir);
@@ -540,9 +545,6 @@ const options = yargs
540545
.option("f", { alias: "file", describe: "file path to containers/tags list"})
541546
.argv;
542547

543-
if(fs.existsSync(`${config.workdir}/biocontainers.json`)) {
544-
fs.unlinkSync(`${config.workdir}/biocontainers.json`);
545-
}
546548

547549
async function getContainers(scan_options) {
548550
if(scan_options.use){
@@ -601,6 +603,10 @@ if(fs.existsSync(`${config.workdir}/sync.lock`)) {
601603
fs.writeFileSync(`${config.workdir}/sync.lock`, '')
602604
}
603605

606+
if(fs.existsSync(`${config.workdir}/biocontainers.json`)) {
607+
fs.unlinkSync(`${config.workdir}/biocontainers.json`);
608+
}
609+
604610

605611

606612
getContainers(options).then((containers) => {

0 commit comments

Comments
 (0)