Sfoglia il codice sorgente

Add constants support to DownloadISSigSource, DownloadUserName, and DownloadPassword + fix param parsing bug.

Martijn Laan 3 mesi fa
parent
commit
9471d2e64b

+ 3 - 3
ISHelp/isetup.xml

@@ -1671,18 +1671,18 @@ ExternalSize: 1_048_576; Flags: external
 </param>
 </param>
 
 
 <param name="DownloadISSigSource">
 <param name="DownloadISSigSource">
-<p>Specifies the URL of the .issig signature file which should be downloaded. This file is used to verify the file downloaded from the URL specified by the <tt>Source</tt> parameter.</p>
+<p>Specifies the URL of the .issig signature file which should be downloaded, which can include constants. This file is used to verify the file downloaded from the URL specified by the <tt>Source</tt> parameter.</p>
 <p>This parameter is ignored if the <tt>download</tt> and <tt>issigverify</tt> flags aren't both also specified.</p>
 <p>This parameter is ignored if the <tt>download</tt> and <tt>issigverify</tt> flags aren't both also specified.</p>
 <p>If this parameter is not set but both these flags are used, Setup will instead append ".issig" (without quotes) to the path portion of the URL specified by the <tt>Source</tt> parameter. It will then use the result as the URL to download the .issig signature file from.</p>
 <p>If this parameter is not set but both these flags are used, Setup will instead append ".issig" (without quotes) to the path portion of the URL specified by the <tt>Source</tt> parameter. It will then use the result as the URL to download the .issig signature file from.</p>
 </param>
 </param>
 
 
 <param name="DownloadUserName">
 <param name="DownloadUserName">
-<p>Specifies the basic authentication username to use for the file download.</p>
+<p>Specifies the basic authentication username to use for the file download, which can include constants.</p>
 <p>This parameter is ignored if the <tt>download</tt> flag isn't also specified.</p>
 <p>This parameter is ignored if the <tt>download</tt> flag isn't also specified.</p>
 </param>
 </param>
 
 
 <param name="DownloadPassword">
 <param name="DownloadPassword">
-<p>Specifies the basic authentication password to use for the file download. Please be aware that this password is stored in an unencrypted form in the resulting Setup file(s), even if you have enabled encryption (using the [Setup] section directive <tt>Encryption</tt>).</p>
+<p>Specifies the basic authentication password to use for the file download, which can include constants. Please be aware that this password is stored in an unencrypted form in the resulting Setup file(s), even if you have enabled encryption (using the [Setup] section directive <tt>Encryption</tt>).</p>
 <p>This parameter is ignored if the <tt>download</tt> flag isn't also specified.</p>
 <p>This parameter is ignored if the <tt>download</tt> flag isn't also specified.</p>
 </param>
 </param>
 
 

+ 7 - 4
Projects/Src/Compiler.SetupCompiler.pas

@@ -4668,9 +4668,9 @@ procedure TSetupCompiler.EnumFilesProc(const Line: PChar; const Ext: Integer);
 type
 type
   TParam = (paFlags, paSource, paDestDir, paDestName, paCopyMode, paAttribs,
   TParam = (paFlags, paSource, paDestDir, paDestName, paCopyMode, paAttribs,
     paPermissions, paFontInstall, paExcludes, paExternalSize, paExtractArchivePassword,
     paPermissions, paFontInstall, paExcludes, paExternalSize, paExtractArchivePassword,
-    paStrongAssemblyName, paISSigAllowedKeys, paComponents, paTasks, paLanguages,
-    paCheck, paBeforeInstall, paAfterInstall, paMinVersion, paOnlyBelowVersion,
-    paDownloadISSigSource, paDownloadUserName, paDownloadPassword);
+    paStrongAssemblyName, paISSigAllowedKeys, paDownloadISSigSource, paDownloadUserName,
+    paDownloadPassword, paComponents, paTasks, paLanguages, paCheck, paBeforeInstall,
+    paAfterInstall, paMinVersion, paOnlyBelowVersion);
 const
 const
   ParamFilesSource = 'Source';
   ParamFilesSource = 'Source';
   ParamFilesDestDir = 'DestDir';
   ParamFilesDestDir = 'DestDir';
