Пример #1
0
        public int VersionCompare(RC.PackageSpec spec1, RC.PackageSpec spec2)
        {
            int raw_ret = rc_packman_version_compare(Handle, spec1.Handle, spec2.Handle);
            int ret     = raw_ret;

            return(ret);
        }
Пример #2
0
        public void ToXml(System.Xml.XmlTextWriter writer)
        {
            // FIXME: if (this.IsOr) rc_package_dep_or_slist_to_xml_node ()

            writer.WriteStartElement("dep");

            using (RC.PackageSpec spec = Spec) {
                writer.WriteAttributeString("name", spec.Name);

                if (this.Relation != PackageRelation.Any)
                {
                    writer.WriteAttributeString("op", Package.RelationToString(this.Relation, 0));

                    if (spec.HasEpoch)
                    {
                        writer.WriteAttributeString("epoch", System.Xml.XmlConvert.ToString(spec.Epoch));
                    }

                    if (spec.Version != null)
                    {
                        writer.WriteAttributeString("version", spec.Version);
                    }

                    if (spec.Release != null)
                    {
                        writer.WriteAttributeString("release", spec.Release);
                    }
                }
            }

            writer.WriteEndElement();
        }
Пример #3
0
        public RC.Package GetPackage(RC.Channel channel, RC.PackageSpec spec)
        {
            IntPtr raw_ret = rc_world_get_package(Handle, channel == null ? IntPtr.Zero : channel.Handle, spec.Handle);

            RC.Package ret = raw_ret == IntPtr.Zero ? null : (RC.Package)GLib.Opaque.GetOpaque(raw_ret, typeof(RC.Package), false);
            return(ret);
        }
Пример #4
0
        public void ToXml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement("update");

            using (RC.PackageSpec spec = Spec) {
                if (spec.HasEpoch)
                {
                    writer.WriteElementString("epoch", System.Xml.XmlConvert.ToString(spec.Epoch));
                }

                writer.WriteElementString("version", spec.Version);
                writer.WriteElementString("release", spec.Release);
            }

            if (this.PackageUrl != null)
            {
                writer.WriteElementString("filename", System.IO.Path.GetFileName(this.PackageUrl));
            }

            writer.WriteElementString("filesize", System.Xml.XmlConvert.ToString(this.PackageSize));
            writer.WriteElementString("installedsize", System.Xml.XmlConvert.ToString(this.InstalledSize));

            if (this.SignatureUrl != null)
            {
                writer.WriteElementString("signaturename", this.SignatureUrl);
                writer.WriteElementString("signaturesize", System.Xml.XmlConvert.ToString(this.SignatureSize));
            }

            if (this.Md5sum != null)
            {
                writer.WriteElementString("md5sum", this.Md5sum);
            }

            writer.WriteElementString("importance", Global.ImportanceToString(this.Importance));
            writer.WriteElementString("description", this.Description);

            if (this.Hid != 0)
            {
                writer.WriteElementString("hid", System.Xml.XmlConvert.ToString(this.Hid));
            }

            if (this.License != null)
            {
                writer.WriteElementString("license", this.License);
            }

            writer.WriteEndElement();
        }
Пример #5
0
 public PackageDep(RC.PackageSpec spec, RC.PackageRelation relation, RC.Channel channel, bool pre, bool is_or)
 {
     Raw = rc_package_dep_new_from_spec(spec.Handle, (int)relation, channel == null ? IntPtr.Zero : channel.Handle, pre, is_or);
 }
Пример #6
0
 public bool NativeCallback(IntPtr pkg, IntPtr spec, IntPtr data)
 {
     RC.Package     _arg0 = pkg == IntPtr.Zero ? null : (RC.Package)GLib.Opaque.GetOpaque(pkg, typeof(RC.Package), false);
     RC.PackageSpec _arg1 = new RC.PackageSpec(spec);
     return((bool)managed(_arg0, _arg1));
 }
Пример #7
0
        public void ToXml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement("package");

            writer.WriteElementString("name", this.Name);

            using (RC.PackageSpec spec = Spec) {
                if (spec.HasEpoch)
                {
                    writer.WriteElementString("epoch", System.Xml.XmlConvert.ToString(spec.Epoch));
                }

                writer.WriteElementString("version", spec.Version);
                writer.WriteElementString("release", spec.Release);
                writer.WriteElementString("arch", RC.Global.ArchToString(spec.Arch));
            }

            writer.WriteElementString("summary", this.Summary);
            writer.WriteElementString("description", this.Description);
            writer.WriteElementString("section", Package.SectionToString(this.Section));
            writer.WriteElementString("filesize", System.Xml.XmlConvert.ToString(this.FileSize));
            writer.WriteElementString("installedsize", System.Xml.XmlConvert.ToString(this.InstalledSize));

            if (this.InstallOnly)
            {
                writer.WriteElementString("install_only", "1");
            }

            if (this.IsPackageSet)
            {
                writer.WriteElementString("package_set", "1");
            }

            if (this.Updates != null)
            {
                writer.WriteStartElement("history");
                foreach (PackageUpdate update in this.Updates)
                {
                    update.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            writer.WriteStartElement("deps");

            PackageDep[] deps;

            deps = this.Requires;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("requires");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Recommends;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("recommends");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Suggests;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("suggests");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Conflicts;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("conflicts");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Obsoletes;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("obsoletes");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Children;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("children");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            deps = this.Provides;
            if (deps.Length > 0)
            {
                writer.WriteStartElement("provides");
                foreach (PackageDep dep in deps)
                {
                    dep.ToXml(writer);
                }
                writer.WriteEndElement();
            }

            writer.WriteEndElement(); // "deps"
            writer.WriteEndElement(); // "package"
        }