Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Prepare extraction of main bucket #3060

Merged
merged 33 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0e36c8f
Add main bucket into buckets
Ash258 Jan 31, 2019
9c52f84
Download main bucket on installing
Ash258 Jan 31, 2019
ab52591
Some duplicated code 🤔
Ash258 Jan 31, 2019
147d49b
Check for branch update
Ash258 Jan 31, 2019
c00c0a1
Add checkup for main bucket
Ash258 Jan 31, 2019
fe87318
Move buckets functions from lib-exec into lib
Ash258 Jan 31, 2019
a7a7431
pre-create folder structure
Ash258 Jan 31, 2019
7d7facd
Revert pre-creating
Ash258 Jan 31, 2019
ec524cf
udpate: don't call scoop, but use get(set)_config functions
Ash258 Feb 1, 2019
9ec0897
update: Add main bucket if there is not
Ash258 Feb 1, 2019
2f16f0d
Make main bucket default
Ash258 Feb 1, 2019
120d79e
Should be all?
Ash258 Feb 1, 2019
273b735
Install from my concept
Ash258 Feb 1, 2019
4240955
Adress main bucket update problem
Ash258 Feb 1, 2019
4d5988b
Merge branch 'master' into new-master
Ash258 Feb 1, 2019
e83ffda
Merge master
Ash258 Apr 22, 2019
972e418
Spaces
Ash258 Apr 22, 2019
3d83643
Some last changes to handle bucket extraction
Ash258 Apr 22, 2019
72847c8
Adopt binaries
Ash258 Apr 22, 2019
5446e8e
bucketdir -> Find-BucketDirectory
Ash258 Apr 22, 2019
0ec7ab9
Full implement extraction progress
Ash258 Apr 22, 2019
74b20aa
Merge branch 'master' of https://github.com/lukesampson/scoop into ne…
Ash258 Apr 22, 2019
d8c75e4
Typo
Ash258 Apr 22, 2019
83884f8
Remove redundant .vscode settings
Ash258 Apr 22, 2019
a5dd6b1
fix merge error
Ash258 Apr 22, 2019
1187dfc
missing imports
Ash258 Apr 22, 2019
8b97370
fix(info): Shows wrong URL to manifest
Ash258 Apr 22, 2019
cfd628c
Load known_buckets from $psscriptroot
Ash258 Apr 22, 2019
bdcf946
Ignore [main] bucket message in list command
Ash258 Apr 22, 2019
8c8e872
Fix update always add and remove main bucket
Ash258 Apr 22, 2019
58eb7ec
Move comment to correct line
Ash258 Apr 22, 2019
d1fa838
fix(install.ps1): PR @niheaven
Ash258 Apr 23, 2019
d9a3d59
Leave binaries params empty, mark them mandatory
Ash258 Apr 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.ignoreOneLineBlock": true,
"json.schemas": [
{
"url": "https://raw.githubusercontent.com/lukesampson/scoop/master/schema.json",
"fileMatch": [
"bucket/*.json"
]
}
],
"files.exclude": {
"**/.git": true,
"**/.svn": true,
Expand Down
15 changes: 10 additions & 5 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,32 @@
.PARAMETER SkipUpdated
Updated manifests will not be shown.
.EXAMPLE
PS REPODIR > .\bin\auto-pr.ps1 'someUsername/repository:branch' -Request
PS BUCKETROOT > .\bin\auto-pr.ps1 'someUsername/repository:branch' -Request
.EXAMPLE
PS REPODIR > .\bin\auto-pr.ps1 -Push
PS BUCKETROOT > .\bin\auto-pr.ps1 -Push
Update all manifests inside 'bucket/' directory.
#>

param(
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!($_ -match '^(.*)\/(.*):(.*)$')) {
throw 'Upstream must be in this format: <user>/<repo>:<branch>'
}
$true
})]
[String] $Upstream = 'lukesampson/scoop:master',
[String] $Upstream,
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
$true
})]
[String] $Dir = "$PSScriptRoot\..\bucket",
[Alias('Path')]
[String] $Dir,
[Switch] $Push,
[Switch] $Request,
[Switch] $Help,
Expand Down
8 changes: 5 additions & 3 deletions bin/checkhashes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
Downloaded files will not be deleted after script finish.
Should not be used, because check should be used for downloading actual version of file (as normal user, not finding in some document from vendors, which could be damaged / wrong (Example: Slack@3.3.1 lukesampson/scoop-extras#1192)), not some previously downloaded.
.EXAMPLE
PS BUCKETDIR> .\bin\checkhashes.ps1
PS BUCKETROOT> .\bin\checkhashes.ps1
Check all manifests for hash mismatch.
.EXAMPLE
PS BUCKETDIR> .\bin\checkhashes.ps1 MANIFEST -Update
PS BUCKETROOT> .\bin\checkhashes.ps1 MANIFEST -Update
Check MANIFEST and Update if there are some wrong hashes.
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
})]
[String] $Dir = "$PSScriptRoot\..\bucket",
[Alias('Path')]
[String] $Dir,
[Switch] $Update,
[Switch] $ForceUpdate,
[Switch] $SkipCorrect,
Expand Down
4 changes: 3 additions & 1 deletion bin/checkurls.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
})]
[String] $Dir = "$PSScriptRoot\\..\bucket",
[Alias('Path')]
[String] $Dir,
[Int] $Timeout = 5,
[Switch] $SkipValid
)
Expand Down
31 changes: 17 additions & 14 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,52 @@
.PARAMETER SkipUpdated
Updated manifests will not be shown.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1
PS BUCKETROOT > .\bin\checkver.ps1
Check all manifest inside default directory.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 -s
PS BUCKETROOT > .\bin\checkver.ps1 -s
Check all manifest inside default directory (list only outdated manifests).
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 -u
PS BUCKETROOT > .\bin\checkver.ps1 -u
Check all manifests and update All outdated manifests.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN
PS BUCKETROOT > .\bin\checkver.ps1 MAN
Check manifest MAN.json inside default directory.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN -u
PS BUCKETROOT > .\bin\checkver.ps1 MAN -u
Check manifest MAN.json and update, if there is newer version.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN -f
PS BUCKETROOT > .\bin\checkver.ps1 MAN -f
Check manifest MAN.json and update, even if there is no new version.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN -u -v VER
PS BUCKETROOT > .\bin\checkver.ps1 MAN -u -v VER
Check manifest MAN.json and update, using version VER
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN DIR
PS BUCKETROOT > .\bin\checkver.ps1 MAN DIR
Check manifest MAN.json inside ./DIR directory.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 -Dir DIR
PS BUCKETROOT > .\bin\checkver.ps1 -Dir DIR
Check all manifests inside ./DIR directory.
.EXAMPLE
PS BUCKETDIR > .\bin\checkver.ps1 MAN DIR -u
Check manifest MAN.json inside ./DIR directory and update if there is newer version.
PS BUCKETROOT > .\bin\checkver.ps1 MAN DIR -u
Check manifest MAN.json inside ./DIR directory and update if there is newer version.
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
$true
})]
[String] $Dir = "$psscriptroot\..\bucket",
[Alias('Path')]
[String] $Dir,
[Switch] $Update,
[Switch] $ForceUpdate,
[Switch] $SkipUpdated,
[String] $Version = ""
[String] $Version = ''
)

