Software package generation method and device based on software secondary compression, equipment and medium
By scanning and compressing metadata through a software package creation engine, the problems of high sharing costs, low compression efficiency, and poor platform compatibility in software development are solved, enabling efficient and low-cost source code sharing across different platforms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-04-10
AI Technical Summary
In software development, existing technologies that directly compress software code and then transmit it via mirroring in an intranet environment suffer from high sharing costs, low compression efficiency, and poor platform compatibility.
The software package creation engine scans the custom and edited metadata, dynamically generates the first compression parameters, performs the first compression of the software package source code, and after verification, stores the metadata and source code compressed package in a temporary directory. Based on the component information in the temporary directory, the second compression parameters are generated for a second compression. Finally, the target software compressed package is published to the server for distribution.
It achieves highly compatible unpacking across any platform, reduces sharing costs, improves compression efficiency, and implements a consistent distribution mechanism through the server, ensuring that developers on different platforms can share source code at low cost.
Smart Images

Figure CN121833019A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software package creation technology, and in particular to software package generation methods, apparatus, equipment and media based on secondary software compression. Background Technology
[0002] In software development, when developers need to share software code with other developers, they often employ various methods, such as directly compressing the software code and transmitting it within an intranet environment. This approach lacks a unified software package specification: the shared software code often involves version control information, compatible system architecture information, and package type information. The absence of a unified specification for this information leads to high costs for sharing software packages among developers, especially in large source code projects. Furthermore, this method suffers from poor platform compatibility. When the software package is shared among developers in compressed form, the different development environments of different developers result in slow and inefficient decompression processes. For example, software compressed in zip format on Windows may not be decompressed on some Linux platforms.
[0003] It is evident that directly compressing software code and mirroring it within an intranet environment during software development presents challenges such as high sharing costs, low compression efficiency, and poor platform compatibility. Summary of the Invention
[0004] This application provides a software package generation method, apparatus, device, and medium based on secondary software compression, to solve the technical problems of high sharing costs, low compression efficiency, and poor platform compatibility in existing software development methods that involve directly compressing software code and mirroring it in an intranet environment.
[0005] According to one aspect of the embodiments of this application, this application provides a software package generation method based on secondary software compression. The method includes: scanning customized and edited metadata based on a software package creation engine, and dynamically generating first compression parameters based on the scanned components; performing initial compression on the source code of the software package to be created imported into the software package creation engine based on the first compression parameters to obtain a source code compressed package; verifying the metadata, and after passing the verification, storing the metadata and the source code compressed package in a temporary directory; dynamically generating second compression parameters based on the components in the temporary directory; performing secondary compression on the temporary directory based on the second compression parameters to obtain a target software compressed package; and publishing the target software compressed package to a server for distribution through the server.
[0006] Optionally, before scanning the custom and edited metadata based on the package creation engine and dynamically generating the first compression parameters according to the scanned components, the method further includes: initializing the metadata of the package to be created based on the package creation engine to generate a configuration file in the target format in the source code directory, the configuration file including the custom metadata required for package creation; and editing the metadata required for package creation in the source code directory.
[0007] Optionally, the step of scanning the customized and edited metadata based on the software package creation engine and dynamically generating the first compression parameter according to the scanned components includes: scanning the metadata in the source code directory through the software package creation engine, reading and parsing the metadata, obtaining component information in the metadata; identifying component characteristics of the component information, and dynamically generating the first compression parameter for different types of components in the metadata based on the identified component characteristics.
[0008] Optionally, the first compression parameters include a target compression algorithm, a target implementation language, and a target compression format. The step of performing an initial compression of the source code of the software package to be created, imported into the software package creation engine, based on the first compression parameters to obtain a source code compressed package includes: locating the source code directory through the software package creation engine, the source code directory including the source code of the software package to be created; importing the source code of the software package to be created into the software package creation engine; and performing an initial compression of the imported source code of the software package to be created based on the target compression algorithm, the target implementation language, and the target compression format to obtain the source code compressed package.
[0009] Optionally, the step of verifying the metadata, and storing the metadata and the source code compressed package in a temporary directory after the verification passes, dynamically generating second compression parameters based on the components of the temporary directory, and performing secondary compression on the temporary directory according to the second compression parameters to obtain the target software compressed package includes: verifying the legality of the metadata; if the verification passes, creating the temporary directory, saving the source code compressed package and the metadata in the temporary directory; scanning the component information of the temporary directory, dynamically generating the second compression parameters based on the scanned component information, and performing secondary compression on the temporary directory based on the second compression parameters to obtain the target software compressed package.
[0010] Optionally, the metadata includes a package compatibility system, package version, package type, package author information, third-party dependency information, and package name. Verifying the validity of the metadata includes: parsing and verifying, through the package creation engine, whether the package compatibility system, package version, package type, package author information, third-party dependency information, and package name conform to their respective predetermined format conditions; if all conform to their respective predetermined format conditions, the verification passes; if any one does not conform to its corresponding predetermined format condition, the information is corrected based on the generated error information.
[0011] Optionally, the step of publishing the target software compressed package to the server and distributing the target software compressed package through the server includes: publishing the target software compressed package to the server; the recipient obtaining the target software compressed package from the server, downloading the software package creation engine from the server, and parsing the target software compressed package based on the software package creation engine.
[0012] According to another aspect of the embodiments of this application, this application provides a software package generation apparatus based on secondary software compression. The apparatus includes: a scanning module, configured to scan customized and edited metadata based on a software package creation engine, and dynamically generate first compression parameters based on the scanned components; a first compression module, configured to perform an initial compression on the source code of the software package to be created imported into the software package creation engine based on the first compression parameters, to obtain a source code compressed package; a second compression module, configured to verify the metadata, and after the verification is passed, dynamically generate second compression parameters based on the components scanned in a created temporary directory, and perform secondary compression on the metadata and the source code compressed package based on the second compression parameters, to obtain a target software compressed package; and a distribution module, configured to publish the target software compressed package to a server, and distribute the target software compressed package through the server.
[0013] According to another aspect of the embodiments of this application, this application provides an electronic device, including: a processor, a memory, and a network interface. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory through the network interface, and the processor executes the machine-readable instructions to perform the steps of the software package generation method based on software secondary compression.
[0014] According to another aspect of the embodiments of this application, this application provides a storage medium having processor-executable non-volatile program code, the program code causing the processor to perform the steps of the software package generation method based on software secondary compression.
[0015] Compared with related technologies, the technical solutions provided in this application have the following advantages: The software package generation method based on secondary software compression provided in this application compresses software packages using a software package creation engine, enabling unpacking across any platform and achieving higher platform compatibility. Furthermore, the metadata can be customized; different customized metadata is analyzed by scanning the metadata and temporary directories to dynamically generate first and second compression parameters. This dynamic generation of compression parameters better adapts to different metadata, leading to optimal software package compression efficiency. In addition, a server-based sharing mechanism for the target software compressed package ensures consistent distribution, allowing developers on different platforms to share source code at low cost, further reducing sharing expenses. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0017] Figure 1 This is a schematic diagram of the hardware environment for an optional software-based secondary compression-based software package generation method provided according to an embodiment of this application. Figure 2 This is a schematic diagram of an optional software-based secondary compression-based software package generation method according to an embodiment of this application; Figure 3 This is a flowchart illustrating another optional software-based secondary compression-based software package generation method provided according to an embodiment of this application; Figure 4 This is a flowchart illustrating another optional software-based secondary compression-based software package generation method provided according to an embodiment of this application; Figure 5 This is a structural diagram of an optional software-based secondary compression software package generation apparatus according to an embodiment of this application; Figure 6 This is a schematic diagram of an optional electronic device structure provided in an embodiment of this application. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] To address the problems mentioned in the background art, according to one aspect of the embodiments of this application, an embodiment of a software package generation method based on software secondary compression is provided.
[0020] like Figure 1 As shown, the above-described software-based secondary compression-based software package generation method can be applied to, for example... Figure 1 The hardware environment shown is described. The system architecture 100 of the hardware environment includes a terminal device 101 and a server 103. The server 103 is connected to the terminal 101 via a network and can provide services to the terminal device 101 or clients installed on the terminal device 101. A database 105 can be set up on or independently of the server 103 to provide data storage services for the server 103. The network can include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0021] Developers can use terminal device 101 to interact with server 103 via a network to receive or send messages. Various communication client applications can be installed on terminal device 101, such as web browsers, search applications, and instant messaging tools. Terminal device 101 can be various electronic devices with a display screen that support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers. Server 103 can be a server providing various services, such as a backend server supporting the pages displayed on terminal device 101.
[0022] In this embodiment, the terminal device 101 may include an electronic device used by the developer on the side of creating the software package, and an electronic device used by the developer to acquire the created software package. The developers on both sides of creating and acquiring the software package share the software package based on the server.
[0023] It should be noted that the software package generation method based on software secondary compression provided in this application is generally executed by a server and / or terminal device, and correspondingly, the software package generation system based on software secondary compression is generally set up in the server / terminal device. Furthermore, it should be understood that... Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0024] like Figure 2 As shown, Figure 2 A flowchart illustrating a software package generation method based on software secondary compression provided in this embodiment of the invention. Taking the execution of the software package generation method based on software secondary compression in a system consisting of a server and terminal devices as an example, the software package generation method based on software secondary compression includes the following steps: Step S202: Scan the custom and edited metadata based on the package creation engine, and dynamically generate the first compression parameters according to the scanned components.
[0025] The software package creation engine is implemented in Python, which is cross-platform compatible. This means the engine can run on all platforms; only a Python interpreter needs to be installed in the developer's runtime environment. The engine can be stored on a server, allowing developers to download and install it.
[0026] In this embodiment, software source code sharing is implemented. Therefore, developers can embed any form of software source, such as third-party components or plugins, into the software package through the package creation engine. Thus, the content included in the software package can be customized. Different compression objects will have different types of information in their metadata. Before compressing the software package, developers can customize and edit the metadata according to the compression object. Because the content of the metadata varies, to achieve the highest compression effect for different compression objects, this embodiment performs component scanning on the customized and edited metadata and dynamically generates first compression parameters based on the information of the scanned components. These first compression parameters include, but are not limited to, compression level, compression algorithm, and dictionary size.
[0027] Step S204: Based on the first compression parameters, the source code of the software package to be created imported into the software package creation engine is compressed for the first time to obtain a source code compressed package.
[0028] The source code of the software package to be compressed can refer to the source code project already existing on the developer's local machine, including dynamic library projects, static library projects, application projects, etc., which are usually located in a directory. Before compression, the source code of the software package to be compressed is imported into the software package creation engine, and then compressed according to the first compression parameters to obtain a compressed source code package.
[0029] Step S206: Verify the metadata, and after the verification is successful, store the metadata and the source code compressed package in a temporary directory. Dynamically generate a second compression parameter based on the components of the temporary directory, and perform secondary compression on the temporary directory according to the second compression parameter to obtain the target software compressed package.
[0030] Before performing secondary compression, the metadata must be verified to meet specified conditions. Verification is considered successful only if all content in the metadata meets the specified conditions. After successful verification, the metadata and source code compressed package are saved in a temporary directory. Then, the temporary directory is scanned to obtain its components, and the second compression parameters are dynamically generated based on these components.
[0031] Furthermore, the temporary directory will be compressed a second time based on dynamically generated second compression parameters. The target compressed software package obtained by the second compression will be used as a software package for low-cost source code sharing among developers on different platforms. The second compression mechanism adopts a custom low compression mechanism, which makes the software package carry a large amount of information and decompresses large source code projects faster.
[0032] Step S208: Publish the target software compressed package to the server, and distribute the target software compressed package through the server.
[0033] The system utilizes a server-side software package sharing mechanism to distribute the target software archive, ensuring consistency in package distribution. Centralized management of code resources reduces local storage pressure on developers. Furthermore, version control ensures code consistency and traceability during multi-user collaboration, improving development efficiency and reducing conflicts caused by environmental differences or misoperations. When other developers need the target software archive, they simply access the server, download the package creation engine, and then use the engine to decompress the archive for further development.
[0034] Combination Figure 3 As shown, Figure 3This is an optional software package creation and sharing flowchart provided in an embodiment of the present invention. Developer 1 creates a software package based on a software package creation engine. After compressing the source code into a compressed package, it is output and further compressed with metadata to obtain the target software compressed package. Then, the target software compressed package is uploaded to the server, and Developer 2 can directly download the target software compressed package from the server.
[0035] In this embodiment of the invention, by employing a software package creation engine for software package compression, unpacking can be achieved across any platform, resulting in higher platform compatibility. Furthermore, metadata can be customized; different customized metadata, through component scanning of metadata and temporary directories, dynamically generates first and second compression parameters. Dynamically generated compression parameters are more adaptable to different metadata, thus achieving optimal software package compression efficiency. In addition, a server-based sharing mechanism for the target software compressed package ensures consistent distribution, allowing developers on different platforms to share source code at low cost, further reducing sharing expenses.
[0036] In some alternative embodiments, combined with Figure 4 As shown, prior to step S202 above, the method further includes: S102, Based on the package creation engine, the metadata of the package to be created is initialized to generate a configuration file in the target format in the source code directory, the configuration file including the custom metadata required for package creation; S104, Edit the metadata required for creating the software package in the source code directory.
[0037] The target formats include XML, JSON, YAML, INI, TOML, etc. On the developer's side, which performs software compression, the metadata of the software package to be compressed is first initialized using a package creation engine.
[0038] In some examples, the metadata initialization process includes: the package creation engine is a command-line tool, and an example of a developer calling the package creation engine is: `pkg_engineinit --pkg_dir C: / app`. After executing this command, the package creation engine will automatically generate an XML text configuration file (meteta.xml) in the C: / app directory. This configuration file contains the metadata required for package creation, which the developer can further edit. The C: / app directory is typically the source code directory. The metadata includes, but is not limited to, the following information: package compatibility architecture, package version, package type, package description information, third-party dependency information, package name, and other additional information. Compatibility architectures include x86, ARM, etc.; package types include static libraries, dynamic libraries, sample applications, etc.
[0039] In this embodiment, the metadata is initialized through the software package creation engine and supports custom editing of the metadata, which can significantly improve the system's flexibility, maintainability, and adaptability.
[0040] In some optional embodiments, step S202 above includes: S2021, The software package creation engine scans the metadata in the source code directory, reads and parses the metadata, and obtains the component information in the metadata; S2022, perform component characteristic identification on the component information, and dynamically generate the first compression parameter for different types of components in the metadata based on the identified component characteristics.
[0041] The software package creation engine integrates a metadata scanning module. This module scans the metadata within configuration files in the source code directory to read and parse the metadata, identify individual components within it, and extract their information, such as file paths, file types, and sizes. The component information in the metadata refers to a collection of data describing the detailed attributes of each independent component in a software, system, or data set. It defines the component's identity, function, dependencies, and configuration parameters through structured information, enabling the system to understand and manage the component's lifecycle, interaction methods, and operating environment. Specifically, it can include information edited within the metadata.
[0042] Furthermore, the software package creation engine identifies and analyzes component characteristics. Based on the scanned component information, it analyzes the characteristics of each component, including but not limited to file type, size, and compression potential. For example, text files typically have high compression potential, while already compressed files, such as images and videos, have lower compression potential.
[0043] Furthermore, based on component characteristics, first compression parameters are dynamically generated for different types of components. These first compression parameters include compression algorithm, compression level, dictionary size, etc. For example, for text files, the Zstandard algorithm is selected with a compression level of 22; for binary files, the LZ4 compression algorithm is selected with a compression level of 12.
[0044] In this embodiment, scanning metadata and parsing component information through the software package creation engine can provide a basis for the dynamic generation of the first compression parameter. Dynamically configuring the first compression parameter based on the identified component features can ensure a higher degree of matching between the first compression parameter and the custom metadata, which is more conducive to the software package achieving the optimal compression effect.
[0045] In some optional embodiments, step S204 above includes: S2041, The source code directory is located by the software package creation engine, and the source code directory includes the source code of the software package to be created; S2042, Import the source code of the software package to be created into the software package creation engine; S2043, Based on the target compression algorithm, the target implementation language, and the target compression format, the imported source code of the software package to be created is compressed for the first time to obtain the source code compressed package.
[0046] The first compression parameters include the target compression algorithm, the target implementation language, and the target compression format. In this embodiment, the target compression algorithm is the gzip compression algorithm, which features fast compression speed, fast decompression speed, and low memory usage; the target implementation language is Python, which has excellent cross-platform capabilities and can meet the deployment requirements of most scenarios; and the target compression format is XML.
[0047] In this embodiment, the source code of the software package to be created is stored in the source code directory. The source code directory can be located and imported into the software package creation engine. For example, this can be done via the engine's command line: `pkg_engineinit --pkg_dir C: / app`, where `C: / app` is the source code directory. The source code is then compressed for the first time according to the target compression algorithm, target implementation language, and target compression format to obtain a compressed source code package. The compression process is fast, the compressed source code package has low memory usage, and it is cross-platform compatible, facilitating deployment.
[0048] In this embodiment, locating the source code directory and importing the source code of the software package to be created through the software package creation engine avoids errors caused by manual searching, ensuring that the imported source code of the software package to be created is complete and structurally consistent, providing a reliable foundation for subsequent compression; the initial compression based on the target compression algorithm, target implementation language, and target compression format can significantly reduce memory usage, speed up compression, and have cross-platform characteristics.
[0049] In some optional embodiments, step S206 above includes: S2061, Verify the legality of the metadata; S2062, If the verification passes, create the temporary directory and save the source code compressed package and the metadata to the temporary directory; S2063, Scan the component information of the temporary directory, dynamically generate the second compression parameters based on the scanned component information, and perform secondary compression on the temporary directory based on the second compression parameters to obtain the target software compressed package.
[0050] In this embodiment, verifying the legality of metadata ensures that the structure, format, content, and relationships of metadata strictly comply with preset rules or standards, thereby preventing system parsing failures, logical confusion, or security vulnerabilities caused by data errors, missing data, or inconsistencies, and ensuring the accuracy, integrity, and reliability of data during storage, transmission, and processing.
[0051] Further, after successful verification, a temporary directory is created to store intermediate files during the compression process. The source code archive and metadata, both compressed initially, are copied to this temporary directory. Since metadata can be customized, the components copied to the temporary directory will differ depending on whether the developer adjusts the metadata. Therefore, the component information in the temporary directory is scanned to dynamically generate second compression parameters. These second compression parameters may include compression algorithms, compression ratios, compression formats, compression levels, output control, structural hierarchy, and dependencies. Finally, the temporary directory is compressed a second time based on the generated second compression parameters to obtain the target software archive.
[0052] In some examples, the output directory of the target software archive can be dynamically specified by the developer via the command line of the package creation engine. For example, the output can be sent to the C: / output directory using the command `pkg_engine make --pkg_dir C: / app --output_path C: / output`. If not specified, the output will default to the source code directory.
[0053] In this embodiment, the accuracy of metadata can be guaranteed by verifying the metadata. By building a temporary directory and importing the source code compressed package and metadata, the software package creation engine can automatically scan the component information in the temporary directory and dynamically generate the optimal second compression parameters accordingly. Finally, a highly adapted target software compressed package is generated, which not only ensures the maximization of compression efficiency and space utilization, but also significantly improves the accuracy and maintainability of software package creation through the metadata-driven automated process.
[0054] In some optional embodiments, step S2061 above includes: The software package creation engine parses and verifies whether the software package adaptation system, software package version, software package type, software package author information, software package third-party dependency information, and software package name each correspond to the predetermined format conditions. If all conditions meet their respective predetermined format requirements, the verification passes. If any of them does not conform to the corresponding predetermined format conditions, the information is corrected according to the generated error information.
[0055] In some examples, metadata includes package compatibility information, package version, package type, package author information, third-party dependency information, and package name. Specifically, metadata validation based on the package creation engine includes: The software package creation engine parses and validates the format of the package name in the metadata. The predefined format for package names is: a combination of letters, numbers, and underscores; it cannot begin with a number; and it cannot exceed 32 characters. If the format is invalid, the software package creation engine will output an error message to guide the developer in correcting it. The engine also parses and validates the format of the package author information in the metadata: this value is usually the system username, automatically generated by the software package creation engine and cannot be modified; if the format is invalid, the engine will output an error message to guide the developer in correcting it. Furthermore, the engine parses and validates the system architecture information in the metadata: this value must be a valid system architecture, such as x86 or arm; if the format is invalid, the engine will output an error message to guide the developer in correcting it. Finally, the engine parses and validates the package type information in the metadata: this field must be a dynamic library (shared), a static library (static), or an application project (sample); if the format is invalid, the engine will output an error message to guide the developer in correcting it. The package creation engine parses and verifies the package version information in the metadata. The valid format for this field is Major.Minor.Path, such as 1.0.0, 2.0.0, etc. If the format is invalid, the package creation engine will output an error message to guide the developer in correcting it. The package creation engine also parses and verifies third-party dependency information in the metadata, such as whether the paths of dependent components exist locally. If the path format is invalid, the package creation engine will output an error message to guide the user in correcting it.
[0056] In this embodiment, the validity of the software package adaptation system, software package version, software package type, software package author information, third-party dependency information of software packages, and software package name in the metadata is verified. This ensures that the structure, format, content and relationship of the metadata strictly comply with preset rules or standards, thereby preventing system parsing failure, logical confusion or security vulnerabilities caused by data errors, missing or inconsistent data, and ensuring the accuracy, integrity and reliability of data in the storage, transmission and processing process.
[0057] In some optional embodiments, step S208 above includes: S2081, The target software compressed package is published to the server; S2082, the object to be distributed obtains the target software compressed package from the server, downloads the software package creation engine from the server, and parses the target software compressed package based on the software package creation engine.
[0058] In this embodiment, the aforementioned recipients refer to the developers who need to download the target software package. The target software package, obtained after secondary compression, will be published to the server by the developers through the compression process. The recipients only need to download the target software package from the server and download the software package creation engine from the server. They can then use the software package creation engine to parse the target software package and perform subsequent development based on the metadata parsed from the target software package. Combined with... Figure 3 As shown, Developer 1 creates a target software compressed package and uploads it to the server. Developer 2 directly downloads the target software compressed package from the server and parses it based on the software package creation engine.
[0059] In this embodiment, the target software compressed package is distributed by implementing a sharing mechanism through a server, which can maintain the consistency of the distribution mechanism and allow developers on different platforms to share source code at low cost, resulting in lower sharing costs.
[0060] To more clearly illustrate the software package generation method based on software secondary compression provided in this application, the following explanation is provided with examples. The specific processes of metadata initialization, software package creation, software package distribution, and software package download include: 1. XML format is used as the metadata description format.
[0061] 2. Design the metadata initialization command-line interface, with the following format: pkg_engine init--pkg_dir C: / app In the above interface: pkg_engine: fixed, indicating the software package creation engine tool; init: fixed, indicating software package initialization; --pkg_dir: indicating the source code directory of the software package to be created.
[0062] 3. Design the command-line interface for the software package, in the following format: pkg_engine make --pkg_dir C: / app In the above interface: pkg_engine: fixed, indicating the software package creation engine tool; make: fixed, indicating software package creation; --pkg_dir: indicates the source code directory of the software package to be created.
[0063] 4. Design a command-line interface for publishing software packages, in the following format: pkg_engine publish --pkg_file C: / app / output.tar.gz --remote192.168.1.1:8000 In the above interface: pkg_engine: fixed, indicating the software package creation engine tool; publish: fixed, indicating software package publishing; --pkg_file: indicating the completed software package; --remote: indicating the server information to be uploaded.
[0064] 5. Design a command-line interface for downloading software packages, in the following format: pkg_engine download --pkg_id 1000 --remote 192.168.1.1:8000 In the above interface: pkg_engine: fixed, indicating the software package creation engine tool; download: fixed, indicating software package download; --pkg_id: software package identifier, which can be viewed through the software package list; --remote: indicates the download server information.
[0065] According to another aspect of the embodiments of this application, such as Figure 5 As shown, corresponding to the software package generation method based on software secondary compression in the above embodiments, this embodiment provides a software package generation apparatus based on software secondary compression, the apparatus comprising: The scanning module 501 is used to scan the custom and edited metadata based on the software package creation engine and dynamically generate the first compression parameters based on the scanned components. The first compression module 503 is used to perform an initial compression on the source code of the software package to be created imported into the software package creation engine based on the first compression parameters, so as to obtain a source code compressed package. The second compression module 505 is used to verify the metadata, and after the verification is passed, dynamically generate second compression parameters based on the components scanned in the created temporary directory, and perform secondary compression on the metadata and the source code compressed package according to the second compression parameters to obtain the target software compressed package; The distribution module 507 is used to publish the target software compressed package to the server and distribute the target software compressed package through the server.
[0066] It should be noted that in this embodiment, the scanning module 501 can be used to execute step S202 in this application embodiment, the first compression module 503 in this embodiment can be used to execute step S204 in this application embodiment, the second compression module 505 in this embodiment can be used to execute step S206 in this application embodiment, and the distribution module 507 in this embodiment can be used to execute step S208 in this application embodiment.
[0067] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented either through software or through hardware.
[0068] Optionally, the apparatus further includes: an initialization module for initializing metadata of the software package to be created based on the software package creation engine, so as to generate a configuration file in a target format in the source code directory, the configuration file including the custom metadata required for software package creation; and an editing module for editing the metadata required for software package creation in the source code directory.
[0069] Optionally, the scanning module 501 includes: a reading submodule, used to scan the metadata in the source code directory through the software package creation engine, read and parse the metadata, and obtain component information in the metadata; and an identification submodule, used to identify component characteristics of the component information, and dynamically generate the first compression parameters for different types of components in the metadata based on the identified component characteristics.
[0070] Optionally, the first compression parameters include a target compression algorithm, a target implementation language, and a target compression format. The first compression module 503 includes: a search submodule, used to search the source code directory through the software package creation engine, the source code directory including the source code of the software package to be created; an import submodule, used to import the source code of the software package to be created into the software package creation engine; and a first compression submodule, used to perform initial compression on the imported source code of the software package to be created based on the target compression algorithm, the target implementation language, and the target compression format to obtain the source code compressed package.
[0071] Optionally, the second compression module 505 includes: a verification submodule for verifying the legality of the metadata; a creation submodule for creating the temporary directory if the verification passes, and saving the source code compressed package and the metadata to the temporary directory; and a second compression submodule for scanning the component information of the temporary directory, dynamically generating the second compression parameters based on the scanned component information, and performing secondary compression on the temporary directory based on the second compression parameters to obtain the target software compressed package.
[0072] Optionally, the metadata includes a package compatibility system, package version, package type, package author information, package third-party dependency information, and package name. The verification submodule is specifically used to: parse and verify, through the package creation engine, whether the package compatibility system, package version, package type, package author information, package third-party dependency information, and package name meet their respective predetermined format conditions; if all meet their respective predetermined format conditions, the verification passes; if any one does not meet its corresponding predetermined format condition, the information is corrected based on the generated error information.
[0073] Optionally, the distribution module 507 includes: a sending submodule, used to publish the target software compressed package to the server; and a decompression submodule, used for the recipient to obtain the target software compressed package from the server, download the software package creation engine from the server, and parse the target software compressed package based on the software package creation engine.
[0074] It should be noted that the suffixes such as module, submodule, and subunit used to represent elements in the above-described device are only for the purpose of illustrative purposes and have no specific meaning in themselves. Therefore, they can be used in combination.
[0075] According to another aspect of the embodiments of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the software package generation method based on software secondary compression in any of the above embodiments.
[0076] According to another aspect of the embodiments of this application, this application also provides an electronic device, such as... Figure 6 As shown, the device includes a memory 601, a processor 603, and a network interface 605. The memory 601 stores a computer program that can run on the processor 603. The memory 601 and the processor 603 communicate through the network interface 605 and a communication bus 607. When the electronic device is running, the processor 603 and the memory 601 communicate through the network interface 605. When the processor 603 executes the computer program, it implements the steps of the software package generation method based on software secondary compression described above.
[0077] The memory and processor in the aforementioned electronic device communicate with each other via a communication bus and a communication interface. The communication bus can be a peripheral component interconnect standard (PCI) bus or an extended industry standard structure (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. The memory can include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor. The aforementioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0078] It is understood that the embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits, digital signal processors, digital signal processing devices, microprocessors, and other electronic units or combinations thereof for performing the functions described herein. For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. Software code can be stored in memory and executed by a processor.
[0079] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, or a combination of computer software and electronic hardware. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0080] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or other forms.
[0081] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the various embodiments of this application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0082] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0083] It should be noted that, in this document, relational terms such as first, second, etc., are used only to distinguish one entity or operation from another entity or operation. The terms include, encompass, or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0084] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A software package generation method based on software secondary compression, characterized in that, The method includes: The software package creation engine scans for custom and edited metadata and dynamically generates the first compression parameters based on the scanned components. Based on the first compression parameters, the source code of the software package to be created, which is imported into the software package creation engine, is compressed for the first time to obtain a source code compressed package. The metadata is verified, and after the verification is passed, the metadata and the source code compressed package are stored in a temporary directory. A second compression parameter is dynamically generated based on the components of the temporary directory. The temporary directory is then compressed a second time according to the second compression parameter to obtain the target software compressed package. The target software compressed package is published to the server, and the target software compressed package is distributed through the server.
2. The software package generation method based on software secondary compression according to claim 1, characterized in that, Before scanning the custom and edited metadata based on the package creation engine and dynamically generating the first compression parameters according to the scanned components, the method further includes: Based on the software package creation engine, the metadata of the software package to be created is initialized to generate a configuration file in the target format in the source code directory. The configuration file includes the custom metadata required for software package creation. Edit the metadata required for creating the software package in the source code directory.
3. The software package generation method based on software secondary compression according to claim 2, characterized in that, The process involves scanning custom and edited metadata using a software package creation engine, and dynamically generating first compression parameters based on the scanned components, including: The software package creation engine scans the metadata in the source code directory, reads and parses the metadata, and obtains the component information in the metadata; The component information is used to identify component characteristics, and the first compression parameters are dynamically generated for different types of components in the metadata based on the identified component characteristics.
4. The software package generation method based on software secondary compression according to claim 3, characterized in that, The first compression parameters include the target compression algorithm, the target implementation language, and the target compression format. Based on the first compression parameters, the source code of the software package to be created, imported into the software package creation engine, is initially compressed to obtain a source code compressed package, including: The software package creation engine locates the source code directory, which contains the source code of the software package to be created. Import the source code of the software package to be created into the software package creation engine; The source code of the imported software package to be created is compressed for the first time based on the target compression algorithm, the target implementation language, and the target compression format to obtain the source code compressed package.
5. The software package generation method based on software secondary compression according to claim 1, characterized in that, The process involves verifying the metadata, and upon successful verification, storing the metadata and the source code compressed package in a temporary directory. A second compression parameter is dynamically generated based on the components of the temporary directory. The temporary directory is then compressed a second time according to the second compression parameter to obtain the target software compressed package, including: The validity of the metadata is verified; If the verification passes, the temporary directory is created, and the source code compressed package and the metadata are saved to the temporary directory. The component information of the temporary directory is scanned, the second compression parameters are dynamically generated based on the scanned component information, and the temporary directory is compressed a second time based on the second compression parameters to obtain the target software compressed package.
6. The software package generation method based on software secondary compression according to claim 5, characterized in that, The metadata includes package compatibility system, package version, package type, package author information, third-party dependency information, and package name. The validation of the metadata includes: The software package creation engine parses and verifies whether the software package adaptation system, software package version, software package type, software package author information, software package third-party dependency information, and software package name each correspond to the predetermined format conditions. If all conditions meet their respective predetermined format requirements, the verification passes. If any of them does not conform to the corresponding predetermined format conditions, the information is corrected according to the generated error information.
7. The software package generation method based on software secondary compression according to any one of claims 1 to 6, characterized in that, The step of publishing the target software compressed package to the server and distributing the target software compressed package through the server includes: The target software package is published to the server; The target software package is obtained from the server and the software package creation engine is downloaded from the server. The target software package is then parsed based on the software package creation engine.
8. A software package generation device based on software secondary compression, characterized in that, The device includes: The scanning module is used to scan custom and edited metadata based on the package creation engine and dynamically generate the first compression parameters based on the scanned components. The first compression module is used to perform initial compression on the source code of the software package to be created imported into the software package creation engine based on the first compression parameters, so as to obtain a source code compressed package; The second compression module is used to verify the metadata, and after the verification is passed, dynamically generate second compression parameters based on the components scanned in the created temporary directory, and perform secondary compression on the metadata and the source code compressed package according to the second compression parameters to obtain the target software compressed package; The distribution module is used to publish the target software compressed package to the server and distribute the target software compressed package through the server.
9. An electronic device, comprising: A processor, a memory, and a network interface, wherein the memory stores machine-readable instructions executable by the processor, characterized in that: when the electronic device is running, the processor communicates with the memory via the network interface, and the processor executes the machine-readable instructions to perform the steps of the software package generation method based on software secondary compression as described in any one of claims 1 to 7.
10. A storage medium having processor-executable non-volatile program code, characterized in that, The program code causes the processor to execute the steps of the software-based secondary compression-based software package generation method according to any one of claims 1 to 7.