NI Package Manager (NIPM)

cancel
Showing results for 
Search instead for 
Did you mean: 

Validate Feed-URL for nipkg.exe

Solved!
Go to solution

Is it possible to run some command to validate if a feed URL is valid, that is a) can be reached, b) has suitable contents/configuration to be used as an NIPM feed?

(I'm fine with just 'b', but I don't see how you could get that without 'a', so I guess establishing 'b' requires 'a').

 

I see that "update" takes a(n optional) list of feed names, so perhaps that can be used and the response message parsed? Is that message designed to be stable?

 

e.g.

> nipkg update "validfeedname"
Updating validfeedname cache... done.

> nipkg update "nonsensename"
Updating nonsensename cache... failed.
Error -125951: Failed to update one or more feeds:
    nonsensename

> $LASTEXITCODE
-125951

> $LASTEXITCODE.equals(-125951)
True

 

Whilst writing this I've become pretty sure that this will be fine, but still posting because a) it might help someone else, and b) someone else might have a better way 🙂


GCentral
0 Kudos
Message 1 of 4
(1,473 Views)

Hi cbutcher -

When NI Package Manager refreshes its feeds so that it can display the list of packages listed in each feed, it is effectively doing the same thing as "nipkg.exe update", which downloads the manifest file and reads the list of packages. What the command does not do is validate that the path to the package file is valid. There is no nipkg.exe command to validate paths to the packages other than trying to downloads say using "nipkg.exe download-feed".

Scott Richardson
0 Kudos
Message 2 of 4
(1,444 Views)

Hi Scott,

 

So in this case, nipkg update will validate that the URL behind the named feed contains a valid (or at least, well formatted - perhaps valid implies more than that) manifest and structure?


GCentral
0 Kudos
Message 3 of 4
(1,440 Views)
Solution
Accepted by topic author cbutcher

cbutcher -

I dug a little deeper.

 

1) A call to "nipkg.exe update" will read the "Packages.gz" file and cache its "Packages" file in the "C:\ProgramData\National Instruments\NI Package Manager\raw" directory, but it does NOT validate the contents.

 

2) You can use the "nipkg.exe list" command to have parse all the cached Packages files, and this will report if anything is malformed within any of the Packages files.

 

What you use as a search criteria does not matter, all the files will be read, listed if matching and then the error is output:

C:\Users\scott>nipkg.exe list foobar
Error -125043: Attribute name 'Package' does not exist.

 

Scott Richardson
Message 4 of 4
(1,432 Views)