[arch-dev-public] [PATCH 1/2] Handle optdepends description stripping correctly
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@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 fi if [ -n "\$optdepends" ]; then echo "%OPTDEPENDS%" - for i in \${!optdepends[*]}; do echo \${optdepends[\$i]%:*}; done + for i in \${optdepends[@]}; do echo \$i; done echo "" fi if [ -n "\$conflicts" ]; then -- 1.7.1
This builds on the previous commit fixing optdepend cleaning and also adds makedepend cleaning to the mix; even though we don't use this data right now we can get it all cleaned up via the same method. Signed-off-by: Dan McGee <dan@archlinux.org> --- pacman.py | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pacman.py b/pacman.py index fd367d7..8d57e28 100644 --- a/pacman.py +++ b/pacman.py @@ -51,14 +51,19 @@ class PacmanPackage(object): Also clean our optdepends and remove any trailing description. The original arrays are copied to orig_depends and orig_optdepends respectively. """ + def strip_depend_info(l): + for item, value in enumerate(l): + l[item] = value.split(':')[0].split('>')[0].split('<')[0].split('=')[0] + 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] + strip_depend_info(self.depends) + if hasattr(self, 'makedepends'): + self.orig_makedepends = self.makedepends[:] + strip_depend_info(self.makedepends) 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] + strip_depend_info(self.optdepends) def process(self): """ -- 1.7.1
participants (1)
-
Dan McGee