|
|
|
|
#1 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
VersionCheckNew testing
I've tried and tested the function so many times, but there's always one version string comparison kind that gets through with false results.
The last update to the function was to compare each digit of the numbers between the dots one by one. However, recently Daijoubu reported that it would fail on 7 & 10. This is because it would compare 7 with 1 and immediately think the 1st one was larger! I've fixed the problem now (which has made the function even bigger!) I was wondering if anyone could test the function more for me, which is here: http://nsis.sourceforge.net/archive/...nstances=0,757 If you find one that fails, post it here so I can see it. Cheers -Stu |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
Probably Afrow UK mean:
http://nsis.sourceforge.net/archive/...s=0,11,122,754 Last edited by Instructor; 23rd March 2005 at 08:32. |
|
|
|
|
|
#3 | |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
Quote:
|
|
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Ah yeh, sorry I posted link to edit
![]() -Stu |
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
$R0="1"code: |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Thanks Instructor. I found that problem a few days ago too and I think it's fixed now. It took me a few hours, but I thought of a new solution which should fix all the problems.
Uploaded as v5 -Stu |
|
|
|
|
|
#7 |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
Very bad that you don't trying to see what do others
![]() P.S. $R0="2"code: |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Thanks fixed.
-Stu |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
|
Version "1.00" is newer than "1.0". Is it supposed to be?
|
|
|
|
|
|
#10 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
I'd just use Instructors VersionCompare
![]() -Stu |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
|
Another question (general).
Why "1.1.1.1" not equal to "1.1.1.01"? |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Because 01 is older than 1, as we go up in 01, 02, 03, to 1. 1 would be counted as "10".
-Stu |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
|
Than, if I include in script
code: And use GetDllVersion - version will be 1.1.0.1. Why? |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
NSIS treats 001 in a variable as 1 (when using IntOp)
-Stu |
|
|
|
|
|
#15 | |
|
Major Dude
|
Quote:
To make a version comparasion with only numbers, it's a matter of comparing the numbers inside the four groups w/ IntCmp, nothing more (and logically converting those numbers to be supported as decimal by NSIS, because 001 is considered as an octal number). |
|
|
|
|
|
|
#16 | |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
Quote:
1.01 != 1.00001, because 1.01 != 1.10 In your words NSIS 2.01 = NSIS 2.1 (it will be I hope )
|
|
|
|
|
|
|
#17 | ||
|
Senior Member
Join Date: Sep 2004
Location: Mogilev (Belarus)
Posts: 372
|
Quote:
2Instructor Quote:
In your words 1 kg 1000 times greater than 0001 kg. ![]()
|
||
|
|
|
|
|
#18 |
|
Major Dude
Join Date: Jul 2004
Posts: 671
|
What sense give to the program version 1.01, if the same is 1.1? I saw only one reason: if number 1.01 compared with 1.1 it will be older
|
|
|
|
|
|
#19 |
|
Senior Member
Join Date: Dec 2004
Location: Turkey
Posts: 447
|
TIP: Versioning scheme as I see it...
I agree there is IMHO no sense in versioning 1.02
This is for me v1.0.2.x Versioning scheme as I see it... A.B.C.D A = Product Major Version B = Product Feature Release C = Product Release incrementeal ID D = Fix/Test/Debug/ for short the Build number Example for a e.g. wordprocessor: 0.x = Initial development 1.0.0.0 = Initial Debug Release 1.0.0.57 = 57th testing build 1.0.1.1 = Initial "official" build 1.0.1.33 = 33rd fix for the official build 1.0.2.1 = Second "official" build including all bug fixes 1.1.1.278 = Now we have a spell checker 1.2.1.45 = And a thesaurus. 2.0.1.352 = And we introduced Linux compatibility because we built it with Kylix ![]() Use this structure internally, it works very well. A customer needs to know A.B for features, A.B.C for fixes to features, and we use D internally for testing/debugging and emergency fixes for when taxes don't add up. Success to everyone to streamline the versioning of your releases. Emin "Just do it" |
|
|
|
|
|
#20 |
|
Major Dude
|
normally its used this way:
major.minor.release.build for most open source projects: 1.0.0.xxx - first public release 1.1.0.1 - first beta for 1.2 release 1.2.0.xxx - second public release 1.9.xx.xxx - beta releases for 2.0 RC 2.0.0.xxx - second major version, means bigger changes. and so on ... the last number ("build") is increased everytime a new beta/release is build and reset everytime the releasenumber changes. hand by comm@nder21 ---------- WiKi pages:CreateInternetShortcut|Enhanced FindWindow|Parse CSV-Data|Open/Close CD-Drive|Installer without Icon|Vista application compatibility |
|
|
|
|
|
#21 |
|
Guest
Posts: n/a
|
you try this ... i didn't find any problem
!insertmacro STRFUNC_DEFFUNC VersionCheck !define VersionCheck_List `ResultVar|CurVersion|CmpVersion` !define VersionCheck_TypeList `Output 0 1 2|Text|Text` !macro `FUNCTION_STRING_UnVersionCheck` !undef UnVersionCheck !insertmacro FUNCTION_STRING_VersionCheck !macroend !macro FUNCTION_STRING_VersionCheck !insertmacro STRFUNC_FUNC `VersionCheck` `2004 - 2005 Tu Tong - Based on functions by Tu Tong` Exch $R0 Exch Exch $R1 Exch Push $R2 Push $R3 Push $R4 Push $R5 Push $R6 Push $R7 StrCmp $R0 "" error 0 StrCmp $R1 "" error 0 StrCmp $R0 $R1 sameversion 0 ClearErrors loop: IfErrors sameversion StrCmp $R0 "" sameversion StrCmp $R1 "" sameversion StrCpy $R4 $R0 GetLabelAddress $R7 return Goto parse return: StrCpy $R6 $R3 StrCpy $R0 $R4 StrCpy $R4 $R1 GetLabelAddress $R7 return1 Goto parse return1: StrCpy $R5 $R3 StrCpy $R1 $R4 IntCmp $R6 $R5 0 olderversion newerversion Goto loop parse: StrCpy $R2 0 StrLen $R5 $R4 parseloop: StrCpy $R3 $R4 1 $R2 StrCmp $R3 "." parsecpy 0 IntCmp $R5 $R2 parsecpy parsecpy 0 IntOp $R2 $R2 + 1 Goto parseloop parsecpy: StrCpy $R3 $R4 $R2 IntOp $R5 $R5 - $R2 IntOp $R2 $R2 + 1 StrCpy $R4 $R4 $R5 $R2 Goto $R7 newerversion: StrCpy $R0 "2" Goto checkdone sameversion: StrCpy $R0 "0" Goto checkdone olderversion: StrCpy $R0 "1" Goto checkdone error: StrCpy $R0 "" checkdone: ClearErrors Pop $R7 Pop $R6 Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 ;------------------------ ;End FunctionEnd !macro FUNCTION_STRING_VersionCheck_Call ResultVar CurVersion CmpVersion !verbose push !verbose 4 !echo `$ {VersionCheck} "${ResultVar}" "${CurVersion}" "${CmpVersion}"` !verbose pop Push `${CurVersion}` Push `${CmpVersion}` Call VersionCheck Pop `${ResultVar}` !macroend !macro FUNCTION_STRING_UnVersionCheck_Call ResultVar CurVersion CmpVersion !verbose push !verbose 4 !echo `$ {UnVersionCheck} "${ResultVar}" "${CurVersion}" "${CmpVersion}"` !verbose pop Push `${CurVersion}` Push `${CmpVersion}` Call un.VersionCheck Pop `${ResultVar}` !macroend !macroend |
|
|
|
#22 |
|
Major Dude
|
It's better for you to post a normal function, because UseFunc (old StrFunc) is being developed, so this function would need to be changed to adapt to future newer versions.
|
|
|
|
|
|
#23 |
|
Guest
Posts: n/a
|
okay deguix i'll post normal function
here my update Function VersionCheck Exch $R1 Exch Exch $R0 Exch Push $R2 Push $R3 Push $R4 Push $R5 Push $R6 ${If} $R0 == "" ${OrIf} $R1 == "" Goto Error ${EndIf} StrCmp $R0 $R1 sameversion StrCpy $R4 $R0 Call :complete StrCpy $R0 $R4 StrCpy $R4 $R1 Call :complete StrCpy $R1 $R4 Goto compare complete: StrCpy $R6 0 StrCpy $R2 0 StrLen $R5 $R4 ${Do} StrCpy $R3 $R4 1 $R2 ${If} $R3 == "." IntOp $R6 $R6 + 1 ${EndIf} ${IfThen} $R2 >= $R5 ${|} ${ExitDo} ${|} IntOp $R2 $R2 + 1 ${Loop} ${Select} $R6 ${Case} 0 StrCpy $R4 "$R4.0.0.0" ${Case} 1 StrCpy $R4 "$R4.0.0" ${Case} 2 StrCpy $R4 "$R4.0" ${CaseElse} StrCpy $R4 "$R4" ${EndSelect} Return compare: ClearErrors Loop: IfErrors sameversion StrCmp $R0 "" sameversion StrCmp $R1 "" sameversion StrCpy $R4 $R0 Call arseStrCpy $R6 $R3 StrCpy $R0 $R4 StrCpy $R4 $R1 Call arseStrCpy $R5 $R3 StrCpy $R1 $R4 IntCmp $R6 $R5 0 olderversion newerversion Goto Loop parse: StrCpy $R2 0 StrLen $R5 $R4 ${Do} StrCpy $R3 $R4 1 $R2 ${IfThen} $R3 == "." ${|} ${ExitDo} ${|} ${IfThen} $R2 >= $R5 ${|} ${ExitDo} ${|} IntOp $R2 $R2 + 1 ${Loop} StrCpy $R3 $R4 $R2 IntOp $R5 $R5 - $R2 IntOp $R2 $R2 + 1 StrCpy $R4 $R4 $R5 $R2 Return olderversion: StrCpy $R0 "2" Goto checkdone newerversion: StrCpy $R0 "1" Goto checkdone sameversion: StrCpy $R0 "0" Goto checkdone error: StrCpy $R0 "" checkdone: ClearErrors Pop $R6 Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd |
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|