A dependency-aware software repository compilation scheduling method, system, and medium

By constructing and splitting the compilation relationship graph and determining the compilation order for each subgraph, the pause problem caused by compilation dependencies in the software repository was solved, thus improving compilation efficiency.

CN117971424BActive Publication Date: 2026-04-07NAT UNIV OF DEFENSE TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-19
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In software repositories, the lack of a defined order for compilation dependencies can cause pauses during concurrent compilation, impacting compilation efficiency.

Method used

By constructing a compilation relationship graph of the software source code package, splitting it into multiple sub-graphs, determining the compilation order for each sub-graph, building an independent compilation chain, and controlling the compilation chains of each sub-graph to perform concurrent compilation.

Benefits of technology

It reduces pauses caused by compilation dependencies and improves the compilation efficiency of software repositories.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117971424B_ABST
    Figure CN117971424B_ABST
Patent Text Reader

Abstract

This invention discloses a dependency-aware software repository compilation scheduling method, system, and medium. The method includes obtaining a list of software source code from a specified software repository; constructing a compilation relationship graph G of the software source code packages based on the compilation dependency attribute fields of each package in the list; splitting the compilation relationship graph G into multiple subgraphs; determining the compilation order of the software source code packages for each subgraph and constructing an independent compilation chain; and controlling the compilation chains of each subgraph to perform concurrent compilation according to the corresponding compilation order of the software source code packages. This invention aims to eliminate or mitigate software package compilation pauses caused by dependencies and conflicts between packages and improve the compilation efficiency of the software repository by perceiving software dependencies and providing a determined compilation order as guidance.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software warehouse construction, in particular to a dependency-aware software warehouse compilation scheduling method, system and medium. BACKGROUND

[0002] At present, the software warehouse of mainstream open source operating system generally maintains more than 60,000 software packages. When it is needed to compile the software packages from source code packages to binary packages, in order to improve the compilation efficiency, the software warehouse maintainer will start multiple pipelines to compile the packages simultaneously in a concurrent compilation manner. Since there is a compilation dependency relationship between the software packages, the multiple pipelines for parallel compilation cannot always proceed, and there is a phenomenon that the package compiled in a pipeline L1 is paused due to the dependency of the package generated in a pipeline L2, and can only be performed after the required package is ready. Usually, the software warehouse needs to be compiled and rolled back several times to complete the compilation and update of the software warehouse from source code to binary software package. The main reason for this problem is that when the concurrent compilation command is sent, no certain compilation order is given as a guide, which makes the software concurrent compilation order random, and there is a phenomenon that the compilation order and the dependency order are inconsistent, resulting in the need to wait for the dependent package to be ready and pause. The performance of concurrent compilation cannot be fully utilized. SUMMARY

[0003] The technical problem to be solved by the present application is to provide a dependency-aware software warehouse compilation scheduling method, system and medium to solve the above problems in the prior art. The present application aims to eliminate or alleviate the software package compilation pause problem caused by the dependency and conflict relationship between the packages by perceiving the dependency relationship of the software in the software warehouse and giving a certain compilation order as a guide, thereby improving the compilation efficiency of the software warehouse.

[0004] To solve the above technical problems, the technical scheme adopted by the present application is as follows:

[0005] A dependency-aware software warehouse compilation scheduling method, comprising the following steps:

[0006] S101, obtaining a software source code list of a specified software warehouse;

[0007] S102, constructing a compilation relationship graph G of the software source code packages according to the compilation dependency relationship attribute fields of each software source code package in the software source code list, wherein the compilation relationship graph G comprises the software source code packages and the dependency relationship between the software source code packages;

[0008] S103, splitting the compilation relationship graph G into multiple subgraphs;

[0009] S104, determining the compilation order of the software source code packages for each subgraph and constructing an independent compilation chain;

[0010] S105 controls the compilation chain of each subgraph to perform concurrent compilation according to the compilation order of the corresponding software source code packages.

