Package: debian-xcontrol
Version: 0.0.2~pre1+nmu2
Followup-For: Bug #479235

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This patch is a solution for the bug. Now Vcs-*, Vcs-Browser and Homepage
fields works.

- -- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=es_ES.UTF-8, LC_CTYPE=es_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIIXmYS/DSSd0S8lMRAmKdAJ445E/rSqbFfL/kq5ErbUeX4X5TrgCgg6pP
2irioIIYmvMvWbxbc6vAcj0=
=J3TW
-----END PGP SIGNATURE-----
diff --git a/debian/changelog b/debian/changelog
index 9acf983..49294c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+debian-xcontrol (0.0.2~pre1+nmu3) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Added new Vcs-*, Vcs-Browser and Homepage source sections.
+    (Closes: #479235)
+
+ -- Victor Seva <[EMAIL PROTECTED]>  Sat, 03 May 2008 20:22:52 +0200
+
 debian-xcontrol (0.0.2~pre1+nmu2) unstable; urgency=low
 
   * Non-maintainer upload.
diff --git a/src/control_file.cc b/src/control_file.cc
index 2b5226b..0095611 100644
--- a/src/control_file.cc
+++ b/src/control_file.cc
@@ -57,6 +57,8 @@ void control_file::merge(std::istream &stream)
 			while(input)
 			{
 				section[input->key] = input->value;
+				if(isVcsField(input->key))
+					section.vcs_type = input->key;
 				++input;
 			}
 			src = section;
diff --git a/src/source_section.cc b/src/source_section.cc
index 0b4eb79..3e71301 100644
--- a/src/source_section.cc
+++ b/src/source_section.cc
@@ -23,6 +23,12 @@ source_section::operator[](attribute_selector_type const &key)
 		return attribute(&source_section::build_depends_tools, *this);
 	if(key == "Standards-Version")
 		return attribute(&source_section::standards_version, *this);
+	if(key == "Homepage")
+		return attribute(&source_section::homepage, *this);
+	if(key == "Vcs-Browser")
+		return attribute(&source_section::vcs_browser, *this);
+	if(isVcsField(key))
+		return attribute(&source_section::vcs_asterisk, *this);
 	throw attribute::unknown_attribute(key);
 }
 
@@ -42,6 +48,14 @@ bool source_section::operator==(source_section const &rhs) const
 		return false;
 	if(standards_version != rhs.standards_version)
 		return false;
+	if(homepage != rhs.homepage)
+		return false;
+	if(vcs_browser != rhs.vcs_browser)
+		return false;
+	if(vcs_type != rhs.vcs_type)
+		return false;
+	if(vcs_asterisk != rhs.vcs_asterisk)
+		return false;
 	return true;
 }
 
@@ -62,5 +76,19 @@ control_file_ostream &operator<<(control_file_ostream &stream, source_section co
 		stream << std::make_pair("Build-Depends-Tools", source.build_depends_tools);
 	if(!source.standards_version.empty())
 		stream << std::make_pair("Standards-Version", source.standards_version);
+	if(!source.homepage.empty())
+		stream << std::make_pair("Homepage", source.homepage);
+	if(!source.vcs_browser.empty())
+		stream << std::make_pair("Vcs-Browser", source.vcs_browser);
+	if(!source.vcs_asterisk.empty() && !source.vcs_type.empty())
+		stream << std::make_pair(source.vcs_type, source.vcs_asterisk);
 	return stream;
 }
+
+bool isVcsField(std::string const &s) const
+{
+	std::string sub = s.substr(0,3);
+	if(sub == "Vcs-")
+		return true;
+	return false;
+}
diff --git a/src/source_section.h b/src/source_section.h
index 3a0be60..dc40b73 100644
--- a/src/source_section.h
+++ b/src/source_section.h
@@ -36,8 +36,12 @@ public:
 	dependency_list build_depends_indep;
 	dependency_list build_depends_tools;
 	std::string standards_version;
+	std::string vcs_asterisk;
+	std::string vcs_type;
+	std::string vcs_browser;
+	std::string homepage;
 };
 
 control_file_ostream &operator<<(control_file_ostream &stream, source_section const &source);
-
+bool isVcsField(std:string const &);
 #endif

Reply via email to