Method for converting deb package or rpm package of application into kaiming package

By automatically processing decompression and dependency package download of deb or rpm packages, the kaiming software package is directly exported, which solves the problem of low packet format conversion efficiency in the existing technology, and improves adaptation efficiency and system security.

CN119292601APending Publication Date: 2025-01-10KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411260594.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing methods of converting deb and rpm package formats to kaiming package formats lack efficiency, resulting in developers facing high learning costs, trial and error costs and time costs during the adaptation process, reducing the efficiency of software adaptation, and some software is maintained due to maintenance. Due to the stage, I am unwilling to replace the new package format.

Method used

Provide a method to automatically process software package decompression, dependency package download and directory organization by obtaining preset metadata file templates, and use the kaiming build-export command to directly export the kaiming package, reducing developers' filling and filling in configuration files and Compilation process.

Benefits of technology

It greatly reduces the time cost of writing kaiming packages from scratch, reduces the learning cost of developers when adapting kaiming packages, improves adaptation efficiency, and avoids compilation and dependency problems through automated processing, improving system security .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119292601A_ABST
    Figure CN119292601A_ABST
Patent Text Reader

Abstract

The invention relates to the field of software package conversion, in particular to a method for converting a deb package or an rpm package of an application into a kaiming package, and the method comprises the following steps: S1, obtaining a preset metadata file template; s2, creating a software name directory according to the name of the kaiming software package, and storing a metadata file template in the software name directory; s3, creating a file directory under the software name directory, and decompressing a deb package or an rpm package of the target application to the file directory; s4, obtaining a dependent package name according to the decompressed file content; s5, according to the names of the dependency packets, decompressing all the missing dependency packets to a file directory, and returning to the step S4; s6, creating an exct catalogue and a var catalogue under the files catalogue, storing a desktop file and an icon file after decompressing a deb package or an rpm package of the target application under the exct catalogue, and deleting a static library file, a pkgconfig file and a share / man file after decompressing the deb package or the rpm package of the target application; s7, searching under the file directory according to the name of the binary file of the started target application, and storing the binary file of the started target application in a bin directory; and S8, a kaiming software package is directly exported through a command kaiming build-export. The technical problems of high learning cost, high trial and error cost and high time cost in software package format conversion are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of software package conversion, and specifically provides a method for converting a deb package or an rpm package of an application into a kaiming package. Background Art

[0002] With the continuous development and use of domestic Linux systems, more and more developers and enterprises choose domestic operating systems as their operating platforms. As the ecosystem continues to improve, the openkylin system has released a new package manager, kaiming, to provide users with a safer application execution environment.

[0003] The package manager kaiming appeared relatively late, which resulted in many application developers already adapting to the deb and rpm formats. As a latecomer, kaiming requires applications to be re-adapted. During the adaptation period, it is necessary to re-sort the software dependencies, compile and verify the software, and modify the kaiming data file based on the verification results until the application can be used normally.

[0004] Currently, the software package formats that are widely used in Linux systems are mainly deb and rpm. There are existing tools for converting these two package formats to each other, but kaiming, as a new software package format, is still blank in converting other software packages into kaiming packages.

[0005] For the kaiming package format, the time cost and trial-and-error cost from writing the most basic configuration file to the YAML file to completing the compilation and verification of the software package will cause application developers to be unable to see the specific application execution effect in the first place, reducing the software adaptation efficiency. In addition, some software will not be replaced with a new software package format because it is only in the maintenance stage.

[0006] Accordingly, the art needs a method that can convert the existing deb or rpm package into the kaiming package format to solve the above problems and speed up the entire adaptation process. Summary of the invention

[0007] In order to overcome the above defects, a technical solution is proposed to solve the technical problems of high learning cost, high trial and error cost and high time cost in software package format conversion.

[0008] The present invention provides a method for converting a deb package or an rpm package of an application into a kaiming package, comprising the following steps:

[0009] S1: Obtain a preset metadata file template, where the metadata file template includes the name of the kaiming software package of the target application and the name of the binary file for starting the target application;

[0010] S2: creating a software name directory according to the kaiming software package name, and storing the metadata file template in the software name directory;

[0011] S3: Create a files directory under the software name directory, and decompress the deb package or rpm package of the target application into the files directory;

[0012] S4: Get the name of the dependent package according to the decompressed file content;

[0013] S5: According to the dependency package name, decompress the corresponding dependency package into the files directory, and return to S4 until all missing dependency packages are decompressed;

[0014] S6: Create export and var directories under the files directory, store the desktop files and icon files after the deb package or rpm package of the target application is decompressed into the export directory, and delete the static library files, pkgconfig files, and share / man files after the deb package or rpm package of the target application is decompressed;

