Queue-based software package quick copying method and device
Through the queue-based fast copying method, the problem of slow copying speed of larger software packages in the prior art is solved, efficient software package copying is achieved, management process is simplified, and system security and storage efficiency are improved.
Patent Information
- Application Number
- CN202311447588.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-05-06
AI Technical Summary
The prior art is slower when copying larger software packages, and cannot effectively improve the copy efficiency of larger software packages.
The queue-based software package quick copy method is adopted. By obtaining the software packages to be updated in the local computer, creating a mount server, using network access to obtain accessed software packages, mounting the shared directory to the local computer, transmitting the software packages to be updated to the shared directory, identifying the shared directory path, building configuration files, filtering and deleting redundant files, creating queues to be copied and copied, until the software package does not exist in the queue to be copied, and completing the quick copy.
It improves the copy efficiency of larger software packages, simplifies the management and distribution process of software packages, enhances the security and storage efficiency of the system, and reduces network traffic and time costs.
Smart Images

Figure CN119938084A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of queue copy software development, and in particular to a queue-based software package fast copy method and device. Background Art
[0002] The method of quickly copying a software package is a process of quickly copying a software package to another location or device in a computer system. The process can be completed in a variety of ways and can solve the problem of duplicate files appearing during file copying, resulting in files being overwritten or replaced, so that the intelligent copy transfer process can automatically delete or roll back the overwritten or duplicate files.
[0003] At present, there is a method for quickly copying a software package. After scanning the program to be installed, it is divided into a software program folder, a cache folder, and a junk file, and then copied and mounted to the drive letters of different software disks respectively. When installing the software, the corresponding installation package is directly decompressed to obtain a virtual disk file and mount it to the drive letter of the installed machine; a soft link is created between the source folder directory, the cache folder directory, and the parent directory corresponding to the junk file, and a mapping relationship is established to realize the quick copying of the software package. Since the above method has a slow copying speed for slightly larger software installation packages, a method for quickly copying software packages based on queues is needed to improve the copying efficiency of larger software packages. Summary of the invention
[0004] In view of the above problems, an embodiment of the present invention provides a method and device for quickly copying a software package based on a queue.
[0005] In a first aspect, an embodiment of the present invention provides a method for quickly copying a software package based on a queue, comprising:
[0006] Obtaining a software package to be updated in a local computer, creating a mount server corresponding to the software package to be updated, using the local computer to perform network access to the mount server to obtain an access software package, mounting a shared directory in the access software package to the local computer, transferring the software package to be updated to the shared directory in the local computer, obtaining a mounted shared directory, and identifying a shared directory path corresponding to the mounted shared directory;
[0007] Based on the shared directory path, construct a configuration file corresponding to the local computer, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter;
[0008] Based on the file path, query the target directory in the mounting server, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine;
[0009] Checking the software package statuses corresponding to the software package to be updated and the access software package in the target path, identifying the development version files and the release version files of the software package to be updated and the access software package, creating a to-be-copied queue corresponding to the software package to be updated and a copied queue corresponding to the access software package based on the development version files and the release version files, extracting a new software package from the to-be-copied queue, transmitting the new software package to the target location corresponding to the server end in the user's local computer, and updating the new software package to the copied queue after the transmission is completed;
[0010] Until the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed.
[0011] According to an embodiment of the present invention, the method of using the local computer to perform network access to the mounting server to obtain an access software package includes:
[0012] Querying the network communication status of the local computer;
[0013] Based on the network communication status, sending an http request to the mounting server;
[0014] After the mounting server receives the http request, the mounting server is used to send a response software package back to the local computer, wherein the response software package can be used as an access software package corresponding to the mounting server.
[0015] According to an embodiment of the present invention, in the local computer, transferring the software package to be updated to the shared directory to obtain a mounted shared directory includes:
[0016] Identifying a storage path of the software package to be updated in the local computer;
[0017] Based on the storage path, determining a transmission protocol corresponding to the shared directory;
[0018] Query the mount instruction in the transmission protocol;
[0019] The shared directory is mounted to a local directory in the local system using the mount instruction, and the local directory is used as the mounted shared directory corresponding to the software package to be updated.
[0020] According to an embodiment of the present invention, querying the file path of the configuration file using an exclusion parameter based on the filtering rule and the deletion rule includes:
[0021] identifying filtering parameters and exclusion parameters in the filtering rule and the deletion rule;
[0022] Filtering the configuration file using the filtering parameter to obtain a file list corresponding to the configuration file;
[0023] The file list is queried using the exclusion parameter to obtain the file path of the configuration file.
[0024] According to an embodiment of the present invention, querying the target directory in the mount server based on the file path and identifying redundant files in the target directory includes:
[0025] Query the directory level of the file path in the file system;
[0026] Sorting the subdirectories in the directory hierarchy to obtain directory serial numbers of the subdirectories;
[0027] Based on the directory serial number, extract the directory file in the target directory;
[0028] Calculating the file similarity of the directory files;
[0029] Based on the file similarities, redundant files in the target directory are identified.
[0030] According to an embodiment of the present invention, the calculating the file similarity of the directory files includes:
[0031] The file similarity of the directory files is calculated using the following formula:
[0032]
[0033] Wherein, Dx represents the file similarity of the directory file, Wi represents the weight of the i-th file corresponding to the directory file, Di represents the difference between the i-th file corresponding to the directory file and other files, MaxDi represents the maximum difference between all files, and i represents the file index in the directory file.
[0034] According to an embodiment of the present invention, the step of creating a queue to be copied corresponding to the software package to be updated and a queue to be copied corresponding to the access software package based on the development version file and the release version file includes:
[0035] Read the configuration files corresponding to the development version file and the release version file;
[0036] Identify the folder directory corresponding to the configuration file, and delete the parameter specifying file corresponding to the configuration file;
[0037] Traverse the specified type of files in the remaining configuration files to get the remaining folders;
[0038] Based on the folder directory, traverse the first-level directory corresponding to the configuration file;
[0039] Based on the first-level directory, scan and determine whether the file type is a folder;
[0040] If the file type is a folder, the remaining folders are deleted, and a folder with the same name is created under the relative path corresponding to the folder to obtain a queue to be copied;
[0041] If the file type is not a folder, the current file is copied to the relative path corresponding to the file type to obtain a copied queue.
[0042] In a second aspect, an embodiment of the present invention provides a queue-based software package fast copying device, characterized in that it includes:
[0043] A directory identification device is used to obtain a software package to be updated in a local computer, create a mounting server corresponding to the software package to be updated, use the local computer to perform network access to the mounting server to obtain an access software package, mount a shared directory in the access software package to the local computer, transfer the software package to be updated to the shared directory in the local computer, obtain a mounted shared directory, and identify a shared directory path corresponding to the mounted shared directory;
[0044] A path query tool, used to construct a configuration file corresponding to the local computer based on the shared directory path, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter;
[0045] A file transfer module is used to query the target directory in the mounting server based on the file path, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine;
[0046] a queue calculation module, configured to check the software package status corresponding to the to-be-updated software package and the access software package in the target path, identify the development version files and the release version files of the to-be-updated software package and the access software package, create a to-be-copied queue corresponding to the to-be-updated software package and a copied queue corresponding to the access software package based on the development version files and the release version files, extract a new software package from the to-be-copied queue, transmit the new software package to the target location corresponding to the server end in the user's local computer, and update the new software package to the copied queue after the transmission is completed;
[0047] The copy completion module is used to complete the fast copy of the software package to be updated until the software package does not exist in the queue to be copied.
[0048] In a third aspect, an embodiment of the present invention provides an electronic device, comprising:
[0049] processor;
[0050] a memory for storing instructions executable by the processor;
[0051] The processor is configured to execute the instructions to implement a queue-based fast software package copy method as described in the first aspect.
[0052] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a queue-based software package fast copying method as described in the first aspect.
[0053] Compared with the prior art, the above technical solution of the present invention has the following beneficial effects:
[0054] The embodiment of the present invention obtains the software package to be updated in the local computer and creates a mount server corresponding to the software package to be updated, so that security vulnerabilities and error repairs existing in the computer can be timely learned, which helps to improve the security of the system, reduce network traffic and time costs, and simplify the management and distribution process of the software package. Based on the shared directory path, a configuration file corresponding to the local computer is constructed, and the access rights and user groups of each shared directory can be specified in the configuration file to ensure that only authorized users can access and use the corresponding shared resources. Based on the file path, the target directory in the mount server is queried to identify redundant files in the target directory, which can help to release the occupied storage space in time and improve the storage efficiency of the server, so as to reduce the risk of data leakage, unauthorized access or abuse, thereby improving the response speed and overall performance of the system. Based on the target path, the development version files and development version files of the software package to be updated and the access software package are identified, which can help to understand the software package to be updated. The function of the software package can be realized, and important information and insights can be provided to help improve the security, stability and performance of the software. After the software package to be updated is updated to the queue to be copied, a new software package is extracted from the queue to be copied to ensure that each software package is correctly updated according to the update order and priority, avoiding confusion and conflict, thereby improving the update efficiency and accuracy. If there is a software package in the queue to be copied, the step of adding the software package to be updated to the queue to be copied is returned to effectively manage, track and accelerate the transmission process of the software package, thereby improving the reliability and maintenance efficiency of the system. If the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed, which can save time, improve efficiency, reduce risks, provide users with a better user experience, and ensure that the system is always in the latest and optimal state. Therefore, the queue-based software package fast copying method, device, electronic device and computer-readable storage medium proposed in the present invention can improve the copying efficiency of larger software packages. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 The flowchart of the method for quickly copying a software package based on a queue according to the first embodiment of the present invention is shown;
[0057] Figure 2The configuration file diagram corresponding to the local computer is shown in the first embodiment of the present invention;
[0058] Figure 3 A diagram showing a configuration file corresponding to the local computer and identifying a development version file and a release version file of the software package to be updated and the access software package in the first embodiment of the present invention is shown;
[0059] Figure 4 The functional module diagram of the queue-based software package rapid copying device of the third embodiment of the present invention is shown;
[0060] Figure 5 A schematic diagram of the structure of an electronic device for implementing the queue-based fast software package copy method according to the fifth embodiment of the present invention is shown. DETAILED DESCRIPTION
[0061] The present disclosure is further described below in conjunction with the embodiments shown in the accompanying drawings.
[0062] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0063] The method proposed in the present invention can realize a fast copy algorithm of a software package folder from a mounted server to a user's local directory. The present invention proposes a queue-based folder copy algorithm, which significantly improves the copy speed compared to a recursive copy algorithm. The user sets the folders and file types to be deleted and filtered through a configuration file, and only copies the folders necessary for the normal operation of the program, such as bin, lib, etc., to complete the copy from the server-side development version to the user's local release version. After the copy is completed, the software program can be directly started and run, which is more suitable for the situation where the software version is frequently updated and iterated during the development process, and reduces the situation of manual copying errors.
[0064] Embodiment 1
[0065] like Figure 1 As shown, the present invention proposes a queue-based software package fast copy method, comprising the following steps:
[0066] S1. Obtain a software package to be updated in a local computer, create a mount server corresponding to the software package to be updated, use the local computer to perform network access to the mount server to obtain an access software package, mount a shared directory in the access software package to the local computer, transfer the software package to be updated to the shared directory in the local computer, obtain a mounted shared directory, and identify a shared directory path corresponding to the mounted shared directory.
[0067] The present invention obtains the software package to be updated in the local computer and creates a mounting server corresponding to the software package to be updated, so that security vulnerabilities and error repairs existing in the computer can be timely learned, and at the same time it helps to improve the security of the system, reduce network traffic and time costs, and simplify the management and distribution process of the software package.
[0068] The software package to be updated refers to a software package whose updated version has been released in the local computer but has not yet been installed; the mounting server refers to a network storage device or server used to store the software package to be updated, and can be provided to other computers for downloading and installation through the network.
[0069] Optionally, the software package to be updated can be obtained through an automated deployment tool, such as Ansible, Chef, Puppet and other tools; the mounting server can be obtained through a distribution tool, such as Nginx, Apache and other tools.
[0070] The present invention uses the local computer to access the mounting server through the network to obtain the access software package, which helps to reduce the bandwidth and storage space of the local computer, and also reduces the problems of bandwidth consumption and data redundancy, so as to timely repair vulnerabilities, provide new functions or improve performance.
[0071] The accessing of the software package refers to accessing the mounting server through the network to obtain the software package file required by the user.
[0072] As an embodiment of the present invention, the method of using the local computer to perform network access to the mounting server to obtain an access software package includes: querying the network communication status of the local computer; sending an http request to the mounting server based on the network communication status; after the mounting server receives the http request, using the mounting server to send a response software package back to the local computer, wherein the response software package can be used as the access software package corresponding to the mounting server.
[0073] Among them, the network communication status refers to the connection status between the local computer and the network, including: whether connected, connection speed, connection stability and other states; the http request refers to an application layer protocol for transmitting data between the client and the server; the response software package refers to the return data of the mounting server to the client request, including: response status code, response header and response body and other contents.
[0074] Furthermore, the network communication status can be obtained by identifying network diagnostic tools, such as Ping, Traceroute, Netstat, etc.; the http request can be obtained by implementing a programming language, such as Python, Java, C#, etc.; the response software package can be obtained by implementing an HTTP server, such as Apache, Nginx, etc.
[0075] The present invention can conveniently realize resource sharing and file transfer by mounting the shared directory in the access software package to the local computer, so that the local computer can directly access and operate the files and data in the shared directory, improve work efficiency, and also reduce the cost of network transmission and data copying, avoid repeated downloading and transmission of the same files, and save network bandwidth and storage space.
[0076] The shared directory refers to a folder or directory that can be accessed and shared by multiple users or computers in a computer network. Optionally, the shared directory can be obtained through a file sharing tool, such as FTP, SMB, NFS and other tools.
[0077] Furthermore, in the local computer, the present invention transfers the software package to be updated to the shared directory to obtain a mounted shared directory, which can achieve convenient file sharing, save storage space and time costs, and keep synchronization with the software package in the shared directory, thereby improving work efficiency and data consistency.
[0078] Mounting a shared directory refers to connecting the remote shared directory to the file system of the local computer, so that the shared directory appears as a local directory on the local computer.
[0079] As an embodiment of the present invention, in the local computer, the software package to be updated is transferred to the shared directory to obtain a mounted shared directory, including: identifying the storage path of the software package to be updated in the local computer; determining the transmission protocol corresponding to the shared directory based on the storage path; querying the mount instruction in the transmission protocol; using the mount instruction to mount the shared directory to a local directory in the local system, and using the local directory as the mounted shared directory corresponding to the software package to be updated.
[0080] Among them, the storage path refers to the location of the software package to be updated; the transmission protocol refers to the protocol used for shared directory transmission and access, such as: SMB / CIFS, NFS, etc.; the mount instruction refers to the command to connect the shared directory to the specified directory of the local computer; the local directory refers to a directory created in the local system for mounting the shared directory.
[0081] Furthermore, the storage path can be obtained through path identification tools, such as NLTK, Spacy and other tools; the transmission protocol can be obtained through protocol identification tools, such as Wireshark, Nmap, P0f and other tools; the mount instruction can be obtained by querying instruction query tools, such as man, help, info, etc.; the local directory can be obtained by identifying directory identification tools, such as tree, du, WinDirStat and other tools.
[0082] The present invention helps to ensure correct configuration and setting of sharing permissions by identifying the shared directory path corresponding to the mounted shared directory, avoids unnecessary access restrictions or security holes, and can enhance the availability and manageability of file sharing.
[0083] The shared directory path refers to the location of the shared folder in the network. Optionally, the shared directory path can be obtained by identifying a command line tool, such as net use, mount, etc.
[0084] S2. Based on the shared directory path, construct a configuration file corresponding to the local computer, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter.
[0085] The present invention constructs a configuration file corresponding to the local computer based on the shared directory path, and can specify access rights and user groups for each shared directory in the configuration file, thereby ensuring that only authorized users can access and use the corresponding shared resources.
[0086] like Figure 2 As shown, wherein the configuration file refers to the Figure 2 The 'MetaData' file is used to store various configuration information of the program or system. The configuration file includes filtering rules and deletion rules. Optionally, the filtering rules refer to the Figure 2 The 'filter path' in the file selection and filtering rules; the deletion rules refer to the Figure 2 'delete path' deletes the specified file or folder during the build or packaging process.
[0087] Furthermore, the configuration file can be obtained through a file building tool, such as MaKe, Ant, Maven and other tools.
[0088] The present invention uses exclusion parameters to query the file path of the configuration file based on the filtering rule and the deletion rule, which can improve the accuracy and efficiency of the query, ensure that the acquired configuration file path is in line with expectations, prevent misoperation or unauthorized access, and ensure the consistency and integrity of the configuration file.
[0089] The exclusion parameter refers to a parameter used in the configuration file query; the file path refers to a specific location or path of the configuration file in the file system.
[0090] As an embodiment of the present invention, the method of querying the file path of the configuration file based on the filtering rule and the deletion rule using the exclusion parameter includes: identifying the filtering parameters and the exclusion parameters in the filtering rule and the deletion rule; filtering the configuration file using the filtering parameter to obtain a file list corresponding to the configuration file; and querying the file list using the exclusion parameter to obtain the file path of the configuration file.
[0091] Among them, the filtering parameters refer to the conditions used to filter files, such as: file extension, file size and creation date, etc.; the exclusion parameters refer to the conditions used to exclude specific files or directories, such as: excluding certain file extensions or specific folder paths, etc.; the file list refers to the set of files that meet the conditions filtered out according to the filtering parameters.
[0092] Furthermore, the filtering parameters can be obtained through Regex; the exclusion parameters can be obtained through NLP; the file list can be obtained through a file management tool, and the file management tool is compiled based on a programming language, such as Python, Java.
[0093] S3. Based on the file path, query the target directory in the mounting server, identify redundant files in the target directory, use the deletion code in the mounting server to delete the redundant files in the target directory, obtain the library file corresponding to the mounting server, transfer the library file to the preset user's local machine, and query the target path corresponding to the library file in the user's local machine.
[0094] The present invention queries the target directory in the mounting server based on the file path and identifies redundant files in the target directory, which can help to release the occupied storage space in time and improve the storage efficiency of the server, so as to reduce the risk of data leakage, unauthorized access or abuse, thereby improving the response speed and overall performance of the system.
[0095] The target directory refers to a specific folder or directory that needs to be queried and identified in the mounting server; the redundant files refer to files that are no longer used, are unnecessary, or have expired.
[0096] As an embodiment of the present invention, the method of querying the target directory in the mount server based on the file path and identifying redundant files in the target directory includes: querying the directory hierarchy of the file path in the file system; sorting the subdirectories in the directory hierarchy to obtain directory serial numbers of the subdirectories; extracting directory files in the target directory based on the directory serial numbers; calculating the file similarity of the directory files; and identifying redundant files in the target directory based on the file similarity.
[0097] Among them, the directory level refers to the depth or hierarchical structure of the file path in the file system; the subdirectory refers to the direct subdirectory under a given directory; the directory sequence number refers to the number after sorting the subdirectories; the directory file refers to the file in the target directory; the file similarity refers to an indicator for measuring the similarity between files.
[0098] Furthermore, the directory hierarchy can be obtained through directory structure visualization tools, such as TreeSize, WinDirStat, etc.; the directory serial number can be obtained through the sorted function; the directory file can be obtained through the listdir function; the file similarity can be calculated using the following formula.
[0099] As an embodiment of the present invention, the calculating the file similarity of the directory files includes:
[0100] The file similarity of the directory files is calculated using the following formula:
[0101]
[0102] Wherein, Dx represents the file similarity of the directory file, Wi represents the weight of the i-th file corresponding to the directory file, Di represents the difference between the i-th file corresponding to the directory file and other files, MaxDi represents the maximum difference between all files, and i represents the file index in the directory file.
[0103] The present invention uses the deletion code in the mounting server to delete the redundant files in the target directory to obtain the library files corresponding to the mounting server, thereby ensuring that the file system will not cause insufficient space due to too many useless files, and can optimize the performance of the file system and improve the reading and writing speed of files.
[0104] Among them, the deletion code refers to a program or script used to perform deletion operations on the mounted server; the library file refers to a precompiled code library used in software development. Optionally, the deletion code can be obtained through static code analysis tools, such as SonarQube, PMD, Checkstyle and other tools; the library file can be obtained by identifying file identification tools, such as File, TrID, DROID and other tools.
[0105] The present invention can simplify the deployment process, ensure version consistency, uniformly manage and update the library files, facilitate maintenance and support, and improve the efficiency and reliability of the software by transferring the library files to a preset user's local machine and querying the target path corresponding to the library files in the user's local machine.
[0106] Among them, the user's local machine refers to the final operating environment of the software or application, such as a personal computer, server, mobile device, etc.; the target path refers to the path of a specific directory or folder in the user's local machine where the library file is stored. Optionally, the target path can be obtained through IED.
[0107] S4, checking the software package status corresponding to the to-be-updated software package and the access software package in the target path, identifying the development version files and the release version files of the to-be-updated software package and the access software package, creating a to-be-copied queue corresponding to the to-be-updated software package and a copied queue corresponding to the access software package based on the development version files and the release version files, extracting a new software package from the to-be-copied queue, transmitting the new software package to the target location corresponding to the server end in the user's local computer, and updating the new software package to the copied queue after the transmission is completed.
[0108] The present invention can provide real-time software package information, simplify the update process, implement version control, ensure security and stability, and provide historical records and change logs by checking the software package status corresponding to the software package to be updated and the access software package in the target path, identifying the development version files and development version files of the software package to be updated and the access software package.
[0109] The software package status refers to the current status of the software package to be updated and the access software package in the target path; the development version file refers to the version file used in the development process of the software or application; and the release version file refers to the version file used when the software or application is officially released and deployed.
[0110] Furthermore, the development version file and the release version file can be obtained by compiling and building tools, such as Apache Maven, Gradle, or Ant.
[0111] like Figure 3 The present invention determines the version information and creates a to-be-copied queue corresponding to the software package to be updated and a copied queue corresponding to the access software package based on the development version file and the release version file, thereby improving software deployment efficiency, ensuring deployment consistency, supporting version control and rollback, and increasing reliability and security.
[0112] The queue to be copied refers to a list or data structure storing the software packages to be updated; the queue to be copied refers to a list or data structure storing the software packages that have been successfully copied.
[0113] As an embodiment of the present invention, the creation of a queue to be copied corresponding to the software package to be updated and a queue to be copied corresponding to the access software package based on the development version file and the release version file includes: reading the configuration files corresponding to the development version file and the release version file; identifying the folder directory corresponding to the configuration file, and deleting the parameter specified file corresponding to the configuration file; traversing the specified type files in the remaining configuration files to obtain the remaining folders; based on the folder directory, traversing the first-level directory corresponding to the configuration file; based on the first-level directory, scanning and determining whether the file type is a folder; if the file type is a folder, deleting the remaining folders, and creating a folder with the same name under the relative path corresponding to the folder to obtain a queue to be copied; if the file type is not a folder, copying the current file under the relative path corresponding to the file type to obtain a queue to be copied.
[0114] Among them, the configuration file refers to a file used to store software package configuration information, including: INI, XML, JSON, etc.; the folder directory refers to the path where the folder is stored; the remaining folder refers to the folder retained in the configuration file; the first-level directory refers to the first-level folder specified in the configuration file, that is, the first-level directory list listed in the configuration file.
[0115] Furthermore, the configuration file can be obtained through automated deployment tools, such as Ansible, Puppet, Chef and other tools; the folder directory can be obtained through file management tools, such as MacOS, Finder and other tools; the remaining folders can be obtained through string matching, regular expressions and other methods; the first-level directory can be obtained through the os module or pathlib library in Python.
[0116] The present invention extracts new software packages from the queue to be copied, so as to ensure that each software package is correctly updated according to the update sequence and priority, avoid confusion and conflict, and thus improve update efficiency and accuracy.
[0117] The new software package refers to the latest software package version that has not appeared in the queue to be copied. Optionally, the new software package can be obtained through a package manager, such as APT, Yum, Homebrew, etc.
[0118] The present invention helps to repair vulnerabilities in the software, improve functions or performance, keep the system synchronized with the latest technology trends, and provide better performance and stability by transmitting the new software package to the target location corresponding to the server side in the user's local machine.
[0119] The target location refers to a specific folder or path on the server side where the new software package is transferred to the user's local computer. Optionally, the target location can be identified and obtained through a resource manager, such as File Explore.
[0120] In the present invention, after the transmission is completed, the new software package is updated to the copied queue, which can facilitate subsequent operations and tracking, as well as tasks such as backup and version control, and can also ensure the accuracy and reliability of transmission, and effectively manage the deployment and update process of the software package.
[0121] The transmission completion refers to the process of successfully copying or moving the new software package from the source location to the target location. Optionally, the checking whether the transmission is completed can be achieved by a software package identification tool, such as File, Binwalk, Trid and other tools.
[0122] S7: until the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed.
[0123] In the present invention, until the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed, which can save time, improve efficiency, reduce risks, provide users with a better usage experience, and ensure that the system is always in the latest and optimal state.
[0124] Furthermore, in the above process of the present invention, firstly, since the software package does not exist in the queue to be copied, the system can start the copy operation immediately without waiting for the completion of other tasks; secondly, fast copying can improve work efficiency and productivity, save human resources, and allow users to obtain updated software packages as soon as possible; in addition, fast copying can also reduce the idle time of the system, making the software package update process smoother and more seamless, and reducing the occurrence of potential problems and errors in the update process.
[0125] Embodiment 2
[0126] In order to understand the present invention more clearly, a second embodiment is used below to further explain the situation in which the target directory in the mounting server is queried and redundant files in the target directory are identified in the embodiment of the present invention.
[0127] The present invention provides a method for quickly copying a software package based on a queue, comprising the following steps:
[0128] The present invention queries the target directory in the mounting server based on the file path and identifies redundant files in the target directory, which can help to release the occupied storage space in time and improve the storage efficiency of the server, so as to reduce the risk of data leakage, unauthorized access or abuse, thereby improving the response speed and overall performance of the system.
[0129] The target directory refers to a specific folder or directory that needs to be queried and identified in the mounting server; the redundant files refer to files that are no longer used, are unnecessary, or have expired.
[0130] As an embodiment of the present invention, the method of querying the target directory in the mount server based on the file path and identifying redundant files in the target directory includes: querying the directory hierarchy of the file path in the file system; sorting the subdirectories in the directory hierarchy to obtain directory serial numbers of the subdirectories; extracting directory files in the target directory based on the directory serial numbers; calculating the file similarity of the directory files; and identifying redundant files in the target directory based on the file similarity.
[0131] Among them, the directory level refers to the depth or hierarchical structure of the file path in the file system; the subdirectory refers to the direct subdirectory under a given directory; the directory sequence number refers to the number after sorting the subdirectories; the directory file refers to the file in the target directory; the file similarity refers to an indicator for measuring the similarity between files.
[0132] Furthermore, the directory hierarchy can be obtained through directory structure visualization tools, such as TreeSize, WinDirStat, etc.; the directory serial number can be obtained through the sorted function; the directory file can be obtained through the listdir function; the file similarity can be calculated using the following formula.
[0133] As an embodiment of the present invention, the calculating the file similarity of the directory files includes:
[0134] The file similarity of the directory files is calculated using the following formula:
[0135]
[0136] Wherein, Dx represents the file similarity of the directory file, Wi represents the weight of the i-th file corresponding to the directory file, Di represents the difference between the i-th file corresponding to the directory file and other files, MaxDi represents the maximum difference between all files, and i represents the file index in the directory file.
[0137] The present invention uses the deletion code in the mounting server to delete the redundant files in the target directory to obtain the library files corresponding to the mounting server, thereby ensuring that the file system will not cause insufficient space due to too many useless files, and can optimize the performance of the file system and improve the reading and writing speed of files.
[0138] Among them, the deletion code refers to a program or script used to perform deletion operations on the mounted server; the library file refers to a precompiled code library used in software development. Optionally, the deletion code can be obtained through static code analysis tools, such as SonarQube, PMD, Checkstyle and other tools; the library file can be obtained by identifying file identification tools, such as File, TrID, DROID and other tools.
[0139] Embodiment 3
[0140] like Figure 4 As shown, this embodiment also provides a functional module diagram of a queue-based software package fast copying device.
[0141] The queue-based software package fast copying device 100 described in this embodiment can be installed in an electronic device. According to the functions to be implemented, the queue-based software package fast copying device 100 may include a directory identification device 101, a path query tool 102, a file transfer module 103, a queue calculation module 104, and a copy completion module 105. The module described in the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0142] In this embodiment, the functions of each module / unit are as follows:
[0143] The directory identification device 101 is used to obtain the software package to be updated in the local computer, create a mounting server corresponding to the software package to be updated, use the local computer to perform network access to the mounting server to obtain the access software package, mount the shared directory in the access software package to the local computer, transfer the software package to be updated to the shared directory in the local computer, obtain the mounted shared directory, and identify the shared directory path corresponding to the mounted shared directory;
[0144] The path query tool 102 is used to construct a configuration file corresponding to the local computer based on the shared directory path, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, the file path of the configuration file is queried using an exclusion parameter;
[0145] The file transfer module 103 is used to query the target directory in the mounting server based on the file path, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine;
[0146] The queue calculation module 104 is used to check the software package status corresponding to the to-be-updated software package and the access software package in the target path, identify the development version files and the release version files of the to-be-updated software package and the access software package, create a to-be-copied queue corresponding to the to-be-updated software package and a copied queue corresponding to the access software package based on the development version files and the release version files, extract a new software package from the to-be-copied queue, transfer the new software package to the target location corresponding to the server end in the user's local computer, and update the new software package to the copied queue after the transfer is completed;
[0147] The copy completion module 105 is used to complete the fast copy of the software package to be updated until the software package does not exist in the queue to be copied.
[0148] Embodiment 4
[0149] like Figure 5 As shown, this embodiment also provides a computer electronic device, which may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a product recommendation program based on user portraits.
[0150] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a product recommendation program based on user portraits, etc.), and calls the data stored in the memory 11 to execute various functions of the electronic device and process data.
[0151] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of a product recommendation program based on a user portrait, but can also be used to temporarily store data that has been output or is to be output.
[0152] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0153] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0154] The figure only shows an electronic device with components. Those skilled in the art will understand that the structure shown in the figure does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0155] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0156] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0157] The product recommendation program based on user portrait stored in the memory 11 of the electronic device is a combination of multiple instructions, and when running in the processor 10, it can achieve:
[0158] A method for quickly copying a software package based on a queue, characterized in that the method comprises:
[0159] Obtaining a software package to be updated in a local computer, creating a mount server corresponding to the software package to be updated, using the local computer to perform network access to the mount server to obtain an access software package, mounting a shared directory in the access software package to the local computer, transferring the software package to be updated to the shared directory in the local computer, obtaining a mounted shared directory, and identifying a shared directory path corresponding to the mounted shared directory;
[0160] Based on the shared directory path, construct a configuration file corresponding to the local computer, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter;
[0161] Based on the file path, query the target directory in the mounting server, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine;
[0162] Checking the software package statuses corresponding to the software package to be updated and the access software package in the target path, identifying the development version files and the release version files of the software package to be updated and the access software package, creating a to-be-copied queue corresponding to the software package to be updated and a copied queue corresponding to the access software package based on the development version files and the release version files, extracting a new software package from the to-be-copied queue, transmitting the new software package to the target location corresponding to the server end in the user's local computer, and updating the new software package to the copied queue after the transmission is completed;
[0163] Until the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed.
[0164] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.
[0165] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0166] Embodiment 5
[0167] This embodiment provides a storage medium storing a computer program. When the computer program is executed by a processor, the steps of the method for fast copying a software package based on a queue as described above are implemented.
[0168] These program codes can also be loaded onto a computer or other programmable data processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 The steps of a specified function in a process or multiple processes.
[0169] Storage media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, modules of programs or other data. Examples of storage media can include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0170] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. When the terms "include" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or their combinations.
[0171] It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or described herein.
[0172] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0173] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0174] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0175] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0176] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0177] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0178] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0179] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for quickly copying a software package based on a queue, characterized in that: The method comprises: Obtaining a software package to be updated in a local computer, creating a mount server corresponding to the software package to be updated, using the local computer to perform network access to the mount server to obtain an access software package, mounting a shared directory in the access software package to the local computer, transferring the software package to be updated to the shared directory in the local computer, obtaining a mounted shared directory, and identifying a shared directory path corresponding to the mounted shared directory; Based on the shared directory path, construct a configuration file corresponding to the local computer, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter; Based on the file path, query the target directory in the mounting server, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine; Check the software package status in the target path, identify the development version file and the release version file of the software package to be updated and the access software package, create a to-be-copied queue corresponding to the software package to be updated and a copied queue corresponding to the access software package based on the development version file and the release version file, extract a new software package from the to-be-copied queue, transfer the new software package to the target location corresponding to the server end in the user's local machine, and after the transfer is completed, update the new software package to the copied queue; Until the software package does not exist in the queue to be copied, the fast copying of the software package to be updated is completed.
2. The method for quickly copying software packages based on queues as claimed in claim 1, characterized in that: The method of using the local computer to perform network access to the mounting server to obtain an access software package includes: Querying the network communication status of the local computer; Based on the network communication status, sending an http request to the mounting server; After the mounting server receives the http request, the mounting server is used to send a response software package back to the local computer, wherein the response software package can be used as an access software package corresponding to the mounting server.
3. The method for quickly copying software packages based on queues as claimed in claim 2, characterized in that: The step of transferring the software package to be updated to the shared directory in the local computer to obtain a mounted shared directory includes: Identifying a storage path of the software package to be updated in the local computer; Based on the storage path, determining a transmission protocol corresponding to the shared directory; Query the mount instruction in the transmission protocol; The shared directory is mounted to a local directory in the local system using the mount instruction, and the local directory is used as the mounted shared directory corresponding to the software package to be updated.
4. The method for quickly copying a software package based on a queue as claimed in claim 2, characterized in that: The querying the file path of the configuration file using the exclusion parameter based on the filtering rule and the deletion rule includes: identifying filtering parameters and exclusion parameters in the filtering rule and the deletion rule; Filtering the configuration file using the filtering parameter to obtain a file list corresponding to the configuration file; The file list is queried using the exclusion parameter to obtain the file path of the configuration file.
5. The method for quickly copying software packages based on queues as claimed in claim 1, characterized in that: The querying of the target directory in the mount server based on the file path and identifying redundant files in the target directory includes: Query the directory level of the file path in the file system; Sorting the subdirectories in the directory hierarchy to obtain directory serial numbers of the subdirectories; Based on the directory serial number, extract the directory file in the target directory; Calculating the file similarity of the directory files; Based on the file similarities, redundant files in the target directory are identified.
6. The method for quickly copying software packages based on queues as claimed in claim 5, characterized in that: The calculating the file similarity of the directory files includes: The file similarity of the directory files is calculated using the following formula: Wherein, Dx represents the file similarity of the directory file, Wi represents the weight of the i-th file corresponding to the directory file, Di represents the difference between the i-th file corresponding to the directory file and other files, MaxDi represents the maximum difference between all files, and i represents the file index in the directory file.
7. The method for quickly copying a software package based on a queue as claimed in claim 1, characterized in that: The step of creating a to-be-copied queue corresponding to the to-be-updated software package and a copied queue corresponding to the accessed software package based on the development version file and the release version file includes: Read the configuration files corresponding to the development version file and the release version file; Identify the folder directory corresponding to the configuration file, and delete the parameter specifying file corresponding to the configuration file; Traverse the specified type of files in the remaining configuration files to get the remaining folders; Based on the folder directory, traverse the first-level directory corresponding to the configuration file; Based on the first-level directory, scan and determine whether the file type is a folder; If the file type is a folder, the remaining folders are deleted, and a folder with the same name is created under the relative path corresponding to the folder to obtain a queue to be copied; If the file type is not a folder, the current file is copied to the relative path corresponding to the file type to obtain a copied queue.
8. A queue-based software package fast copying device, characterized in that: The device comprises: A directory identification device is used to obtain a software package to be updated in a local computer, create a mounting server corresponding to the software package to be updated, use the local computer to perform network access to the mounting server to obtain an access software package, mount a shared directory in the access software package to the local computer, transfer the software package to be updated to the shared directory in the local computer, obtain a mounted shared directory, and identify a shared directory path corresponding to the mounted shared directory; A path query tool, used to construct a configuration file corresponding to the local computer based on the shared directory path, wherein the configuration file includes a filtering rule and a deletion rule, and based on the filtering rule and the deletion rule, query the file path of the configuration file using an exclusion parameter; A file transfer module is used to query the target directory in the mounting server based on the file path, identify redundant files in the target directory, delete the redundant files in the target directory using the deletion code in the mounting server, obtain the library file corresponding to the mounting server, transfer the library file to a preset user local machine, and query the target path corresponding to the library file in the user local machine; a queue calculation module, configured to check the software package status corresponding to the software package to be updated and the access software package in the target path, identify the development version files and the release version files of the software package to be updated and the access software package, create a to-be-copied queue corresponding to the software package to be updated and a copied queue corresponding to the access software package based on the development version files and the release version files, extract a new software package from the to-be-copied queue, transmit the new software package to the target location corresponding to the server end in the user's local computer, and update the new software package to the copied queue after the transmission is completed; The copy completion module is used to complete the fast copy of the software package to be updated until the software package does not exist in the queue to be copied.
9. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the queue-based fast software package copy method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the method for quickly copying a software package based on a queue as claimed in any one of claims 1 to 7 is implemented.