Skip to content

Commit 9833a51

Browse files
committed
add option to scan from a git sha
1 parent 7c5aede commit 9833a51

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

bioconda-backup/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,21 @@ async function send_report() {
108108

109109
}
110110

111-
async function repoFiles(kind='biocontainers', do_scan=false) {
111+
async function repoFiles(kind='biocontainers', scan_options) {
112+
let do_scan = !scan_options.updated;
112113
let destDir = `${config.workdir}/${kind}`;
113114
let lastCommit = null;
115+
if(scan_options.gitSha) {
116+
lastCommit = scan_options.gitSha;
117+
}
114118
if (fs.existsSync(destDir)) {
119+
if(lastCommit === null) {
115120
let existingRepo = await Git.Repository.open(destDir);
116121
let bc = await existingRepo.getBranchCommit('master');
117122
lastCommit = bc.sha();
118-
console.log('existing, last commit', kind, lastCommit);
119-
fs.rmdirSync(destDir, {recursive: true, force: true})
123+
}
124+
console.log('existing, last commit', kind, lastCommit);
125+
fs.rmdirSync(destDir, {recursive: true, force: true})
120126
//fs.rmSync(destDir, {recursive: true});
121127
}
122128
let repoUrl = kind == 'biocontainers' ? biocontainers : bioconda;
@@ -526,7 +532,7 @@ function scan(kind, scan_options) {
526532
if(kind == 'bioconda' && !scan_options.conda) {
527533
return []
528534
}
529-
return repoFiles(kind, !scan_options.updated)
535+
return repoFiles(kind, scan_options)
530536
}
531537

532538
// let dockerhubImages = [];
@@ -543,6 +549,7 @@ const options = yargs
543549
.options("n", {alias: "use", describe: "use specific container for example bioconda:xxx or biocontainers:xxx"})
544550
.option("d", { alias: "dry", describe: "dry run, do not execute", type: "boolean"})
545551
.option("f", { alias: "file", describe: "file path to containers/tags list"})
552+
.option("g", {alias: "gitSha", describe: "like updated, but scan from related scan sha for updated containers"})
546553
.argv;
547554

548555

0 commit comments

Comments
 (0)