PDA

View Full Version : Applying a patch?



lemmy999
2007-10-15, 10:15
I am currently running Slimserver 6.5.4 on a Windows machine. I was wondering how you apply a patch (like this one: http://bugs.slimdevices.com/attachment.cgi?id=2268&action=view )?


SlimServer Version: 6.5.4 - 12568 - Windows XP - EN - cp1252
Server IP address: 192.168.2.50
Perl Version: 5.8.8 MSWin32-x86-multi-thread
MySQL Version: 5.0.22-community-nt

kdf
2007-10-15, 10:36
I am currently running Slimserver 6.5.4 on a Windows machine. I was wondering how you apply a patch

In short, you don't. If you have installed the windows version using the installer, everything is pre-compiled. The source is included, but any changes will have no effect aside from the Plugin modules.

If you wish to run the server manually, you can install ActivePerl from activatestate.com and run slimserver.pl from a command session. This will use the source modules at runtime. You can apply a patch, usually with the command:
patch -p0 < <patchfile>

replacing <patchfile> with the name of the patch file you need to use. If you don't have the patch command on your system (windows doesn't usually have dev tools installed) then you are stuck doing it manually (unless you install some third party app). Remove the lines with '-' at the start, replacing them with the lines starting with '+'. The filenames are given for each group, with line numbers to help you find things. All files are text files with unix-style line endings, so you'll want to use wordpad to edit them (notepad would be messy). Programs like UltraEdit and TextPad are great for this. TortoiseSVN is a good option if you want to do a direct "check out" of code from SD and it supports applying patches as a menu option.

-kdf

lemmy999
2007-10-15, 10:47
Thanks for the information. So if I run slimserver.pl from a command session, would I be unable to start slimserver as a service in windows?

kdf
2007-10-15, 10:59
There are tools to allow you to run as a service. srvany or firedaemon will work. Google should give you plenty of info on how to download and set up either one.
-kdf

lemmy999
2007-10-15, 11:29
Thanks. One last question concerning applying the patch though. I assume the "revision" numbers in the patch have to match the ones in the .pm files that are going to be modified. Since the nightly builds are updated every day, and only about 4-5 days worth of nightly builds are available, how are you supposed to get the correct revision of the files for the patch.

kdf
2007-10-15, 12:18
The revisions are only there for reference. If the code that you are patching is similar enough, then the patch program will find the right place based on the extra lines either side of the changed lines. If it cannot find the right place, the "hunk" will fail, and you'll be left to sort out the rejected hunks manually.

If you want to keep up with daily code, then use TortoiseSVN, which allows you to check out any specific revision that you like.

-kdf

lemmy999
2007-10-15, 13:58
Then couldn't I just apply the patch to the source code that comes with the windows installation, then install perl on my computer and use the perl module PAR to complie slimserver.pl to slim.exe?

kdf
2007-10-15, 14:42
Then couldn't I just apply the patch to the source code that comes with the windows installation, then install perl on my computer and use the perl module PAR to complie slimserver.pl to slim.exe?

If you want to pay for ActiveStates Perl Dev Kit, then yes, that should be possible. I assumed you'd probably want to spend a lot less money on it.

-kdf

lemmy999
2007-10-16, 07:42
But couldn't I just install Active Perl and then use something like Perl2Exe to compile slimserver.pl? Or would I need PerlSvc which is a tool that only comes in the ActiveState dev kit?

kdf
2007-10-16, 08:19
On 16-Oct-07, at 7:42 AM, lemmy999 wrote:

>
> But couldn't I just install Active Perl and then use something like
> Perl2Exe to compile slimserver.pl? Or would I need PerlSvc which is a
> tool that only comes in the ActiveState dev kit?

That, I cannot answer. If you'd like to try it out and let us know,
great.
Personally, I wouldn't waste my time compiling if you can turn
slimserver.pl into a service on it's own.
-kdf

lemmy999
2007-10-16, 08:48
On 16-Oct-07, at 7:42 AM, lemmy999 wrote:

>
> But couldn't I just install Active Perl and then use something like
> Perl2Exe to compile slimserver.pl? Or would I need PerlSvc which is a
> tool that only comes in the ActiveState dev kit?

That, I cannot answer. If you'd like to try it out and let us know,
great.
Personally, I wouldn't waste my time compiling if you can turn
slimserver.pl into a service on it's own.
-kdf

Well, I installed ActivePerl 5.8.8 Build 822 to try to run the slimserver.pl but I get an error that I have XML::Simple 2.12 and 2.15 is needed. So I get the 2.17 Simple.pm and put it in c:\perl\lib\XML and try again and get the same error. I think if I can't even get slimserver.pl to run with ActivePerl, I have no chance of getting it to compile :)