[0011] Optionally, after step S101 and before step S102, the process also includes obtaining the set of software source code packages {P} contained in the specified custom system compilation image. k}, and remove the set of software source packages {P} contained in the specified custom system build image from the software source code list. k}

[0012] Optionally, step S102 includes:

[0013] S201, Based on the compilation dependency attribute field of each software source package in the software source code list, determine the software source package that the software source package depends on, thereby determining the dependency relationship between software source packages;

[0014] S202, using software source packages as nodes in the compilation relationship graph, for each determined dependency relationship between software source packages, draws a path from the dependent software source package to the dependent software source package, and finally obtains the compilation relationship graph G.

[0015] Optionally, when splitting the compilation relation graph G into multiple subgraphs in step S103, the splitting principle is that there are connecting edges between nodes within the subgraphs, and there are no connecting edges between different subgraphs.

[0016] Optionally, step S104 includes:

[0017] S301, Initialize the loop variable i used to traverse and process the subgraph;

[0018] S302, traverse the compilation relation graph G to obtain the i-th subgraph Gi. If all subgraphs in the compilation relation graph G have been traversed, generate the compilation order of each subgraph according to the order of the sequential linked list, the sequentialized ring, and the reverse linked list, and jump to step S105; otherwise, jump to step S303.

[0019] S303, create an initial sequential linked list L for the i-th subgraph Gi. Gi ;

[0020] S304, find all leaf nodes in the i-th subgraph Gi, where each leaf node is a node containing only its out-degree, and obtain the leaf node set {LeafP}. L} Gi ;

[0021] S305, from the leaf node set {LeafP L} Gi Extract a leaf node (LeafP) by traversing the middle node.L Leaf node LeafP L Placed in sequential linked list L Gi First, starting from the first level, and then taking the first level as the current level, add the node pointed to by the node of the current level, nextLeafPk, into the sequential linked list L. Gi The next level of the list and points to the node of the current level, until the node of the current level no longer points to any node; add the leaf node LeafPL and the linked list L. Gi The middle node is deleted from the i-th subgraph Gi;

[0022] S306, Determine the set of leaf nodes {LeafPL} Gi Has the traversal been completed? If not, proceed to step S305; otherwise, proceed to the next step.

[0023] S307, determine whether the i-th subgraph Gi is empty. If it is, increment the loop variable i by 1 and jump to step S302; otherwise, generate an initial reverse linked list RL for the i-th subgraph Gi. Gi ;

[0024] S308, find all root nodes in the i-th subgraph Gi, where each root node is a node containing only its in-degree, and obtain the root node set {RootP}. R};

[0025] S309, from the root node set {RootP R Iterate through the nodes to retrieve a root node RootP. RK Root node RootP RK Place in the reverse linked list RL Gi The first layer is used as the current layer, and the node nextLeafPk pointing to the current layer node is added to the reverse linked list RL. Gi The next level down and pointing to the current level node, until the current level node no longer points to any other node; the root node RootP RK And adding to the reverse linked list RL Gi The middle node is deleted from the i-th subgraph Gi;

[0026] S310, determine the root node set {RootP} R} Check if the traversal is complete. If not, proceed to step S309; ​​otherwise, proceed to the next step.

[0027] S311, for the ring in the i-th subgraph Gi, the ring is eliminated by adding a virtual bag, and the ring is obtained after the sequence is changed to RingGi;

[0028] S312, create a ring sequence list RingL for the sequenced ring RingGi. Gi ;

[0029] S313, extract a leaf node (Leaf) from the sequentialized ring RingGi. k , leaf node k Placed in the Ring sequence list Gi The first layer, and then starting from the first layer as the current layer, will point to the non-virtual bag node Leaf of the current layer node. j Ring List Gi The next level and pointing to the current level node, until the current level node no longer points to any other node; the leaf node is then... k and adding to the Ring list Gi The middle node is removed from the sequentialized RingGi;

