[arch-dev-public] [PATCH 1/2] Handle optdepends description stripping correctly

Dan McGee dan at archlinux.org
Tue Jun 8 00:10:44 EDT 2010

Commit 95986ec3 attempted to fix handling of optdepends with descriptions,
but it only affected the PKGBUILD parser. Do the description stripping in
the package building code in namcap proper so we can handle all varieties of
packages, whether from a PKGBUILD, the database, or a package file. The
original fix is reverted as part of this commit, and this fixes FS#18259.

Signed-off-by: Dan McGee <dan at archlinux.org>
 pacman.py     |    8 +++++++-
 parsepkgbuild |    2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pacman.py b/pacman.py
index 2fb64e2..fd367d7 100644
--- a/pacman.py
+++ b/pacman.py
@@ -47,12 +47,18 @@ class PacmanPackage(object):
 	def clean_depends(self):
-		Go through the special depends instance property, copy it to self.orig_depends and strip all the depend version info off ('neon>=0.25.5-4' => 'neon')
+		Go through the special depends instance property and strip all the depend version info off ('neon>=0.25.5-4' => 'neon').
+		Also clean our optdepends and remove any trailing description.
+		The original arrays are copied to orig_depends and orig_optdepends respectively.
 		if hasattr(self, 'depends'):
 			self.orig_depends = self.depends[:]
 			for item, value in enumerate(self.depends):
 				self.depends[item] = value.split('>')[0].split('<')[0].split('=')[0]
+		if hasattr(self, 'optdepends'):
+			self.orig_optdepends = self.optdepends[:]
+			for item, value in enumerate(self.optdepends):
+				self.optdepends[item] = value.split(':')[0].split('>')[0].split('<')[0].split('=')[0]
 	def process(self):
diff --git a/parsepkgbuild b/parsepkgbuild
index a9ab894..295416b 100755
--- a/parsepkgbuild
+++ b/parsepkgbuild
@@ -61,7 +61,7 @@ if [ -n "\$makedepends" ]; then
 if [ -n "\$optdepends" ]; then
 	echo "%OPTDEPENDS%"
-	for i in \${!optdepends[*]}; do echo \${optdepends[\$i]%:*}; done
+	for i in \${optdepends[@]}; do echo \$i; done
 	echo ""
 if [ -n "\$conflicts" ]; then

More information about the arch-dev-public mailing list