Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openxt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
openxt
Commits
d13ae7f2
There was an error fetching the commit references. Please try again later.
Commit
d13ae7f2
authored
3 years ago
by
Recolic K
Browse files
Options
Downloads
Patches
Plain Diff
allow debug output
parent
2722074e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/nuget-download-package/main.go
+17
-7
17 additions, 7 deletions
tools/nuget-download-package/main.go
with
17 additions
and
7 deletions
tools/nuget-download-package/main.go
+
17
−
7
View file @
d13ae7f2
...
...
@@ -9,6 +9,7 @@ import (
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
)
...
...
@@ -176,7 +177,7 @@ func decidePackageVersionRange(packageName, frameworkVersion string, indexJsons
// If frameworkVersion != "", then I find the latest available package for this framework.
// If packageVersion != "", then I find the url for this version.
// You must only set ONE OF THEM! If you set both, the `frameworkVersion` would be ignored.
func
decidePackageVersion
(
frameworkVersion
,
packageVersion
string
,
indexJsons
,
indexJsons_Login
[]
string
)
(
maxAvailableVersion
,
maxAvailableVersionUrl
,
maxAvailableVersionUrlLogin
string
)
{
func
decidePackageVersion
(
frameworkVersion
,
packageVersion
string
,
indexJsons
,
indexJsons_Login
[]
string
,
debugOutput
bool
)
(
maxAvailableVersion
,
maxAvailableVersionUrl
,
maxAvailableVersionUrlLogin
string
)
{
// The golang json parse library sucks. Prevent it from crashing
// on a json syntax error.
//
...
...
@@ -204,7 +205,9 @@ func decidePackageVersion(frameworkVersion, packageVersion string, indexJsons, i
jCatalogEntry
:=
jPkgVersionItem
[
"catalogEntry"
]
.
(
map
[
string
]
interface
{})
myVersionText
:=
jCatalogEntry
[
"version"
]
.
(
string
)
myVersionUrl
:=
jPkgVersionItem
[
"packageContent"
]
.
(
string
)
// log.Println("DEBUG: reaching " + myVersionText)
if
debugOutput
{
log
.
Println
(
"DEBUG: reaching "
+
myVersionText
)
}
// Let's check if this version is ok
thisPkgVersionIsOk
,
thisPkgVersionIsPossibleOk
:=
false
,
false
...
...
@@ -214,7 +217,9 @@ func decidePackageVersion(frameworkVersion, packageVersion string, indexJsons, i
for
_
,
j6
:=
range
j5
.
([]
interface
{})
{
j7
:=
j6
.
(
map
[
string
]
interface
{})
if
j8
,
ok
:=
j7
[
"targetFramework"
];
ok
{
// log.Println("DEBUG: " + frameworkVersion +" vs "+ netVersionNugetFormatToStandardFormat(j8.(string)))
if
debugOutput
{
log
.
Println
(
"DEBUG: "
+
frameworkVersion
+
" vs "
+
netVersionNugetFormatToStandardFormat
(
j8
.
(
string
)))
}
if
frameworkVersion
==
netVersionNugetFormatToStandardFormat
(
j8
.
(
string
))
{
thisPkgVersionIsOk
=
true
break
...
...
@@ -231,6 +236,9 @@ func decidePackageVersion(frameworkVersion, packageVersion string, indexJsons, i
}
if
packageVersion
!=
""
{
if
debugOutput
{
log
.
Println
(
"DEBUG: "
+
packageVersion
+
" vs "
+
myVersionText
)
}
// It should be a percise match here. However, someone in ControlPlane using PkgNewtonsoft_json_12.
// They only provide parts of the version number. It sucks.
thisPkgVersionIsOk
=
packageVersion
==
myVersionText
...
...
@@ -261,7 +269,9 @@ func decidePackageVersion(frameworkVersion, packageVersion string, indexJsons, i
PossibleAvailableVersionUrlLogin
=
indexJsons_Login
[
indexJson_currIndex
]
}
}
// log.Println("DEBUG: leaving " + myVersionText)
if
(
debugOutput
)
{
log
.
Println
(
"DEBUG: leaving "
+
myVersionText
+
". IsOk="
+
strconv
.
FormatBool
(
thisPkgVersionIsOk
)
+
", IsPossibleOk="
+
strconv
.
FormatBool
(
thisPkgVersionIsPossibleOk
))
}
}()
// catch exception and continue
}
}
...
...
@@ -299,9 +309,9 @@ func main() {
pkgVer
,
targetUrl
,
targetUrlLogin
:=
""
,
""
,
""
if
strings
.
HasPrefix
(
pkgVerOrNetVer
,
"net"
)
{
pkgVer
,
targetUrl
,
targetUrlLogin
=
decidePackageVersion
(
pkgVerOrNetVer
,
""
,
indexJsons
,
indexJsons_Login
)
}
else
{
pkgVer
,
targetUrl
,
targetUrlLogin
=
decidePackageVersion
(
""
,
pkgVerOrNetVer
,
indexJsons
,
indexJsons_Login
)
pkgVer
,
targetUrl
,
targetUrlLogin
=
decidePackageVersion
(
pkgVerOrNetVer
,
""
,
indexJsons
,
indexJsons_Login
,
os
.
Getenv
(
"OPENXT_DEBUG"
)
==
"1"
)
}
else
{
pkgVer
,
targetUrl
,
targetUrlLogin
=
decidePackageVersion
(
""
,
pkgVerOrNetVer
,
indexJsons
,
indexJsons_Login
,
os
.
Getenv
(
"OPENXT_DEBUG"
)
==
"1"
)
}
if
pkgVer
==
""
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment