Re: testing patchlevel from script

2006-09-11 Thread A.J.Mechelynck

Yakov Lerner wrote:

On 9/11/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:

On 9/11/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

[a way to create a list of what patches has been applied]

Here's a simpler version of that script that doesn't allow for patches
to be skipped.  I don't know if the Vim build scripts actually allow
for patches to be skipped,

Yes it is allowed.


... and considering that later patches will
often depend on earlier ones, I can't see any reason why someone
wouldn't have applied patch i when they have applied patch j, where i
< j.

" Vim plugin file
" Maintainer:   Nikolai Weibull <[EMAIL PROTECTED]>
" Latest Revision:  2006-09-11

if exists("g:patches")
  finish
endif

let s:i = 1
let g:patches = [0]
while has("patch" . s:i)
  call add(g:patches, s:i)
  let s:i += 1
endwhile
unlet s:i
let g:version_string = (version / 100) . '.' . (version % 100) . '.' .
g:patches[-1]


I'd prefer

  let g:full_version = version . sprintf("%03d", g:patches[-1])

because such version string is comparable for (<,<=,>,>=)
whereas  g:full_version  is not.

I'd consider patchlevel to be max # of hole-free sequence
of patches starting from 1 (I think patch numbers are 1-starting),
*not* max # of patch applied. The extreme example would be
single patch#100 applied (without patches 1-99) which does
*not* make patchlevel 100.

Yakov



(imaginary example) A Unix version might display

Applied patches: 1-5,7-13,17-25,27-42,48-55,58-60,62-66,69-74,77,79-85

in the ":version" listing and it would still display "Version 6.4.85" 
near the top of the splash screen; and properly so, since patches 
6,14-16,26,43-47,56,57,61,67,68,75,76 and 78 would quite possibly be 
Windows and Mac patches. I remember Unix versions from 6.x which had 
that kind of "applied patches". In this example, no one in his right 
mind should consider such a version as "6.4.5".



Best regards,
Tony.


Re: testing patchlevel from script

2006-09-11 Thread A.J.Mechelynck

Nikolai Weibull wrote:

On 9/11/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

[a way to create a list of what patches has been applied]

Here's a simpler version of that script that doesn't allow for patches
to be skipped.  I don't know if the Vim build scripts actually allow
for patches to be skipped, and considering that later patches will
often depend on earlier ones, I can't see any reason why someone
wouldn't have applied patch i when they have applied patch j, where i
< j.


Yes, patches may be skipped, as mentioned under ":help has-patch". Linux 
versions commercially distributed often skip all "extra" patches which 
are for other OSes: the admin in charge of compilation would download 
only the "unix" and "lang" archives, and the "unix" patches, skipping 
the rest.


To use your example, a Linux admin may skip patch i if it is for Windows 
or Mac, and apply patch j (j>i) if it is for Unix or for all-platforms. 
A later Unix patch will never depend on an earlier Windows-only patch.



Best regards,
Tony.


Re: testing patchlevel from script

2006-09-11 Thread James Vega
On Mon, Sep 11, 2006 at 08:55:50PM +0200, Nikolai Weibull wrote:
> On 9/11/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
> 
> [a way to create a list of what patches has been applied]
> 
> Here's a simpler version of that script that doesn't allow for patches
> to be skipped.  I don't know if the Vim build scripts actually allow
> for patches to be skipped, and considering that later patches will
> often depend on earlier ones, I can't see any reason why someone
> wouldn't have applied patch i when they have applied patch j, where i
> < j.

The Vim build scripts have no knowledge of which patches have or haven't
been applied.  One can skip patches and an example of a situation where
that might be done is if the patch applies to the extra tarball.  If I'm
not using that, I have no need for the patch(es) that apply to it.

James
-- 
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]>


signature.asc
Description: Digital signature


Re: testing patchlevel from script

2006-09-11 Thread Yakov Lerner

On 9/11/06, Nikolai Weibull <[EMAIL PROTECTED]> wrote:

On 9/11/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

[a way to create a list of what patches has been applied]

Here's a simpler version of that script that doesn't allow for patches
to be skipped.  I don't know if the Vim build scripts actually allow
for patches to be skipped,

Yes it is allowed.


... and considering that later patches will
often depend on earlier ones, I can't see any reason why someone
wouldn't have applied patch i when they have applied patch j, where i
< j.

" Vim plugin file
" Maintainer:   Nikolai Weibull <[EMAIL PROTECTED]>
" Latest Revision:  2006-09-11

if exists("g:patches")
  finish
endif

let s:i = 1
let g:patches = [0]
while has("patch" . s:i)
  call add(g:patches, s:i)
  let s:i += 1
endwhile
unlet s:i
let g:version_string = (version / 100) . '.' . (version % 100) . '.' .
g:patches[-1]


I'd prefer

  let g:full_version = version . sprintf("%03d", g:patches[-1])

because such version string is comparable for (<,<=,>,>=)
whereas  g:full_version  is not.

I'd consider patchlevel to be max # of hole-free sequence
of patches starting from 1 (I think patch numbers are 1-starting),
*not* max # of patch applied. The extreme example would be
single patch#100 applied (without patches 1-99) which does
*not* make patchlevel 100.

Yakov


Re: testing patchlevel from script

2006-09-11 Thread Nikolai Weibull

On 9/11/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

[a way to create a list of what patches has been applied]

Here's a simpler version of that script that doesn't allow for patches
to be skipped.  I don't know if the Vim build scripts actually allow
for patches to be skipped, and considering that later patches will
often depend on earlier ones, I can't see any reason why someone
wouldn't have applied patch i when they have applied patch j, where i
< j.

" Vim plugin file
" Maintainer:   Nikolai Weibull <[EMAIL PROTECTED]>
" Latest Revision:  2006-09-11

if exists("g:patches")
 finish
endif

let s:i = 1
let g:patches = [0]
while has("patch" . s:i)
 call add(g:patches, s:i)
 let s:i += 1
endwhile
unlet s:i
let g:version_string = (version / 100) . '.' . (version % 100) . '.' .
g:patches[-1]

 nikolai


Re: testing patchlevel from script

2006-09-11 Thread A.J.Mechelynck

Benji Fisher wrote:

On Sun, Sep 10, 2006 at 01:05:11PM +, Yakov Lerner wrote:

How can a script test for specific patchlevel ?
For example, I have vim 7.0.86 and I need to check in the script that
patchlevel is >= 7.0.86. But v:version is 700. How ? It would be
nice if to have patchlist available through some v: variable.


 I agree that a List of patch numbers would be convenient.  You can
test for a specific patch with has("patch86").

:help has-patch

HTH --Benji Fisher



 $VIM/plugin/patchlist.vim  start
" Global plugin to make a List of included patches
" Maintainer:  A.J.Mechelynck <[EMAIL PROTECTED]>
" Last change: 2006 Sep 11
" Version: 0.0

" run once only
if exists("g:patchList")
finish
endif

" Let's assume a single version of Vim cannot have
" more than 999 patches.
" If that maximum is irrealistic, it can be changed.
if ! exists("g:maxPatch")
let g:maxPatch = 1000
endif

" g:patchList : ordered List of all included patch numbers
" g:patchArray : string of (g:maxPatch) digits
" g:PatchArray()[n] is has("patch{n}") for all n (1 <= n < g:maxPatch)
" g:PatchArray()[0] is always 1 to represent the unpatched release

let s:i = 1
let g:patchList = []
let g:patchArray = "1"
while s:i < g:maxPatch
let g:patchArray .= has("patch" . s:i)
if g:patchArray[s:i]
let g:patchList += [s:i]
endif
endwhile
unlet s:i
let g:ver_patch = (version / 100) . "." . (version % 100) . "." .
\ g:patchList[-1]
 $VIM/plugin/patchlist.vim  end


Re: testing patchlevel from script

2006-09-11 Thread Benji Fisher
On Sun, Sep 10, 2006 at 01:05:11PM +, Yakov Lerner wrote:
> How can a script test for specific patchlevel ?
> For example, I have vim 7.0.86 and I need to check in the script that
> patchlevel is >= 7.0.86. But v:version is 700. How ? It would be
> nice if to have patchlist available through some v: variable.

 I agree that a List of patch numbers would be convenient.  You can
test for a specific patch with has("patch86").

:help has-patch

HTH --Benji Fisher