CN120216008A - Application installation package generation method, device, electronic device and readable storage medium - Google Patents
Application installation package generation method, device, electronic device and readable storage medium Download PDFInfo
- Publication number
- CN120216008A CN120216008A CN202510298900.7A CN202510298900A CN120216008A CN 120216008 A CN120216008 A CN 120216008A CN 202510298900 A CN202510298900 A CN 202510298900A CN 120216008 A CN120216008 A CN 120216008A
- Authority
- CN
- China
- Prior art keywords
- target
- configuration information
- application
- installation package
- installation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
Abstract
The application provides an application installation package generation method, an application installation package generation device, electronic equipment and a readable storage medium, wherein the method is applied to the technical field of computers and comprises the steps of responding to a compiling request of a target application program, generating a first installation package of the target application program, wherein the compiling request is used for requesting to generate at least two installation packages, and one installation package corresponds to one function requirement; the method comprises the steps of copying a first installation package to obtain at least two second installation packages, wherein the number of the second installation packages is the same as that of the functional requirements, the at least two second installation packages comprise the first installation package, acquiring application configuration information of the at least two functional requirements corresponding to compiling requests, the application configuration information being used for configuring a target application program to meet the corresponding functional requirements, and writing the application configuration information of the at least two functional requirements into the at least two second installation packages respectively to obtain the at least two target installation packages.
Description
Technical Field
The present application relates to the field of computer technology, and more particularly, to an application installation package generating method and apparatus, an electronic device, and a readable storage medium in the field of electronic device technology.
Background
Engineering compilation is a vital loop in the development work of Android applications. However, as the types of user groups develop more and more, in order to enable Application (APP) to adapt to the demands of different user groups, new configuration information is often added to the APP, so that the APP operates different functions to meet different user groups, but after new configuration information is continuously added to the APP, codes for writing the APP are greatly increased, so that the volume of an installation package of the APP is larger.
Therefore, how to reduce the volume of the APP installation package is a technical problem to be solved at present.
Disclosure of Invention
The application provides an application installation package generation method, an application installation package generation device, electronic equipment and a readable storage medium.
The method comprises the steps of responding to a compiling request of a target application program, generating a first installation package of the target application program, wherein the compiling request is used for requesting to generate at least two installation packages, one installation package corresponds to one functional requirement, copying the first installation package to obtain at least two second installation packages, the number of the second installation packages is the same as that of the functional requirements corresponding to the compiling request, the at least two second installation packages comprise the first installation package, acquiring application configuration information of the at least two functional requirements corresponding to the compiling request, the application configuration information is used for configuring the target application program to meet the corresponding functional requirements, and writing the application configuration information of the at least two functional requirements into the at least two second installation packages respectively to obtain the at least two target installation packages.
According to the technical scheme, when a compiling request for a target application program is received and is used for requesting to generate at least two installation packages, and one installation package corresponds to one functional requirement, a first installation package of the target application program can be generated by compiling and packaging firstly, the first installation package is used as a basic installation package to be copied, at least two second installation packages are obtained, the number of the second installation packages is the same as the number of the functional requirements corresponding to the compiling request, then application configuration information of the at least two functional requirements corresponding to the compiling request is obtained, and the application configuration information of each functional requirement is written into the second installation package respectively to obtain target installation packages corresponding to each functional requirement, namely different target installation packages are used for meeting different functional requirements. In addition, the target installation packages corresponding to the functional requirements are obtained by writing the application configuration information on the basis of the first installation packages, so that the whole target application program does not need to be recompiled, the compiling time of the target installation packages containing different application configuration information can be reduced, and the compiling efficiency of the target installation packages corresponding to different functional requirements is improved.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, generating, in response to a compiling request for a target application program, a first installation package of the target application program includes obtaining source code of the target application program from a source code library in response to the compiling request for the target application program, compiling the source code into an executable file based on a preset compiling environment, wherein the executable file is a file that can be executed by a computer, obtaining a public resource file and public configuration information in the target application program, the public resource file refers to a static resource shared in the target application program, the public configuration information refers to configuration parameters shared in the target application program, and packaging the executable file, the public resource file and the public configuration information based on a packaging tool to obtain the first installation package.
In the technical scheme, in the process of generating the first installation package of the target application program, the public resource file and the public configuration information are packaged, so that the storage and transmission of repeated resources can be reduced, and in addition, the generated first installation package contains necessary resource files and configuration information, so that the first installation package can be smoothly installed and operated in any environment.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, before generating the first installation package of the target application program, the method further includes writing application configuration information corresponding to each function of the target application program into a target directory, and generating a file name, where the target directory is in response to compiling the target application program, acquiring application configuration information of at least two function requirements corresponding to the compiling request, including calling a target function, reading the application configuration information of at least two function requirements corresponding to the compiling request written into the target directory based on the target function and the file name, where the target function is used to locate a position of the application configuration information of the at least two function requirements in the target directory, and reading the application configuration information of the at least two function requirements.
In the technical scheme, before the first installation package of the target application program is generated, the application configuration information corresponding to each function of the target application program can be stored in the target catalog, so that the application configuration information can be managed and modified independently of the source code of the target application program, when different functions are configured for the target application program, only the application configuration information is required to be updated, the source code of the target application program is not required to be modified, maintenance work of a developer is simplified, and in addition, the application configuration information is positioned and read through the target function and the file name, reading efficiency can be improved, and unnecessary searching time is reduced.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, each function requirement corresponds to an identifier, the identifier is associated with application configuration information, before generating the first installation package of the target application program, the method further includes writing application configuration information corresponding to each function of the target application program into a database, and acquiring application configuration information of at least two function requirements corresponding to a compiling request, including determining an identifier of each function requirement, and acquiring application configuration information associated with the identifier of each function requirement from the database based on the identifier of each function requirement to obtain application configuration information of at least two function requirements.
In the above technical solution, by allocating a unique identifier to each function requirement and associating it with the application configuration information, the accuracy of the application configuration information of each function requirement can be ensured.
With reference to the first aspect and the implementation manner, in some possible implementation manners, writing application configuration information of at least two functional requirements into at least two second installation packages respectively to obtain at least two target installation packages, including detecting whether formats of the application configuration information of at least two functional requirements are correct, compressing the application configuration information of each functional requirement based on a compression algorithm to obtain compressed application configuration information of at least two functional requirements under the condition that the formats of the application configuration information of at least two functional requirements are correct, and writing the compressed application configuration information of at least two functional requirements into the second installation packages respectively to obtain at least two target installation packages.
In the technical scheme, when at least two target installation packages are obtained, whether the formats of application configuration information of at least two function requirements are correct or not is detected, the error formats in the application configuration information can be found and corrected in advance, so that the application configuration information of each function requirement meets the expected format, and the generated target installation packages can be ensured to run successfully.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, each target installation package corresponds to an initial digital signature, and the digital signature is used for verifying whether the target installation package is illegally tampered, and the method further includes deleting the initial digital signatures of at least two target installation packages after obtaining at least two target installation packages, performing hash calculation on each file in each target installation package based on a hash algorithm to generate a first hash value for each target installation package, and encrypting each first hash value based on a preset private key to generate a target digital signature for each target installation package again.
It should be noted that, in order to ensure the security of the first installation package, a digital signature is generated for the first installation package based on each file in the first installation package when the first installation package is generated, so as to verify whether the configuration information in the first installation package is tampered, it can be understood that each second installation package obtained based on the first installation copy has the same digital signature, and each target installation package obtained based on the second installation package also has the same digital signature, that is, each target installation package corresponds to an initial digital signature, but after at least two application configuration information required by functions is written into at least two second installation packages respectively, at least two target installation packages are obtained, since the configuration information in the target installation packages is inconsistent with the configuration information in the first installation package, the digital signature generated based on each file in the target installation package is inconsistent with the initial digital signature, so that the target installation package cannot pass verification when the target installation package is installed, that is to avoid that the target installation package cannot pass verification when the target installation package is installed, that at least two target installation packages can pass verification after the initial digital signatures are obtained, each target installation package can be successfully installed when the target installation package is installed.
With reference to the first aspect and the foregoing implementation manner, in some possible implementation manners, after generating a target digital signature for each target installation packet again, the method further includes decrypting the target digital signature of each target installation packet based on a public key corresponding to a private key to obtain a first hash value corresponding to each target installation packet, re-performing hash calculation on each file in each target installation packet based on a hash algorithm to regenerate a second hash value for each target installation packet, comparing each first hash value with each corresponding second hash value, and if the first hash value is the same as the corresponding second hash value, determining that application configuration information in the target installation packet is not tampered or lost in a re-signing process, otherwise, re-generating the target installation packet and re-signing is required.
According to the technical scheme, after a target digital signature is generated for each target installation package again, the regenerated second hash value is compared with the first hash value obtained after the target digital signature is decrypted, so that the target installation package is regenerated and re-signed under the condition that the second hash value is different from the first hash value, namely, under the condition that application configuration information in the target installation package is tampered or lost in the re-signing process, and therefore accuracy of the application configuration information in the finally obtained target installation package is guaranteed, and further the generated target installation package can meet corresponding functional requirements.
In a second aspect, there is provided an application installation package generating apparatus including:
The generation module is used for responding to a compiling request of the target application program, generating a first installation package of the target application program, wherein the compiling request is used for requesting to generate at least two installation packages, and one installation package corresponds to one functional requirement;
The replication module is used for replicating the first installation packages to obtain at least two second installation packages, the number of the second installation packages is the same as the number of the functional requirements corresponding to the compiling request, and the at least two second installation packages comprise the first installation packages;
The acquisition module is used for acquiring application configuration information of at least two functional requirements corresponding to the compiling request, and the application configuration information is used for configuring the target application program to meet the corresponding functional requirements;
And the writing module is used for writing application configuration information of at least two function requirements into at least two second installation packages respectively to obtain at least two target installation packages.
In a third aspect, an electronic device is provided that includes a memory and a processor. The memory is configured to store executable program code, and the processor is configured to invoke and run the executable program code from the memory, so that the electronic device performs the method for generating an application installation package in the first aspect or any of the possible implementation manners of the first aspect.
In a fourth aspect, there is provided a computer program product comprising computer program code which, when run on a computer, causes the computer to perform the method of generating an application installation package of the first aspect or any one of the possible implementation manners of the first aspect.
In a fifth aspect, there is provided a computer readable storage medium storing computer program code which, when run on a computer, causes the computer to perform the application installation package generation method of the first aspect or any one of the possible implementation manners of the first aspect.
Drawings
FIG. 1 is a schematic diagram of an implementation environment of a method for generating an application installation package according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of an application installation package generation method provided by an embodiment of the present application;
FIG. 3 is a schematic flow chart of another method for generating application installation packages provided by an embodiment of the present application;
fig. 4 is a schematic structural diagram of an application installation package generating device according to an embodiment of the present application;
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical scheme of the application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiment of the present application, unless otherwise indicated, "/" means or, for example, a/B may mean a or B, "and/or" in the text is only one association relationship describing the association object, and it means that there may be three relationships, for example, a and/or B, three cases where a exists alone, a and B exist together, and B exists alone, and further, "a plurality" means two or more in the description of the embodiment of the present application.
The terms "first," "second," and the like, are used below for descriptive purposes only and are not to be construed as implying or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature.
Before describing the application installation package generating method provided by the embodiment of the present application, first, an implementation environment of the application installation package generating method provided by the embodiment of the present application is described, referring to fig. 1, and fig. 1 is a schematic diagram of an implementation environment of the application installation package generating method provided by the embodiment of the present application.
By way of example, as shown in FIG. 1, the implementation environment includes an electronic device 101 and a server 102.
The electronic device 101 may be any device having an installation package generating capability, such as a smart phone, a notebook computer, a desktop computer, or a virtual reality terminal, which is not limited in the embodiment of the present application. The electronic device 101 may be running a variety of different types of applications, for example, the applications run by the electronic device 101 may include one or more of a drawing application, a gaming application, a video application, a telephony application, a social application, a live application, an email application, a digital camera application, a spreadsheet application, and the like.
The server 102 may be an independent physical server, a server cluster or a distributed file system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligence platforms, which are not limited in the embodiment of the present application.
In one possible implementation, the server 102 is directly or indirectly connected to the terminal 101 through a wired or wireless communication manner, which is not limited by the embodiment of the present application.
In one possible implementation manner, when a compiling request for a target application program is received and the compiling request is used for requesting to generate at least two installation packages, when one installation package corresponds to one function requirement, a first installation package of the target application program is generated, the first installation package is copied to obtain at least two second installation packages, the number of the second installation packages is the same as the number of the function requirements corresponding to the compiling request, the at least two second installation packages include the first installation package, then application configuration information of the at least two function requirements corresponding to the compiling request is obtained, the application configuration information is used for configuring the target application program to meet the corresponding function requirements, and finally the application configuration information of the at least two function requirements is written into the at least two second installation packages respectively to obtain the at least two target installation packages.
In one possible implementation, the electronic device 101 may obtain application configuration information of at least two function requirements corresponding to the compiling request from a database of the server 102.
After the implementation environment of the application installation package generating method provided by the embodiment of the present application is introduced, the application installation package generating method provided by the embodiment of the present application is described below.
The method according to an embodiment of the present application is described in detail below with reference to fig. 2.
Fig. 2 is a schematic flowchart of an application installation package generating method according to an embodiment of the present application.
Illustratively, as shown in FIG. 2, taking the electronic device 101 of FIG. 1 as an example of an execution subject, the method 200 includes the following steps 201-204.
In step 201, a first installation package of a target application is generated in response to a compiling request for the target application, the compiling request being used for requesting generation of at least two installation packages, one installation package corresponding to each functional requirement.
Wherein the target application is an application to be run. For example, the target application may be a navigation application to be run, a weather forecast application, a cart interconnection application, a vehicle recorder application, a drawing application, a game application, a video application, a phone application, a social application, a live broadcast application, an email application, a digital camera application, or a spreadsheet application, etc., which embodiments of the present application are not limited.
Each function requirement is used for representing at least one function which the target application program needs to have, for example, the target application program corresponds to two installation packages, wherein the function requirement corresponding to one installation package is used for representing that the target application program needs to support a Chinese interface and has functions of collection and checking, and the function requirement corresponding to the other installation package is used for representing that the target application program needs to support an English interface and has a payment function, namely, each function requirement can be regarded as a function set which the target application program needs to have.
In one possible implementation manner, the compiling request for the target application program may be triggered by a developer on the electronic device, or may be triggered automatically by the electronic device according to a preset triggering rule, which is not limited by the embodiment of the present application.
In one possible implementation, when a developer manually triggers a compilation request for a target application on an electronic device, and the compilation request is used to request generation of at least two installation packages, one installation package corresponding to each functional requirement, the electronic device may generate a first installation package for the target application in response to the compilation request for the target application.
Next, the implementation procedure of the first installation package of the target application program is generated in four steps, which will be described in detail.
And (1) acquiring the source code of the target application program from a source code library.
Wherein the source code library is a centralized or distributed system for storing and managing the source code of the target application.
In one possible implementation, the electronic device may clone the latest source code of the target application from the source code library to the local via a command line tool (e.g., a Git command), thereby obtaining the source code of the target application.
And (2) compiling the source code into an executable file based on a preset compiling environment, wherein the executable file is a file which can be executed by a computer.
Where a compilation environment refers to a set of software tools and configurations that support the compilation process of source code.
The compilation environment typically includes a Compiler, a Linker, and environment variables Environment Variables.
Specifically, the compiler is configured to convert source code (such as C, C ++ or Java) of the target application program into target code, where the target code is usually a binary format code that can be identified by a computer, and generate a target file from the converted target code, and then the linker links the compiled target file and the library file together based on a library path specified by an environment variable, so as to generate a file that can be executed by the computer, that is, an executable file. It will be appreciated that the executable file is a binary file generated after compiling and linking, and may cause a computer to be directly loaded and executed.
And (3) acquiring a public resource file and public configuration information in the target application program.
Wherein the common resource file refers to a static resource shared in the target application. For example, the common resource file may include an image file for displaying icons and background drawings of a user interface, a style sheet for defining a target application appearance style, an audio file for notifying a user of sound effects and background music, and the like.
The common configuration information refers to configuration parameters shared in the target application. For example, the common configuration information may include an API endpoint (API Endpoints) for defining a URL address for the target application to communicate with the backend server, keys and tokens (Keys and Tokens) for ensuring the security of the target application's operation, such as API keys, OAuth tokens, etc., and color information for defining the color theme of the target application, etc.
It will be appreciated that the common resource file and the common configuration information are located under a specific directory, for example, a directory such as resources, assets or config, and in one possible implementation, the locations of the common resource file and the common configuration information, that is, the directory, may be searched in a script manner, and after the locations of the common resource file and the common configuration information are found, the common resource file and the common configuration information are copied to a temporary directory for later packaging.
And (4) packaging the executable file, the public resource file and the public configuration information based on a packaging tool to obtain a first installation package.
The packaging tool may be any tool capable of packaging the execution file, the common resource file and the common configuration information. For example, ZIP, tar, MSI, NSIS or JAR, etc., which are not limiting embodiments of the present application.
Specifically, after the common resource file and the common configuration information in the target application program are acquired, a packaging command corresponding to the packaging tool may be executed based on the packaging tool, and the executable file, the common resource file and the common configuration information may be packaged to obtain the first installation package.
For example, when the packaging tool is a ZIP, after the common resource file and the common configuration information in the target application program are acquired, a packaging command (i.e., a ZIP command) corresponding to the ZIP may be executed based on the ZIP, and the executable file, the common resource file, and the common configuration information may be packaged to obtain the first installation package.
It should be noted that, in order to avoid illegal tampering of the files in the first installation package, ensure the security of the first installation package, after the first installation package is generated, hash calculation may be performed on each file in the first installation package based on a hash algorithm to generate a hash value for the first installation package, and the hash value is encrypted based on a preset private key, so as to generate a digital signature for the first installation package, where the digital signature is used to verify whether the first installation package is illegally tampered.
Among them, a hash algorithm (also referred to as a hash function) is an algorithm that converts data of an arbitrary length into a fixed-length output.
Alternatively, the hash algorithm may be any one of MD5, SHA-256, BLAKE2, RIPEMD-160, etc., and embodiments of the present application are not limited in this regard.
For example, when the hash algorithm is SHA-256 and the first installation package includes file a and file B, the electronic device may use file a and file B as input, and calculate the contents in file a and file B using the hashlib library of Python, thereby obtaining a hash value. For example, the electronic device uses the hashlib library of Python to calculate a hash value of e9c4f7e0a6b.
Further, after obtaining the hash value, the electronic device may encrypt the hash value with a preset private key based on an asymmetric encryption algorithm, such as RSA or ECDSA, and the encrypted output is the digital signature of the first installation packet.
The private key is preset by a developer and is used for generating a digital signature for the installation package. When the developer sets the private key, a public key corresponding to the private key, that is, a public key, is set to verify the authenticity of the digital signature, and may be understood as verifying whether the file in the first installation package is tampered when the first installation package is installed.
Step 202, copying the first installation packages to obtain at least two second installation packages, wherein the number of the second installation packages is the same as the number of the functional requirements corresponding to the compiling request, and the at least two second installation packages comprise the first installation packages.
Wherein a second installation package may be understood as a copy of the installation package that is copied based on the first installation package, which may be identical to the original first installation package.
In one possible implementation, after the executable file, the common resource file, and the common configuration information are packaged based on the packaging tool to obtain the first installation package, the first installation package may be replicated using a command line tool such as xcopy or robocopy to obtain at least two second installation packages.
In another possible implementation manner, after the executable file, the common resource file and the common configuration information are packaged based on the packaging tool to obtain the first installation package, the first installation package may be further copied using a share.
Step 203, obtaining application configuration information of at least two functional requirements corresponding to the compiling request, where the application configuration information is used to configure the target application program to meet the corresponding functional requirements.
Specifically, after the first installation package is copied to obtain at least two second installation packages, application configuration information of at least two functional requirements corresponding to the compiling request can be obtained, so that the application configuration information is written into the second installation packages respectively, and thus a target installation package corresponding to each functional requirement is obtained.
It should be noted that, in order to simplify maintenance work of a developer by only updating the application configuration information and not modifying the source code of the target application when configuring different functions for the target application, in one possible implementation, before generating the first installation package of the target application, the application configuration information corresponding to each function of the target application may be written into the target directory, and a file name may be generated, so that the application configuration information may be managed and modified independently of the source code of the target application, so that when configuring different functions for the target application, only the application configuration information needs to be updated and not modifying the source code of the target application, thereby simplifying maintenance work of the developer.
The target directory is a directory which does not enable written application configuration information to be modified in response to a compiling request of the target application program. For example, the target directory may be a assets directory.
Specifically, before the first installation package of the target application program is generated, application configuration information corresponding to each function of the target application program may be written into the target directory using a Python script or a Bash script, and a unique file name may be generated based on a time stamp, a version number of the target application program, or a specific identifier.
For example, the electronic device may run the following code to write application configuration information corresponding to the respective functions of the target application program into the target directory:
config_file_path='./config'
config_file=open(config file path,'w')
config_file.close()
configs=[configl,config2,config3]
for apk in apks:
apk_split=os.path.splitext(apk)
apk_file namemapk split[0]
apk_file suffix=apk split[1]
config_dir=apks_dir+"/configs_apks/"
if not os.path.exists(config_dir):
os.makedirs(config dir)
For config in configs:
config_apk=config_dir+apk_file_name+"-"+config+apk_file_suffix
shutil.copy(os.path.join(apks dir,apk),config_apk)
config_file=open(config_file_path,'w')
config_file.write(config)
config_file.close()
config_zip_apk=zipfile.2ipFile(config_apk,"a",zipfile.ZIP_DEFLATED)config_zip apk.write(config_file_path,"assets/config")
conf1g_zip apk.close()
further, after application configuration information corresponding to each function of the target application program is written into the target directory, the electronic device may call the target function, and read application configuration information of at least two function requirements corresponding to the compiling request written into the target directory based on the target function and the file name.
The objective function is used for positioning the positions of application configuration information of at least two functional requirements in the objective catalog and reading the application configuration information of the at least two functional requirements.
For example, the electronic device may execute the following code to read application configuration information of at least two functional requirements corresponding to a compilation request written in a target directory:
@Throws(I0Exception::class)
fun readFileFromAssets(context:Context,fileName:string?):string{
val assetManager=context.assets
var inputStream:Inputstream?=null
val stringBuilder=stringBuilder()
try{
inputStream=assetManager.open(fileName!!)
Valreader=BufferedReader(InputStreamReader(inputStream)
varline:string?
While(reader.readLine().also{line=it}!=null){
stringBuilder.append(line)
}
}finally{
inputstream?.close()
}
return stringBuilder.tostring()
}
in another possible embodiment, before the first installation package of the target application program is generated, application configuration information corresponding to each function of the target application program may also be written into the database.
Specifically, before the first installation package of the target application program is generated, application configuration information corresponding to each function of the target application program may also be written into the database using a Python script or SQLALCHEMY script.
In one possible implementation, to ensure accuracy of the application configuration information obtained for each function requirement, each function requirement may be associated with an identifier associated with the application configuration information. For example, the compiling request is used for requesting to generate two installation packages, and the two installation packages respectively correspond to one function requirement, wherein an identifier corresponding to the one function requirement is F001, the identifier 001 is associated with application configuration information of a user payment function, and an identifier corresponding to the other function requirement is F002, and the identifier F001 is associated with application configuration information of a user payment and reconciliation function.
Further, after application configuration information corresponding to each function of the target application program is written into the database, an identifier of each function requirement may be determined first, and then, based on the identifier of each function requirement, application configuration information associated with the identifier of each function requirement is obtained from the database, so as to obtain application configuration information of at least two function requirements.
Specifically, after application configuration information corresponding to each function of the target application program is written into the database, task management tools such as Jira, trello and the like can be used to obtain identifiers of each function requirement, and SQL query sentences are used to query application configuration information associated with the identifiers of each function requirement from the database, so that application configuration information of at least two function requirements is obtained.
And 204, writing application configuration information of at least two function requirements into at least two second installation packages respectively to obtain at least two target installation packages.
Specifically, after the application configuration information of at least two functional requirements corresponding to the compiling request is obtained, the application configuration information of the at least two functional requirements may be written into at least two second installation packages by using a Python script or a Shell script, so as to obtain at least two target installation packages.
Next, an embodiment of obtaining at least two target installation packages is described in detail in three steps.
And (1) detecting whether the formats of the application configuration information of at least two function requirements are correct.
It should be noted that, in order to avoid writing application configuration information in an incorrect format into the second installation package, so that the final destination installation package cannot be successfully operated, that is, in a possible implementation, before writing application configuration information of at least two function requirements into at least two second installation packages respectively, it may be detected whether the format of the application configuration information of at least two function requirements is correct, that is, whether the format of the application configuration information of each function requirement conforms to a predefined format (for example, JSON, XML or YAML format, etc.), so as to avoid writing application configuration information that does not conform to the predefined format into the second installation package, thereby ensuring that the final destination installation package can be successfully operated.
Specifically, before the application configuration information of at least two functional requirements is written into at least two second installation packages, a verification tool such as jsonschema, yamllint, XML Schema, or relay may be used to detect the format of the application configuration information.
And (2) compressing the application configuration information of each function requirement based on a compression algorithm under the condition that the formats of the application configuration information of at least two function requirements are correct, so as to obtain the compressed application configuration information of at least two function requirements.
Specifically, in the case that the formats of the application configuration information of at least two functional requirements are correct, a compression algorithm such as gzip, bzip2, lzma may be used to compress the application configuration information of each functional requirement, so as to obtain the compressed application configuration information of at least two functional requirements.
And (3) writing the compressed application configuration information of at least two function requirements into a second installation package respectively to obtain at least two target installation packages.
Specifically, after obtaining the application configuration information of the at least two compressed functional requirements, the application configuration information of the at least two compressed functional requirements may be written into at least two second installation packages respectively by using a Python script or a Shell script, so as to obtain at least two target installation packages.
In summary, in the method for generating an application installation package according to the embodiment of the present application, when a compiling request for a target application program is received and the compiling request is used for requesting to generate at least two installation packages, when one installation package corresponds to one functional requirement, a first installation package of the target application program may be compiled and packaged first to generate the first installation package of the target application program, so as to copy the first installation package as a basic installation package, to obtain at least two second installation packages, where the number of the second installation packages is the same as the number of the functional requirements corresponding to the compiling request, then obtain application configuration information of at least two functional requirements corresponding to the compiling request, and write the application configuration information of each functional requirement into the second installation package respectively, so as to obtain target installation packages corresponding to each functional requirement, that is, different target installation packages are used to satisfy different functional requirements. In addition, the target installation packages corresponding to the functional requirements are obtained by writing the application configuration information on the basis of the first installation packages, so that the whole target application program is not required to be recompiled, the compiling time of the target installation packages containing different application configuration information can be reduced, the compiling efficiency of the target installation packages corresponding to different functional requirements is improved, and in addition, before the application configuration information of at least two functional requirements is respectively written into at least two second installation packages, whether the format of the application configuration information of at least two functional requirements is correct or not is detected, the writing of the application configuration information which does not conform to a predefined format into the second installation packages can be avoided, the finally generated target installation packages can be ensured to run successfully, and under the condition that the application configuration information is correct, a compression algorithm can be used for compressing the application configuration information to reduce the volume of the application configuration information, so that the volume of the target installation packages can be further generated.
Fig. 3 is a schematic flowchart of another method for generating an application installation package according to an embodiment of the present application.
Illustratively, as shown in FIG. 3, taking the electronic device 101 of FIG. 1 as an example of an execution subject, the method 300 includes the following steps 301-310.
In step 301, a first installation package of a target application is generated in response to a compiling request for the target application, the compiling request being used for requesting generation of at least two installation packages, one installation package corresponding to each functional requirement.
And step 302, copying the first installation package to obtain at least two second installation packages.
Step 303, obtaining application configuration information of at least two functional requirements corresponding to the compiling request.
And step 304, writing application configuration information of at least two function requirements into at least two second installation packages respectively to obtain at least two target installation packages.
Steps 301 to 304 may be referred to the above embodiments, and are not described herein.
Step 305, deleting the initial digital signature of at least two target installation packages.
As can be seen from the foregoing embodiments, after the first installation package is generated, in order to ensure that the security of the first installation package will generate a digital signature for the first installation package, it may be understood that each second installation package obtained by copying the first installation package will have the same digital signature, and each target installation package obtained by copying the second installation package will also have the same digital signature, that is, each target installation package will have an initial digital signature, but after at least two application configuration information required by the function is written into at least two second installation packages respectively, so as to obtain at least two target installation packages, since the configuration information in the target installation packages is inconsistent with the configuration information in the first installation package, the digital signature generated based on each file in the target installation package is inconsistent with the initial digital signature, so that the target installation package cannot pass verification during installation, that is, in order to avoid that the target installation package cannot pass verification during installation, in a possible implementation, after at least two target installation packages are obtained, each initial digital signature of the target installation package may be deleted, and each target installation package may be reinstalled for successful installation script, and each target installation package may be obtained.
At step 306, hash calculations are performed on the files in each target installation package based on a hash algorithm to generate a first hash value for each target installation package.
In step 307, each first hash value is encrypted based on the preset private key to regenerate a target digital signature for each target installation package.
The implementation manners of step 306 and step 307 are the same as those of the first installation package generation method in the above embodiment, and specific reference may be made to the above embodiment, which is not repeated here.
Step 308, decrypting the target digital signature of each target installation package based on the public key corresponding to the private key, to obtain a first hash value corresponding to each target installation package.
It should be noted that, after a target digital signature is generated for each target installation packet, in order to ensure that the application configuration information in the target installation packet is not tampered or lost in the process of re-signing, in one possible implementation, a apksigner tool may be used to decrypt the target digital signature of each target installation packet by using a public key corresponding to a private key, so as to obtain a first hash value corresponding to each target installation packet, so that the first hash value obtained by decryption is compared with a second hash value regenerated for the target installation packet, thereby determining whether the application configuration information in the target installation packet is tampered or lost in the process of re-signing based on the comparison result.
Step 309, re-hashing the files in each target installation package based on the hashing algorithm to re-generate a second hash value for each target installation package.
The implementation of step 309 may be referred to the above examples, and will not be described herein.
And step 310, comparing each first hash value with each corresponding second hash value, if the first hash value is the same as the corresponding second hash value, determining that the application configuration information in the target installation package is not tampered or lost in the re-signing process, otherwise, regenerating the target installation package and re-signing the target installation package.
In this case, it is determined that the application configuration information in the target installation packet is not tampered or lost during the re-signing process because the first hash value is the same as the corresponding second hash value when the first hash value is the e7c2f3e0a6d and the second hash value corresponding to the first hash value is the e7c2f3e0a6d, and it is necessary to re-generate and re-sign the target installation packet in order to ensure that the target installation packet can pass the verification smoothly at this time, since the first hash value is the e7c2f3e0a6d and the second hash value corresponding to the first hash value is the e7c2f3e0a6d, in this case, since the first hash value is different from the corresponding second hash value, the application configuration information in the target installation packet can be determined to be illegally tampered or lost during the re-signing process.
It should be noted that after a target digital signature is generated for each target installation package again, the regenerated second hash value is compared with the decrypted first hash value, so that when the second hash value is different from the first hash value, that is, when the application configuration information in the target installation package is tampered or lost in the re-signing process, the target installation package is regenerated and re-signed, thereby ensuring the accuracy of the application configuration information in the finally obtained target installation package, and further ensuring that the generated target installation package can meet the corresponding functional requirements.
Fig. 4 is a schematic structural diagram of an application installation package generating device according to an embodiment of the present application.
Illustratively, as shown in FIG. 4, the apparatus 400 includes:
A generating module 401, configured to generate a first installation package of a target application program in response to a compiling request of the target application program, where the compiling request is used to request generation of at least two installation packages, and one installation package corresponds to one functional requirement;
The replication module 402 is configured to replicate the first installation package to obtain at least two second installation packages, where the number of the second installation packages is the same as the number of the functional requirements corresponding to the compiling request, and the at least two second installation packages include the first installation package;
The obtaining module 403 is configured to obtain application configuration information of at least two functional requirements corresponding to the compiling request, where the application configuration information is used to configure the target application program to meet the corresponding functional requirements;
And the writing module 404 is configured to write application configuration information of at least two function requirements into at least two second installation packages respectively, so as to obtain at least two target installation packages.
In a possible implementation manner, the obtaining module 403 is further configured to obtain, from a source code library, a source code of the target application program in response to a compiling request of the target application program, the generating module 401 is specifically configured to compile the source code into an executable file based on a preset compiling environment, the executable file is a file that can be executed by a computer, the obtaining module 403 is further configured to obtain a public resource file and public configuration information in the target application program, the public resource file is a static resource shared in the target application program, the public configuration information is a configuration parameter shared in the target application program, and the generating module 401 is specifically further configured to package the executable file, the public resource file and the public configuration information based on a packaging tool to obtain the first installation package.
In a possible implementation manner, the writing module 404 is further configured to write application configuration information corresponding to each function of the target application program into the target directory before generating the first installation package of the target application program, and generate a file name, where the target directory is a directory that does not enable the written application configuration information to be modified in a process of responding to a compiling request for the target application program, and the apparatus further includes a calling module configured to call the target function, and the obtaining module 403 is specifically configured to read, based on the target function and the file name, application configuration information of at least two function requirements corresponding to the compiling request written into the target directory, where the target function is configured to locate a position of the application configuration information of the at least two function requirements in the target directory, and read the application configuration information of the at least two function requirements.
In a possible implementation manner, each function requirement corresponds to an identifier, the identifier is associated with application configuration information, the writing module 404 is further configured to write application configuration information corresponding to each function of the target application program into the database before generating the first installation package of the target application program, the obtaining module 403 is specifically configured to determine the identifier of each function requirement, and based on the identifier of each function requirement, obtain application configuration information associated with the identifier of each function requirement from the database, so as to obtain application configuration information of at least two function requirements.
In a possible implementation manner, the device further comprises a detection module for detecting whether the format of the application configuration information of at least two functional requirements is correct, a compression module for compressing the application configuration information of each functional requirement based on a compression algorithm to obtain compressed application configuration information of at least two functional requirements when the format of the application configuration information of at least two functional requirements is correct, and a writing module 404 specifically for writing the compressed application configuration information of at least two functional requirements into a second installation package respectively to obtain at least two target installation packages.
In a possible implementation manner, each target installation package corresponds to an initial digital signature, the digital signature is used for verifying whether the target installation package is illegally tampered, the device further comprises a deleting module, the generating module 401 is used for deleting the initial digital signatures of at least two target installation packages after the at least two target installation packages are obtained, hash calculation is further performed on each file in each target installation package based on a hash algorithm to generate a first hash value for each target installation package, and encryption is performed on each first hash value based on a preset private key to generate a target digital signature for each target installation package again.
In a possible implementation manner, the device further comprises a decryption module, a generation module 401, a judgment module and a judgment module, wherein the decryption module is used for decrypting the target digital signature of each target installation packet based on the public key corresponding to the private key after the target digital signature is generated again for each target installation packet to obtain a first hash value corresponding to each target installation packet, the generation module 401 is further used for carrying out hash calculation on each file in each target installation packet based on a hash algorithm to regenerate a second hash value for each target installation packet, the judgment module is used for comparing each first hash value with each corresponding second hash value, if the first hash value is the same as the corresponding second hash value, it is determined that application configuration information in the target installation packet is not tampered or lost in the process of re-signing, and otherwise, the target installation packet needs to be regenerated and signed again.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
As shown in fig. 5, the electronic device 500 includes a memory 501 and a processor 502, wherein the memory 501 stores executable program code 503, and the processor 502 is configured to invoke and execute the executable program code 503 to perform an application installation package generating method.
In addition, the embodiment of the application also protects a device, which can comprise a memory and a processor, wherein executable program codes are stored in the memory, and the processor is used for calling and executing the executable program codes to execute the method for generating the application installation package.
In this embodiment, the functional modules of the apparatus may be divided according to the above method example, for example, each functional module may be corresponding to one processing module, or two or more functions may be integrated into one processing module, where the integrated modules may be implemented in a hardware form. It should be noted that, in this embodiment, the division of the modules is schematic, only one logic function is divided, and another division manner may be implemented in actual implementation.
In case of dividing the respective functional modules with the respective functions, the apparatus may further include a first transmitting module. A second send module, a torque zero module, etc. It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional descriptions of the corresponding functional modules, which are not described herein.
It should be understood that the apparatus provided in this embodiment is used to perform the above-described method for generating an application installation package, and thus the same effects as those of the above-described implementation method can be achieved.
In case of an integrated unit, the apparatus may comprise a processing module, a memory module. When the device is applied to the electronic equipment, the processing module can be used for controlling and managing the actions of the electronic equipment. The memory module may be used to support the electronic device in executing associated program code, etc.
Wherein the processing module may be a processor or controller that may implement or execute the various illustrative logical blocks, modules, and circuits described in connection with the present disclosure. A processor may also be a combination of computing functions, including for example one or more microprocessors, digital Signal Processing (DSP) and microprocessor combinations, etc., and a memory module may be a memory.
In addition, the device provided by the embodiment of the application can be a chip, a component or a module, and the chip can comprise a processor and a memory which are connected, wherein the memory is used for storing instructions, and when the processor calls and executes the instructions, the chip can be made to execute the method for generating the application installation package provided by the embodiment.
The present embodiment also provides a computer-readable storage medium having stored therein computer program code which, when run on a computer, causes the computer to execute the above-described related method steps to implement an application installation package generating method provided in the above-described embodiments.
The present embodiment also provides a computer program product, which when run on a computer, causes the computer to perform the above-mentioned related steps to implement an application installation package generating method provided by the above-mentioned embodiments.
The apparatus, the computer readable storage medium, the computer program product, or the chip provided in this embodiment are used to execute the corresponding method provided above, and therefore, the advantages achieved by the apparatus, the computer readable storage medium, the computer program product, or the chip can refer to the advantages of the corresponding method provided above, which are not described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510298900.7A CN120216008A (en) | 2025-03-13 | 2025-03-13 | Application installation package generation method, device, electronic device and readable storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202510298900.7A CN120216008A (en) | 2025-03-13 | 2025-03-13 | Application installation package generation method, device, electronic device and readable storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN120216008A true CN120216008A (en) | 2025-06-27 |
Family
ID=96117806
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202510298900.7A Pending CN120216008A (en) | 2025-03-13 | 2025-03-13 | Application installation package generation method, device, electronic device and readable storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN120216008A (en) |
-
2025
- 2025-03-13 CN CN202510298900.7A patent/CN120216008A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR102618665B1 (en) | Version history management using blockchain | |
| US10338946B1 (en) | Composable machine image | |
| RU2759329C2 (en) | Sealing data with sealing enclave | |
| CA3046517C (en) | Cross-platform enclave identity | |
| AU2017395731B2 (en) | Abstract enclave identity | |
| US11949789B2 (en) | Blockchain-enabled computing | |
| CN110199285B (en) | Slave enclave binary | |
| CN111143869B (en) | Application package processing method, device, electronic device and storage medium | |
| US9009840B1 (en) | Validating machine images | |
| EP3574438A1 (en) | Data unsealing with a sealing enclave | |
| WO2018140162A1 (en) | Key vault enclave | |
| EP3574437A1 (en) | Cross-platform enclave data sealing | |
| US10853141B2 (en) | Resource provisioning in distributed computing environments | |
| CN113051622B (en) | Index construction method, device, equipment and storage medium | |
| EP3574441A1 (en) | Enclave abstraction model | |
| CN111273920A (en) | Method and device for writing data into installation package and storage medium | |
| EP3574433A1 (en) | Nested enclave identity | |
| US11954007B2 (en) | Tracking usage of common libraries by means of digitally signed digests thereof | |
| CN116723247A (en) | Microservice calling methods, devices, equipment and storage media | |
| KR101411181B1 (en) | Schema packaging, deployment, and availability | |
| CN120216008A (en) | Application installation package generation method, device, electronic device and readable storage medium | |
| CN118012453A (en) | Software deployment method, device, electronic device, storage medium and program product | |
| CN113094051B (en) | Application program construction method, device, equipment and medium | |
| CN120104144A (en) | Image building method, device, electronic device and medium | |
| HK40024808A (en) | Method and device for writing data to installation package and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |