Software package updating method and device, equipment and storage medium
By remotely accessing the upstream repository to obtain the package tag and the identity of the submitted information, the time-consuming problem of cloning the cloud code repository is solved, and efficient software package update evaluation and automated query are achieved.
Patent Information
- Application Number
- CN202410017737.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-07-08
AI Technical Summary
In the prior art, cloning a complete cloud code repository to query software package updates is time-consuming and memory consuming, affecting query efficiency and may even lead to query failure.
By obtaining the identification information and version number of the software package, remotely access the upstream repository to obtain the identification of the tag and submission information, and using the mapping relationship between the version number, tag and submission information, determine whether the package needs to be updated.
It realizes efficient evaluation software package updates, avoids cloning complete upstream warehouses, and improves query efficiency and update automation.
Smart Images

Figure CN120276745A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of cloud technologies, and particularly to a method, apparatus, device, and storage medium for updating software packages. Background Art
[0002] An operating system is usually distributed in the form of a software package set. In addition to the core basic packages required for building the system, this software package set also needs to include software packages for many typical applications to enrich the usage scenarios. And these software packages will be continuously updated and evolved, and the distribution vendors of the operating system need to evaluate and update them as needed.
[0003] In related technologies, the cloud code repository of the above software packages can be cloned to a local repository, and then the version update situation of these software packages can be queried in the local repository, so as to determine whether it is necessary to update these software packages in the software package set.
[0004] However, for a cloud code repository with a large code volume and active maintenance, the above query method of cloning the complete repository is both time-consuming and memory-consuming, affecting the query efficiency and even causing query failures. Summary of the Invention
[0005] Embodiments of the present application provide a method, apparatus, device, and storage medium for updating software packages. The technical solutions provided by the embodiments of the present application are as follows:
[0006] According to one aspect of the embodiments of the present application, a method for updating a software package is provided. The method includes:
[0007] Obtain the identification information of a first software package in a software package set of a release version, where the software package set includes at least one software package, and the identification information of the software package is used to distinguish different software packages;
[0008] According to the identification information of the first software package, obtain the version number of the first software package of a first version, where the first version refers to the version of the first software package in the software package set, and the version number is used to distinguish the release order of each version of the first software package;
[0009] Based on the address of the upstream repository of the first software package, remotely access the upstream repository of the first software package, and obtain the tags corresponding to each version of the first software package and the identification of the commit information corresponding to each tag; where the upstream repository of the first software package includes the tags corresponding to each version of the first software package and the commit information corresponding to each tag, the tag is used to distinguish different versions of the first software package, the commit information is used to record the modifications made to the first software package, and the identification of the commit information is used to distinguish different modifications made to the first software package;
[0010] Determine whether to update the first software package in the software package set according to the version number of the first software package of the first version, the tags respectively corresponding to each version of the first software package, and the identifiers of the commit information respectively corresponding to each tag.
[0011] According to one aspect of the embodiments of the present application, there is provided an apparatus for updating software packages, the apparatus including:
[0012] An obtaining module, configured to obtain the identification information of the first software package in the software package set of the distribution version, where the software package set includes at least one software package, and the identification information of the software package is used to distinguish different software packages;
[0013] The obtaining module is further configured to obtain the version number of the first software package of the first version according to the identification information of the first software package, where the first version refers to the version of the first software package in the software package set, and the version number is used to distinguish the release order of each version of the first software package;
[0014] A remote access module, configured to remotely access the upstream repository of the first software package based on the address of the upstream repository of the first software package, and obtain the tags respectively corresponding to each version of the first software package and the identifiers of the commit information respectively corresponding to each tag; where the upstream repository of the first software package includes the tags respectively corresponding to each version of the first software package and the commit information respectively corresponding to each tag, the tags are used to distinguish different versions of the first software package, the commit information is used to record the modifications made to the first software package, and the identifiers of the commit information are used to distinguish different modifications made to the first software package;
[0015] A determination module, configured to determine whether to update the first software package in the software package set according to the version number of the first software package of the first version, the tags respectively corresponding to each version of the first software package, and the identifiers of the commit information respectively corresponding to each tag.
[0016] According to one aspect of the embodiments of the present application, there is provided a computer device, the computer device including a processor and a memory, and a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above software package update method.
[0017] According to one aspect of the embodiments of the present application, there is provided a computer-readable storage medium, and a computer program is stored in the storage medium, and the computer program is loaded and executed by a processor to implement the above software package update method.
[0018] According to one aspect of the embodiments of the present application, a computer program product is provided. The computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, and a processor reads and executes the computer program from the computer-readable storage medium to implement the above software package update method.
[0019] The technical solution provided by the embodiments of the present application at least includes the following beneficial effects:
[0020] By obtaining the identification information of the first software package in the software package set of the distribution. Then, according to the identification information of the first software package, obtain the version number of the first software package in the first version, where the first version refers to the version of the first software package in the software package set. And, based on the address of the upstream repository of the first software package, remotely access the upstream repository of the first software package to obtain the tags corresponding to each version of the first software package and the identification of the commit information corresponding to each tag. Then, according to the version number of the first software package in the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each tag, determine whether to update the first software package in the software package set. It realizes evaluating whether to update the software package in the software package set by remotely accessing the upstream repository, avoiding cloning the entire upstream repository, which is relatively efficient. Description of the Drawings
[0021] Figure 1 It is a schematic diagram of the scheme implementation environment provided by an embodiment of the present application;
[0022] Figure 2 It is a flowchart of the software package update method provided by an embodiment of the present application;
[0023] Figure 3 It is a schematic diagram of the functional architecture of the software package version information query tool provided by an embodiment of the present application;
[0024] Figure 4 It is a flowchart of the label processing method provided by an embodiment of the present application;
[0025] Figure 5 It is a flowchart of the version release time query method provided by an embodiment of the present application;
[0026] Figure 6 It is a flowchart of the overall scheme of the software package update method provided by an embodiment of the present application;
[0027] Figure 7 It is a schematic diagram of the display interface of the software package version information query tool provided by an embodiment of the present application;
[0028] Figure 8It is a block diagram of an update device for a software package provided by an embodiment of the present application;
[0029] Figure 9 It is a structural block diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0030] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the implementation manners of the present application in detail with reference to the accompanying drawings.
[0031] Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0032] Cloud technology can be based on network technology, information technology, integration technology, management platform technology, application technology, etc. applied in the cloud computing business model to form a resource pool, which can be used as needed, flexibly and conveniently. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites, and more portal websites. With the high development and application of the Internet industry, in the future, each item may have its own identification mark and needs to be transmitted to the background system for logical processing. Data at different levels will be processed separately, and various industry data requires a powerful system support, which can only be achieved through cloud computing.
[0033] Cloud storage is a new concept extended and developed on the basis of the cloud computing concept. A distributed cloud storage system (hereinafter referred to as the storage system) refers to a storage system that combines a large number of different types of storage devices (storage devices are also called storage nodes) in the network through cluster applications, grid technology, and distributed storage file systems, etc., and collaborates through application software or application interfaces to jointly provide data storage and service access functions to the outside world. Currently, the storage method of the storage system is as follows: Create a logical volume. When creating a logical volume, physical storage space is allocated for each logical volume. This physical storage space may be composed of the disks of a certain storage device or several storage devices. The client stores data on a certain logical volume, that is, stores the data on the file system. The file system divides the data into many parts, and each part is an object. The object contains not only data but also additional information such as data identification (ID, IDentity). The file system writes each object into the physical storage space of the logical volume respectively, and the file system will record the storage location information of each object. Thus, when the client requests to access the data, the file system can enable the client to access the data according to the storage location information of each object. The process of the storage system allocating physical storage space for the logical volume is specifically as follows: According to the capacity estimation of the objects stored in the logical volume (this estimation often has a large margin relative to the actual capacity of the objects to be stored) and the group of redundant array of independent disks (RAID), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space for the logical volume.
[0034] A database, in short, can be regarded as an electronic filing cabinet - a place to store electronic files. Users can perform operations such as adding, querying, updating, and deleting data in the files. A so-called "database" is a data set stored together in a certain way, shared by multiple users, with as little redundancy as possible, and independent of application programs. A database management system (DBMS) is a computer software system designed to manage databases and generally has basic functions such as storage, interception, security protection, and backup. Database management systems can be classified according to the database models they support, such as relational, XML (Extensible Markup Language); or according to the types of computers they support, such as server clusters, mobile phones; or according to the query languages they use, such as SQL (Structured Query Language), XQuery; or according to the key performance metrics, such as maximum scale, highest running speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories. For example, they can support multiple query languages simultaneously.
[0035] The technical solution provided by the embodiments of this application relates to technologies such as cloud storage and databases in cloud technology. Specifically, the "warehouse" mentioned in the embodiments of this application can be regarded as a database. This will be described in detail in the following embodiments.
[0036] Please refer to Figure 1 , which shows a schematic diagram of the solution implementation environment provided by an embodiment of this application. The solution implementation environment may include: a terminal device 10, a software package set distribution platform 20, and an upstream platform 30.
[0037] The terminal device 10 can be an electronic device such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, etc., but is not limited thereto. A client for running a target application can be installed and run in the terminal device 10. The target application is used to manage each software package in the software package set. For example, a user can modify the first software package in the software package set through the target application, or query the version number of the first software package in the software package set through the target application.
[0038] The software package collection distribution platform 20 can be provided with a repository of the above-mentioned software package collection, which can be used to provide a download service for the software package collection of the release version. For example, a user can download, through the software package collection distribution platform 20, a software package that meets the user's requirements from the software package collection of the release version. Optionally, the software package collection distribution platform 20 can include one or more servers, which can be the background server of the above-mentioned target application and be used to provide background services for the target application.
[0039] The upstream platform 30 can be provided with a code repository of the software package (such as the first software package) in the above-mentioned software package collection, and this code repository can also be referred to as the upstream repository of the software package. The upstream platform 30 can provide a download service for the source code of each version of the software package (such as the latest version of the first software package). Optionally, the upstream platform 30 can include one or more servers, which are used to provide query and download services for the upstream repository of the software package.
[0040] The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal device 10 and the server can be directly or indirectly connected through wired or wireless communication means, and the present application does not make any restrictions in this regard. The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, assisted driving, big data, data analysis, machine learning, cloud native, audio and video, programming tools, network tools, etc.
[0041] Please refer to Figure 2 , which shows a flowchart of a software package update method provided by an embodiment of the present application. The execution subject of each step of this method can be a computer device. For example, this computer device can be the terminal device 10, or this computer device can be the software package collection distribution platform 20. This method can include at least one of the following steps 210 to 240.
[0042] Step 210, obtain the identification information of the first software package in the software package collection of the release version.
[0043] Among them, the software package collection includes at least one software package, and the identification information of the software package is used to distinguish different software packages.
[0044] The set of software packages in a release refers to the set of software packages currently provided to users. In some embodiments, a user can obtain the set of software packages in a release, or obtain the software packages that meet the user's requirements in the set of software packages in a release, by accessing the software package set release platform 20.
[0045] In some embodiments, the set of software packages is the set of software packages of an operating system, and the set of software packages of the operating system includes the basic software packages for building the operating system and the software packages of application programs adapted to the operating system. In some embodiments, the above operating system is an operating system for digital infrastructure, such as the operating system of a server.
[0046] In some embodiments, the first software package is any software package in the set of software packages.
[0047] In some embodiments, the first software package is any software package in the set of software packages other than the above basic software packages.
[0048] In some embodiments, the first software package is a software package to be queried in the set of software packages whose version information is waiting to be queried. The version information of the first software package is used to evaluate whether the first software package in the set of software packages needs to be updated.
[0049] In some embodiments, the identification information of a software package is the name of the software package. Further, the name of the software package may be the name of the application program corresponding to the software package.
[0050] In some embodiments, a technician can also number each software package in the set of software packages, and use the numbers corresponding to each software package as the identification information of the software packages. This application does not limit how to set the identification information of the software packages.
[0051] Step 220: Obtain the version number of the first software package in the first version according to the identification information of the first software package. The first version refers to the version of the first software package in the set of software packages, and the version number is used to distinguish the release order of each version of the first software package.
[0052] The version number of the first software package is used to distinguish the release order of each version of the first software package. For example, the version number can be expressed in the form of "1.1", "1.2", "1.3" (the "1.1" version is released earliest, the "1.2" version comes next, and the "1.3" version is released latest). For another example, the version number can be expressed in the form of "3.1", "3.1.2", "3.1.3". For another example, the version number can be expressed in the form of "A", "B", "C". This application does not limit the specific form of the version number of the software package.
[0053] In some embodiments, a repository of a software package collection (also referred to as a distribution repository) can be accessed, and according to the identification information of the first software package, the version number of the first software package of the first version can be queried and obtained.
[0054] The repository of the software package collection is used to store the software package collection of the distribution. In some embodiments, according to the identification information of the first software package, relevant information (such as code, version number, etc.) of the first software package of the first version can be queried and obtained in the repository of the software package collection. In some embodiments, the repository of the software package collection may include multiple code repositories, and these multiple code repositories respectively correspond to each software package in the software package collection. Exemplarily, the relevant information of the first software package of the first version can be queried and obtained in the code repository corresponding to the first software package.
[0055] Exemplarily, please refer to Figure 3 , which shows a schematic diagram of the functional architecture of a version information query tool for software packages provided in an embodiment of the present application. In this example, after specifying the software package to be queried (such as the first software package) according to the identification information of the software package, the repository of the software package collection can be accessed through the online interface of the software package collection distribution platform, such as the gitee online interface, and the version number of the first software package of the first version can be obtained from the repository of the software package collection.
[0056] Step 230, based on the address of the upstream repository of the first software package, remotely access the upstream repository of the first software package, and obtain the tags corresponding to each version of the first software package and the identifiers of the commit information corresponding to each tag.
[0057] The upstream repository of the first software package includes tags corresponding to each version of the first software package and commit information corresponding to each tag. The tags are used to distinguish different versions of the first software package, and the commit information is used to record the modifications made to the first software package. The identifier of the commit information is used to distinguish different modifications made to the first software package.
[0058] The upstream repository of the first software package is a repository different from the repository of the software package collection, and it is the cloud code repository of the first software package, which can be set in the upstream platform 30. The modifications made by the developer of the first software package will be committed to the upstream repository of the first software package. The commit information corresponding to one modification may include the modified content (modified code) corresponding to this modification, the publisher of this modification, a brief description of this modification, the modification time of this modification, etc. In some embodiments, the upstream repository of the first software package does not include information about software packages other than the first software package in the software package collection. In some embodiments, please refer to Figure 3, the upstream repository of the first software package is an open-source Git repository, and the supported platforms can be upstream platforms such as github, gitlab, and gitee.
[0059] In the upstream Git repository of the first software package, each modification made to the first software package can be regarded as a commit, and the commit id (commit identifier) corresponding to this commit can be used as the identifier of the commit information in the embodiments of the present application. Those skilled in the art should be able to understand that during the process of updating the first software package from one version (such as the version with the label v1.1) to another version (such as the version with the label v1.2), multiple modifications will occur, and these multiple modifications will correspond to multiple commit ids. In this case, the commit id corresponding to the commit that updates the first software package to another version can be used as the identifier of the commit information corresponding to the label of the updated version. For example, during the process of updating the first software package from the version with the label v1.1 to the version with the label v1.2, 5 commits have occurred. Then, the 5th commit can be given the label v1.2 to indicate that the version of the first software package has changed, and the commit id corresponding to the 5th commit above is the identifier of the commit information corresponding to the label v1.2.
[0060] The various versions of the first software package can include the latest version of the first software package and the historical versions updated before the latest version. The various versions of the first software package include the first version.
[0061] Exemplarily, based on the address of the upstream repository of the first software package, remotely access the upstream repository of the first software package, and obtain the labels v1.0, v1.1, v1.2, v1.3, and v1.4, as well as the identifiers a of the commit information corresponding to v1.0, the identifier b of the commit information corresponding to v1.1, the identifier c of the commit information corresponding to v1.2, the identifier d of the commit information corresponding to v1.3, and the identifier e of the commit information corresponding to v1.4.
[0062] Remote access to the upstream repository of the first software package based on the address of the upstream repository of the first software package refers to accessing the upstream repository of the first software package online through the network based on the address of the upstream repository of the first software package. In some embodiments, the upstream repository of the first software package is a Git repository, and the Git repository can be remotely accessed through the git ls-remote command to obtain a list of tags corresponding to each version of the first software package and commit ids corresponding to each tag. The above method of remotely accessing the upstream repository based on the address to obtain the tags and the identification of commit information can be applied to any open-source upstream repository, does not require the use of an API (Application Programming Interface), can be applied to multiple upstream platforms, is not restricted by the code hosting platform, and has high versatility.
[0063] In some embodiments, before step 230, parse the configuration file corresponding to the first software package to obtain the address of the upstream repository of the first software package.
[0064] In some embodiments, the address of the upstream repository of the software package can be a URL (Uniform Resource Locator).
[0065] Each software package in the software package collection has a corresponding configuration file, and the configuration file corresponding to the software package is used to indicate the address of the upstream repository of the software package.
[0066] Exemplarily, if the software package collection includes 1000 software packages, corresponding configuration files can be deployed for these 1000 software packages respectively. After specifying the software package to be queried (such as the first software package), the corresponding configuration file can be parsed to obtain the address of the upstream repository of the software package to be queried.
[0067] The above method enables the address of the remote repository to be obtained by parsing the configuration file when remote access to the upstream repository is required by deploying the configuration file in advance, without the need to manually specify the address of the remote repository during the query process, ensuring the automation of the query process and improving the efficiency of obtaining the tags and the identification of commit information of each version of the software package.
[0068] Step 240, determine whether to update the first software package in the software package collection according to the version number of the first software package of the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each tag.
[0069] In some embodiments, step 240 includes at least one of the following sub-steps 242 to 252.
[0070] Sub-step 242: Standardize the tags corresponding to each version of the first software package to obtain the version numbers corresponding to each version of the first software package.
[0071] Those skilled in the art should understand that since each software package in the software package set may have different developers, different upstream repositories, and the tag forms of different software packages may vary greatly, in order to ensure the automation of software package updates in the software package set, a unified standard is needed to measure the version release order of each software package. Therefore, it is necessary to standardize the tags corresponding to each version of the software package to obtain version numbers that can be sorted under a unified standard. For example, the tags v1.0, v1.1, v1.2, v1.3, and v1.4 in the above example can be standardized to version numbers 1.0, 1.1, 1.2, 1.3, and 1.4.
[0072] Moreover, since each version's tag corresponds to an identifier of different commit information, after the above standardization process, a mapping of the three elements of "version number - tag - identifier of commit information" is established. That is to say, any one of the three elements in "version number - tag - identifier of commit information" can be used to determine the other two elements corresponding to this element. The above mapping can also be called the "Version - tag - commit" mapping.
[0073] Sub-step 244: Sort the version numbers corresponding to each version of the first software package in the release order to determine the version number of the latest version of the first software package.
[0074] Exemplarily, the version numbers 1.0, 1.1, 1.2, 1.3, and 1.4 in the above example can be arranged in the order from the latest release to the earliest release as 1.4, 1.3, 1.2, 1.1, 1.0, and the version number 1.4 is determined as the version number of the latest version of the first software package.
[0075] Sub-step 246: Determine the version difference between the first version of the first software package and the latest version of the first software package according to the number of version numbers between the version number of the first version of the first software package and the version number of the latest version of the first software package.
[0076] The above version difference is used to indicate the number of version releases when the first software package is updated from the first version to the latest version. In some embodiments, adding 1 to the number of the above version numbers gives the version difference between the first software package of the first version and the first software package of the latest version. Exemplarily, if the version number of the first software package of the first version is 1.1, according to the sorted version numbers 1.4, 1.3, 1.2, 1.1, 1.0 in the above example and the version number 1.4 of the first software package of the latest version, it can be obtained that there are two version numbers 1.2 and 1.3 between them, and then the version difference between the first software package of the first version and the first software package of the latest version can be determined to be 3 (that is, the first version and the latest version of the first software package have experienced 3 version releases).
[0077] Sub-step 248: Obtain the release time of the first software package of the first version and the release time of the first software package of the latest version according to the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag, where the first tag corresponds to the version number of the first software package of the first version, and the second tag corresponds to the version number of the first software package of the latest version.
[0078] Please refer to Figure 4 , which shows a flowchart of a tag processing method provided by an embodiment of the present application. In this method, after sorting the version numbers and calculating the number of version releases of the first software package from the first version to the latest version, it is also necessary to obtain the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag from the identifiers of the commit information corresponding to each tag.
[0079] Exemplarily, the tag v1.1 in the above example is the first tag, and the tag v1.4 is the second tag. The release time of the first software package of the first version and the release time of the first software package of the latest version can be obtained according to the identifier b of the commit information corresponding to the tag v1.1 and the identifier e of the commit information corresponding to the tag v1.4.
[0080] In some embodiments, sub-step 248 includes at least one of the following steps:
[0081] 1. Add the upstream repository of the first software package as a remote repository of the local repository.
[0082] The local repository refers to a repository set in the computer device where each step of this solution is executed. Users can directly query and manage the content in the local repository without going through the network.
[0083] In some embodiments, a local empty repository can be established as the above local repository. In some embodiments, a local repository that already stores commit information can also be directly used, and the present application does not make any limitations on this.
[0084] Exemplarily, please refer to Figure 5 , which shows a flowchart of a version release time query method provided by an embodiment of the present application. In this example, a local Git empty repository can be established through the git init (Git initialization) command. The upstream repository of the first software package can be added as a remote repository of the local repository based on the address (such as URL) of the upstream repository of the first software package through the git remote add origin (Git remote add source) command.
[0085] 2. Based on the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag, synchronize the commit information corresponding to the first tag and the commit information corresponding to the second tag from the remote repository to the local repository.
[0086] In some embodiments, based on the identifier of the commit information corresponding to the first tag (or the second tag), it can be determined whether the commit information corresponding to the first tag has been synchronized to the local repository. And, in the case of non-synchronization, based on the identifier of the commit information corresponding to the first tag (or the second tag), synchronize the commit information corresponding to the first tag (or the second tag) from the remote repository to the local repository.
[0087] Exemplarily, please refer to Figure 5 . In this example, through the git cat-file -e command, based on the identifier of the commit information (commit id), it can be checked whether the corresponding commit information already exists in the local Git repository. In the case where the corresponding commit information (such as the commit information corresponding to the first tag or the second tag) does not exist in the local repository, through the git fetch origin (Git fetch source) command, based on the identifier of the commit information, synchronize the corresponding commit information from the remote repository to the local repository.
[0088] 3. In the local repository, query the release time of the first software package of the first version and the release time of the first software package of the latest version.
[0089] In some embodiments, in the local repository, according to the identifier of the commit information corresponding to the first tag, query the modification time of the first software package in the commit information corresponding to the first tag, and use this modification time as the release time of the first software package of the first version.
[0090] In some embodiments, in the local repository, according to the identifier of the commit information corresponding to the second tag, query the modification time of the first software package in the commit information corresponding to the second tag, and use this modification time as the release time of the first software package of the latest version.
[0091] Exemplarily, please refer to Figure 5, in this example, through the git show-s instruction, based on the identifier (commit id) of the commit information corresponding to the first tag, the release time of this commit can be queried, and the release time of this commit can be used as the release time of the first software package of the first version.
[0092] The above method only synchronizes the commit information corresponding to the first tag and the commit information corresponding to the second tag to the local repository to obtain the release time of the first software package of the first version and the release time of the first software package of the latest version. While realizing the local query of the release time information of the first software package, it avoids cloning the complete upstream repository and improves the query efficiency.
[0093] Sub-step 252, determine whether to update the first software package in the software package set according to the version difference, the release time of the first software package of the first version, and the release time of the first software package of the latest version.
[0094] The above method utilizes the mapping relationship of the three elements of "version number - tag - identifier of commit information" to determine the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag, and then the release time of the first software package of the first version and the release time of the first software package of the latest version can be obtained separately, reducing information redundancy. Moreover, by combining the version difference and the above release time, it is possible to more reasonably evaluate whether to update the first software package in the software package set.
[0095] In some embodiments, when the first condition is met, the first software package in the software package set is updated.
[0096] The first condition includes at least one of the following: the version difference is greater than the first threshold, the time interval between the release time of the first software package of the first version and the release time of the first software package of the latest version is greater than the second threshold, the release frequency is greater than the third threshold, and the release frequency is determined based on the version difference and the above time interval.
[0097] The version difference is greater than the first threshold, which indicates that the version difference between the first version and the latest version is large and needs to be updated. Exemplarily, the first threshold can be set to 3, 5, 10, etc., and the present application does not limit this.
[0098] The above time interval is greater than the second threshold, which indicates that the first software package in the software package set has stayed in the old version for a long time and needs to be updated. Exemplarily, the second threshold can be set to 7 days, 1 month, half a year, etc., and the present application does not limit this.
[0099] In some embodiments, the version difference can be divided by the above time interval to obtain the release frequency. If the release frequency is greater than a third threshold, it indicates that the first software package is still being updated relatively frequently after being updated to the first version. Therefore, it is necessary to update the first software package in the software package set.
[0100] Through the above method, the software packages in the software package set can be selectively updated, that is, when the version difference between the first version and the latest version is large, the first version is relatively old, and the release frequency is fast, the software package is updated.
[0101] In some embodiments, when it is necessary to update the first software package in the software package set, obtain the first software package of the latest version, and update the release configuration file of the first software package. The release configuration file of the first software package is used to configure the packaging and installation process of the first software package.
[0102] The developer of the first software package will upload the source code of the first software package to the upstream repository. Therefore, the source code of the first software package can be obtained from the upstream repository of the first software package. By packaging and releasing the source code of the first software package, the first software package in the distribution software package set (i.e., the first distribution software package) can be obtained. Users can download the first distribution software package from the repository of the software package set.
[0103] In some embodiments, obtain the first software package of the latest version from the upstream repository. In some embodiments, obtain the tarball file of the first software package of the latest version from the upstream repository of the first software package (the tarball file includes the source code of the first software package of the latest version), and update the release configuration file of the first software package (such as the spec file). Then, according to the spec file of the first software package, package the above tarball file to obtain the first software package of the distribution version, and upload the first software package of the distribution version to the repository of the software package set, that is, the update work of the first software package in the software package set is completed. In some embodiments, users can download the first software package of the distribution version from the repository of the software package set, and install the first software package of the distribution version according to the spec file of the first software package.
[0104] Each software package in the software package set has a corresponding release configuration file. When the upstream updates the source code, the distributor of the software package set needs to be aware of it in a timely manner and follow up the release of the new version, that is, upload the packaged software package of the latest version to the repository of the software package set in a timely manner, and update the release configuration file of the software package.
[0105] By the above method, the latest version of the first software package is obtained, and the packaging configuration file of the first software package is updated. This can ensure that after the first software package in the software package collection is updated, the first software package can still be normally packaged and installed, meeting the distribution requirements of the software package collection.
[0106] In some embodiments, every set time period, the steps start from obtaining the identification information of the first software package in the software package collection of the distribution version.
[0107] Exemplarily, the set time can be 3 days, 7 days, 1 month, etc., and the present application does not limit this.
[0108] That is to say, for the first software package in the software package collection, it can be set to periodically query whether an update is needed. Further, the remaining software packages in the software package collection can also periodically query whether an update is needed through the above method.
[0109] By integrating the relevant steps of the update query into the CI (Continuous Integration) process of the software package collection through the above method, when there is an update in the upstream repositories of thousands of software packages maintained by the software package collection of the distribution version, the corresponding version information can be obtained, realizing regular automatic synchronization and tracking, and significantly improving the maintenance efficiency of the software package collection of the distribution version.
[0110] The technical solution provided by the embodiments of the present application obtains the identification information of the first software package in the software package collection of the distribution version. Then, according to the identification information of the first software package, the version number of the first software package of the first version is obtained, where the first version refers to the version of the first software package in the software package collection. And based on the address of the upstream repository of the first software package, the upstream repository of the first software package is remotely accessed to obtain the tags corresponding to each version of the first software package and the identification of the commit information corresponding to each tag. Then, according to the version number of the first software package of the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each tag, it is determined whether to update the first software package in the software package collection. It realizes evaluating whether to update the software package in the software package collection by remotely accessing the upstream repository, avoiding cloning the entire upstream repository, which is relatively efficient.
[0111] Please refer to Figure 6 , which shows the flowchart of the overall solution of the software package update method provided by an embodiment of the present application. This solution includes at least one of the following steps.
[0112] 1. Obtain the identification information of the software package to be queried (for example, the name of the software package to be queried can be input. Here, it is described by taking the software package to be queried as the first software package as an example).
[0113] 2. Query the version number of the first software package (i.e., the first software package of the first version) in the software package collection (for example, it can be queried by accessing the repository of the software package collection).
[0114] 3. Parse the configuration file corresponding to the first software package to obtain the address of the upstream repository of the first software package (technicians can deploy the corresponding configuration files for each software package in the software package collection in advance).
[0115] 4. Based on the address of the upstream repository of the first software package, access the upstream repository of the first software package (for example, the upstream repository can be a Git repository).
[0116] 5. In the upstream repository, remotely query the tags corresponding to each version of the first software package and the identifiers of the commit information corresponding to each tag (the commit id corresponding to the tag).
[0117] 6. Map the tags corresponding to each version of the first software package to version numbers.
[0118] 7. Sort the above version numbers to obtain the version number of the latest version of the first software package.
[0119] 8. Query the release times of the first software package of the first version and the latest version, and the release frequency of the versions between the first version and the latest version.
[0120] 9. Based on the release times of the first software package of the first version and the latest version, and the release frequency, evaluate whether it is necessary to update the first software package in the software package collection (for example, when the release times of the first version and the latest version are quite different and the release frequency is fast, it is determined that it is necessary to update the first software package in the software package collection).
[0121] 10. In the case where it is necessary to update the first software package in the software package collection, obtain the source code of the latest version of the first software package (such as a tarball file), and modify the release configuration file of the first software package (for example, the release configuration file of the first software package can be a spec file).
[0122] In addition, it should be noted that the technical solution provided in the embodiments of the present application can be implemented based on relevant tools or plugins. For example, for Figure 3A version information query tool for the software packages shown, which can be correspondingly deployed with configuration files of each software package, and supports single-package single query (for example, separately querying the version information of the first software package), single-batch query (querying the version information of multiple software packages at a time), and pipeline cycle query (querying the version information of software packages at a set time interval). This tool can access both the repository of the software package set and the upstream repository of the software packages in the software package set, and can query the version information (such as release time) of the software packages (current version) in the software package set and the version information (such as release time) of the latest version of the software packages locally.
[0123] Exemplarily, please refer to Figure 7 , which shows a schematic diagram of the display interface of the version information query tool for software packages provided by an embodiment of the present application. It can be seen that this tool can remotely obtain the tags corresponding to each version of the software package according to the identification information of the software package and the address of the upstream repository of the software package, and sort the above tags after processing them into version numbers. Then, it outputs the version number of the software packages in the software package set (the version number of the current version of the software package), the version number of the latest version of the software packages, the version release time of the software packages in the software package set (the current version release time), the release time of the latest version of the software packages (the latest version release time), and the number of versions between the latest version and the current version. Finally, according to the above version number of the current version of the software package, the version number of the latest version of the software packages, the current version release time, the latest version release time, and the number of different versions, it is determined whether the software packages in the release version of the software package set need to follow up the upstream updates.
[0124] The following is an embodiment of the device of the present application, which can be used to execute the method embodiment of the present application. For the details not disclosed in the device embodiment of the present application, please refer to the method embodiment of the present application.
[0125] Please refer to Figure 8 , which shows a block diagram of the software package update device provided by an embodiment of the present application. This device has the function of implementing the above software package update method, and this function can be implemented by hardware or by hardware executing corresponding software. This device can be a computer device or can be set in a computer device. The device 800 may include: an acquisition module 810, a remote access module 820, and a determination module 830.
[0126] The acquisition module 810 is configured to acquire the identification information of the first software package in the release version of the software package set, where the software package set includes at least one software package, and the identification information of the software package is used to distinguish different software packages.
[0127] The obtaining module 810 is further configured to obtain the version number of the first software package in the first version according to the identification information of the first software package, where the first version refers to the version of the first software package in the software package set, and the version number is used to distinguish the release order of each version of the first software package.
[0128] The remote access module 820 is configured to remotely access the upstream repository of the first software package based on the address of the upstream repository of the first software package, and obtain the tags corresponding to each version of the first software package and the identification of the commit information corresponding to each tag; wherein, the upstream repository of the first software package includes the tags corresponding to each version of the first software package and the commit information corresponding to each tag, the tags are used to distinguish different versions of the first software package, the commit information is used to record the modifications made to the first software package, and the identification of the commit information is used to distinguish different modifications made to the first software package.
[0129] The determination module 830 is configured to determine whether to update the first software package in the software package set according to the version number of the first software package in the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each tag.
[0130] In some embodiments, the determination module 830 includes: a tag processing sub-module, an obtaining sub-module, and an updating sub-module.
[0131] The tag processing sub-module is configured to perform standardization processing on the tags corresponding to each version of the first software package to obtain the version numbers corresponding to each version of the first software package. Sort the version numbers corresponding to each version of the first software package according to the release order to determine the version number of the first software package in the latest version. Determine the version difference between the first software package in the first version and the first software package in the latest version according to the number of version numbers between the version number of the first software package in the first version and the version number of the first software package in the latest version.
[0132] The obtaining sub-module is configured to obtain the release time of the first software package in the first version and the release time of the first software package in the latest version according to the identification of the commit information corresponding to the first tag and the identification of the commit information corresponding to the second tag, where the first tag corresponds to the version number of the first software package in the first version, and the second tag corresponds to the version number of the first software package in the latest version.
[0133] An update sub-module, configured to determine whether to update the first software package in the software package set according to the version difference, the release time of the first software package of the first version, and the release time of the first software package of the latest version.
[0134] In some embodiments, an update sub-module is configured to update the first software package in the software package set when a first condition is met. The first condition includes at least one of the following: the version difference is greater than a first threshold, the time interval between the release time of the first software package of the first version and the release time of the first software package of the latest version is greater than a second threshold, and the release frequency is greater than a third threshold, where the release frequency is determined based on the version difference and the time interval.
[0135] In some embodiments, an acquisition sub-module is configured to add the upstream repository of the first software package as a remote repository of the local repository. Based on the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag, synchronize the commit information corresponding to the first tag and the commit information corresponding to the second tag from the remote repository to the local repository. In the local repository, query the release time of the first software package of the first version and the release time of the first software package of the latest version.
[0136] In some embodiments, the acquisition module 810 is further configured to parse the configuration file corresponding to the first software package to obtain the address of the upstream repository of the first software package. Each software package in the software package set has a corresponding configuration file, and the configuration file corresponding to the software package is used to indicate the address of the upstream repository of the software package.
[0137] In some embodiments, the determination module 830 is further configured to, when it is necessary to update the first software package in the software package set, obtain the first software package of the latest version and update the release configuration file of the first software package, where the release configuration file of the first software package is used to configure the packaging and installation process of the first software package.
[0138] In some embodiments, the apparatus 800 further includes: a loop execution module ( Figure 8 not shown in the figure).
[0139] The loop execution module is configured to execute from the step of obtaining the identification information of the first software package in the software package set of the release version at each set time interval.
[0140] It should be noted that, when the device provided in the above embodiments realizes its functions, only the division of the above function modules is used for illustration. In practical applications, the above functions can be allocated to different function modules according to needs, that is, the internal structure of the device is divided into different function modules to complete all or part of the functions described above. In addition, the device provided in the above embodiments and the method embodiments belong to the same concept. For the specific implementation process, please refer to the method embodiments and will not be elaborated here.
[0141] Please refer to Figure 9 , which exemplarily shows the structural block diagram of a computer device provided in an embodiment of the present application.
[0142] Generally, the computer device 900 includes: a processor 901 and a memory 902.
[0143] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may further include an AI processor, and the AI processor is used to process computational operations related to machine learning.
[0144] The memory 902 may include one or more computer-readable storage media, and the computer-readable storage media may be tangible and non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 stores a computer program, and the computer program is loaded and executed by the processor 901 to implement the above software package update method.
[0145] Those skilled in the art can understand, Figure 9The structure shown does not constitute a limitation on the computer device 900, and may include more or fewer components than shown, or combine certain components, or adopt a different component arrangement.
[0146] In some embodiments, a computer-readable storage medium is also provided. A computer program is stored in the storage medium and is loaded and executed by a processor to implement the above software package update method.
[0147] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical discs, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0148] In some embodiments, a computer program product is also provided. The computer program product includes a computer program. The computer program is stored in a computer-readable storage medium, and the processor reads and executes the computer program from the computer-readable storage medium to implement the above software package update method.
[0149] It should be understood that "a plurality" as mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the numbered order. For example, two steps with different numbers are executed simultaneously, or two steps with different numbers are executed in the reverse order of the illustration. The embodiments of the present application do not limit this.
[0150] The above are only exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.
Claims
1. A method for updating a software package, characterized in that, The method includes: Obtaining the identification information of a first software package in a software package set of a distribution, where the software package set includes at least one software package, and the identification information of the software package is used to distinguish different software packages; According to the identification information of the first software package, obtaining the version number of the first software package of a first version, where the first version refers to the version of the first software package in the software package set, and the version number is used to distinguish the release order of each version of the first software package; Based on the address of the upstream repository of the first software package, remotely accessing the upstream repository of the first software package to obtain the tags corresponding to each version of the first software package and the identification of the commit information corresponding to each of the tags; where the upstream repository of the first software package includes the tags corresponding to each version of the first software package and the commit information corresponding to each of the tags, the tags are used to distinguish different versions of the first software package, the commit information is used to record the modifications made to the first software package, and the identification of the commit information is used to distinguish different modifications made to the first software package; Determining whether to update the first software package in the software package set according to the version number of the first software package of the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each of the tags.
2. The method according to claim 1, wherein The determining whether to update the first software package in the software package set according to the version number of the first software package of the first version, the tags corresponding to each version of the first software package, and the identification of the commit information corresponding to each of the tags includes: Performing normalization processing on the tags corresponding to each version of the first software package to obtain the version numbers corresponding to each version of the first software package; Sorting the version numbers corresponding to each version of the first software package in the release order to determine the version number of the latest version of the first software package; According to the number of version numbers between the version number of the first software package of the first version and the version number of the latest version of the first software package, determining the version difference between the first software package of the first version and the latest version of the first software package; Obtaining the release time of the first software package of the first version and the release time of the latest version of the first software package according to the identification of the commit information corresponding to the first tag and the identification of the commit information corresponding to the second tag, where the first tag corresponds to the version number of the first software package of the first version, and the second tag corresponds to the version number of the latest version of the first software package; Determining whether to update the first software package in the software package set according to the version difference, the release time of the first software package of the first version, and the release time of the latest version of the first software package.
3. The method according to claim 2, wherein The determining whether to update the first software package in the software package set according to the version difference, the release time of the first software package of the first version, and the release time of the latest version of the first software package includes: When the first condition is met, update the first software package in the software package set; Among them, the first condition includes at least one of the following: the version difference is greater than the first threshold, the time interval between the release time of the first software package of the first version and the release time of the first software package of the latest version is greater than the second threshold, and the release frequency is greater than the third threshold, and the release frequency is determined based on the version difference and the time interval.
4. The method according to claim 2, wherein The obtaining of the release time of the first software package of the first version and the release time of the first software package of the latest version according to the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag includes: Add the upstream repository of the first software package as a remote repository of the local repository; Based on the identifier of the commit information corresponding to the first tag and the identifier of the commit information corresponding to the second tag, synchronize the commit information corresponding to the first tag and the commit information corresponding to the second tag from the remote repository to the local repository; In the local repository, query the release time of the first software package of the first version and the release time of the first software package of the latest version.
5. The method according to claim 1, characterized in that, Before remotely accessing the upstream repository of the first software package based on the address of the upstream repository of the first software package, it further includes: Parse the configuration file corresponding to the first software package to obtain the address of the upstream repository of the first software package; among them, each software package in the software package set has a corresponding configuration file, and the configuration file corresponding to the software package is used to indicate the address of the upstream repository of the software package.
6. The method according to claim 1, characterized in that The method further includes: When it is necessary to update the first software package in the software package set, obtain the first software package of the latest version and update the release configuration file of the first software package, and the release configuration file of the first software package is used to configure the packaging and installation process of the first software package.
7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: Every set time period, start executing from the step of obtaining the identifier information of the first software package in the software package set of the distribution.
8. An update device for a software package, characterized in that, The device includes: An obtaining module, configured to obtain the identifier information of the first software package in the software package set of the distribution, where the software package set includes at least one software package, and the identifier information of the software package is used to distinguish different software packages; The obtaining module is further configured to obtain the version number of the first software package of the first version according to the identifier information of the first software package, where the first version refers to the version of the first software package in the software package set, and the version number is used to distinguish the release order of each version of the first software package. A remote access module, configured to remotely access the upstream repository of the first software package based on the address of the upstream repository of the first software package, and obtain the tags corresponding to the respective versions of the first software package and the identifiers of the commit information corresponding to the respective tags; wherein, the upstream repository of the first software package includes the tags corresponding to the respective versions of the first software package and the commit information corresponding to the respective tags, the tags are used to distinguish different versions of the first software package, the commit information is used to record the modifications made to the first software package, and the identifier of the commit information is used to distinguish different modifications made to the first software package; A determination module, configured to determine whether to update the first software package in the software package set according to the version number of the first software package of the first version, the tags corresponding to the respective versions of the first software package, and the identifiers of the commit information corresponding to the respective tags.
9. A computer device, characterized in that, The computer device includes a processor and a memory, and a computer program is stored in the memory. The computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 7 above.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the method according to any one of claims 1 to 7 above.
11. A computer program product, characterized in that, The computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, and the processor reads and executes the computer program from the computer-readable storage medium to implement the method according to any one of claims 1 to 7 above.