kdf
2007-10-16, 09:46
Some modules have binary components, so it's not always as easy as saving a module. ActivePerl does come with PPM to help manage packages. I am running build 820 of 5.8.8 and have had it working for some time. This probably means that I'm forgetting the steps to get it working. Everything should be included with the code, but I'm also using TortoiseSVN so I have all the CPAN modules included. I'm not sure if those just get packaged with the EXE or are included. Look in c:\program files\slimserver\server\lib.

Make sure you don't have multiple copies of XML::Simple in the various Perl lib folders.

lemmy999
2007-10-16, 09:55
Some modules have binary components, so it's not always as easy as saving a module. ActivePerl does come with PPM to help manage packages. I am running build 820 of 5.8.8 and have had it working for some time. This probably means that I'm forgetting the steps to get it working. Everything should be included with the code, but I'm also using TortoiseSVN so I have all the CPAN modules included. I'm not sure if those just get packaged with the EXE or are included. Look in c:\program files\slimserver\server\lib.

Make sure you don't have multiple copies of XML::Simple in the various Perl lib folders.

I did find different size simple.pm files in
Perl\lib\Filter
Perl\lib\LWP
Perl\lib\Test
Perl\lib\XML

I only replaced the one in \lib\XML

When I run ppm install XML::Simple it returns "No missing packages to install"

Also, I just found in the slimserver/server/lib folder another Simple.pm. I updated it to the 2.17 version and now when I run "perl slimserver.pl" I don't get the error, but nothing happens. The window just hangs.

There is also a \slimserver\server\CPAN directory. Inside it is another \XML\Simple.pm that is older. I have also updated it.

kdf
2007-10-16, 10:10
.pm files are text files, so you can open with wordpad and check the version directly.

lemmy999
2007-10-16, 10:51
Ok, the version of the one in the CPAN directory was 2.15. I copied that one to the /lib/XML directory (it was 2.12) and now slimserver.pl is running. So I guess all I need to do now and continue letting mqsqld.exe as a service at startup and then run the slimserver.pl as a service with srvany. thanks for your help.

lemmy999
2007-10-16, 12:17
The patch tool I downloaded (UnxUtils) didn't seem to work, so I started applying the patch manually. The patch requires modificiations to 5 files.

/Slim/Schema/Resultset/Contributor.pm (-1/+25 lines)
/Slim/Utils/Prefs.pm (+1 lines)
/Slim/Web/Settings/Server/TextFormatting.pm (+1 lines)
/HTML/EN/settings/server/formatting.html (+13 lines)
strings.txt (+15 lines)

The problem is that I do not have all of the files (or even all of the directories). Under /Slim/Web I just have a Pages and Template directory. I do not even have a TextFormatting.pm file anywhere on my computer. The same sort of thing for the formatting.html file. The patch I am using was for 6.5 and I use 6.5.4. However even the updated patch for 7.0 requires modifying these files. I altered the 3 files I had and tried to run slimserver.pl. I got several errors but it seems to run ok, but the patch seems to not have done anything.

kdf
2007-10-16, 12:42
On 16-Oct-07, at 12:17 PM, lemmy999 wrote:

>
> /Slim/Schema/Resultset/Contributor.pm (-1/+25 lines)
> /Slim/Utils/Prefs.pm (+1 lines)
> /Slim/Web/Settings/Server/TextFormatting.pm (+1 lines)
> /HTML/EN/settings/server/formatting.html (+13 lines)
> strings.txt (+15 lines)
>
> The problem is that I do not have all of the files (or even all of the
> directories). Under /Slim/Web I just have a Pages and Template
> directory. I do not even have a TextFormatting.pm file anywhere on my
> computer. The same sort of thing for the formatting.html file. The
> patch I am using was for 6.5 and I use 6.5.4.

A proper patch for 6.5 won't be using those files.
Slim/Web/Settings/Server/TextFormatting.pm is part of Slim/Web/
Setup.pm in 6.5
HTML/EN/settings/server/formatting.html is irrelevant in 6.5 as all
setting templates get built by Slim/Web/Setup.pm

Slim/Utils/Prefs.pm is also very different between 6.5 and 7.0

If you use 6.5 you should try to find the right place in Slim/Web/
Setup.pm to add the setting to the web ui (it's an ugly file to find
stuff in, which is why it was blown apart for 7.0)
I'm not sure what the default does, so you may not see any difference
until you can change the pref.

-kdf

lemmy999
2007-10-16, 14:01
Thanks for all of your help. It looks like the patch and its modifications are either for much older versions or 7.0. It may just be easier to start using 7.0 and then apply the patch cleanly.