[0015] S7: Search in the files directory according to the name of the binary file of the target application to be started, and store the binary file of the target application to the bin directory;

[0016] S8: Use the kaiming build-export command to directly export the kaiming software package.

[0017] Furthermore, the kaiming software package name of the target application and the binary file name for starting the target application are manually filled in by the developer according to the target application.

[0018] Furthermore, the metadata file template also includes the default filled-in dbus, dev, file directory, debug, locale and default runtime. The dbus, dev and file directory are kaiming's permission control over the target application, the debug is the parameter required for kaiming to debug the application, and the default runtime includes the initial dependency package of the kaiming software package.

[0019] Further, the step S4 comprises:

[0020] Get the DEBIAN directory after decompressing the deb package in the files directory, and get the name of the dependent package of the deb package from the Depends field of the control file in the DEBIAN directory; or

[0021] Directly obtain the name of the dependent package of the rpm package by executing the preset command in the files directory.

[0022] Further, the corresponding dependent package is decompressed into the files directory according to the dependent package name, including:

[0023] For the name of the direct dependency package of the target application, obtain the corresponding runtime directory according to the default dependency runtime, obtain the package.json file in the runtime directory, and create a depends.json file in the files directory. Use the dependency package name as a keyword to search in the package.json file. For the dependency package that is not found, download it to the local computer through apt / yum and decompress it to the files directory, and store the processed dependency package name in the depends.json file;

[0024] For the indirect dependency package name of the target application, directly unzip the corresponding dependency package to the files directory.

[0025] Furthermore, the bin directory is a folder under the files directory where the deb package or rpm package is decompressed.

[0026] Further, it is characterized in that

[0027] The directly dependent package is the name of the dependent package obtained by decompressing the deb package or rpm package of the target application into the files directory;

[0028] The indirect dependency package name is the dependency package name obtained by decompressing the direct dependency package of the target application or the indirect dependency package of the target application into the files in the files directory.

[0029] The present invention has the following beneficial effects:

[0030] In the technical solution of the present invention, it is only necessary to fill in the basic information of the application and the required permissions and dbus information according to the metadata file template, and the rest of the work can be automatically executed by the program, which reduces a lot of time cost for the YAML file writing and compilation process of the kaiming software package from scratch. The deb / rmp package is directly converted into the kaiming software package to fill in the gaps related to the software package conversion tool, reduce the learning cost required by developers when adapting the kaiming software package, and increase development efficiency. Solve the problem that users want to run the software in kaiming format to improve system security, but individual applications are not adapted to the kaiming format. Through the automatic processing of the program, the adaptation items that developers need to fill in the configuration file are reduced, and compilation problems and dependency problems are avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0032] Figure 1 The present invention is a flow chart of main steps of a method for converting a deb package or rpm package of an application into a kaiming package. DETAILED DESCRIPTION

[0033] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0034] Here we first explain some terms involved in the present invention.

[0035] openkylin system: openkylin is a desktop Linux system with complete functions and good user experience released by the domestic root community openkylin.

[0036] Kaiming: A new Linux-based package manager released by the Open Kylin Community, which includes a new package format, provides isolated execution environments and more detailed permission control for applications.

[0037] Format conversion: The process of converting one file format to another.

[0038] Metadata: The software description file required for the execution of the kaiming software package. The metadata file contains the name of the software, the name of the dependent runtime, which dbus permissions the system needs to grant, the file directory to be used, and can set custom environment variables. It sets the binary program name when the application is started, sets whether read and write permissions for related device files are required, and whether to include additional localization and debug content.

[0039] In the embodiments of the present invention, kaiming package and kaiming software package both refer to software packages in kaiming format, deb package and deb software package both refer to software packages in deb format, rmp package and rmp software package both refer to software packages in rmp format, and target application refers to the application that is currently to be converted into a file format (converting a deb or rmp package into a kaiming package).

[0040] Figure 1 The present invention is a flow chart of the main steps of a method for converting an application deb package or rpm package into a kaiming package. Figure 1 As shown, a method for converting a deb package or rpm package of an application into a kaiming package in this embodiment mainly includes the following steps S1 to S8.

[0041] Step S1: Obtain a preset metadata file template, where the metadata file template includes the kaiming software package name of the target application and the binary file name for starting the target application.

[0042] Before converting the file format, first obtain the metadata file template, which has already filled in the default contents of dbus, dev, file directory, debug, locale and default runtime. Then, manually fill in the custom kaiming package name and the binary file name of the startup application in the current metadata file template according to the target application. If necessary environment variables need to be set, they should also be added to the metadata file template.

