|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - download
Length: 38912 (0x9800) Types: Ada Source Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Build, seg_0211f5, separate Extensions_Support
└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000 └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« └─⟦this⟧
separate (Extensions_Support) package body Build is procedure Create_Program_Library (Host_View : String; Remote_Directory : String; Remote_Program_Library : String; Remote_Machine : String; Remote_Connection : Rci.Context; Status : in out Ss.Condition; Trace_Command : Boolean) is Family_Directory : constant String := Get_Family_Name (Du.Get_View (Host_View, Profile.Get), Remote_Directory); -- Build_Adalib_Command : constant String := -- "ada l\(" & Family_Directory & "\).n " & -- Remote_Directory & "/adalib"; -- Build_Adalib_Command : constant String := "ada lib_manager\(" & Family_Directory & "\).new " & Remote_Directory & "/adalib"; -- Full_Build_Adalib_Command : constant String := -- "ada l(" & Family_Directory & -- "\).n " & Remote_Directory & -- -- This Unix command wlll be too long if the directory names are -- -- long. We will attempt to solve this problem by eliminating -- -- the annotation. We could alternatively truncate the -- -- annotation when necessary, but that makes it pretty useless. -- -- Note that we can't avoid the problem if the directory names -- -- are REALLY long. -- "/adalib " & "a=RCI_LIB::" & Remote_Directory; -- Full_Build_Adalib_Command : constant String := "ada lib_manager\(" & Family_Directory & "\).new " & Remote_Directory & -- This Unix command wlll be too long if the directory names are -- long. We will attempt to solve this problem by eliminating -- the annotation. We could alternatively truncate the -- annotation when necessary, but that makes it pretty useless. -- Note that we can't avoid the problem if the directory names -- are REALLY long. "/adalib " & "annotate=RCI_LIB::" & Remote_Directory; begin if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Create_Program_Library (Host_View" & Qt (Host_View) & ", Remote_Directory" & Qt (Remote_Directory) & ", Remote_Program_Library" & Qt (Remote_Program_Library) & ", Remote_Machine" & Qt (Remote_Machine) & ")", Kind => Profile.Sharp_Msg); end if; Log.Put_Line (Message => "Creating remote program library " & Quot (Remote_Program_Library), Kind => Profile.Position_Msg); -- Create the program library REMOTE_DIRECTORY/adalib. if Full_Build_Adalib_Command'Length > Max_Command_Length then -- Note that the build command may still be too long. if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot (Build_Adalib_Command), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => Build_Adalib_Command, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); else if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot (Full_Build_Adalib_Command), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => Full_Build_Adalib_Command, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); end if; if Problem (Status, Trace_Command) then Log.Put_Line ("Can't create a remote ada library in " & Quot (Remote_Directory) & ". " & Ss.Message (Status), Profile.Error_Msg); Log.Put_Line (Message => "Creation of the remote Ada library failed", Kind => Profile.Error_Msg); Log.Put_Line (Message => "Possible causes of this failure include:", Kind => Profile.Negative_Msg); Log.Put_Line (Message => " - Invalid Username & Password " & "from Session Switches or ", Kind => Profile.Negative_Msg); Log.Put_Line (Message => " remote passwords file", Kind => Profile.Negative_Msg); Log.Put_Line (Message => " - Remote machine is not accessible via the network", Kind => Profile.Negative_Msg); Log.Put_Line (Message => " - Invalid permissions on the target", Kind => Profile.Negative_Msg); Log.Put_Line (Message => " - Remote directory name is too long", Kind => Profile.Negative_Msg); Log.Put_Line (Message => "After resolving this problem, " & "use Rci.Build_Remote_Library " & "to create the Ada library on the target", Kind => Profile.Negative_Msg); return; end if; exception when others => Unhandled_Exception (Status, "Create_Program_Library"); end Create_Program_Library; procedure Build_Libraries (View_Obj : Directory.Object; Remote_Machine : String; Remote_Directory : String; Remote_Program_Library : String; Status : in out Simple_Status.Condition; Trace_Command : Boolean) is View_Name : constant String := Naming.Get_Full_Name (View_Obj); Family_Directory : constant String := Get_Family_Name (View_Obj, Remote_Directory); Machine_Result : constant Li.String_Result := Li.Remote_Machine (View => View_Name); Old_Remote_Machine : constant String := Machine_Result.Result; Remote_Directory_Result : constant Li.String_Result := Li.Remote_Directory (View => View_Name); Old_Remote_Directory : constant String := Su.Lower_Case (Remote_Directory_Result.Result (1 .. Remote_Directory_Result.Size)); Ada_Family : constant String := Family_Directory & "/adafamily.add"; -- Build_Family_Command : constant String := -- "ada f.n f=" & Family_Directory; -- Build_Family_Command : constant String := "ada family_manager.new family=" & Family_Directory; Remote_Program_Lib : constant String := Remote_Directory & "/adalib"; Remote_Connection : Rci.Context; Dir_Exists : Boolean := False; begin if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Build_Libraries (View_Obj => " & View_Name & ", Remote_Machine" & Qt (Remote_Machine) & ", Remote_Directory" & Qt (Remote_Directory) & ", Remote_Program_Library" & Qt (Remote_Program_Library) & ")", Kind => Profile.Sharp_Msg); end if; Log.Put_Line (Message => "Entering Build_Libraries", Kind => Profile.Position_Msg); if Problem (Machine_Result.Condition, Trace_Command) then Set_Status ("Can't get Remote_Machine switch for view " & View_Name, Status); return; elsif Problem (Remote_Directory_Result.Condition, Trace_Command) then Set_Status ("Can't get Remote_Directory switch for view " & View_Name, Status); return; end if; if Debugging or else Trace_Command then if Old_Remote_Machine'Length /= 0 or else Old_Remote_Directory'Length /= 0 then Log.Put_Line ("#~Old switch values: Remote_Machine " & Qt (Old_Remote_Machine) & ", Remote_Directory " & Qt (Old_Remote_Directory), Profile.Note_Msg); end if; end if; -- Don't try to build a family if we can't derive its name from the -- specified Remote_Directory. if Family_Directory'Length = 0 then Set_Status ("Can't derive a family name from the remote pathname " & Quot (Remote_Directory), Status); return; end if; Rci.Acquire (Remote_Connection => Remote_Connection, Status => Status, Target_Key => Target_Key, Remote_Machine => Remote_Machine, Trace_Command => Debugging or else Trace_Command); if Problem (Status, Trace_Command) then Set_Status ("Can't acquire a connection to " & Remote_Machine, Status); return; end if; -- The remote family may already exist. If so, we don't need to build -- it. Rci_Execute_Command (Command_Line => "test -f " & Ada_Family, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if not Ss.Error (Status, Ss.Problem) then if Debugging or else Trace_Command then -- Use the existing Ada family on the remote machine. Log.Put_Line ("#~Reusing the existing Alsys family """ & Family_Directory & """", Profile.Note_Msg); end if; else if Debugging then Log.Put_Line (Message => "#~" & Ss.Message (Status), Kind => Profile.Note_Msg); end if; if Debugging or else Trace_Command then Log.Put_Line (Message => "#~The remote file " & Quot (Ada_Family) & " does not exist", Kind => Profile.Note_Msg); end if; -- The Alsys family doesn't exist, but maybe the remote family -- directory does. If so, we would need to remove it before we -- could create a new Ada family in it, which would also remove any -- subdirectories of the family, including the specified -- Remote_Directory. Instead of removing it, we will treat this -- situation as an error, i.e., a family can only be created in a -- virgin (nonexistent) directory. Directory_Exists (Remote_Directory => Family_Directory, Remote_Connection => Remote_Connection, Status => Status, Exists => Dir_Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if Dir_Exists then Set_Status ("An Alsys family can only be created " & "in a new directory, but the remote directory " & Quot (Family_Directory) & " already exists", Status); return; end if; declare Base_Directory : constant String := Get_Enclosing_Directory (Family_Directory); begin -- Check for the existence of the enclosing directory. If it -- doesn't exist then create it. (If Remote_Directory is -- /a/b/c/d/e/fam_f/g/h/dir and only /a/b/c exists, we need to -- build the directory that will enclose the /fam_f directory.) Directory_Exists (Remote_Directory => Base_Directory, Remote_Connection => Remote_Connection, Status => Status, Exists => Dir_Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if not Dir_Exists then Log.Put_Line (Message => "Creating the new remote directory " & Quot (Base_Directory), Kind => Profile.Note_Msg); Create_Remote_Directory (Remote_Directory => Base_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; end if; end; -- The family doesn't now exist, so we will build it. Log.Put_Line (Message => "Creating remote family library " & Quot (Family_Directory), Kind => Profile.Position_Msg); if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot (Build_Family_Command), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => Build_Family_Command, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't create the remote ada family in " & Quot (Family_Directory) & ". " & Ss.Message (Status), Profile.Error_Msg); return; end if; end if; if Old_Remote_Machine'Length /= 0 and then not Su.Equal (Remote_Machine, Old_Remote_Machine) then Log.Put_Line (Message => "Building new library on different machine " & Quot (Remote_Machine) & ". Old library " & Quot (Old_Remote_Directory) & " is on machine " & Quot (Old_Remote_Machine), Kind => Profile.Warning_Msg); elsif Old_Remote_Directory'Length /= 0 then -- Does the old remote directory still exist? Directory_Exists (Remote_Directory => Old_Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Exists => Dir_Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if Dir_Exists then Log.Put_Line (Message => "The old Remote_Directory " & Quot (Old_Remote_Directory) & " still exists on " & Remote_Machine, Kind => Profile.Warning_Msg); end if; end if; -- Check for the existence of the Remote_Directory. If it doesn't -- exist, create a new remote directory. Directory_Exists (Remote_Directory => Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Exists => Dir_Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if Dir_Exists then Log.Put_Line (Message => "Directory " & Quot (Remote_Directory) & " already exists", Kind => Profile.Warning_Msg); Log.Put_Line (Message => "Using an existing directory", Kind => Profile.Note_Msg); else Log.Put_Line (Message => "Creating the new remote directory " & Quot (Remote_Directory), Kind => Profile.Note_Msg); Create_Remote_Directory (Remote_Directory => Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; end if; -- Check for an Ada program library in our remote directory. Directory_Exists (Remote_Directory => Remote_Program_Lib, Remote_Connection => Remote_Connection, Status => Status, Exists => Dir_Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if Dir_Exists then Log.Put_Line (Message => "A program library already exists in " & Quot (Remote_Program_Lib), Kind => Profile.Warning_Msg); Log.Put_Line (Message => "The existing program library will be used", Kind => Profile.Warning_Msg); else Log.Put_Line (Message => "Creating the new remote program library " & Quot (Remote_Program_Lib), Kind => Profile.Note_Msg); Create_Program_Library (Host_View => View_Name, Remote_Machine => Remote_Machine, Remote_Program_Library => Remote_Program_Lib, Remote_Directory => Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then Set_Status ("Can't build remote program library " & Quot (Remote_Program_Lib), Status); return; end if; -- Update the Rci.Remote_Directory switch. Li.Set_Remote_Directory (View => View_Name, Value => Remote_Directory, Condition => Status, Response => Profile.Get); end if; exception when others => Unhandled_Exception (Status, "Build_Libraries"); end Build_Libraries; procedure Destroy_Library (Host_View : Directory.Object; Remote_Directory : String; Remote_Connection : Remote_Command_Interface.Context; Status : in out Simple_Status.Condition; Trace_Command : Boolean) is View_Name : constant String := Naming.Get_Full_Name (Host_View); Family : constant String := Get_Family_Name (Host_View, Remote_Directory); Exists : Boolean := False; begin if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Destroy_Library (Host_View" & Qt (View_Name) & ", Remote_Directory" & Qt (Remote_Directory) & ")", Kind => Profile.Sharp_Msg); end if; Log.Put_Line (Message => "Executing Destroy_Library", Kind => Profile.Position_Msg); -- Don't continue if we can't derive a family name from the specified -- Remote_Directory. if Family'Length = 0 then Set_Status ("Can't derive a family name from the remote pathname " & Quot (Remote_Directory), Status); return; end if; -- How do we determine whether to destroy the family? -- -- (For now we'll leave family destruction to the user, and we won't -- even try to destroy a family). -- Make sure that the remote Ada program library exists. Directory_Exists (Remote_Directory => Remote_Directory & "/adalib", Remote_Connection => Remote_Connection, Status => Status, Exists => Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if not Exists then -- The program library should exist, but it doesn't. Log.Put_Line (Message => "Remote directory " & Remote_Directory & " doesn't contain an Ada program library" & ", so it can't be destroyed", Kind => Profile.Warning_Msg); return; end if; -- Delete the view's Ada library from its family, and then remove the -- view directory and everything contained therein. if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot ("ada lib_manager\(" & Family & "\).erase libraries=" & Remote_Directory & "/adalib confirm=no"), Kind => Profile.Position_Msg); end if; Log.Put_Line (Message => "Erasing remote library " & Quot (Remote_Directory), Kind => Profile.Position_Msg); Rci_Execute_Command -- (Command_Line => "ada l(" & Family & -- "\).e l=" & -- Remote_Directory & "/adalib c=n", (Command_Line => "ada lib_manager\(" & Family & "\).erase libraries=" & Remote_Directory & "/adalib confirm=no", Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't erase the Ada library in " & Quot (Remote_Directory) & ". " & Ss.Message (Status), Profile.Error_Msg); return; end if; -- Destroy the view's Download_Times and Remote_Links files. Delete_Links_Files (Host_View); -- Make sure that the remote directory exists. Directory_Exists (Remote_Directory => Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Exists => Exists, Trace_Command => Trace_Command); if Ss.Error (Status, Ss.Problem) then return; end if; if not Exists then -- The Remote_Directory should exist, but it doesn't. Log.Put_Line (Message => "Remote directory " & Remote_Directory & " doesn't exist for view " & View_Name & ", so it can't be destroyed", Kind => Profile.Warning_Msg); return; end if; -- Get Host_View's referencers, and erase all of its links in the -- referencer views. Also erase all of its copied import libraries (in -- other families). declare Referencers : constant Import_Interface.Unit_List := Import_Interface.Get_Referencers (Host_View); View_Obj : Directory.Object; begin if Ss.Error (Referencers.Condition) then Status := Referencers.Condition; return; end if; for Index in Referencers.Data'First .. Referencers.Data'Last loop declare Ref_View_Obj : Directory.Object := Referencers.Data (Index); Ref_View_Name : constant String := Naming.Get_Full_Name (Ref_View_Obj); Ref_Remote_Result : constant Li.String_Result := Li.Remote_Directory (Ref_View_Name); Ref_Remote_Directory : constant String := Ref_Remote_Result.Result; begin if Problem (Ref_Remote_Result.Condition, Trace_Command) then Set_Status ("Can't get remote directory name " & "for imported view " & Ref_View_Name, Status); return; end if; if Debugging then -- Print the name of the referencer. Log.Put_Line ("#~ Referencer" & Integer'Image (Index) & ": " & Ref_View_Name, Profile.Note_Msg); end if; -- Remove Host_View (and all links to its units) as a -- remote import into the referencer view. Host_View will -- remain as an R1000 import. Remove_Remote_Import (View_To_Remove => Host_View, From_View => Ref_View_Name, Remote_Machine => "", -- This won't be used. Remote_Directory => Ref_Remote_Directory, Remote_Connection => Remote_Connection, Destroying_Library => True, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't remove remote import for " & View_Name & " from " & Ref_View_Name & ". " & Ss.Message (Status), Profile.Warning_Msg); end if; end; end loop; end; -- Now we can destroy the Remote_Directory. First make sure that it -- isn't protected. if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot ("cd;chmod -R 777 " & Remote_Directory), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => "cd;chmod -R 777 " & Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't change protections. " & Ss.Message (Status), Profile.Error_Msg); return; end if; -- Open the protections for the Remote_Directory itself. if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot ("chmod 777 " & Remote_Directory), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => "chmod 777 " & Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't change protections. " & Ss.Message (Status), Profile.Error_Msg); return; end if; -- Go to the directory which encloses our Remote_Directory. (Unix -- won't let us remove the directory that we are in.) if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot ("cd " & Remote_Directory & ";cd .."), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => "cd " & Remote_Directory & ";cd ..", Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't go to the enclosing directory for " & Remote_Directory & ". " & Ss.Message (Status), Profile.Error_Msg); return; end if; -- Now we should be able to destroy the Remote_Directory. if Debugging or else Trace_Command then Log.Put_Line (Message => "#~Executing remote command: " & Quot ("rm -r " & Remote_Directory), Kind => Profile.Position_Msg); end if; Rci_Execute_Command (Command_Line => "rm -r " & Remote_Directory, Remote_Connection => Remote_Connection, Status => Status, Trace_Command => Trace_Command); if Problem (Status, Trace_Command) then Log.Put_Line ("Can't remove the contents of " & Quot (Remote_Directory) & ". " & Ss.Message (Status), Profile.Error_Msg); end if; exception when others => Unhandled_Exception (Status, "Destroy_Library"); end Destroy_Library; end Build;
nblk1=25 nid=24 hdr6=48 [0x00] rec0=18 rec1=00 rec2=01 rec3=032 [0x01] rec0=11 rec1=00 rec2=02 rec3=080 [0x02] rec0=13 rec1=00 rec2=03 rec3=08a [0x03] rec0=15 rec1=00 rec2=04 rec3=02c [0x04] rec0=13 rec1=00 rec2=05 rec3=062 [0x05] rec0=10 rec1=00 rec2=06 rec3=072 [0x06] rec0=1a rec1=00 rec2=07 rec3=042 [0x07] rec0=18 rec1=00 rec2=25 rec3=038 [0x08] rec0=01 rec1=00 rec2=08 rec3=018 [0x09] rec0=15 rec1=00 rec2=09 rec3=02a [0x0a] rec0=1a rec1=00 rec2=0a rec3=006 [0x0b] rec0=15 rec1=00 rec2=0b rec3=064 [0x0c] rec0=15 rec1=00 rec2=0c rec3=06e [0x0d] rec0=1a rec1=00 rec2=0d rec3=010 [0x0e] rec0=12 rec1=00 rec2=0e rec3=002 [0x0f] rec0=16 rec1=00 rec2=0f rec3=090 [0x10] rec0=16 rec1=00 rec2=10 rec3=070 [0x11] rec0=15 rec1=00 rec2=11 rec3=020 [0x12] rec0=16 rec1=00 rec2=12 rec3=010 [0x13] rec0=15 rec1=00 rec2=13 rec3=06a [0x14] rec0=18 rec1=00 rec2=14 rec3=038 [0x15] rec0=19 rec1=00 rec2=15 rec3=038 [0x16] rec0=14 rec1=00 rec2=16 rec3=078 [0x17] rec0=01 rec1=00 rec2=23 rec3=008 [0x18] rec0=17 rec1=00 rec2=17 rec3=032 [0x19] rec0=15 rec1=00 rec2=18 rec3=088 [0x1a] rec0=15 rec1=00 rec2=19 rec3=070 [0x1b] rec0=18 rec1=00 rec2=1a rec3=06e [0x1c] rec0=1b rec1=00 rec2=1b rec3=02c [0x1d] rec0=14 rec1=00 rec2=1c rec3=058 [0x1e] rec0=00 rec1=00 rec2=22 rec3=01a [0x1f] rec0=13 rec1=00 rec2=1d rec3=01a [0x20] rec0=1a rec1=00 rec2=1e rec3=020 [0x21] rec0=16 rec1=00 rec2=1f rec3=030 [0x22] rec0=17 rec1=00 rec2=20 rec3=004 [0x23] rec0=14 rec1=00 rec2=21 rec3=001 [0x24] rec0=00 rec1=00 rec2=00 rec3=00c tail 0x2171d5890838d6b322f02 0x42a00088462065003 Free Block Chain: 0x24: 0000 00 00 00 17 80 05 20 74 68 65 6e 05 00 0c 20 20 ┆ then ┆