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

Fix exception when paket outdated runs on a repo with a http zip dependency #2565

Merged
merged 3 commits into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions completion/paket-completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ _paket-outdated() {
args=(
$global_options
"${(f)$(_paket_group_option 'specify dependency group (default: all groups)')}"
'(-f --force)'{-f,--force}'[force download and reinstallation of all dependencies]'
'(--ignore-constraints)'--ignore-constraints'[ignore version constraints in the paket.dependencies file]'
'(--pre --include-prereleases)'{--pre,--include-prereleases}'[consider prerelease versions as updates]'
)
Expand Down
1 change: 1 addition & 0 deletions src/Paket.Core/Dependencies/RemoteDownload.fs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ let downloadRemoteFiles(remoteFile:ResolvedSourceFile,destination) = async {
let authentication = auth remoteFile.AuthKey url
match Path.GetExtension(destination).ToLowerInvariant() with
| ".zip" ->
CleanDir targetFolder.FullName
do! downloadFromUrl(authentication, url) destination
ZipFile.ExtractToDirectory(destination, targetFolder.FullName)
| _ -> do! downloadFromUrl(authentication, url) destination
Expand Down
7 changes: 3 additions & 4 deletions src/Paket.Core/PackageAnalysis/FindOutdated.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ let private adjustVersionRequirements strict includingPrereleases (dependenciesF
DependenciesFile(dependenciesFile.FileName, groups, dependenciesFile.Lines)

/// Finds all outdated packages.
let FindOutdated strict includingPrereleases groupNameFilter environment = trial {
let FindOutdated strict force includingPrereleases groupNameFilter environment = trial {
let! lockFile = environment |> PaketEnv.ensureLockFileExists
let force = true

let dependenciesFile =
environment.DependenciesFile
Expand Down Expand Up @@ -83,7 +82,7 @@ let private printOutdated changed =
tracefn " * %O %O -> %O" packageName oldVersion newVersion

/// Prints all outdated packages.
let ShowOutdated strict includingPrereleases groupName environment = trial {
let! allOutdated = FindOutdated strict includingPrereleases groupName environment
let ShowOutdated strict force includingPrereleases groupName environment = trial {
let! allOutdated = FindOutdated strict force includingPrereleases groupName environment
printOutdated allOutdated
}
18 changes: 13 additions & 5 deletions src/Paket.Core/PublicAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,24 @@ type Dependencies(dependenciesFileName: string) =
|> Array.choose (fun (p:ProjectFile) -> p.FindReferencesFile())
if Array.isEmpty referencesFiles then
traceWarnfn "No paket.references files found for which packages could be installed."
else
else
this.Restore(force, group, Array.toList referencesFiles, touchAffectedRefs, ignoreChecks, failOnFailedChecks, targetFramework)

/// Lists outdated packages.
member this.ShowOutdated(strict: bool,includePrereleases: bool, groupName: string Option): unit =
FindOutdated.ShowOutdated strict includePrereleases groupName |> this.Process
[<Obsolete("Use ShowOutdated with the force parameter set to true to get the old behavior")>]
member this.ShowOutdated(strict: bool, includePrereleases: bool, groupName: string Option): unit =
this.ShowOutdated(strict, true, includePrereleases, groupName)

member this.ShowOutdated(strict: bool, force: bool, includePrereleases: bool, groupName: string Option): unit =
FindOutdated.ShowOutdated strict force includePrereleases groupName |> this.Process

/// Finds all outdated packages.
member this.FindOutdated(strict: bool,includePrereleases: bool, groupName: string Option): (string * string * SemVerInfo) list =
FindOutdated.FindOutdated strict includePrereleases groupName
[<Obsolete("Use FindOutdated with the force parameter set to true to get the old behavior")>]
member this.FindOutdated(strict: bool, includePrereleases: bool, groupName: string Option): (string * string * SemVerInfo) list =
this.FindOutdated(strict, true, includePrereleases, groupName)

member this.FindOutdated(strict: bool, force: bool, includePrereleases: bool, groupName: string Option): (string * string * SemVerInfo) list =
FindOutdated.FindOutdated strict force includePrereleases groupName
|> this.Process
|> List.map (fun (g, p,_,newVersion) -> g.ToString(),p.ToString(),newVersion)

Expand Down
2 changes: 2 additions & 0 deletions src/Paket/Commands.fs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ with
| Load_Script_Type_Legacy(_) -> "[obsolete]"

type OutdatedArgs =
| [<Unique;AltCommandLine("-f")>] Force
| [<Unique>] Ignore_Constraints

| [<Unique;AltCommandLine("-g")>] Group of name:string
Expand All @@ -181,6 +182,7 @@ with
interface IArgParserTemplate with
member this.Usage =
match this with
| Force -> "force download and reinstallation of all dependencies"
| Ignore_Constraints -> "ignore version constraints in the paket.dependencies file"

| Group(_) -> "specify dependency group (default: all groups)"
Expand Down
5 changes: 3 additions & 2 deletions src/Paket/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,14 @@ let install (results : ParseResults<_>) =
alternativeProjectRoot)

let outdated (results : ParseResults<_>) =
let force = results.Contains <@ OutdatedArgs.Force @>
let strict = results.Contains <@ OutdatedArgs.Ignore_Constraints @> |> not
let includePrereleases = results.Contains <@ OutdatedArgs.Include_Prereleases @>
let group =
(results.TryGetResult<@ OutdatedArgs.Group @>,
results.TryGetResult<@ OutdatedArgs.Group_Legacy @>)
|> legacyOption results "--group" "group"
Dependencies.Locate().ShowOutdated(strict, includePrereleases, group)
Dependencies.Locate().ShowOutdated(strict, force, includePrereleases, group)

let remove (results : ParseResults<_>) =
let packageName =
Expand Down Expand Up @@ -594,7 +595,7 @@ let findPackageVersions (results : ParseResults<_>) =
results.TryGetResult <@ FindPackageVersionsArgs.Source_Legacy @>)
|> legacyOption results "--source" "source"
discoverPackageSources arg dependencies

let root =
match dependencies with
| Some d ->
Expand Down