[0043] Among them, dbus, dev, and file directory can be considered as Kaiming's permission control over the application. debug is the parameter required by Kaiming to debug the application. Runtime is the necessary content for the execution of the Kaiming software package (also the only dependency required by the Kaiming software), specifically:

[0044] dbus: A communication service under Linux. After setting up dbus, you can communicate with other programs in Linux through dbus. Applications using the kaiming package can interact with other applications in the system through dbus and use the dbus functions provided by the system.

[0045] dev: Indicates the device (hard disk, USB flash drive, terminal, etc.) file in the Linux system. Kaiming can control the dev file to limit the application's reading, writing and use of external devices (such as printers and USB flash drives). If Kaiming does not have dev permissions, the application cannot control these two hardware.

[0046] File directory: The file directory open to applications using the kaiming package. Kaiming can limit the directory access of applications. This parameter can set which directories applications using the kaiming package can use. For example, if the file directory is set to / home / test / data, then file directories other than this directory cannot be accessed by the application.

[0047] debug: refers to debugging information, which is a parameter used to control whether to generate debugging information. It is used to debug applications in kaiming.

[0048] Locale: localization, translating the text displayed on the program interface into the local language. It is used to set whether the program's translation file needs to be set separately. By default, the translation file is displayed as a separate plug-in.

[0049] Default dependent runtime: Applications using the kaiming package run in a sandbox, which provides a basic operating environment called runtime, which is the basic environment for application execution (similar to the Linux environment, but the runtime here is much simpler). Kaiming provides multiple runtimes to meet different application requirements.

[0050] In one embodiment, after the kaiming software package is completed and the software is tested, any unsatisfactory content in the metadata file template can be adjusted, and S8 is re-executed after the adjustment. When the application dependencies are satisfied during the testing phase, if only the metadata is modified, it is only necessary to re-package the software.

[0051] S2: Create a software name directory according to the kaiming software package name, and store the metadata file template in the software name directory.

[0052] S3: Create a files directory under the software name directory, download the deb package or rpm package of the target application to the local computer, and then decompress it into the files directory.

[0053] The format conversion program starts, obtains the kaiming package name of the target application from the metadata file template, creates a software name directory with the same name, and stores the metadata file template in the software name directory. Then, create a files directory in the software name directory, and unzip the deb / rpm package downloaded to the local computer to the files directory at the same level as the metadata file template.

[0054] S4: Analyze the dependency relationship of the software package according to the file content after the decompression of the deb package or the rpm package, and obtain the name of the dependent package.

[0055] Specifically for deb software packages, obtain the DEBIAN directory after decompressing the deb package in the files directory, and obtain the name of the software package that the deb package depends on from the Depends field of the control file in the DEBIAN directory; for rpm software packages, directly obtain the name of the dependent package of the rpm package by executing the preset command in the files directory.

[0056] The default command is "rpm-qpR***.rpm". The result of this command will output the software packages it depends on. The data will be in a column, and each row represents the name of a dependent software package. Among them, *** represents the software package name. Taking the test.rpm software package as an example, the corresponding command is "rpm-qpR test.rpm"

[0057] S5: According to the dependency package name, download all missing dependency packages to the local computer and decompress them to the files directory, and return to S4. Specifically, two cases are discussed here.

[0058] (1) For the name of the direct dependency package of the target application, which is the name of the dependency package obtained by decompressing the deb package or rpm package of the target application into the files directory, that is, the name of the dependency package obtained in step S3, perform the following steps:

[0059] First, get the corresponding runtime directory according to the default dependent runtime, get the package.json file in the runtime directory, and create a depends.json file in the files directory.

[0060] Then use the dependency package name as a keyword to search in the package.json file. For the dependency packages that are not found, download them to the local computer through apt / yum and decompress them to the files directory, and store the processed dependency package names in the depends.json file.

[0061] (2) For the indirect dependency package name of the target application, directly unzip the corresponding dependency package to the files directory.

[0062] The indirect dependency package name is the dependency package name obtained by decompressing the direct dependency package of the target application or the indirect dependency package of the target application into the files directory, that is, the dependency package name corresponding to the file obtained in the previously executed step S5.

[0063] Assuming that the target application has dependent packages A and B, then A and B are executed through the above (1) process. During the execution, the decompression of dependent package A may generate files C and D in the flies directory, and the decompression of dependent package B may generate files E and F in the flies directory. Then, when returning to S4, what is obtained may be the dependent package of one of files C, D, E, and F. At this time, the dependent package (name) is the indirect dependent package (name). Assuming that the dependent packages G and H of file C are obtained through S4, then G and H are executed through the above (2) process.

[0064] In this embodiment, the basic operating environment of the application is a runtime, and the default dependent runtime automatically filled in the metadata file template is a runtime environment configured for the target application. Kaiming's runtime includes some dependent packages by default, and the list of dependent packages in the runtime is in the "package.json" file in the runtime directory.

