chocolatey-archive / chocolatey

[DEPRECATED - https://github.com/chocolatey/choco] Chocolatey NuGet - Like apt-get, but for windows.
https://chocolatey.org
Apache License 2.0
2.8k stars 344 forks source link

Package tutorial correct? #198

Closed Redsandro closed 12 years ago

Redsandro commented 12 years ago

I tried creating the easiest of packages, with some .msi file.

Yet on cinst tomboy -source %cd% it consistently sais:

'tomboy' is not a valid version string. Parameter name: version

But clearly, my version is not tomboy. It is 1.10.2.

        <id>tomboy</id>
        <title>Tomboy Notes 1.10.2</title>
        <version>1.10.2</version>

Did I miss something?

Redsandro commented 12 years ago
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>tomboy</id>
        <title>Tomboy Notes 1.10.2</title>
        <version>1.10.2</version>
        <authors>Alex Graveley</authors>
        <owners>Redsandro</owners>
        <summary>Create and synchronize notes.</summary>
        <description>Quickly draft and synchronize notes with multiple computers in Linux, OSX and Ubuntu One.</description>
        <projectUrl>http://projects.gnome.org/tomboy/</projectUrl>
        <tags>note notes notetaking multiplatform synchronize</tags>
        <copyright></copyright>
        <licenseUrl>http://www.gnu.org/copyleft/lesser.html</licenseUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <!--<iconUrl>https://github.com/__CHOCO_PKG_OWNER_REPO__/raw/master/__NAME__/__NAME__.gif</iconUrl>-->
            <dependencies>
                <!--<dependency id=".NET" version="3.5" />-->
                <!-- http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52-4E35-B531-508D977D32A6&displaylang=en -->
                <dependency id="gtksharp" version="2.12.10" />
                <!-- http://download.mono-project.com/gtk-sharp/gtk-sharp-2.12.10.win32.msi -->
            </dependencies>
        <releaseNotes></releaseNotes>
    </metadata>
    <files>
        <file src="tools\**" target="tools" />
        <!--<file src="content\**" target="content" />-->
    </files>
</package>
$packageName = 'tomboy'
$installerType = 'msi' 
$url = 'http://download.gnome.org/binaries/win32/tomboy/1.10/Tomboy-1.10.2.msi'
$url64 = $url # 64bit URL here or just use the same as $url
$silentArgs = '/quiet'
$validExitCodes = @(0,3010) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx

# main helpers - these have error handling tucked into them already
Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" "$url64"  -validExitCodes $validExitCodes
ferventcoder commented 12 years ago

While I appreciate the ability for github markdown to help make the code very readable for this question, questions should really go to chocolatey@googlegroups.com. That way others can benefit from them. Please try to post future questions there, we'd like to try (emphasis on try) to reserve this area for bugs and features.

To ask a question in return, did you create the package (cpack) prior to running cinst? My apologies if this is not in tue tutorial. You should have a nupkg file in the folder you are running your cinst command from.

Redsandro commented 12 years ago

Sorry, I didn't notice there was a mailgroup for questions. New questions will be redirected henceforth.

But let me assure you, I am one of the cleverest people in my subnet (;)), and if I cannot get my custom package to install from source, I'm afraid it's gonna be a problem for other package committing 'noobs' too.

In response, yes the tutorial is quite comlpete and it does explain how cpack needs to be run first. When someone points out the problem and I get my first package to work, I will, with your permission, add a quick-start guide to the lengthy package creating part of the wiki.

Or could it be a bug in the latest cpack or cinst? That would be a fine coincidence, I would have posted my section in the right section after all.

ferventcoder commented 12 years ago

When you say latest, what version of chocolatey are you using? alpha or release?

Adding documentation is always helpful and appreciated!

Redsandro commented 12 years ago

I cannot check that right now as I am on the wrong computer, but I used the command that is on the website yesterday: @powershell something.DownloadString('http://bit.ly/psChocInstall')) one. I am assuming it points to the release version.

ferventcoder commented 12 years ago

That would be the current release. When you open the package with nuget package explorer (the .nupkg file), does it open correctly?


Rob "Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds http://ferventcoder.com http://twitter.com/ferventcoder

On Mon, Nov 19, 2012 at 10:42 AM, Redsandro notifications@github.comwrote:

I cannot check that right now as I am on the wrong computer, but I used the command that is on the website yesterday: @powershellhttps://github.com/powershellsomething.DownloadString(' http://bit.ly/psChocInstall')) one. I am assuming it points to the release version.

— Reply to this email directly or view it on GitHubhttps://github.com/chocolatey/chocolatey/issues/198#issuecomment-10520668.

Redsandro commented 12 years ago

Yes, works nicely. I was gonna make a screenshot, but I bet you believe me when I say it shows exactly the same as mentioned in the above XML code.

-edit- On second thought, the below comment is probably irrelevant.

I made a typo on a virtual machine just now while playing around with it, and I noticed:

dir
3.504 tomboy.1.10.2.nupkg
1.351 tomboy.nuspec
[DIR] tools

cinst tomboy -source %cd%
'tomboy' is not a valid version string. Parameter name: version

cinst -source %cd%
Unable to find package 'tomboy'.

Don't know if it's relevant, but if the second command cannot find the package, how does it know which package I mean?

ferventcoder commented 12 years ago

I see what might be wrong. Your nupkg/nuspec might be named incorrectly. the nuspec itself should be named tomboy.nuspec. The name of the package file (3.504 tomboy.1.10.2.nupkg) should not have a number or a space on the front of it.

Redsandro commented 12 years ago