. "$psscriptroot\..\lib\core.ps1"
Expand Down
11 changes: 7 additions & 4 deletions bin/describe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
$true
})]
[String] $Dir = "$PSScriptRoot\..\bucket"
[Alias('Path')]
[String] $Dir
)

. "$PSScriptRoot\..\lib\core.ps1"
Expand All @@ -34,7 +37,7 @@ $Queue | ForEach-Object {
$name, $manifest = $_
Write-Host "$name`: " -NoNewline

if(!$manifest.homepage) {
if (!$manifest.homepage) {
Write-Host "`nNo homepage set." -ForegroundColor Red
return
}
Expand All @@ -49,7 +52,7 @@ $Queue | ForEach-Object {
}

$description, $descr_method = find_description $manifest.homepage $home_html
if(!$description) {
if (!$description) {
Write-Host "`nDescription not found ($($manifest.homepage))" -ForegroundColor Red
return
}
Expand Down
6 changes: 4 additions & 2 deletions bin/formatjson.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
$true
})]
[Alias('Path')]
[String] $Dir = "$PSScriptRoot\..\bucket"
[String] $Dir
)

. "$PSScriptRoot\..\lib\core.ps1"
Expand Down
26 changes: 20 additions & 6 deletions bin/install.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# requires -v 3
#Requires -Version 3