[0030] S314. Determine whether the sequentialized RingGi still has untraversed leaf nodes. If there are still untraversed leaf nodes, jump to step S313; otherwise, jump to step S315.

[0031] S315, check if the sequentialized ring RingGi is empty. If it is empty, increment the loop variable i by 1 and jump to step S302; otherwise, report an error, end and exit.

[0032] Optionally, in step S311, when resolving the loop in the i-th subgraph Gi by adding a virtual packet, it includes identifying single loops and compound loops in the i-th subgraph Gi based on the dependency relationships of the nodes in the i-th subgraph Gi. When resolving the single loop and compound loop by adding a virtual packet, the single loop refers to a loop in which each node has an out-degree and an in-degree. The compound loop refers to a loop in which each node has multiple loops in which there are two or more nodes with out-degrees or in-degrees.

[0033] Optionally, resolving a single ring by adding a virtual packet includes: selecting elements on the single ring that are already in the sequential linked list L. Gi Or reverse linked list RL Gi In the last layer of the software source code package A, a virtual package A~ with the same name is set up. The dependency relationship between software source code package A and the next software source code package that software source code package A points to in the single ring is removed. The virtual package A~ replaces the software source code package and establishes the dependency relationship with the next software source code package that software source code package A points to in the single ring, thereby completing the dissolution of the ring within the single ring.

[0034] Optionally, the method of resolving a compound ring by adding a virtual package includes: selecting a software source package A with an in-degree greater than 1 in the compound ring, setting a virtual package A~ with the same name for it, removing the dependency relationship between software source package A and the next software source package that software source package A points to in the compound ring, establishing a dependency relationship with the next software source package that software source package A points to in the compound ring starting with the virtual package A~, thereby resolving the ring in the compound ring into a single ring; and then, for the resolved unit, performing the method of resolving the single ring by adding a virtual package.

[0035] Furthermore, the present invention also provides a dependency-aware software repository compilation scheduling system, including interconnected microprocessors and memory, wherein the microprocessors are programmed or configured to execute the dependency-aware software repository compilation scheduling method.

[0036] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program for being programmed or configured by a microprocessor to execute the dependency-aware software repository compilation scheduling method.

[0037] Compared with the prior art, the present invention has the following main advantages:

[0038] 1. This invention guides the compilation process of software source packages based on the compilation dependencies between source packages in the software repository, so as to reduce the pause problem caused by compilation dependencies and improve the construction efficiency of the software repository.

[0039] 2. The present invention includes splitting the compilation relationship graph into multiple subgraphs; determining the compilation order of software source code packages for each subgraph and constructing an independent compilation chain; controlling the compilation chains of each subgraph to perform concurrent compilation according to the compilation order of the corresponding software source code packages. By adopting the method of concurrent compilation of compilation chains, the compilation efficiency of the software repository can be further improved. Attached Figure Description

[0040] Figure 1 This is a schematic diagram of the basic process of the method in an embodiment of the present invention.

[0041] Figure 2 This is a detailed flowchart illustrating the method of an embodiment of the present invention.

[0042] Figure 3 This is a schematic diagram of the topological structure of a subgraph of the compilation relationship graph G in an embodiment of the present invention.

[0043] Figure 4 As described in the embodiments of the present invention Figure 3 The diagram shows the intended sequential chain representation of the subgraph.

[0044] Figure 5 As described in the embodiments of the present inventionFigure 3 The diagram shows the reverse chain representation of the subgraph.

[0045] Figure 6 This is a schematic diagram of single-ring digestion in an embodiment of the present invention.

[0046] Figure 7 This is a schematic diagram of the complex ring digestion in an embodiment of the present invention. Detailed Implementation

[0047] like Figure 1 As shown, the dependency-aware software repository compilation scheduling method in this embodiment includes the following steps:

[0048] S101, retrieve the list of software source code from the specified software repository;

