CN117573154B - Method and device for optimizing desktop application installation package based on electronics on Linux system - Google Patents

Method and device for optimizing desktop application installation package based on electronics on Linux system Download PDF

Info

Publication number
CN117573154B
CN117573154B CN202410057472.4A CN202410057472A CN117573154B CN 117573154 B CN117573154 B CN 117573154B CN 202410057472 A CN202410057472 A CN 202410057472A CN 117573154 B CN117573154 B CN 117573154B
Authority
CN
China
Prior art keywords
code
architecture
debian
package
bin
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.)
Active
Application number
CN202410057472.4A
Other languages
Chinese (zh)
Other versions
CN117573154A (en
Inventor
付正威
郭皓
吴春光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kirin Software Co Ltd
Original Assignee
Kirin Software Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Kirin Software Co Ltd filed Critical Kirin Software Co Ltd
Priority to CN202410057472.4A priority Critical patent/CN117573154B/en
Publication of CN117573154A publication Critical patent/CN117573154A/en
Application granted granted Critical
Publication of CN117573154B publication Critical patent/CN117573154B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting

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 invention provides a method and a device for optimizing desktop application installation packages based on an electron on a Linux system, which are used for compiling source codes of the desktop application based on the electron once in environments of a plurality of CPU architectures needing to be adapted to respectively obtain the installation packages corresponding to different CPU architectures; splitting the installation package into an architecture independent package and an architecture dependent package respectively; respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; compiling the updated source code once optionally with an environment of a CPU architecture to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture dependent package; the architecture independent packages are installed separately in an environment where multiple CPU architectures need to be adapted. The invention solves the problems that when the application based on the Electron is matched on a plurality of CPU architectures, compiling is needed for a plurality of times, downloading and installing are time-consuming, and storage space is wasted.

Description

Method and device for optimizing desktop application installation package based on electronics on Linux system
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method and a device for optimizing desktop application installation packages based on electronics on a Linux system.
Background
Electron is an open source framework that uses JavaScript, HTML and CSS to build a cross-platform desktop application. The method integrates the Chromium and the NodeJS into a runtime environment, and achieves the aim of constructing a desktop application program by using HTML, CSS, javaScript. VSCode, skype, whatsapp, new version QQ, etc. are well known open source or commercial applications, all built on Electron basis. The electronics are compatible with Mac, windows and Linux, and can build application programs of three platforms.
The code of the Electron is supporting multiple CPU architectures, but the Electron executable is architecture dependent, and the code of the Electron-based desktop application is architecture independent. Because the content in the desktop application installation package based on the Electron can be divided into two parts of an architecture independent file and an architecture dependent file, the installation package can be split, and the installation package on each CPU architecture can be split into an architecture independent package and an architecture dependent package. The architecture independent package is an installation package which can be shared by all CPU architectures, the content of the architecture independent package is mainly the function code of the application itself, and content update, bug repair and recompilation are needed frequently; the content of each CPU architecture is an architecture-related installation package, belongs to the application dependent item, basically does not change, and can be used all the time after once compiling.
Most of the installation packages of Linux desktop applications developed based on electronics are provided with an electronic executable file. The size of an Electron executable file is nearly 100M, and the size of an installation package is more than 100M, except for resource files such as HTML, javaScript, CSS.
For operating system manufacturers, when adapting to a plurality of CPU architectures, compiling and packaging are needed to be performed on each architecture respectively; when the codes of the application are updated, the codes are also required to be recompiled and packed on all the architectures, which is time-consuming and labor-consuming; the HTML, javaScript, CSS is originally used for enjoying the freedom of being not constrained by the platform architecture, and the version updating, the installation and the test of the application are not different from those of the common native application because of the influence of the architecture related files such as an Electron, and the installation package is larger. When multiple Electron-based desktop applications are installed on a system, multiple Electron executables are actually installed on the system, and in fact most applications can share the same Electron executable. Because a plurality of Electron executable files are installed, the storage space is wasted, the time for downloading and installing is longer, and the installation efficiency is affected.
Disclosure of Invention
The invention aims to provide a method and a device for optimizing desktop application installation packages based on an Electron on a Linux system, which solve the problems that compiling is needed for a plurality of times, downloading and installation are time-consuming and storage space is wasted when the Electron-based application is matched on a plurality of CPU architectures.
In order to achieve the above object, the technical scheme of the present invention is as follows:
an optimization method for desktop application installation packages based on electrons on a Linux system comprises the following steps:
s1, compiling source codes of desktop application based on electronics once in environments of a plurality of CPU architectures to be adapted respectively to obtain installation packages corresponding to different CPU architectures;
s2, dividing the installation package into an architecture independent package and an architecture dependent package respectively;
s3, respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; installing the desktop application by the installation framework irrelevant package;
s4, when the source code of the desktop application based on the electronics is updated, compiling the updated source code once optionally with an environment of a CPU architecture needing to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture related package;
s5, respectively installing the framework independent packages obtained in the step S4 in environments of a plurality of CPU frameworks needing to be adapted.
Further, in steps S2 and S4, the method for splitting the installation packet into the architecture independent packet and the architecture dependent packet includes:
s11, extracting the installation files in the installation package to the position below the directory code by using a dpkg-X command;
s12, extracting the installation script file in the installation package to the catalog code/DEBIAN by using a dpkg-e command;
s13, creating a structure related directory code-bin, copying the structure related files under the code directory to the directory code-bin, reserving the original directory structure during copying, and copying the control files under the code/DEBIAN directory to the directory code-bin/DEBIAN;
s14, modifying a control file under the code-bin/DEBIAN directory; the modification content comprises:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
s15, packaging out a framework related packet by using the catalog code-bin;
s16, deleting all the related files of the architecture under the code directory;
s17, modifying an installation script file under the code/DEBIAN directory; the modification content comprises:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/controlsed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
s18, packaging the framework irrelevant package by using the directory code.
Further, in steps S2 and S4, the installation package is split into the architecture independent package and the architecture dependent package using the split script.
The invention also provides an optimizing device for the desktop application installation package based on the electronics on the Linux system, which comprises the following steps:
and a compiling module: compiling source codes of desktop application based on electronics once in environments of a plurality of CPU architectures to be adapted respectively to obtain installation packages corresponding to different CPU architectures;
splitting module: splitting the installation package into an architecture independent package and an architecture dependent package respectively;
and (3) installing a module: respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; installing the desktop application by the installation framework irrelevant package;
updating the compiling splitting module: when the source code of the desktop application based on the electronics is updated, compiling the updated source code once optionally with an environment of a CPU architecture needing to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture related package;
updating an installation module: and respectively installing the framework independent packages obtained in the updating compiling splitting module in the environment of a plurality of CPU frameworks needing to be adapted.
Further, in the splitting module and the updating compiling splitting module, the splitting of the installation package into the architecture independent package and the architecture related package includes:
a first extraction unit: extracting the installation files in the installation package to the position under the directory code by using a dpkg-X command;
a second extraction unit: extracting an installation script file in an installation package to a catalog code/DEBIAN by using a dpkg-e command;
a correlation catalog unit: creating a structure related catalog code-bin, copying a structure related file under a code catalog to the catalog code-bin, reserving an original catalog structure during copying, and copying a control file under the code/DEBIAN catalog to the catalog code-bin/DEBIAN;
a first modification unit: modifying a control file under the code-bin/DEBIAN directory; the modification content comprises:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
a first packing unit: packaging the architecture-related package by using a catalog code-bin;
a deletion unit: deleting the related files of the architecture under the code directory;
a second modification unit: modifying an installation script file under a code/DEBIAN directory; the modification content comprises:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/controlsed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
a second packing unit: using the directory code, the fabric independent package is packed.
Furthermore, in the splitting module and the updating compiling splitting module, the installation package is split into a framework irrelevant package and a framework relevant package by using a splitting script.
The invention also provides a computer readable storage medium, wherein the storage medium stores a computer program, and the computer program is used for executing the optimization method of the desktop application installation package based on the electron on the Linux system.
Compared with the prior art, the invention has the following beneficial effects:
the invention realizes the desktop application based on the Electron, and the desktop application is compiled on the environments of a plurality of CPU architectures only once, and then the architecture related packages of each architecture are separated from the installation packages obtained in the front by using the installation package splitting script provided by the invention. And then, each time the source code is updated, only one architecture is compiled once, then, one architecture-independent installation package is separated, and the application can be installed and used on all architectures by combining the architecture-related packages on each architecture separated after the first compilation. The compiling times can be saved during iterative source code development and bug repair, the workload of version release can be reduced, and the time of a user can be saved during downloading and installing an application.
Drawings
Fig. 1 is a schematic flow chart of a first embodiment of the present invention.
Detailed Description
It should be noted that, without conflict, the embodiments of the present invention and features of the embodiments may be combined with each other.
The design idea of the invention is as follows: when the desktop application based on the Electron is compiled for the first time, the desktop application needs to be compiled once on all CPU architectures, and then the compiled installation package is split into an architecture independent package and an architecture dependent package by using the split script provided by the invention. The obtained architecture independent package only stores one, and all the architecture dependent packages are stored and installed on the corresponding CPU architecture. When the content is updated or bug repaired later, the content is compiled once on one CPU architecture, then the architecture independent package and the architecture dependent package are separated by using the split script, and only the architecture independent package is saved. The architecture independent package is used to install on each CPU architecture.
Embodiment one:
example one of the methods of the present invention was tested and verified. Preparing multiple CPU architectures to be adapted, in this embodiment including an environment of amd64, arm64, using source code-1.68.0 for the test Electron-based desktop application.
The specific process is as shown in fig. 1, and comprises the following steps:
1. the desktop application source code for testing-1.68.0 is compiled once on the environment of the amd64 that needs to be adapted, resulting in an installation package code_1.68.0-1654690107_amd64. Db.
2. The desktop application source code for testing-1.68.0 is compiled once on the environment of arm64 that needs adaptation, resulting in an installation package code_1.68.0-1654688734_arm64. Db.
3. The installation package obtained in the step 1 is split into an architecture independent package and an architecture related package respectively by using a splitting script, and the specific splitting steps are as follows:
(1) Extracting the installation files in the installation package to the directory code by using a dpkg-X command,
command "dpkg-X code_1.68.0-1654690107_amd64.deb code";
(2) Extracting the installation script file in the installation package to the catalog code/DEBIAN by using a dpkg-e command,
the commands are: "dpkg-e code_1.68.0-1654690107_amd64.deb code/'DEBIAN'";
(3) Creating a structure related catalog code-bin, copying a structure related file under a code catalog to the catalog code-bin, reserving an original catalog structure during copying, and copying a control file under the code/DEBIAN catalog to the catalog code-bin/DEBIAN;
(4) Modifying the code-bin/DEBIAN/control file, wherein the modification content is as follows:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
(5) Using the directory code-bin, the architecture-dependent packet code-bin 1.68.0-1654690107_amd64. Db is packed,
the commands are: "dpkg-deb-b code-bin bin/code-bin_1.68.0-1654690107_amd64.Deb";
(6) Deleting the related files of the architecture under the code directory;
(7) Modifying an installation script file under a code/DEBIAN directory; the modification content is as follows:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/control
sed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
(8) Using the directory code, the fabric independent packet code 1.68.0-1654690107_all.db is packed,
the commands are: "dpkg-deb-b code all/code_1.68.0-1654690107_all.
4. The installation package obtained in the step 2 is split into an architecture independent package and an architecture dependent package code_1.68.0-1654688734_all.deb and code-bin_1.68.0-1654688734_arm64.deb by using a split script in the same manner as in the step 3.
5. The architecture-dependent packet code-bin_1.68.0-1654690107_amd64. Db obtained in step 3 was installed on the environment of amd64, and the architecture-dependent packet code-bin_1.68.0-1654688734_arm64. Db obtained in step 4 was installed on the environment of arm64.
6. The test source code-1.68.0 is modified and then the modified source code is compiled once in the environment of amd64 to obtain an installation package code_1.68.0-1654691124_amd64. Db.
7. And (3) adopting a splitting method similar to the step (3), and splitting the installation package obtained in the step (6) into an architecture independent package and an architecture dependent package code_ 1.68.0-1654691124_all.db and code-bin_ 1.68.0-1654691124_amd64.db by using a splitting script.
8. The architecture independent package code_ 1.68.0-1654691124_all.db obtained in step 7 is installed on the environment of amd64, and the architecture independent package code_ 1.68.0-1654691124_all.db obtained in step 7 is installed on the environment of arm64.
9. Executing the code command on the environment of amd64 and the environment of arm64, respectively, it can be seen that the code application is launched normally.
10. The steps 6, 7, 8 and 9 can see that the source code is compiled once after being modified, the architecture independent package obtained through splitting can be normally installed and used in the environments of the amd64 and the arm64, if the architecture independent package is released outwards, the architecture independent package of all architectures is released except for the first release, and only one architecture independent package is released every time later.
Through verification of the embodiment, the method can realize desktop application based on the Electron, and the method only needs to compile on a plurality of CPU architecture environments once, and then separates the architecture related packages of each architecture from the installation packages obtained in the front by using the installation package splitting script provided by the invention. And then, each time the source code is updated, only one architecture is compiled once, then, one architecture-independent installation package is separated, and the application can be installed and used on all architectures by combining the architecture-related packages on each architecture separated after the first compilation. The compiling times can be saved during iterative source code development and bug repair, the workload of version release can be reduced, and the time of a user can be saved during downloading and installing an application.
Embodiment two:
in a second embodiment, an optimization device for an electronic-based desktop application installation package on a Linux system is provided, including:
and a compiling module: compiling source codes of desktop application based on electronics once in environments of a plurality of CPU architectures to be adapted respectively to obtain installation packages corresponding to different CPU architectures;
splitting module: splitting the installation package into an architecture independent package and an architecture dependent package respectively;
and (3) installing a module: respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; installing the desktop application by the installation framework irrelevant package;
updating the compiling splitting module: when the source code of the desktop application based on the electronics is updated, compiling the updated source code once optionally with an environment of a CPU architecture needing to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture related package;
updating an installation module: and respectively installing the framework independent packages obtained in the updating compiling splitting module in the environment of a plurality of CPU frameworks needing to be adapted.
In the splitting module and the updating compiling splitting module, the installation package is split into an architecture independent package and an architecture related package, which comprise:
a first extraction unit: extracting the installation files in the installation package to the position under the directory code by using a dpkg-X command;
a second extraction unit: extracting an installation script file in an installation package to a catalog code/DEBIAN by using a dpkg-e command;
a correlation catalog unit: creating a structure related catalog code-bin, copying a structure related file under a code catalog to the catalog code-bin, reserving an original catalog structure during copying, and copying a control file under the code/DEBIAN catalog to the catalog code-bin/DEBIAN;
a first modification unit: modifying a control file under the code-bin/DEBIAN directory; the modification content comprises:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
a first packing unit: packaging the architecture-related package by using a catalog code-bin;
a deletion unit: deleting the related files of the architecture under the code directory;
a second modification unit: modifying an installation script file under a code/DEBIAN directory; the modification content comprises:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/controlsed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
a second packing unit: using the directory code, the fabric independent package is packed.
In the splitting module and the updating compiling splitting module, the installation package is split into a framework irrelevant package and a framework relevant package by using a splitting script.
The optimization device for the desktop application installation package based on the electrons provided by the embodiment of the invention can realize the optimization method for the desktop application installation package based on the electrons on the Linux system.
Embodiment III:
in a third embodiment, a storage medium is provided that contains computer-executable instructions that, when executed by a computer processor, are configured to perform a method of optimizing an electron-based desktop application installation package on a Linux system provided by the present invention.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The above embodiments are merely preferred embodiments of the present invention and are not intended to limit the present invention, and any modifications, equivalent substitutions, improvements, etc. within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (5)

1. An optimization method for desktop application installation packages based on electronics on a Linux system is characterized by comprising the following steps:
s1, compiling source codes of desktop application based on electronics once in environments of a plurality of CPU architectures to be adapted respectively to obtain installation packages corresponding to different CPU architectures;
s2, dividing the installation package into an architecture independent package and an architecture dependent package respectively;
s3, respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; installing the desktop application by the installation framework irrelevant package;
s4, when the source code of the desktop application based on the electronics is updated, compiling the updated source code once optionally with an environment of a CPU architecture needing to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture related package;
s5, respectively installing the framework independent packages obtained in the step S4 in environments of a plurality of CPU frameworks needing to be adapted;
in steps S2 and S4, the method for splitting the installation packet into the architecture independent packet and the architecture dependent packet includes:
s11, extracting the installation files in the installation package to the position below the directory code by using a dpkg-X command;
s12, extracting the installation script file in the installation package to the catalog code/DEBIAN by using a dpkg-e command;
s13, creating a structure related directory code-bin, copying the structure related files under the code directory to the directory code-bin, reserving the original directory structure during copying, and copying the control files under the code/DEBIAN directory to the directory code-bin/DEBIAN;
s14, modifying a control file under the code-bin/DEBIAN directory; the modification content comprises:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
s15, packaging out a framework related packet by using the catalog code-bin;
s16, deleting all the related files of the architecture under the code directory;
s17, modifying an installation script file under the code/DEBIAN directory; the modification content comprises:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/controlsed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
s18, packaging the framework irrelevant package by using the directory code.
2. The method for optimizing desktop application installation packages on an electron-based desktop application according to claim 1, wherein in steps S2 and S4, the installation packages are split into architecture-independent packages and architecture-dependent packages using a split script.
3. An optimizing device for desktop application installation packages based on electronics in a Linux system, which is characterized by comprising:
and a compiling module: compiling source codes of desktop application based on electronics once in environments of a plurality of CPU architectures to be adapted respectively to obtain installation packages corresponding to different CPU architectures;
splitting module: splitting the installation package into an architecture independent package and an architecture dependent package respectively;
and (3) installing a module: respectively installing corresponding architecture related packages in environments of a plurality of CPU architectures to be adapted; installing the desktop application by the installation framework irrelevant package;
updating the compiling splitting module: when the source code of the desktop application based on the electronics is updated, compiling the updated source code once optionally with an environment of a CPU architecture needing to be adapted, and splitting the compiled installation package into an architecture independent package and an architecture related package;
updating an installation module: respectively installing the framework independent packages obtained in the updating, compiling and splitting module in the environment of a plurality of CPU frameworks needing to be adapted;
in the splitting module and the updating compiling splitting module, the installation package is split into an architecture independent package and an architecture related package, which comprise:
a first extraction unit: extracting the installation files in the installation package to the position under the directory code by using a dpkg-X command;
a second extraction unit: extracting an installation script file in an installation package to a catalog code/DEBIAN by using a dpkg-e command;
a correlation catalog unit: creating a structure related catalog code-bin, copying a structure related file under a code catalog to the catalog code-bin, reserving an original catalog structure during copying, and copying a control file under the code/DEBIAN catalog to the catalog code-bin/DEBIAN;
a first modification unit: modifying a control file under the code-bin/DEBIAN directory; the modification content comprises:
“sed -i "s/Package: code/Package: code-bin/g" code-bin/DEBIAN/control
LINE=`grep 'Provides:' code-bin/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code-bin/g" code-bin/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code-bin/g" code-bin/DEBIAN/control”;
a first packing unit: packaging the architecture-related package by using a catalog code-bin;
a deletion unit: deleting the related files of the architecture under the code directory;
a second modification unit: modifying an installation script file under a code/DEBIAN directory; the modification content comprises:
“LINE=`grep 'Provides:' code/DEBIAN/control`
PRONAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Provides: ${PRONAME}/Provides: code/g" code/DEBIAN/control
sed -i "s/Conflicts: ${PRONAME}/Conflicts: code/g" code/DEBIAN/control
sed -i "s/Replaces: ${PRONAME}/Replaces: code/g" code/DEBIAN/control
LINE=`grep 'Architecture:' code/DEBIAN/control`
ARCHNAME=`echo ${LINE} | cut -d ' ' -f 2`
sed -i "s/Architecture: ${ARCHNAME}/Architecture: all/g" code/DEBIAN/controlsed -i "s/Depends:/Depends: code-bin,/g" code/DEBIAN/control”;
a second packing unit: using the directory code, the fabric independent package is packed.
4. The apparatus for optimizing desktop application installation packages on an electron-based desktop application according to claim 3, wherein the installation packages are split into architecture-independent packages and architecture-dependent packages using a split script in the splitting module and the update compilation splitting module.
5. A computer readable storage medium, wherein the storage medium stores a computer program for executing the optimization method for an electron-based desktop application installation package on the Linux system according to any one of claims 1-2.
CN202410057472.4A 2024-01-16 2024-01-16 Method and device for optimizing desktop application installation package based on electronics on Linux system Active CN117573154B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410057472.4A CN117573154B (en) 2024-01-16 2024-01-16 Method and device for optimizing desktop application installation package based on electronics on Linux system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410057472.4A CN117573154B (en) 2024-01-16 2024-01-16 Method and device for optimizing desktop application installation package based on electronics on Linux system

Publications (2)

Publication Number Publication Date
CN117573154A CN117573154A (en) 2024-02-20
CN117573154B true CN117573154B (en) 2024-04-12

Family

ID=89862797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410057472.4A Active CN117573154B (en) 2024-01-16 2024-01-16 Method and device for optimizing desktop application installation package based on electronics on Linux system

Country Status (1)

Country Link
CN (1) CN117573154B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5432937A (en) * 1993-08-20 1995-07-11 Next Computer, Inc. Method and apparatus for architecture independent executable files
CN111142935A (en) * 2019-12-31 2020-05-12 奇安信科技集团股份有限公司 Method, apparatus, computer system, and medium for cross-platform running of applications
CN112947947A (en) * 2019-12-11 2021-06-11 华为终端有限公司 Downloading method and distribution method of installation package, terminal equipment, server and system
CN113179314A (en) * 2021-04-25 2021-07-27 网易(杭州)网络有限公司 Channel installation package processing method and device
CN113377415A (en) * 2021-06-28 2021-09-10 郑州阿帕斯数云信息科技有限公司 Application publishing method and device
CN114637519A (en) * 2022-02-18 2022-06-17 联想(北京)有限公司 Method and device for installing infrastructure and service
CN115061691A (en) * 2022-06-14 2022-09-16 杭州安恒信息技术股份有限公司 Integration method, device, equipment and readable storage medium
CN115357257A (en) * 2022-10-21 2022-11-18 统信软件技术有限公司 Installation file generation method, system, computing device and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5432937A (en) * 1993-08-20 1995-07-11 Next Computer, Inc. Method and apparatus for architecture independent executable files
CN112947947A (en) * 2019-12-11 2021-06-11 华为终端有限公司 Downloading method and distribution method of installation package, terminal equipment, server and system
CN111142935A (en) * 2019-12-31 2020-05-12 奇安信科技集团股份有限公司 Method, apparatus, computer system, and medium for cross-platform running of applications
CN113179314A (en) * 2021-04-25 2021-07-27 网易(杭州)网络有限公司 Channel installation package processing method and device
CN113377415A (en) * 2021-06-28 2021-09-10 郑州阿帕斯数云信息科技有限公司 Application publishing method and device
CN114637519A (en) * 2022-02-18 2022-06-17 联想(北京)有限公司 Method and device for installing infrastructure and service
CN115061691A (en) * 2022-06-14 2022-09-16 杭州安恒信息技术股份有限公司 Integration method, device, equipment and readable storage medium
CN115357257A (en) * 2022-10-21 2022-11-18 统信软件技术有限公司 Installation file generation method, system, computing device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Package Management System in Linux;Shrinidhi G Hegde;《2021 Asian Conference on Innovation in Technology(ASIANCON)》;20211004;全文 *

Also Published As

Publication number Publication date
CN117573154A (en) 2024-02-20

Similar Documents

Publication Publication Date Title
US9417857B2 (en) Unifying static and dynamic compiler optimizations in source-code bases
KR102077360B1 (en) Generating native code from intermediate language code for an application
CN111381852A (en) Application dynamic updating method and device based on Flutter, storage medium and electronic equipment
CN105786538B (en) software upgrading method and device based on android system
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
US8997085B2 (en) Image delta-based upgrade of complex stack in software appliance
KR20140124774A (en) Generating and caching software code
US10303449B2 (en) Compiling non-native constants
JP2012527027A (en) System and method for building a runtime environment
US8881123B2 (en) Enabling symbol resolution of private symbols in legacy programs and optimizing access to the private symbols
US20110067018A1 (en) Compiler program, compilation method, and computer system
KR102052776B1 (en) Installation engine and package format for parallelizable, reliable installations
CN104134039A (en) Virus checking and killing method, virus checking and killing client, virus checking and killing server and virus checking and killing system
CN116401003A (en) Android application running method, system and storage medium based on desktop operating system
CN102364433A (en) Method for realizing Wine construction tool transplanting on ARM (Advanced RISC Machines) processor
CN117573154B (en) Method and device for optimizing desktop application installation package based on electronics on Linux system
CN114490103A (en) Operating system interface calling method and device and electronic equipment
CN111061486B (en) Android application program increment method
US20170003958A1 (en) Non-transitory computer-readable recording medium, information processing device, and information processing method
KR101349631B1 (en) Method For Transforming Intermediate Language, System And Computer-Readable Recording Medium with Program Therefor
US9612808B1 (en) Memory use for string object creation
CN110874226B (en) Android system function upgrading method
CN112379885A (en) Applet compiling method, device and equipment and readable storage medium
US9720660B2 (en) Binary interface instrumentation
CN113220303A (en) Compiling method and system of kernel module

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
GR01 Patent grant
GR01 Patent grant