Embodiment
Reach technological means and the effect that predetermined goal of the invention is taked for further setting forth the present invention, below in conjunction with accompanying drawing, to its embodiment of unified modeling method, method, step, structure, feature and the effect thereof that proposes according to invention based on the GraphML language of unified software package metadata format and expansion, describe in detail as after.
Relevant aforementioned and other technology contents, characteristics and effect of the present invention present with reference to knowing in the graphic detailed description in following cooperation.By the explanation of embodiment, when can being to reach the technological means of being taked of predetermined purpose and effect is able to more deeply and concrete understanding to the present invention, yet appended graphic only provide with reference to the usefulness of explanation, be not to be used for the present invention is limited.
In order better to understand content of the present invention, provide some relevant notions below:
(1) but the installation unit bag
But the installation unit bag is a kind of file set that comprises contents such as metadata, program file, configuration information and installation script, is that of composition software can install base unit.In (SuSE) Linux OS, be called software package, but this paper primary study the dependence management of the installation unit bag on the (SuSE) Linux OS, but therefore followingly abbreviate the installation unit bag as software package.
(2) dependence between software package
Generally speaking, the dependence between the software package can be divided into two classes: rely on and conflict.For install software bag p1, install software bag p2 at first, there is dependence in p1 to p2; Software package p1 and p2 can't exist jointly, claim that between p1 and the p2 be conflict relationship.Can obtain the dependence and the conflict constraint information of bag from the meta data file of software package.
(3) the dependence satisfiability of software package
For a software package set R, the dependence satisfiability of software package p refers among the R, in software package set R, has an assignment λ, D
λ(X) for relying on function, definition D
λ(X) be the set of the direct dependent software package of X.D
N λ(p) expression D
λ(D
λ(D
λ(... (D
λ(p) ...))), to subclass
In arbitrary software package x, make
,
And
(4) software package can be installed
For software package set R, a given software package p if p meets the dependence satisfiability with respect to software package set R, then claims p can install on software package set R.
(5) or rely on and dependence
Most dependence is " with relying on ", if software package A " with relying on " is software package B and C, represents that then software package A under the situation that lacks B or C, can not use.
Some software package form can be supported " or dependence " relation, if software package A " or dependence " is software package B and software package C, represents that then software package A exists under the situation at B or the arbitrary bag of C, just can use.In DEB software package form, Depends, Recommands, Suggests and Pre-Depends relation are all supported " or dependence ".
(6) expression of dependence
A dependence also limits the version that it relies on through regular meeting.If software package A depends on libc6 (>=2.4), just show that software package depends on libc6, and version must be more than or equal to 2.4.
One has the comparison of five kinds of different versions about bag:
=equal fully;<=be less than or equal to;>=more than or equal to;<less than;>greater than.
(7) empty bag
Empty bag is meant one group of general designation with software of approximation function, and for example tin and trn are newsreaders, for other program that need upgrade reading in the system provides service.Therefore we can say that they all provide the void bag of " news-reader (news reading) ".
Equally, the function that mail transport agent all is provided of smail and sendmail.Therefore say that they provide the void bag of " mail transport agent (mail transport agent) ", both installations can be satisfied the void bag requirement of other program for " mail transport agent ".Empty bag does not have version number.
(8) classification of dependence
8 kinds of different dependences that comprise in the Linux software package metadata are as follows:
The Depends relation: if having dependence between software package B and the software package A, this just means that software package B can not move under the situation that lacks software package A.
The Recommends relation: identical with the Depends relation, but dependence noted here is not that pressure is necessary.
The Suggests relation: if there is Suggests relation (ASuggests B) between software package B and the software package A, this just means that software package A can strengthen the function of software package B.But under the situation that software package A lacks, software package B still can move.
Pre-Depends relation: belong to dependence when installing.If software package B and software package A have the Pre-Depends relation, show that software package B needs the support of software package A when mounted.
The Enhances relation: similar to the Suggests relation, if software package A and software package B have the Enhances relation, expression software package A can strengthen the function of software package B.
Conflicts relation: the conflict relationship between the expression software package.If software package A conflicts with software package B, then software package A and software package B can not coexist in same system.
Replaces relation: a kind of method that can manage conflict is provided.If software package A can Replaces software package B, then software package B just must first remove from system, and software package A just can be mounted then.
Provides relation: the empty bag relation of expression.
The unified modeling method based on the GraphML language of unifying software package metadata format and expansion that the present invention proposes may further comprise the steps:
Step 10: the dependence of resolving in the software package is expressed as unified software package metadata format Package form.
Be illustrated in figure 1 as dependence leaching process figure between the Linux software package, may further comprise the steps:
Step 101:,, propose a kind of unified software package metadata format Package form and XML method for expressing thereof from the angle of dependence modeling according to various Linux software package form.
At first enter step 1011:, provide the element that unified software package metadata format Package form is comprised from dependence modeling angle according to various Linux software package form;
Execution in step 1012 then: the descriptive definition that provides the element that is comprised in the Package form;
Various Linux software package form is arranged, as Redhat Linux software package is the rpm form, Debian Linux is the deb form, software package also can be forms such as tgz or pkg, the content that different software package forms comprises is also variant, the analysis of different software packet format and contrast as shown in table 1.When extracting the parlor dependence, need handle respectively at different packet formats, a kind of packet format of every increase, just need make modification to the appropriate section of dependence modeling member, for making dependence modeling member be independent of various packet format, need it to be input as a unified bag metadata format, the present invention proposes a kind of unified software package metadata format from dependence modeling angle for this reason, and this metadata format has only comprised the required necessary information of dependence modeling.Separate with dependence modeling member by of parsing, the dependence extraction of unified bag metadata format, to increase extensibility separately different-format software package information.Unified software package metadata format definition is as shown in table 2.
The contrast of table 1 different software packet format
The definition of the unified software package metadata format of table 2
Wherein:
(1) pk_depends in the table 2, pk_pre_depends, pk_suggests, pk_recommands, pk_enhances, pk_provides, pk_replaces and pk_conflicts represent the following eight kinds of different dependences of Linux respectively.
(2) PackageVersion in the table 2 represents a dependence in the software package metadata, and it has the title that three field: dep_pkg_name represent to rely on bag, does not comprise version number; Dep_version_operator represents to rely on the version operational character of bag, has five values (GE, LE, LT, GT, enumeration type EQ), represent five kinds of comparisons, be respectively:>=more than or equal to,<=be less than or equal to,<less than,>greater than ,=equal fully; Dep_version represents to rely on the version number of bag.
(3) pk_depends in the table 2, pk_pre_depends, pk_suggests, pk_recommands and pk_enhances relation are different with the method for expressing of pk_provides, pk_replaces and pk_conflicts, and this mainly is because five kinds of comparisons of software package version need to support " or dependence " relation.
Last execution in step 1013:, provide the XML method for expressing of Package form according to the Package form.
The present invention adopts XML to describe unified software package metadata.The XML of the unified software package metadata format of the present invention's definition represents as shown in Figure 2.
Wherein, be converted to name node among the XML corresponding to the pk_name in the Package structure in the table 2; Pk_version in the Package structure is converted to the version node among the XML; Pk_architecture in the Package structure is converted to the architecture node among the XML; Pk_size in the Package structure is converted to the size node among the XML; Pk_installed_size in the Package structure is converted to the installed_size node among the XML; Pk_source attribute in the Package structure can be converted to the source node among the XML, and will be divided into (software package title, software package version) two; These eight kinds of dependences of pk_provide in the Package structure, pk_conflicts, pk_replaces, pk_depends, pk_pre_depends, pk_suggests, pk_recommands and pk_enhances all can be converted to the dependency node among the XML, type in the dependency node represents the type that concerns, AndOrRelation represents " or with " relation, dependency-package-list represents to rely on the package list, each relies on bag and is divided into (software package name, operation, the software package version) three; Pk_description in the Package structure is converted to the description node among the XML.
Step 102: according to the software package form of input, read the software package file of Bao Ji of this kind software package form or the description document of Bao Ji, resolve and extract the dependence information of software package metadata.
At first enter step 1021:, judge the form of software package base according to the software package form of input;
Execution in step 1022 then: according to the form of Bao Ji, read the software package file of Bao Ji of this kind form or the description document of Bao Ji;
Last execution in step 1023:, resolve and extract the dependence information of software package metadata according to the description document of software package file that reads or Bao Ji.
The current metadata parsing work of supporting DEB, RPM, Cache and four kinds of formatted files of HDList.As shown in Figure 1, according to the software package form of input, the software package form is judged; Read the software package file of Bao Ji of this kind software package form or the description document of Bao Ji then, if what read in is that (description document of RPM bag base is HDList for the description document of Bao Ji, the description document of Debian bag base is DebianCache), resolve the basic description document of bag, obtain the attribute of an element value and the content of unified software package meta data definition; If that read in is Bao Ji, then judge the form of software package, if rpm format software bag, then read the spec file, if deb format software bag then reads the control file, the software package file that parsing is read is obtained the property value that belongs to originally and the content of unified software package meta data definition.
A preferred embodiment of the present invention be with DEB software package form as software package to be described,, resolve its process and to the transfer process of unified software package metadata format.
DEB software package form is as follows:
·apache2_2.2.8-lubuntu0.3_all.deb
оdebian-binary(version)
оcontrol.tar.gz
·postinst(post-install?script)
·prerm(pre-removal?script)
·postrm(post-removal?script)
·md5sums(MD5sums?for?data.tar.gz)
·control(package?metadata)
оdata.tar.gz
·/usr
·/usr/lib
·...
A DEB bag is an AR file, and it is comprising three members: two compressed files of the version number of bag (being generally 2.0 now) with the GZIP packing, and as implied above.In compressed file, comprising the file that metadata (control information of bag) and this bag will be installed respectively.
Control.tar.gz file the inside is comprising all metadata, in the controlling packet except comprising metadata, it also comprised whole bag the MD5 verification and, can comprise also certainly that simultaneously those are mounted the script file of required operation when deleted at bag.
Comprised all metadata informations among the control documents control, it is that a text is comprising many different paragraphs, is comprising many different fields in each paragraph again.Cut apart with blank line between the paragraph.The control file content of libmyth-dev as shown below
Package:libmyth-dev
Priority:optional
Section:multiverse/libdevel
Installed-Size:1776
Maintainer: MythTV Ubuntu Maintainers
<ubuntu-mythtv@lists.ubuntu.com>
Original-Maintainer:Christian?Marillat<marillat@debian.org>
Architecture:i386
Source:mythtv
Version:O.22.0+fixes18207-0ubuntu4~hardv1
Provides:libmyth-0.21-0-dev
Depends:libmyth-O.21-O (=O.21.O+fixes18207-Oubuntu4~hardy1),
libqt3c102-mt-dev|libqt3-mt-dev
Conflicts:libmyth-0.2l-dev
Filename:
pool/multiverse/m/mythtv/libmyth-dev?0.21.0+fixes18207-0ubuntu4~h
ardv1_i386.deb
Size:358762
MD5sum:72c1ea0de80067fb0e48536d98de010d
SHA1:402c83e016db3d39f3b1c1fb1098537fa4d0870f
SHA256:
66abff43def8e6cc7b05779bda98a142ff91a088046645364fa2b7c88b9d
5f56
Description:Common?library?code?for?MythTV?and?add-on?modules
(development)
MythTV?provides?a?unified?graphical?interface?for?recording?and
viewing
television programs.Refer to the mythtv?package for more
information.
·
This?package?contains?files?needed?for?developing?applications?which
use
libmyth(such?as?the?various?add-ons?for?MythTV)
Bugs:mailto:ubuntu-users@lists.ubuntu.com
Homepage:http://www.mythtv.org
Origin:Ubuntu
Each field all can occupy the position of delegation usually, and text formatting is that field name adds the structure of quotation marks in the content that adds field.Control documents allows control field can occupy multirow, in this case, and all need be since second row with a space beginning.
Step 103: the dependence information translation that will obtain is unified software package metadata format Package form, and is expressed as the bag base description document of unified software package metadata description with XML.
At first execution in step 1031: with the dependence information translation of the software package metadata extracted be Package structure towards the dependence modeling; Follow above-mentioned steps 102, carry out following operation: the dependence information translation that will obtain is the Package form.
In the preferred embodiment, the dependence of DEB software package all is arranged in the control file, and the control file is a text, metadata of each line display.Each bar metadata separates with ": ", and Key is represented in the colon front, and content is represented in the back.Table 3 is the mapping situation of Key and Package.Resolve the control file,, obtain the attribute of an element value and the content of unified software package metadata Package organization definition according to the mapping relations of table 3.
Table 3
DEB metadata title |
Unified software package metadata |
Package |
pk_unit |
Installed-Size |
pk_installed_size |
Architecture |
pk_architecture |
Source |
pk_source |
Version |
pk_version |
Replaces |
pk_replaces |
Provides |
pk_provides |
Depends |
pk_depends |
Pre-Depends |
pk_pre_depends |
Suggests |
pk_suggests |
Conflicts |
pk_conflicts |
Size |
pk_size |
Description |
pk_description |
Step 1032 then: with the bag base description document of Package Structure Conversion for the unified software package metadata description represented with XML.According to the XML method for expressing of unified software package metadata format shown in Figure 2, the Package thaumatropy of describing according to abovementioned steps 1013 is the transformation rule of XML method for expressing, is expressed as the XML file.
It is as follows that the software package of different-format is converted to the algorithm of unified software package metadata:
Input: the description document place catalogue of different-format bag base or Bao Ji, and the storing directory of output file;
Output: the unified software package metadata description XML file of Bao Ji;
Algorithm steps:
(1) judges whether what read in is the basic description document of bag,, otherwise change (2) over to for Bao Ji if change (3) over to
(2) for each software package file under the basic catalogue of bag, carry out following operation:
1. judge the form of software package, if rpm format software bag then reads the spec file;
If deb format software bag then reads the control file;
2. resolution file obtains the attribute of an element value and the content of unified software package meta data definition;
3. according to the XML method for expressing of unified software package metadata format, unified software package metadata is write the unified software package metadata description XML file of Bao Ji.
(3) read the basic description document of bag (description document of RPM bag base is HDList, and the description document of Debian bag base is DebianCache); Resolve the basic description document of bag, obtain the attribute of an element value and the content of unified software package meta data definition; According to the XML method for expressing of unified software package metadata format, unified software package metadata is write the unified software package metadata description XML file of Bao Ji.
Above-mentioned algorithm is converted to unified software package metadata towards the dependence modeling with the software package descriptor of different-format.Read the software package descriptor of different-format, be converted to unified software package metadata description.
Step 20: will be expressed as of the GraphML language description of the dependence of unified software package metadata format Package form with expansion, and it is visual.
For set up in the step 10 based on dependence leaching process between unified software package meta-data pack, need carry out modeling process.Be illustrated in figure 3 as based on dependence between unified software package meta-data pack and extract and modeling process, may further comprise the steps:
Step 201:, GraphML is expanded the GraphML form that is expanded based on bag capital construction mould demand.
The parlor dependence of Bao Ji can adopt " with-or figure " describe.The parlor dependence of Bao Ji has the complex network characteristic.The present invention adopt GrapML pictorial symbolization language description Bao Ji the parlor dependence " with-or figure ".GraphML is the pictorial symbolization language based on XML, is a kind of comprehensive and easy-to-use graphics file format.GraphML is by the language core of describing the graphic structure attribute and can carry out flexible expansion mechanism according to application-specific data and form.GraphML supports oriented, undirected and combination chart; Support hypergraph; Hierarchy chart; Diagrammatic representation; External data is quoted; The resolver of application-specific attribute data and lightweight etc.Having separately the graphics file format of peculiar grammer with other compares, the advantage of GraphML is for adopting the grammer based on XML, this makes it become desirable figure generation, documenting and processing format, and allows the user by increasing attribute for its element or being<data〉mode of element increase structured content expands.Another chief reason of selecting GraphML is that GraphML supports super limit (super limit is meant the limit that is connected to a plurality of node), can be used for a software package in the emulation " and-or figure " and " or the dependence " between a plurality of software package to concern.
Based on GraphML, the present invention increases attribute and increase<data by being its element〉mode of element content expands it, satisfying the demand of bag capital construction mould, thereby obtained the GraphML form of expansion.
Step 202: the Package Structure Conversion is described for the GraphML file layout of expansion, generated the graphmlxml file.
The GraphML that the present invention is based on expansion represents the software package dependence graph, as shown in Figure 4.
Illustrate, dependence graph is made up of node node, limit edge and super limit hyperedge.Utilized node node modeling among the figure and formed the software package of Bao Ji, limit edge modeling the dependence between two software packages, the hyperedge modeling of super limit " or the dependence " between software package concern.Be described in detail as follows:
(1) node node
The composition of node node element mainly contains packagename attribute, version and provide child node.
● the title of packagename attribute representation software package (not comprising version number);
● version child node (1..N) is all different version situations of same names;
● provide child node (1..N) is all void bags that software package provided.
Fig. 5 has represented the example of a node node.
(2) edge node
The composition of node edge element mainly contains dependency-type, source and target attribute, and child node version.
● dependency-type is two dependence types between software package, and the value of type is:
Provide (Provides relation), install (Pre-Depends relation), run (Depends relation), conflict (Conflicts relation), replace (Replaces relation), suggest (Suggests relation), enhance (Enhances relation), recommend (Recommends relation);
● the source attribute is the source node (not comprising version number) of dependence;
● the target attribute is the destination node (not comprising version number) of dependence;
● version child node (1..N) expression has the version of two bags of dependence, and it has three attributes.Attribute source represents the version of source node, and target represents the version of destination node, and operator represents the comparison of dependence, and the comparison value is: LT, and LE, EQ, GE, GT, ALL, expression successively<,<=,==,>=,>and concern arbitrarily.
Fig. 6 has represented the example of an edge node.
(3) hyperedge node
The composition of node hyperedge element mainly contains the dependency-type attribute, child node endpoint and version.
● the type of dependency-type attribute representation dependence, same meaning in its implication and the edge node.
● endpoint has defined all involved bags of " or dependence " relation.The value of the attribute type of endpoint is in and out, and wherein in is the destination node of " or dependence ", and out is the source node of " or dependence ".The attribute node of endpoint represents to have the software package title of " or dependence " relation.Endpoint has the version daughter element, and it has illustrated the version information of software package in the dependence.Attribute source, the operator of version and target represent the version number of version number, relation character and the purpose software package of source software bag in the dependence respectively, and the value of relation character is LT, LE, EQ, GE, GT, ALL, expression successively<,<=,==,>=,>and concern arbitrarily.
What Fig. 7 represented is the example of a hyperedge node.
Step 203: read graphml.xml and it is visual.
The dependence that text is represented is visual, and figure is a kind of display mode intuitively.The graph visualization technological side adopts the ripe graph visualization software Jung that increases income, and reads the graphml.xml file, extracts the dependence between the software package of representing among the graphml.xml, and is shown as figure.
The java class that uses in visualization process comprises following several:
● DependencyVertex: the base class of the node in the dependency graph, expression software package.
● StandardPackageVertex: inherit and DependencyVertex, represent a standard software packet node.
● VirtualPackageVertex: inherit in DependencyVertex, represent an empty packet node.
● AlternativeVertex: inherit in DependencyVertex, represent " or dependence " node.
● DependencyEdge: the base class on the limit in the dependency graph, the dependence between the expression software package.
● StandardDependencyEdge: connect the limit of two normal packet, the dependence between the expression normal packet.
● VirtualPackageEdge: connect normal packet and empty limit of wrapping.Represent the void bag relevant with normal packet.
● AlternativeEdge: connect the limit of normal packet node and " or dependence " node, " or dependence " relation between the expression software package.
● DependencyType: the dependence type between software package.Enumeration type, the type that expression relies on.
● VersionOperator: for version relies on enumerating of operational character, desirable value is: LT, LE, EQ, GE, GT, ALL.
● VersionRelationship: represent a dependence.
Fig. 4 explanation, the dependence graph of the GraphML representation of file of expansion is made up of node node, limit edge and super limit hyperedge, respectively the visualization process of node node, limit edge and super limit hyperedge is described below.
(1) visual to the node node
A node node can be set up a StandardPackageVertex object, represents the software package of all version.The name of this object is called the packagename attribute of node node and all version numbers thereof.
When running into a provide child node, will set up a VirtualPackageVertex object, be expressed as an empty bag.And between StandardPackageVertex object and VirtualPackageVertex object, set up a limit, the expression node provides an empty bag.
(2) visual to the edge node
An edge node can be set up a StandardDependencyEdge object, and this limit can connect two StandardPackageVertex objects.
● at first need to set up the VersionOperator object according to the operator attribute of version child node.
● search source StandardPackageVertex object according to the source attribute in source attribute and the version child node.
● search purpose StandardPackageVertex object according to the target attribute in target attribute and the version child node.
● the object above utilizing in three steps is set up the VersionRelationship object, represents this dependence.
● set up the StandardDependencyEdge object at last.
(3) visual to the hyperedge node
" or rely on " relation has related to the relation between two above nodes.
● to be that the endpoint of in finds source StandardPackageVertex object at first according to type.
● according to type is that the endpoint of out finds target StandardPackageVertex object.
● need to set up a new AlternativeVertex object then, and connect with source node.
● between AlternativeVertex object and target StandPackageVertex object, connect respectively at last.
The above, it only is preferred embodiment of the present invention, be not that the present invention is done any pro forma restriction, though the present invention discloses as above with preferred embodiment, yet be not in order to limit the present invention, any those skilled in the art, in not breaking away from the technical solution of the present invention scope, when the method that can utilize above-mentioned announcement and technology contents are made a little change or be modified to the equivalent embodiment of equivalent variations, in every case be the content that does not break away from technical solution of the present invention, according to technical spirit of the present invention to any simple modification that above embodiment did, equivalent variations and modification all still belong in the scope of technical solution of the present invention.