[or-cvs] r18848: {torvm} Fix problem with empty directory component splicing followed (in torvm/trunk/build/win32: files patches)

coderman at seul.org coderman at seul.org
Tue Mar 10 09:01:00 UTC 2009


Author: coderman
Date: 2009-03-10 05:00:59 -0400 (Tue, 10 Mar 2009)
New Revision: 18848

Modified:
   torvm/trunk/build/win32/files/buildall.sh
   torvm/trunk/build/win32/patches/vidalia-torvm.patch
Log:
Fix problem with empty directory component splicing followed by user local install conversion.

Modified: torvm/trunk/build/win32/files/buildall.sh
===================================================================
--- torvm/trunk/build/win32/files/buildall.sh	2009-03-10 05:59:48 UTC (rev 18847)
+++ torvm/trunk/build/win32/files/buildall.sh	2009-03-10 09:00:59 UTC (rev 18848)
@@ -1238,11 +1238,11 @@
   tail +4c torvm-bin.wxs > torvm-bin.wxs.tmp; dos2unix torvm-bin.wxs.tmp; cat torvm-bin.wxs.tmp > torvm-bin.wxs; rm -f torvm-bin.wxs.tmp
   tail +4c torvm-lib.wxs > torvm-lib.wxs.tmp; dos2unix torvm-lib.wxs.tmp; cat torvm-lib.wxs.tmp > torvm-lib.wxs; rm -f torvm-lib.wxs.tmp
   tail +4c torvm-state.wxs > torvm-state.wxs.tmp; dos2unix torvm-state.wxs.tmp; cat torvm-state.wxs.tmp > torvm-state.wxs; rm -f torvm-state.wxs.tmp
-  wixtool.exe splice -i torvm.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-bin.wxs:Directory:bin
+  wixtool.exe splice -i torvm.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-bin.wxs:Directory:TARGETDIR
   wixtool.exe splice -i torvm-tmpdir.wxs -o torvm-tmpall.wxs Feature:MainApplication=torvm-bin.wxs:Feature:ProductFeature
-  wixtool.exe splice -i torvm-tmpall.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-lib.wxs:Directory:lib
+  wixtool.exe splice -i torvm-tmpall.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-lib.wxs:Directory:TARGETDIR
   wixtool.exe splice -i torvm-tmpdir.wxs -o torvm-tmpall.wxs Feature:MainApplication=torvm-lib.wxs:Feature:ProductFeature
-  wixtool.exe splice -i torvm-tmpall.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-state.wxs:Directory:state
+  wixtool.exe splice -i torvm-tmpall.wxs -o torvm-tmpdir.wxs Directory:ProgramsInstDir=torvm-state.wxs:Directory:TARGETDIR
   wixtool.exe splice -i torvm-tmpdir.wxs -o torvm-tmpall.wxs Feature:MainApplication=torvm-state.wxs:Feature:ProductFeature
   wixtool.exe userlocal -i torvm-tmpall.wxs -o torvm-all.wxs "Software/Tor VM:MainApplication"
   rm -f torvm-tmpdir.wxs torvm-tmpall.wxs

Modified: torvm/trunk/build/win32/patches/vidalia-torvm.patch
===================================================================
--- torvm/trunk/build/win32/patches/vidalia-torvm.patch	2009-03-10 05:59:48 UTC (rev 18847)
+++ torvm/trunk/build/win32/patches/vidalia-torvm.patch	2009-03-10 09:00:59 UTC (rev 18848)
@@ -803,8 +803,8 @@
 +
 diff -Naur a/src/tools/wixtool/wixtool.cpp b/src/tools/wixtool/wixtool.cpp
 --- a/src/tools/wixtool/wixtool.cpp	1970-01-01 00:00:00.000000000 +0000
-+++ b/src/tools/wixtool/wixtool.cpp	2009-03-10 02:55:48.337230000 +0000
-@@ -0,0 +1,673 @@
++++ b/src/tools/wixtool/wixtool.cpp	2009-03-10 08:52:45.590313000 +0000
+@@ -0,0 +1,687 @@
 +/*
 +**  $Id$
 +**
@@ -1193,8 +1193,12 @@
 +createDirMgmtComponent(QDomElement e,
 + QString dirName)
 +{
-+  QDomElement nce = e.ownerDocument().createElement(WIX_TAG_CREATEDIR);
-+  e.appendChild(nce);
++  QDomElement nce;
++  /* An empty dir might produce a createdir, so only add if not present. */
++  if (e.elementsByTagName(WIX_TAG_CREATEDIR).count() == 0) {
++    nce = e.ownerDocument().createElement(WIX_TAG_CREATEDIR);
++    e.appendChild(nce);
++  }
 +  nce = e.ownerDocument().createElement(WIX_TAG_REMOVEDIR);
 +  nce.setAttribute("On", WIX_ATTR_DIRACTION);
 +  nce.setAttribute(WIX_ATTR_ID, QString("Remove").append(dirName));
@@ -1211,7 +1215,22 @@
 +  if (e.tagName().compare(WIX_TAG_FILE) == 0) {
 +    e.removeAttribute(WIX_ATTR_KEY);
 +  }
++  else if (e.tagName().compare(WIX_TAG_COMPONENT) == 0) {
++    /* If the WiX tools get confused we need to remove KeyPath attrs
++     * on any component elements after creation or merging.
++     * Empty directories with a CreateFolder and nothing else will do this.
++     */
++    e.removeAttribute(WIX_ATTR_KEY);
++  }
 +  else if (e.tagName().compare(WIX_TAG_FEATURE) == 0) {
++    /* be sure to remove any default feature names; changed added above. */
++    QDomNodeList cnl = e.elementsByTagName(WIX_TAG_COMPONENT_REF);
++    for (int i = 0; i < cnl.count(); i++) {
++      QDomElement cre = cnl.item(i).toElement();
++      if (cre.attribute(WIX_ATTR_ID).compare(WIX_TAG_COMPONENT) == 0) {
++        e.removeChild(cre);
++      }
++    }
 +    if (ulinfo->featureid.compare(e.attribute(WIX_ATTR_ID)) == 0) {
 +      /* this is the target feature element for the new components, if any. */
 +      QDomElement ne;
@@ -1233,7 +1252,6 @@
 +      QDomElement fc;
 +      bool  hasComponent = false;
 +      bool  hasRegKey;
-+      bool  hasDirMgmt = false;
 +      QDomNodeList subnodes = e.childNodes();
 +      for (int i = 0; i < subnodes.count(); i++) {
 +        hasRegKey = false;
@@ -1243,6 +1261,14 @@
 +            if (!hasComponent) {
 +              hasComponent = true;
 +              fc = ce;
++              if (ce.attribute(WIX_ATTR_ID).compare(WIX_TAG_COMPONENT) == 0) {
++                /* Fix default named components before adding registry elements. */
++                ce.setAttribute(WIX_ATTR_ID, QString("DCOMP").append(dirName));
++                ulinfo->newcomps.append(ce.attribute(WIX_ATTR_ID));
++              }
++              if (ce.elementsByTagName(WIX_TAG_REMOVEDIR).count() == 0) {
++                createDirMgmtComponent(ce, ce.attribute(WIX_ATTR_ID));
++              }
 +            }
 +            QDomNodeList compnodes = ce.childNodes();
 +            for (int j = 0; j < compnodes.count(); j++) {
@@ -1251,9 +1277,6 @@
 +                if (compe.tagName().compare(WIX_TAG_REGKEY) == 0) {
 +                  hasRegKey = true;
 +                }
-+                else if (compe.tagName().compare(WIX_TAG_CREATEDIR) == 0) {
-+                  hasDirMgmt = true;
-+                }
 +              }
 +            }
 +            if (!hasRegKey) {
@@ -1262,16 +1285,7 @@
 +          }
 +        }
 +      }
-+      if (hasComponent) {
-+        /* If no registry based key path exists, create it under the
-+         * first component for this directory element.
-+         */
-+        QString compname = fc.attribute(WIX_ATTR_ID);
-+        if (!hasDirMgmt) {
-+          createDirMgmtComponent(fc, compname);
-+        }
-+      }
-+      else {
++      if (!hasComponent) {
 +        /* Certain system directories must be ignored; we don't manage them. */
 +        if (dirId.compare("LocalAppDataFolder") &&
 +            dirId.compare("AppDataFolder") &&



More information about the tor-commits mailing list