# remote install:
# iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
Expand Down Expand Up @@ -42,23 +42,37 @@ $dir = ensure (versiondir 'scoop' 'current')
# download scoop zip
$zipurl = 'https://github.com/lukesampson/scoop/archive/master.zip'
$zipfile = "$dir\scoop.zip"
Write-Output 'Downloading...'
Write-Output 'Downloading scoop...'
dl $zipurl $zipfile

'Extracting...'
Write-Output 'Extracting...'
Add-Type -Assembly "System.IO.Compression.FileSystem"
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile,"$dir\_tmp")
Copy-Item "$dir\_tmp\scoop-master\*" $dir -r -force
Remove-Item "$dir\_tmp" -r -force
Remove-Item $zipfile
Copy-Item "$dir\_tmp\*master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

Write-Output 'Creating shim...'
shim "$dir\bin\scoop.ps1" $false

# download main bucket
$dir = "$scoopdir\buckets\main"
$zipurl = 'https://github.com/scoopinstaller/scoop-main/archive/master.zip'
$zipfile = "$dir\main-bucket.zip"
Write-Output 'Downloading main bucket...'
New-Item $dir -Type Directory -Force | Out-Null
dl $zipurl $zipfile

Write-Output 'Extracting...'
[IO.Compression.ZipFile]::ExtractToDirectory($zipfile, "$dir\_tmp")
Copy-Item "$dir\_tmp\*-master\*" $dir -Recurse -Force
Remove-Item "$dir\_tmp", $zipfile -Recurse -Force

ensure_robocopy_in_path
ensure_scoop_in_path

scoop config lastupdate ([System.DateTime]::Now.ToString('o'))
success 'Scoop was installed successfully!'

Write-Output "Type 'scoop help' for instructions."

$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value
11 changes: 10 additions & 1 deletion bin/missing-checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@
#>
param(
[String] $App = '*',
[String] $Dir = "$PSScriptRoot\..\bucket",
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
} else {
$true
}
})]
[Alias('Path')]
[String] $Dir,
[Switch] $SkipSupported
)

Expand Down
2 changes: 1 addition & 1 deletion bin/scoop.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) {
Pop-Location

Get-LocalBucket | ForEach-Object {
Push-Location $(bucketdir $_)
Push-Location (Find-BucketDirectory $_ -Root)
if(test-path '.git') {
write-host "'$_' bucket:"
git_log --oneline HEAD -n 1
Expand Down
1 change: 1 addition & 0 deletions buckets.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"main": "https://github.com/scoopinstaller/scoop-main",
"extras": "https://github.com/lukesampson/scoop-extras",
"versions": "https://github.com/scoopinstaller/versions",
"nightlies": "https://github.com/scoopinstaller/nightlies",
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.6'

services:
scoop:
image: microsoft/windowsservercore:1803
container_name: scoop_debug
command: powershell.exe -NoLogo -NoExit
working_dir: C:\SCOOP\apps\scoop\current\bin
environment:
SCOOP: C:\SCOOP
SCOOP_HOME: C:\SCOOP\apps\scoop\current
volumes:
- .:C:\SCOOP\apps\scoop\current
11 changes: 0 additions & 11 deletions lib/autoupdate.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<#
TODO
- add a github release autoupdate type
- tests (single arch, without hashes etc.)
- clean up
#>
. "$psscriptroot\..\lib\json.ps1"
Expand Down Expand Up @@ -141,15 +139,6 @@ function find_hash_in_headers([String] $url) {
function get_hash_for_app([String] $app, $config, [String] $version, [String] $url, [Hashtable] $substitutions) {
$hash = $null

<#
TODO implement more hashing types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest leave hash mode comment for illustrations, there is something TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All are already implemented

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean TODO more, and leave these implemented alone as comment. Maybe need to rearrange these lines.

`extract` Should be able to extract from origin page source
`sourceforge` Default `extract` method for sf.net
`metalink` Default `extract` method for metalink
`json` Find hash from JSONPath
`rdf` Find hash from a RDF Xml file
`download` Last resort, download the real file and hash it
#>
$hashmode = $config.mode
$basename = url_remote_filename($url)

Expand Down
Loading