Oops, that was a mistake on my part posting the output of the dir command here on github, it is the file size from the cmd.com console window.

The filename is tomboy.nuspec and when running cpack it automatically creates tomboy.1.10.2.nupkg. It must be getting those numbers from the nuspec xml file, so cpack reads the version correctly.

Hence we're back at the confusing 'tomboy' is not a valid version string error message when testing the package.

ferventcoder commented 12 years ago

Okay, dumb question. What shell are you using?

Redsandro commented 12 years ago

Windows' default shell. Run -> cmd [enter]

ferventcoder commented 12 years ago

Your github repo?

Redsandro commented 12 years ago

Don't use one. I thought you only need a repo when you push your package. So far I'm getting it to run correctly before I push it.

(Still have to figure out that repo part, the tutorial doesn't really explain that)

If you have a virtual machine running and you have a minute to spare, you can see if it has the same error message for you. https://dl.dropbox.com/u/1919923/chocolatey.tomboy.zip

ferventcoder commented 12 years ago

tried it out on a VM. Getting the appropriate issue about not being able to find gtksharp.

So it's working on my machine...

ferventcoder commented 12 years ago

Still would like to know what is going on on your end though.

Redsandro commented 12 years ago

Oh yeah I remember the gtksharp message the first time I ran it. I am guessing the package (owned by somebody else) is not gonna be downloaded in testing mode. You should cinst gtksharp on your vm and try again. Now you get the error message.

ferventcoder commented 12 years ago

Installs good for me.

Redsandro commented 12 years ago

What?? I am at a loss.

Thanks for taking the efford to try it out. I was sure you would get the same error. What sorcery is this? You are probably as clueless as I am at this point.

I tested this out on Windows 7 Professional and Windows 8 Professional. Same message.

Oh yeah I have version 0.9.8.19 of Chocolatey, I figured out from some logs I got on my dropbox.

ferventcoder commented 12 years ago

What happens when you run cinst tomboy -source %cd% -debug ??

Redsandro commented 12 years ago

D'oh I found the cause.

C:\Users\Redsandro\Dropbox\temp\chocolatey tomboy>cinst tomboy -source "%cd%" -debug
(..)
'C:\Users\Redsandro\Dropbox\temp\chocolatey', version: 'tomboy',
(..)
DEBUG: Using '-Source "C:\Users\Redsandro\Dropbox\temp\chocolatey"' as the source

The "" in "%cd%" would in Linux cause the path to be a single parameter but apparently not in Windows. The space in the pathname caused the failure.

ferventcoder commented 12 years ago

Double Double Quotes. FTW. The switch from batch to powershell leaves something to be desired in keeping quotes.

so this will work: cinst tomboy -source ""%cd%""

My bad, Didn't ask what your path was.

ferventcoder commented 12 years ago

Normally with command line applications on Windows you would only need the single quote. It would be interesting to know what you get if you use a single quote (') instead.

Redsandro commented 12 years ago

Good thought! I tried it out and single quote ' also works!

ferventcoder commented 12 years ago

Nice! Yeah, there is something in the conversion from batch to powershell that destroys all double quotes by themselves. It could be something I'm doing. It is annoying...I should really look into it.

ferventcoder commented 12 years ago

Closing as not a bug... you will follow up with the wiki article updates?

Redsandro commented 12 years ago

Yes, once I complete pushing the package successfully, I will add the steps.

If I may be so blunt to ask, is this repository you mentioned earlier necessary for this step? If I read the tutorial correctly, I can just get an api-key and push the package. There is no mention of this repository. In the templating system there is mention of filling in your personal repo and an auto-update repo (without further explanation), but the template I used for this .msi package does not require them.

If I missed repo documentation from the tutorial, you can just provide a link and I will read from there.

ferventcoder commented 12 years ago

Ah, I mean source code repository for your packages. Look at my profile on chocolatey.org and you will see https://github.com/ferventcoder/nugetpackages and https://github.com/ferventcoder/chocolateyautomaticpackages

Redsandro commented 12 years ago

Ah I get it now. The only thing I ever do is git clone, so I've git some reading to do on how to get my stuff up there.

Redsandro commented 12 years ago

Ouch, gotta love that wiki editor. :')

Thanks for the help. In return, a Quick Start Guide: https://github.com/chocolatey/chocolatey/wiki/CreatePackagesQuickStart

ferventcoder commented 12 years ago

Looks good. Only note is the second source to the package should not contain a file, just a directory

Redsandro commented 12 years ago

What do you mean by second source to the package?

I am pretty sure it works like this (too) because I copied most commands in a little notepad when I executed them. But maybe I got something mixed up.

If you are sure and/or have any other changes in mind, feel free to edit the page.

Redsandro commented 11 years ago

I was looking for that quickstartguide I made earlier and couldn't find a link in the main page (CreatePackages) although I am pretty sure I made one.

After googling, I found this issue and rediscovered the page through above link.

Am I having a mini-epilepsy-attack and did I never create a reference in the main packaging wiki, or was it removed with good reason?

I (re)created the reference. Of course, feel free to change if the wording is wrong.

My rationale is this: I (and therefor undoubtedly others too) just wanted to know the basic steps, and looking at the size of the page (scrollbar) made me initially lose interest. That's why I think a new visitor should see that there is a quick start guide in the first a-screens-length of the CreatePackages page.

Maybe I was an idiot and pressed preview in stead of save. Could also be. :P

ferventcoder commented 11 years ago

No, we didn't delete it. I thought you updated the CreatePackages page only, I never remember seeing a link to another page

Redsandro commented 11 years ago

Okay my bad, please ignore. :P