[0049] S102, construct a compilation relationship graph G of the software source code packages based on the compilation dependency attribute fields of each software source code package in the software source code list. The compilation relationship graph G includes the software source code packages and the dependencies between the software source code packages.

[0050] S103, split the compiler relation graph G into multiple subgraphs;

[0051] S104 determines the compilation order of the software source code packages for each subgraph and builds an independent compilation chain;

[0052] S105 controls the compilation chain of each subgraph to perform concurrent compilation according to the compilation order of the corresponding software source code packages.

[0053] See Figure 2 In this embodiment, after step S101 and before step S102, it also includes obtaining the set of software source code packages {P} contained in the specified customized system compilation image. k}, and remove the set of software source packages {P} contained in the specified custom system build image from the software source code list. k For example, a custom system build image can be specified as needed. In this embodiment, the custom system build image is a bootstrap (build-essential) build image. Since the software source code packages in the custom system build image are all pre-compiled, there is no need to perform software repository build scheduling. By removing it, the efficiency of the dependency-aware software repository build scheduling method in this embodiment can be improved.

[0054] Software source code packages contain compilation dependency attribute fields. These fields are typically named `builddepend` or other fields representing compilation dependencies. They indicate the packages the software package depends on during compilation, thus determining the compilation order constraints. Using the compilation dependencies indicated by the `builddepend` class field to establish partial order relationships for package compilation, and then using these partial order relationships to guide the concurrent compilation process of the software repository, becomes a way to improve the efficiency of software repository building. For the software repository, a compilation relationship graph of the software source code packages is constructed based on the `build-depends` class field. This compilation relationship graph contains dependencies. If there is a `Build-depends` class relationship between package A and package B, and A depends on B, then an edge is drawn from B to A between node A and node B. Step S102 in this embodiment includes:

[0055] S201, Based on the compilation dependency attribute field of each software source package in the software source code list, determine the software source package that the software source package depends on, thereby determining the dependency relationship between software source packages;

[0056] S202, treating software source packages as nodes in the compilation relationship graph, for each determined dependency relationship between software source packages, a path is drawn from the dependent software source package to the dependent software source package, ultimately resulting in the compilation relationship graph G. The final compilation relationship graph G is a tree structure, with nodes including root nodes, intermediate nodes, and leaf nodes. Leaf nodes are nodes that only contain out-degrees; root nodes are nodes that only contain in-degrees.

[0057] In step S103 of this embodiment, when splitting the compilation relationship graph G into multiple subgraphs, the splitting principle is that there are connecting edges between nodes within the subgraphs, and there are no connecting edges between different subgraphs.

[0058] See Figure 2 In this embodiment, step S104 includes:

[0059] S301, Initialize the loop variable i used to traverse and process the subgraph;

[0060] S302, traverse the compilation relation graph G to obtain the i-th subgraph Gi. If all subgraphs in the compilation relation graph G have been traversed, generate the compilation order of each subgraph according to the order of sequential linked list, sequentialized cycle, and reverse linked list (i.e., first sequential linked list, then sequentialized cycle, and finally reverse linked list), and jump to step S105; otherwise, jump to step S303.

[0061] S303, create an initial sequential linked list L for the i-th subgraph Gi. Gi ;

[0062] S304, find all leaf nodes in the i-th subgraph Gi, where each leaf node is a node containing only its out-degree, and obtain the leaf node set {LeafP}. L} Gi ;by Figure 3 Taking a subgraph of the compilation relation graph G as an example, the set of leaf nodes {LeafP} L} Gi The leaf nodes in the diagram include four nodes: A, B, C, and D.

[0063] S305, from the leaf node set {LeafP L} Gi Extract a leaf node (LeafP) by traversing the middle node. L Leaf node LeafP L Placed in sequential linked list L Gi First, starting from the first level, and then taking the first level as the current level, add the node pointed to by the node of the current level, nextLeafPk, into the sequential linked list L. Gi The next level of the list and points to the node of the current level, until the node of the current level no longer points to any node; add the leaf node LeafPL and the linked list L. Gi The middle node is deleted from the i-th subgraph Gi;