@@ -5521,8 +5521,11 @@ begin
         CheckCheckOrInstall(ParamCommonCheck, Check, cikCheck);
         CheckCheckOrInstall(ParamCommonCheck, Check, cikCheck);
         CheckCheckOrInstall(ParamCommonBeforeInstall, BeforeInstall, cikInstall);
         CheckCheckOrInstall(ParamCommonBeforeInstall, BeforeInstall, cikInstall);
         CheckCheckOrInstall(ParamCommonAfterInstall, AfterInstall, cikInstall);
         CheckCheckOrInstall(ParamCommonAfterInstall, AfterInstall, cikInstall);
+        CheckConst(DownloadISSigSource, MinVersion, []);
+        CheckConst(DownloadUserName, MinVersion, []);
+        CheckConst(DownloadPassword, MinVersion, []);
         CheckConst(ExtractArchivePassword, MinVersion, []);
         CheckConst(ExtractArchivePassword, MinVersion, []);
-     end;
+      end;
 
 
       FileList := TList.Create();
       FileList := TList.Create();
       DirList := TList.Create();
       DirList := TList.Create();

+ 6 - 4
Projects/Src/Setup.Install.pas

@@ -1576,17 +1576,19 @@ var
               { Download a file with or without ISSigVerify. Note: estimate of
               { Download a file with or without ISSigVerify. Note: estimate of
                 extra .issig size has already been added to CurFile's ExternalSize. }
                 extra .issig size has already been added to CurFile's ExternalSize. }
               LastOperation := SetupMessages[msgErrorDownloading];
               LastOperation := SetupMessages[msgErrorDownloading];
+              const DownloadUserName = ExpandConst(CurFile^.DownloadUserName);
+              const DownloadPassword = ExpandConst(CurFile^.DownloadPassword);
               if foISSigVerify in CurFile^.Options then begin
               if foISSigVerify in CurFile^.Options then begin
                 const ISSigTempFile = TempFile + ISSigExt;
                 const ISSigTempFile = TempFile + ISSigExt;
                 const ISSigDestF = TFileRedir.Create(DisableFsRedir, ISSigTempFile, fdCreateAlways, faReadWrite, fsNone);
                 const ISSigDestF = TFileRedir.Create(DisableFsRedir, ISSigTempFile, fdCreateAlways, faReadWrite, fsNone);
                 try
                 try
                   { Download the .issig file }
                   { Download the .issig file }
-                  const ISSigUrl = GetISSigUrl(SourceFile, CurFile^.DownloadISSigSource);
-                  DownloadFile(ISSigUrl, CurFile^.DownloadUserName, CurFile^.DownloadPassword,
+                  const ISSigUrl = GetISSigUrl(SourceFile, ExpandConst(CurFile^.DownloadISSigSource));
+                  DownloadFile(ISSigUrl, DownloadUserName, DownloadPassword,
                     ISSigDestF, False, '', '', JustProcessEventsProc);
                     ISSigDestF, False, '', '', JustProcessEventsProc);
                   FreeAndNil(ISSigDestF);
                   FreeAndNil(ISSigDestF);
                   { Download and verify the actual file }
                   { Download and verify the actual file }
-                  DownloadFile(SourceFile, CurFile^.DownloadUserName, CurFile^.DownloadPassword,
+                  DownloadFile(SourceFile, DownloadUserName, DownloadPassword,
                     DestF, True, CurFile^.ISSigAllowedKeys, TempFile, ExtractorProgressProc);
                     DestF, True, CurFile^.ISSigAllowedKeys, TempFile, ExtractorProgressProc);
                 finally
                 finally
                   ISSigDestF.Free;
                   ISSigDestF.Free;
@@ -1594,7 +1596,7 @@ var
                   DeleteFileRedir(DisableFsRedir, ISSigTempFile);
                   DeleteFileRedir(DisableFsRedir, ISSigTempFile);
                 end;
                 end;
               end else
               end else
-                DownloadFile(SourceFile, CurFile^.DownloadUserName, CurFile^.DownloadPassword,
+                DownloadFile(SourceFile, DownloadUserName, DownloadPassword,
                   DestF, False, '', '', ExtractorProgressProc);
                   DestF, False, '', '', ExtractorProgressProc);
             end
             end
             else begin
             else begin