<i>package provide/package ifneeded mismatch errors</i> status still Open with 4 other changes
by
.
D 2007-04-18T13:56:34
J icomment Logged\sIn:\sYES\s\nuser_id=91629\nOriginator:\sNO\n\nI'm\sgoing\sto\sadd\sa\scurve\sball\sinto\sthis\sproblem,\ssince\sit\sis\smaking\smy\smigration\sto\s8.5\svery\sunhappy.\n\nI\shave\sused\s(possibly\sabused)\sthe\sability\sof\s"package\sifneeded"\sto\stake\sonly\sa\smajor\snumber,\sthan\sthen\shave\sthe\ssourced\sscript\sprovide\sthe\slatest\sversion\sof\sthe\spackage\shavingthat\smajor\snumber.\n\ne.g:\n\s\spackage\sifneeded\smyutils\s1\s[list\ssource\s[file\sjoin\s$dir\smyutils1.tcl]]\n\s\spackage\sifneeded\smyutils\s2\s[list\ssource\s[file\sjoin\s$dir\smyutils2.tcl]]\n\nThis\sallows\sme\sto\suse\smy\sversion\scontrol\ssystem\sto\strack\sthe\sminor\sversions\sof\spackages\sfor\sme,\sby\sdoing\sthe\sfollowing:\n\n\s\spackage\sprovide\smyutils\s"1.[lindex\s{$Revision:\s1\s$}\s1]"\n\n(That's\sfor\sVisual\sSourceSafe;\sCVS\sshould\sbe\ssimilar)\n\nThe\ssame\stechnique\sallows\syou\sto\sspecify\smajor\s&\sminor\snumbers\swith\sifneeded,\sand\sallow\sthe\sSCM\sto\shandle\sthe\spatchlevel\sfor\syou.\n\nMy\spoint:\sif\sCompareVersions\sis\sused\sin\sTcl_PkgRequireProc\sin\sthe\scurrent\smanner,\sit\sis\snot\spossible\sto\slet\sthe\sSCM\shandle\sany\saspect\sof\sversion\snumbering\sfor\syou;\syou\smust\sdo\sit\smanually.\s\sWhich\sis\sa\spain,\sIMHO.\n\nI\sconsider\sthis\sability\sof\sthe\s8.4\sifneeded/require/provide\ssystem\sto\sbe\sa\sfeature.\s\n\nMy\ssuggestion:\sif\sthe\sprovided\sversion\sis\scompatible\swith\sthe\sifneeded\sversion\s(the\sifneeded\sversion\sis\seffectively\sthe\sprefix\sof\sthe\sprovided\sversion)\sthen\sthe\spackage\srequire\sshould\ssucceed\s(no\swarnings\sor\serrors).\s\sIf\sthere\sis\sany\sconflict\sbetween\sthe\sprovided\sand\sifneeded\sversions\sthen\sraise\san\serror.\s\s\n\ne.g.\n\s\spackage\sifneeded\smyutils\s1\s[list\ssource\s[file\sjoin\s$dir\smyutils2.tcl]]\n\s\spackage\srequire\smyutils\n\s\s-->\sERROR\s(ifneeded\s1,\sprovided\s2.1)\n\n\s\spackage\sifneeded\smyutils\s3\s[list\ssource\s[file\sjoin\s$dir\smyutils3.tcl]]\n\s\spackage\srequire\smyutils\n\s\s-->\s3.4\n\nThis\swould\smake\sthe\sversion\smatching\slogic\sbetween\sifneeded\sand\sprovided\sidentical\sto\sthe\srequirements\ssatisfied\slogic\sfor\sa\s-exact\srequirement\s(if\smy\sunderstanding\sof\sthe\slatter\sis\scorrect).\n\nThis\sbehaviour\sis\salso\sconsistent\swith\s"package\spresent".\s\si.e.\s"package\spresent\smyutils\s1"\swill\shappily\sreturn\s"1.2"\sif\sthat\sis\sthe\sactual\sversion\sof\sthe\spackage\sthat\sis\sloaded.\n\nRequired\schange\sto\sdo\sthis:\n\nReplace\sline\s520:\n\s\sres\s=\sCompareVersions(pvi,\svi,\sNULL);\nWith:\n\s\sTcl_Obj\s*ov;\n\s\sov\s=\sExactRequirement(versionToProvide);\n\s\sres\s=\s!\sAllRequirementsSatisfied(pvi,\s1,\s&ov);\s\n\nA\scleaner\sversion\sof\sthis\schange\sis\sgiven\sin\sthe\spatch\sbelow\s(against\sthe\slatest\sversion\sin\sCVS):\n\nIndex:\stclPkg.c\n===================================================================\nRCS\sfile:\s/cvsroot/tcl/tcl/generic/tclPkg.c,v\nretrieving\srevision\s1.26\ndiff\s-u\s-r1.26\stclPkg.c\n---\stclPkg.c5\sDec\s2006\s15:36:12\s-00001.26\n+++\stclPkg.c18\sApr\s2007\s06:48:46\s-0000\n@@\s-504,7\s+504,6\s@@\n\s\s\s\s\s"\sprovided",\sNULL);\n\s}\selse\s{\n\s\s\s\s\schar\s*pvi,\s*vi;\n-\s\s\s\sint\sres;\n\s\n\s\s\s\s\sif\s(CheckVersionAndConvert(interp,\spkgPtr->version,\s&pvi,\n\s\s\s\s\sNULL)\s!=\sTCL_OK)\s{\n@@\s-514,11\s+513,14\s@@\n\sckfree(pvi);\n\scode\s=\sTCL_ERROR;\n\s\s\s\s\s}\selse\s{\n-res\s=\sCompareVersions(pvi,\svi,\sNULL);\n+\s\s\s\s\s\s\s\sTcl_Obj\s*ov;\n+\s\s\s\s\s\s\s\sov\s=\sExactRequirement(versionToProvide);\n+\s\s\s\s\s\s\s\s\s\s\s\ssatisfies\s=\sAllRequirementsSatisfied(pvi,\s1,\s&ov);\s\n+\s\s\s\s\s\s\s\s\s\s\s\s\n\sckfree(pvi);\n\sckfree(vi);\n\s\n-if\s(res\s!=\s0)\s{\n+if\s(!satisfies)\s{\n\s\s\s\s\scode\s=\sTCL_ERROR;\n\s\s\s\s\sTcl_AppendResult(interp,\n\s\s\s\s\s"attempt\sto\sprovide\spackage\s",\sname,\s"\s",\n\n
J login twylite
J mimetype text/plain
J username twylite
K 1426692fffffffffffffffffffffffffffffffff
U twylite
Z 8c75d4396d7b24f0949afc2bd142265e