use bash script for unpacking during import
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
"cytoscape-elk": "^2.1.0",
|
"cytoscape-elk": "^2.1.0",
|
||||||
"cytoscape-klay": "^3.1.4",
|
"cytoscape-klay": "^3.1.4",
|
||||||
"debounce": "^1.2.1",
|
"debounce": "^1.2.1",
|
||||||
"decompress": "^4.2.1",
|
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"lean4-infoview": "https://gitpkg.now.sh/leanprover/vscode-lean4/lean4-infoview?de0062c",
|
"lean4-infoview": "https://gitpkg.now.sh/leanprover/vscode-lean4/lean4-infoview?de0062c",
|
||||||
"lean4web": "github:hhu-adam/lean4web",
|
"lean4web": "github:hhu-adam/lean4web",
|
||||||
|
|||||||
+1
-6
@@ -1,7 +1,6 @@
|
|||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import request from 'request'
|
import request from 'request'
|
||||||
import decompress from 'decompress'
|
|
||||||
import requestProgress from 'request-progress'
|
import requestProgress from 'request-progress'
|
||||||
import { Octokit } from 'octokit';
|
import { Octokit } from 'octokit';
|
||||||
|
|
||||||
@@ -77,11 +76,7 @@ async function doImport (owner, repo, id) {
|
|||||||
progress[id].output += `Download from ${url}\n`
|
progress[id].output += `Download from ${url}\n`
|
||||||
await download(id, url, `tmp/artifact_${artifactId}.zip`)
|
await download(id, url, `tmp/artifact_${artifactId}.zip`)
|
||||||
progress[id].output += `Download finished.\n`
|
progress[id].output += `Download finished.\n`
|
||||||
progress[id].output += `Unpacking ZIP.\n`
|
await runProcess(id, "/bin/bash", ["./unpack.sh", artifactId],".")
|
||||||
const files = await decompress(`tmp/artifact_${artifactId}.zip`, `tmp/artifact_${artifactId}`)
|
|
||||||
if (files.length != 1) { throw Error(`Unexpected number of files in ZIP: ${files.length}`) }
|
|
||||||
progress[id].output += `Unpacking TAR.\n`
|
|
||||||
const files_inner = await decompress(`tmp/artifact_${artifactId}/${files[0].path}`, `tmp/artifact_${artifactId}_inner`)
|
|
||||||
let manifest = fs.readFileSync(`tmp/artifact_${artifactId}_inner/manifest.json`);
|
let manifest = fs.readFileSync(`tmp/artifact_${artifactId}_inner/manifest.json`);
|
||||||
manifest = JSON.parse(manifest);
|
manifest = JSON.parse(manifest);
|
||||||
if (manifest.length !== 1) {
|
if (manifest.length !== 1) {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#/bin/bash
|
||||||
|
|
||||||
|
ARTIFACT_ID=$1
|
||||||
|
|
||||||
|
mkdir workingdir
|
||||||
|
echo "Unpacking ZIP."
|
||||||
|
unzip tmp/artifact_${ARTIFACT_ID}.zip -d tmp/artifact_${ARTIFACT_ID}
|
||||||
|
echo "Unpacking TAR."
|
||||||
|
for f in tmp/artifact_${ARTIFACT_ID}/* #Should only be one file
|
||||||
|
do
|
||||||
|
echo "Unpacking $f"
|
||||||
|
mkdir tmp/artifact_${ARTIFACT_ID}_inner
|
||||||
|
tar -xvf $f -C tmp/artifact_${ARTIFACT_ID}_inner
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user