[0064] S306, Determine the set of leaf nodes {LeafPL} Gi Has the traversal been completed? If not, proceed to step S305; otherwise, proceed to the next step.

[0065] S307, determine whether the i-th subgraph Gi is empty. If it is, increment the loop variable i by 1 and jump to step S302; otherwise, generate an initial reverse linked list RL for the i-th subgraph Gi. Gi ;

[0066] S308, find all root nodes in the i-th subgraph Gi, where each root node is a node containing only its in-degree, and obtain the root node set {RootP}. R};

[0067] S309, from the root node set {RootP R Iterate through the nodes to retrieve a root node RootP. RK Root node RootP RK Place in the reverse linked list RL Gi The first layer is used as the current layer, and the node nextLeafPk pointing to the current layer node is added to the reverse linked list RL. Gi The next level down and pointing to the current level node, until the current level node no longer points to any other node; the root node RootP RK And adding to the reverse linked list RLGi The middle node is deleted from the i-th subgraph Gi;

[0068] S310, determine the root node set {RootP} R} Check if the traversal is complete. If not, proceed to step S309; ​​otherwise, proceed to the next step.

[0069] S311, for the ring in the i-th subgraph Gi, the ring is eliminated by adding a virtual bag, and the ring is obtained after the sequence is changed to RingGi;

[0070] S312, create a ring sequence list RingL for the sequenced ring RingGi. Gi ;

[0071] S313, extract a leaf node (Leaf) from the sequentialized ring RingGi. k , leaf node k Placed in the Ring sequence list Gi The first layer, and then starting from the first layer as the current layer, will point to the non-virtual bag node Leaf of the current layer node. j Ring List Gi The next level (Ring List) Gi Each layer has only one node and points to the node in the current layer, until the node in the current layer no longer points to any other node; the leaf node is then... k and adding to the Ring list Gi The middle node is removed from the sequentialized RingGi.

[0072] S314. Determine whether the sequentialized RingGi still has untraversed leaf nodes. If there are still untraversed leaf nodes, jump to step S313; otherwise, jump to step S315.

[0073] S315, check if the sequentialized ring RingGi is empty. If it is empty, increment the loop variable i by 1 and jump to step S302; otherwise, report an error, end and exit.

[0074] by Figure 3 Taking a subgraph of the compilation relationship graph G as an example, a cube frame represented by a letter represents a node. The sequential linked list L constructed in this embodiment... Gi like Figure 4 As shown, the constructed reverse linked list RL Gi like Figure 5 As shown. See also Figure 4 It can be seen that nodes A, B, C, and D form a sequential linked list L. GiThe first layer; nodes E, F, and G pointed to by node A in the first layer are located in the second layer; nodes H, I, J, and K pointed to by node D in the first layer are located in the second layer; nodes L and M pointed to by node F in the second layer are located in the third layer; nodes N pointed to by node H in the second layer are located in the third layer; nodes O, P, Q, and R pointed to by node J in the second layer are located in the third layer; nodes S pointed to by node K in the second layer are located in the third layer; nodes B and C in the first layer have no dependencies, so they have no associated nodes in the second layer.

[0075] See Figure 5 It can be seen that nodes A, B, C, and D form a reverse linked list RL. Gi The third layer; nodes E, F, and G pointed to by node A in the third layer are located in the second layer; nodes H, I, J, and K pointed to by node D in the third layer are located in the second layer; nodes L and M pointed to by node F in the second layer are located in the first layer; nodes N pointed to by node H in the second layer are located in the first layer; nodes O, P, Q, and R pointed to by node J in the second layer are located in the first layer; nodes S pointed to by node K in the second layer are located in the first layer; nodes B and C in the third layer have no dependencies, so they have no associated nodes in the second layer.

