use extract_dir instead of unzip_folder

This commit is contained in:
Luke Sampson
2013-08-09 12:20:44 +10:00
parent 6a4af89f7c
commit e1b1bcb880
12 changed files with 26 additions and 17 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
"homepage": "https://github.com/lukesampson/concfg",
"version": "0.2013.07.01",
"url": "https://github.com/lukesampson/concfg/archive/master.zip",
"extract_subdir": "concfg-master",
"extract_dir": "concfg-master",
"bin": "bin\\concfg.ps1"
}
+1 -1
View File
@@ -2,6 +2,6 @@
"version": "0.2013.07.19",
"homepage": "https://github.com/lukesampson/cowsay-psh",
"url": "https://github.com/lukesampson/cowsay-psh/archive/master.zip",
"extract_subdir": "cowsay-psh-master",
"extract_dir": "cowsay-psh-master",
"bin": ["cowsay.ps1","cowthink.ps1"]
}
+1 -1
View File
@@ -6,7 +6,7 @@
"http://curl.haxx.se/gknw.net/7.30.0/dist-w32/curl-7.30.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32.zip",
"http://curl.haxx.se/ca/cacert.pem#/curl-ca-bundle.crt"
],
"extract_subdir": "curl-7.30.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32",
"extract_dir": "curl-7.30.0-rtmp-ssh2-ssl-sspi-zlib-idn-static-bin-w32",
"hash": [
"sha256:90af768c246136c14a2ae52e8775fa4d976eda4632159bc565e1a539b4f15e1a",
null
+1 -1
View File
@@ -12,7 +12,7 @@
"hash": "sha1:dee46d45e27193c14e07e695aa4c13d7fdc9de9b"
}
},
"extract_subdir": "go",
"extract_dir": "go",
"add_env_path": "bin",
"set_env": {
"GOROOT": "$dir"
+1 -1
View File
@@ -12,7 +12,7 @@
"hash": "sha256:26bd5d1555a3c010b0c58a4aaf5e1acd16bcf819926984f0716496d326768502"
}
},
"extract_subdir": "pgsql",
"extract_dir": "pgsql",
"bin": [
"bin\\clusterdb.exe",
"bin\\createdb.exe",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"version": "0.2013.07.10",
"url": "https://github.com/lukesampson/pshazz/archive/master.zip",
"extract_subdir": "pshazz-master",
"extract_dir": "pshazz-master",
"bin": [ "bin\\pshazz.ps1" ]
}
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "0.6.0-alpha-130707",
"license": "Apache 2.0",
"url": "https://www.myget.org/F/scriptcsnightly/api/v2/package/scriptcs/0.6.0-alpha-130707?fn=/dl.zip",
"extract_subdir": "tools\\scriptcs",
"extract_dir": "tools\\scriptcs",
"hash": "sha256:d0521827f09813cb3e22402e32a0089cf0b425981f3182568c47811717682750",
"bin": "scriptcs.exe"
}
+1 -1
View File
@@ -12,7 +12,7 @@
"md5:e16ec5b633d2f00bf511529e6abf3670",
"sha256:f6081071fa95a6f49c049e9d2aed2d2a2632ec47635b4b497a97bab5f5add498"
],
"extract_subdir": "vim\\vim73",
"extract_dir": "vim\\vim73",
"bin": [ "vim.exe", "vimtutor.ps1" ],
"post_install": "if(!(test-path ~\\.vimrc)) {
cp \"$(split-path(scoop which vim))\\vimrc_example.vim\" ~\\.vimrc
+1 -1
View File
@@ -3,6 +3,6 @@
"license": "GPL2",
"url": "http://downloads.sourceforge.net/project/winmerge/stable/2.14.0/WinMerge-2.14.0-exe.zip",
"hash": "sha256:9c77580ff9594536ce84dbbf0095e4b8654892a713989c378b9349c833c0f177",
"extract_subdir": "WinMerge-2.14.0-exe",
"extract_dir": "WinMerge-2.14.0-exe",
"bin": "WinMergeU.exe"
}
+3 -4
View File
@@ -7,16 +7,15 @@ function requires_7zip($fname) {
$fname -match '(\.gz)|(\.tar)|(\.lzma)|(\.7z)$'
}
function extract_7zip($path, $recurse) {
function extract_7zip($path, $to, $recurse) {
if(!$recurse) { write-host "extracting..." -nonewline }
$dir = split-path $path
$output = 7z x "$path" -o"$dir"
$output = 7z x "$path" -o"$to"
if($lastexitcode -ne 0) { abort "exit code was $lastexitcode" }
# recursively extract files, e.g. for .tar.gz
$output | sls '^Extracting\s+(.*)$' | % {
$fname = $_.matches[0].groups[1].value
if(requires_7zip $fname) { extract_7zip "$dir\$fname" $true }
if(requires_7zip $fname) { extract_7zip "$to\$fname" $to $true }
}
rm $path
+12 -3
View File
@@ -69,7 +69,7 @@ function dl_urls($app, $version, $manifest, $architecture, $dir) {
write-host "extracting..." -nonewline
# use tmp directory and copy so we can prevent 'folder merge' errors when multiple URLs
$null = mkdir "$dir\_scoop_unzip"
unzip "$dir\$fname" "$dir\_scoop_unzip" $manifest.extract_subdir
unzip "$dir\$fname" "$dir\_scoop_unzip" (extract_dir $manifest $architecture)
cp "$dir\_scoop_unzip\*" "$dir" -recurse -force
rm -r -force "$dir\_scoop_unzip"
rm "$dir\$fname"
@@ -79,7 +79,16 @@ function dl_urls($app, $version, $manifest, $architecture, $dir) {
warn "aborting: you'll need to run 'scoop uninstall $app' to clean up"
abort "7-zip is required. you can install it with 'scoop install 7zip'"
}
extract_7zip "$dir\$fname" $manifest.extract_subdir
$to = $dir
$extract_dir = extract_dir $manifest $architecture
if($extract_dir) {
$to = "$dir\_scoop_extract"
}
extract_7zip "$dir\$fname" $to
if($extract_dir) {
gci "$to\$extract_dir" -r | mv -dest "$dir" -force
rm -r -force "$to"
}
}
}
@@ -342,7 +351,7 @@ function rm_env($manifest) {
$manifest.set_env | gm -member noteproperty | % {
$name = $_.name;
env $name $null
rm env:\$name
if(test-path env:\$name) { rm env:\$name }
}
}
}
+2 -1
View File
@@ -65,4 +65,5 @@ function url($manifest, $arch) { arch_specific 'url' $manifest $arch }
function installer($manifest, $arch) { arch_specific 'installer' $manifest $arch }
function uninstaller($manifest, $arch) { arch_specific 'uninstaller' $manifest $arch }
function msi($manifest, $arch) { arch_specific 'msi' $manifest $arch }
function hash($manifest, $arch) { arch_specific 'hash' $manifest $arch }
function hash($manifest, $arch) { arch_specific 'hash' $manifest $arch }
function extract_dir($manifest, $arch) { arch_specific 'extract_dir' $manifest $arch}