[0065] The "depends.json" file added in the files directory contains the names of the resolved dependency packages. Repeat the dependency package search operation in step S4 to see if the software dependencies are fully met. At this time, you need to compare the json file in the files directory with the json file in the runtime directory until all the dependency packages required for the execution of the kaiming software package have been installed.

[0066] S6: After the program resolves the dependencies, it is necessary to organize the decompressed file directory. Create export and var directories under the files directory, and store the desktop files and icon files of the target application's deb / rpm package in the export directory. The var directory exists as a necessary directory for kaiming compilation. Delete the static library files, pkgconfig files, and share / man files after decompressing the target application's deb / rpm package.

[0067] In one implementation, since not every deb / rpm package has desktop files, icon files or static library files, pkgconfig files, and share / man files after decompression, the files directory is first checked to see whether they exist. If they do not exist, the corresponding process of S6 is executed.

[0068] S7: Search in the files directory according to the binary file name of the target application to be started, and store the binary file of the target application to the / files / bin / directory by copying or soft linking. The bin directory is a folder obtained after the deb / rpm package is decompressed.

[0069] S8: Finally, combine them into the directory structure after kaiming compilation is completed, and then directly export them through the kaiming build-export command to skip the compilation stage and directly package the kaiming software package.

[0070] Based on the above steps S1 to S8, you only need to fill in the basic information of the application and the required permissions and dbus information according to the metadata file template. The rest of the work can be automatically performed by the program, which reduces the time cost of writing and compiling the YAML file of the kaiming software package from scratch. Convert the deb / rmp package directly to the kaiming software package to fill in the gaps related to the software package conversion tool, reduce the learning cost required by developers when adapting the kaiming software package, and increase development efficiency. Solve the problem that users want to run software in kaiming format to improve system security, but individual applications are not adapted to the kaiming format.

[0071] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0072] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A method for converting a deb package or rpm package of an application into a kaiming package, characterized in that: The following steps are involved: S1: Obtain a preset metadata file template, where the metadata file template includes the name of the kaiming software package of the target application and the name of the binary file for starting the target application; S2: creating a software name directory according to the kaiming software package name, and storing the metadata file template in the software name directory; S3: Create a files directory under the software name directory, and decompress the deb package or rpm package of the target application into the files directory; S4: Get the name of the dependent package according to the decompressed file content; S5: According to the dependency package name, decompress the corresponding dependency package into the files directory, and return to S4 until all missing dependency packages are decompressed; S6: Create export and var directories under the files directory, store the desktop files and icon files after the deb package or rpm package of the target application is decompressed into the export directory, and delete the static library files, pkgconfig files, and share / man files after the deb package or rpm package of the target application is decompressed; S7: Search in the files directory according to the name of the binary file of the target application to be started, and store the binary file of the target application to the bin directory; S8: Use the kaiming build-export command to directly export the kaiming software package.

2. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 1, characterized in that: The kaiming software package name of the target application and the binary file name for starting the target application are manually filled in by the developer according to the target application.

3. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 1, characterized in that: The metadata file template also includes the default filled-in dbus, dev, file directory, debug, locale and default runtime. The dbus, dev and file directory are Kaiming's permission control over the target application. The debug is the parameter required by Kaiming to debug the application. The default runtime includes the initial dependency package of the Kaiming software package.

4. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 1, characterized in that: The step S4 comprises: Get the DEBIAN directory after decompressing the deb package in the files directory, and get the name of the dependent package of the deb package from the Depends field of the control file in the DEBIAN directory; or Directly obtain the name of the dependent package of the rpm package by executing the preset command in the files directory.

5. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 3, characterized in that: According to the dependency package name, the corresponding dependency package is unzipped to the files directory, including: For the name of the direct dependency package of the target application, obtain the corresponding runtime directory according to the default dependency runtime, obtain the package.json file in the runtime directory, and create a depends.json file in the files directory. Use the dependency package name as a keyword to search in the package.json file. For the dependency package that is not found, download it to the local computer through apt / yum and decompress it to the files directory, and store the processed dependency package name in the depends.json file; For the indirect dependency package name of the target application, directly unzip the corresponding dependency package to the files directory.

6. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 1, characterized in that: The bin directory is a folder under the files directory where the deb package or rpm package is decompressed.

7. A method for converting a deb package or rpm package of an application into a kaiming package according to claim 5, characterized in that: The directly dependent package name is the dependent package name obtained by decompressing the deb package or rpm package of the target application into the file in the files directory; The indirect dependency package name is the dependency package name obtained by decompressing the direct dependency package of the target application or the indirect dependency package of the target application into the files in the files directory.