[0076] When generating subgraphs in the order of sequential linked lists, sequentialized cycles, and reversed linked lists (i.e., first sequential linked lists, then sequentialized cycles, and finally reversed linked lists), a simple method is to process them layer by layer. For example, based on... Figure 4 The sequential linked list L shown Gi In the order of layers one, two, and three: First batch: ABCD can be compiled concurrently; second batch: EFGHIJK can be compiled concurrently; third batch: LMNOPQR can be compiled concurrently. (This is for items like...) Figure 5 The reverse linked list RL shown Gi In the order of three, two, and one layer: the first batch: ABCD can be compiled concurrently, the second batch: EFGHIJK can be compiled concurrently, and the third batch: LMNOPQR can be compiled concurrently.

[0077] For the cycle in the i-th subgraph Gi, adding dummy packets can resolve the cycle, revealing the true dependencies of the cycle and eliminating spurious dependencies. (See also...) Figure 2In step S311, when resolving cycles in the i-th subgraph Gi by adding virtual packets, this includes identifying single and compound cycles in the i-th subgraph Gi based on the dependencies of nodes in Gi. For single and compound cycles, the virtual packets are used to resolve them respectively. A single cycle refers to a loop formed by nodes, where each node has an out-degree and an in-degree. A compound cycle refers to multiple loops formed by nodes, where there are two or more nodes with out-degrees or in-degrees. It should be noted that cycle detection in directed graphs is a well-known method. Based on this, the number of out-degrees and in-degrees (a well-known attribute of nodes in a tree structure) of nodes can be used to determine whether it is a single or compound cycle. When adding virtual packets to resolve cycles, the virtual packets do not need to be compiled; only a header is provided. During the environment check for the actual package compilation, the compilation environment is provided.

[0078] like Figure 6 As shown, the method of resolving a single ring by adding a virtual packet includes: selecting rings that are already in the sequential linked list L on the single ring. Gi Or reverse linked list RL Gi In the last layer of the loop, software source package A is given a virtual package A~ with the same name. This removes the dependency between software source package A and the next software source package that software source package A points to in the single loop. The virtual package A~ replaces the software source package and establishes a dependency with the next software source package that software source package A points to in the single loop, thus completing the dissolution of the loop within the single loop. Selecting software source package A on the single loop and giving it a virtual package A~ means that software source package A is the first package on the loop that is ready to compile. Packages that depend on it can meet the compilation conditions and be compiled. Then, compilation proceeds in this order, and package A is the last package to be compiled.

[0079] like Figure 7 As shown, the method of dissolving a compound ring by adding a virtual package includes: For a compound ring formed by multiple interconnected rings, select a software source package A with an in-degree greater than 1, and set a virtual package A~ with the same name for it. Remove the dependency between software source package A and the next software source package that software source package A points to in the compound ring. Establish a dependency relationship between the virtual package A~ and the next software source package that software source package A points to in the compound ring, thus dissolving the ring in the compound ring into a single ring. Then, for the dissolved unit, perform the method of dissolving the single ring by adding a virtual package. Selecting a software source package A on the ring (with an out-degree greater than 2) and setting a virtual package A~ for it means that software source package A is the first package on the ring that is ready to compile. Packages that depend on it can meet the compilation conditions and be compiled. Then, compiling in this order, software source package A is the last package to be compiled. Figure 7Software source package B, which depends on software source package A and has an in-degree greater than 2, is a package on another ring. Adding virtual package A is equivalent to dissolving the composite ring into two single rings at software source package A; then, for the units obtained after dissolution, the ring dissolution is performed by adding virtual packages for the single rings, thus finally completing the dissolution of the rings in the composite ring.

[0080] In summary, the dependency-aware software repository compilation scheduling method of this embodiment guides the compilation process of software source packages based on the compilation dependencies between them, thereby reducing pauses caused by compilation dependencies and improving the build efficiency of the software repository. This method includes splitting the compilation relationship graph into multiple subgraphs; determining the compilation order of software source packages for each subgraph and constructing an independent compilation chain; and controlling the compilation chains of each subgraph to perform concurrent compilation according to the corresponding software source package compilation order. This concurrent compilation of compilation chains further improves the compilation efficiency of the software repository. Based on the subgraphs in the compilation graph, this method can support the generation of multiple fully concurrent compilation chains, improving compilation efficiency. Furthermore, this method supports setting all virtual packages at once, preventing compilation rollbacks caused by dependency cycles during unordered compilation, which helps improve compilation efficiency.

[0081] Furthermore, this embodiment also provides a dependency-aware software repository compilation scheduling system, including a microprocessor and a memory interconnected, wherein the microprocessor is programmed or configured to execute the dependency-aware software repository compilation scheduling method. Additionally, this embodiment also provides a computer-readable storage medium storing a computer program for being programmed or configured by the microprocessor to execute the dependency-aware software repository compilation scheduling method.

[0082] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable apparatus for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0083] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.

Claims

1. A dependency-aware software repository compilation scheduling method, characterized in that, Includes the following steps: S101, retrieve the list of software source code from the specified software repository; S102, construct a compilation relationship graph G of the software source code packages based on the compilation dependency attribute fields of each software source code package in the software source code list. The compilation relationship graph G includes the software source code packages and the dependencies between the software source code packages. S103, split the compiler relation graph G into multiple subgraphs; S104 determines the compilation order of the software source code packages for each subgraph and builds an independent compilation chain; S105 controls the compilation chain of each subgraph to perform concurrent compilation according to the compilation order of the corresponding software source code packages; Step S104 includes: S301, Initialize the loop variable i used to traverse and process the subgraph; S302, traverse the compilation relation graph G to obtain the i-th subgraph Gi. If all subgraphs in the compilation relation graph G have been traversed, generate the compilation order of each subgraph according to the order of the sequential linked list, the sequentialized ring, and the reverse linked list, and jump to step S105; otherwise, jump to step S303. S303, create an initial sequential linked list L for the i-th subgraph Gi. Gi ; S304, find all leaf nodes in the i-th subgraph Gi, where the leaf nodes are nodes that only contain out-degree, and obtain the leaf node set {LeafPL}Gi; S305, traverse the set of leaf nodes {LeafPL}Gi and take out a leaf node LeafPL, then place the leaf node LeafPL in the sequential linked list L. Gi First, starting from the first level, and then taking the first level as the current level, add the node pointed to by the node of the current level, nextLeafPk, into the sequential linked list L. Gi The next level of the list and points to the node of the current level, until the node of the current level no longer points to any node; add the leaf node LeafPL and the linked list L. Gi The middle node is deleted from the i-th subgraph Gi; S306, determine whether the leaf node set {LeafPL}Gi has been traversed. If it has not been traversed, jump to step S305; otherwise, jump to the next step. S307, determine whether the i-th subgraph Gi is empty. If it is, increment the loop variable i by 1 and jump to step S302; otherwise, generate an initial reverse linked list RL for the i-th subgraph Gi. Gi ; S308, find all root nodes in the i-th subgraph Gi, where each root node is a node containing only its in-degree, and obtain the root node set {RootP}. R }; S309, from the root node set {RootP R Iterate through the nodes to retrieve a root node RootP. RK Root node RootP RK Place in the reverse linked list RL Gi The first layer is used as the current layer, and the node nextLeafPk pointing to the current layer node is added to the reverse linked list RL. Gi The next level down and pointing to the current level node, until the current level node no longer points to any other node; the root node RootP RK And adding to the reverse linked list RL Gi The middle node is deleted from the i-th subgraph Gi; S310, determine the root node set {RootP} R } Check if the traversal is complete. If not, proceed to step S309; ​​otherwise, proceed to the next step. S311, for the ring in the i-th subgraph Gi, the ring is eliminated by adding a virtual bag, and the ring is obtained after the sequence is changed to RingGi; S312, create a ring sequence list RingL for the sequenced ring RingGi. Gi ; S313, traverse through the sequenced ring RingGi and extract a leaf node Leafk, then place Leafk in the ring sequence list RingL. Gi The first layer is then used as the current layer, and the non-virtual bag node Leafj pointing to the current layer node is placed into the ring list RingL. Gi The next level of the node points to the node in the current level, until the node in the current level no longer points to any other node; the leaf node is added to the ring list. Gi The middle node is removed from the sequentialized RingGi; S314. Determine whether the sequentialized RingGi still has untraversed leaf nodes. If there are still untraversed leaf nodes, jump to step S313; otherwise, jump to step S315. S315, check if the sequentialized ring RingGi is empty. If it is empty, increment the loop variable i by 1 and jump to step S302; otherwise, report an error, end and exit.

