Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Help with sed
Help with sed
 
   NeoOffice Forum Index -> Random Whatnot
View previous topic :: View next topic  
Author Message
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Sun Aug 07, 2005 1:40 pm    Post subject: Help with sed

All:

I'm looking for help with sed, or a method to select the first number in a dotted number sequence. Why? uname -r gives the following: 8.2.0 for 10.4.2, 7.9.0 for 10.3.9. I want to use a if, elif, endif so that it will select some code for Pather vice Tiger vice Jaguar for code testing.

Thanks folks.

James
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Aug 07, 2005 4:04 pm    Post subject:

I'd recommend ignoring uname -r as this is really a pain to use on Mac OS X.

Instead, you may want to use the script code that uses the /usr/bin/sw_vers command in the following file in the Neo/J CVS respository:

neojava/bin/InstallationCheck

Patrick
Back to top
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Sun Aug 07, 2005 4:22 pm    Post subject:

pluby wrote:
I'd recommend ignoring uname -r as this is really a pain to use on Mac OS X.

Instead, you may want to use the script code that uses the /usr/bin/sw_vers command in the following file in the Neo/J CVS respository:

neojava/bin/InstallationCheck


Patrick:

Is this in the NeoJ 1-1 cvs and/or HEAD cvs?

James
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Aug 07, 2005 4:45 pm    Post subject:

It is in all branches. I have been using the script in the Neo/J installer for at least two years now.

Patrick
Back to top
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Sun Aug 07, 2005 5:24 pm    Post subject:

pluby wrote:
It is in all branches. I have been using the script in the Neo/J installer for at least two years now.


Found it and I am using an expanded case statement that also stops builds on versions that should not exist (5-9) Also, I don't think anyone is attempting to build OOo 1.9 on Jaguar so I also stop builds if that is the version of MacOSX.

Thank you.

James
Back to top
OPENSTEP
The One
The One


Joined: May 25, 2003
Posts: 4752
Location: Santa Barbara, CA

PostPosted: Sun Aug 07, 2005 6:18 pm    Post subject:

FWIW, the most reliable way on Mac OS X to get the exact system version is to examine the sysv gestalt response. If you look at the configure.in for OOo you'll see my code for doing this from a command line via osascript. The sysv response is base 10 encoded, but will get major/minor/revision versions no problem. This is what is used to set the BUILD_OS_MAJOR et. al. environment variables via configure.

The one drawback to this method is that it requires the Finder to be running as apparently the Finder is what is responding to sysv requests. This has posed problems only on XServe build machines where Finder may not be running.

uname is not reliable on Mac OS X (as was said above). The only reliable way to find appropriate version information is the sysv variable (or equivalent).

ed
Back to top
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Sun Aug 07, 2005 7:04 pm    Post subject:

OPENSTEP wrote:

uname is not reliable on Mac OS X (as was said above). The only reliable way to find appropriate version information is the sysv variable (or equivalent).


Ed:

I used Patrick's code, which uses the same method as in a patch that I received from Eric B. This is definately much better than using uname. This is good enough to determine which version is being used. I will know if this works in about 36 hours.

James
Back to top
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11949

PostPosted: Sun Aug 07, 2005 7:16 pm    Post subject:

OPENSTEP wrote:
uname is not reliable on Mac OS X (as was said above). The only reliable way to find appropriate version information is the sysv variable (or equivalent).


I think that the /usr/bin/sw_vers command is actually more reliable than the oascript approach as by doing an "nm -g /usr/bin/sw_vers", I found that the sw_vers command looks up the system version using the Core Foundation APIs. My guess is that the gestalt stuff in Mac OS X is really just a wrapper around Core Foundation calls.

Patrick
Back to top
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Sun Aug 07, 2005 7:47 pm    Post subject:

pluby wrote:
OPENSTEP wrote:
uname is not reliable on Mac OS X (as was said above). The only reliable way to find appropriate version information is the sysv variable (or equivalent).


I think that the /usr/bin/sw_vers command is actually more reliable than the oascript approach as by doing an "nm -g /usr/bin/sw_vers", I found that the sw_vers command looks up the system version using the Core Foundation APIs. My guess is that the gestalt stuff in Mac OS X is really just a wrapper around Core Foundation calls.


It is also the way that OOo 1.9 determines which version of MacOSX is running. I just looked at the set_soenv script in config_office.

Patrick, Ed and you have great code and this should solve the problem that I had. (And yes, I am optimistic, just like I believe that Discovery will land at KSC tomorrow, but I'm upset that they will not be overflying the United States as I live in the area where they determine if the flight is going to KSC or White Sands.)

James[/i]
Back to top
Terry Teague
Guest





PostPosted: Sun Aug 07, 2005 11:40 pm    Post subject: Re: Mac OS X version checking

jjmckenzie51 wrote:
It is also the way that OOo 1.9 determines which version of MacOSX is running. I just looked at the set_soenv script in config_office

James

Be aware that the method set_soenv uses in OOo 2.0 (last time I checked) won't actually work on Jaguar, so you may wish to do a different check on Jaguar.

Regards, Terry
Back to top
jjmckenzie51
The Anomaly


Joined: Apr 01, 2005
Posts: 1055
Location: Southeastern Arizona

PostPosted: Mon Aug 08, 2005 8:29 am    Post subject: Re: Mac OS X version checking

Terry Teague wrote:
jjmckenzie51 wrote:
It is also the way that OOo 1.9 determines which version of MacOSX is running. I just looked at the set_soenv script in config_office

James

Be aware that the method set_soenv uses in OOo 2.0 (last time I checked) won't actually work on Jaguar, so you may wish to do a different check on Jaguar.


Correct, but I am using the method that Patrick uses. This method does work on Jaguar and prior versions. It is short, simple and to the point. And I like that. The method used by set_soenv is more complex and will not work with Jaguar. It also does not work completely with Tiger (it had to be patched to fully work as the original Tiger did not report a full version in the form 10.x.x but only 10.x).

As soon as I finish the test build I will report back my findings and patches suggestions for the fix.

James
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> Random Whatnot All times are GMT - 7 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.