2. The dependency-aware software repository compilation scheduling method according to claim 1, characterized in that, After step S101 and before step S102, the process also includes obtaining the set of software source code packages {P} contained in the specified custom system compilation image. k }, and remove the set of software source packages {P} contained in the specified custom system build image from the software source code list. k } 3. The dependency-aware software repository compilation scheduling method according to claim 1, characterized in that, Step S102 includes: S201, Based on the compilation dependency attribute field of each software source package in the software source code list, determine the software source package that the software source package depends on, thereby determining the dependency relationship between software source packages; S202, using software source packages as nodes in the compilation relationship graph, for each determined dependency relationship between software source packages, draws a path from the dependent software source package to the dependent software source package, and finally obtains the compilation relationship graph G.

4. The dependency-aware software repository compilation scheduling method according to claim 1, characterized in that, In step S103, when splitting the compilation relation graph G into multiple subgraphs, the splitting principle is that there are connecting edges between nodes within the subgraphs, and there are no connecting edges between different subgraphs.

5. The dependency-aware software repository compilation scheduling method according to claim 1, characterized in that, In step S311, when resolving the loop in the i-th subgraph Gi by adding a virtual packet, it includes identifying single loops and compound loops in the i-th subgraph Gi based on the dependency relationships of the nodes in the i-th subgraph Gi. When resolving the loop by adding a virtual packet for single loops and compound loops respectively, a single loop refers to a loop in which each node has an out-degree and an in-degree. A compound loop refers to a loop in which each node has multiple loops in which there are two or more nodes with out-degrees or in-degrees.

6. The dependency-aware software repository compilation scheduling method according to claim 5, characterized in that, The method of resolving single rings by adding dummy packets includes: selecting single rings that are already in the sequential linked list L. Gi Or reverse linked list RL Gi In the last layer of the software source code package A, a virtual package A~ with the same name is set up. The dependency relationship between software source code package A and the next software source code package that software source code package A points to in the single ring is removed. The virtual package A~ replaces the software source code package and establishes the dependency relationship with the next software source code package that software source code package A points to in the single ring, thereby completing the dissolution of the ring within the single ring.

7. The dependency-aware software repository compilation scheduling method according to claim 6, characterized in that, The method of resolving compound rings by adding virtual packages includes: selecting a software source package A with an in-degree greater than 1 in the compound ring, setting a virtual package A~ with the same name for it, removing the dependency relationship between software source package A and the next software source package that software source package A points to in the compound ring, and establishing a dependency relationship between the virtual package A~ and the next software source package that software source package A points to in the compound ring, thereby resolving the ring in the compound ring into a single ring; then, for the resolved unit, performing the method of resolving the single ring by adding virtual packages.

8. A dependency-aware software repository compilation scheduling system, comprising interconnected microprocessors and memory, characterized in that, The microprocessor is programmed or configured to execute the dependency-aware software repository compilation scheduling method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing a computer program, characterized in that, The computer program is used to be programmed or configured by a microprocessor to execute the dependency-aware software repository compilation scheduling method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • System and method for scheduling instructions to maximize outstanding prefetches and loads

    US6918111B1