ava1ar / customizepkg

A tool for Arch Linux package manager pacman to modify PKGBUILD automatically
GNU General Public License v3.0
49 stars 14 forks source link

Your last commit broke substitutions&removals in depends/makedepends #8

Closed stevenhoneyman closed 10 years ago

stevenhoneyman commented 10 years ago

Hi! It's been a while since I've used this much (started to move away from yaourt/abs/arch). However, I've just been doing a clean install of Arch, so customizepkg was your latest version (pipes instead of @ symbols). Unforutnately this for some reason breaks a lot of things for changing/removing depends and makedepends (haven't tried to see why yet - still busy installing!)

Here's what the output looks like, the first is your latest version; the second is when I went back 1 commit:

==> Building glances from sources.

==> Retrieving PKGBUILD and local sources...
x PKGBUILD
=> adds '!emptydirs' in options
=> replaces ''python'' with ''python2'' in depends
=> replaces ''python-psutil'' with ''python2-psutil'' in depends
=> removes ''python-setuptools'' from depends
=> adds 'python2-setuptools' in makedepends
=> replaces 'python.*$' with 'find . -type f -name "*.py" -exec sed -i "s/env python/env python2/" {} \\; \n&' in package
=> replaces '^python' with 'python2' in package
=> replaces 'images}$' with '&\n rm -r "$pkgdir/usr/share/locale/de" \n  echo "/usr/bin/python2 -m glances" >"$pkgdir/usr/bin/glances"' in package
--- ./PKGBUILD  2014-09-18 22:07:49.000000000 +0000
+++ ./PKGBUILD.custom   2014-09-19 17:38:18.898007583 +0000
@@ -3,6 +3,8 @@
 # Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
 # Contributor: Francois Boulogne <fboulogne at april dot org>

+options=('!emptydirs')
+makedepends=('python2-setuptools')
 pkgname=glances
 pkgver=2.1
 pkgrel=1
@@ -19,9 +21,12 @@

 package() {
   cd Glances-$pkgver
-  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
+  find . -type f -name "*.py" -exec sed -i "s/env python/env python2/" {} \; 
+python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
   # remove html doc
   rm -r "$pkgdir/usr/share/doc/$pkgname"/{glances-doc.html,images}
+ rm -r "$pkgdir/usr/share/locale/de" 
+  echo "/usr/bin/python2 -m glances" >"$pkgdir/usr/bin/glances"
 }

 # vim:set ts=2 sw=2 et:
==> Edit PKGBUILD ? [y/N] ("A" to abort)
==> ------------------------------------
==> a

==> Aborted...
==> Building glances from sources.

==> Retrieving PKGBUILD and local sources...
x PKGBUILD
=> adds '!emptydirs' in options
=> replaces ''python'' with ''python2'' in depends
=> replaces ''python-psutil'' with ''python2-psutil'' in depends
=> removes ''python-setuptools'' from depends
=> adds 'python2-setuptools' in makedepends
=> replaces 'python.*$' with 'find . -type f -name "*.py" -exec sed -i "s/env python/env python2/" {} \\; \n&' in package
=> replaces '^python' with 'python2' in package
=> replaces 'images}$' with '&\n rm -r "$pkgdir/usr/share/locale/de" \n  echo "/usr/bin/python2 -m glances" >"$pkgdir/usr/bin/glances"' in package
--- ./PKGBUILD  2014-09-18 22:07:49.000000000 +0000
+++ ./PKGBUILD.custom   2014-09-19 17:42:17.454677791 +0000
@@ -3,6 +3,8 @@
 # Contributor: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
 # Contributor: Francois Boulogne <fboulogne at april dot org>

+options=('!emptydirs')
+makedepends=('python2-setuptools')
 pkgname=glances
 pkgver=2.1
 pkgrel=1
@@ -10,7 +12,7 @@
 arch=('any')
 url='https://github.com/nicolargo/glances'
 license=('LGPL')
-depends=('python' 'python-psutil' 'python-setuptools')
+depends=(python2 python2-psutil)
 optdepends=('python-jinja: HTML export'
             'python-bottle: web server support'
             'hddtemp: HDD temperature monitoring support')
@@ -19,9 +21,12 @@

 package() {
   cd Glances-$pkgver
-  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
+  find . -type f -name "*.py" -exec sed -i "s/env python/env python2/" {} \; 
+python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
   # remove html doc
   rm -r "$pkgdir/usr/share/doc/$pkgname"/{glances-doc.html,images}
+ rm -r "$pkgdir/usr/share/locale/de" 
+  echo "/usr/bin/python2 -m glances" >"$pkgdir/usr/bin/glances"
 }

 # vim:set ts=2 sw=2 et:
==> Edit PKGBUILD ? [y/N] ("A" to abort)
ava1ar commented 10 years ago

As far as I see from your examples, the difference in depends section - it was not updated with recent commit in. Can you please share your customization file?

stevenhoneyman commented 10 years ago

I know - I even did a diff of the broken customizepkg script, and the working one... but the only changes were the seperators!

Here's the customization file (it happened the same with at least 10 others before I realised something was wrong):

# 
# Package: glances
# Version: 2.0.1
# 
# -- Did I mention that I really hate python?!

add#options#!emptydirs
replace#depends#'python'#'python2'
replace#depends#'python-psutil'#'python2-psutil'
remove#depends#'python-setuptools'
add#makedepends#python2-setuptools
replace#package#python.*$#find . -type f -name "*.py" -exec sed -i "s/env python/env python2/" {} \\; \n&
replace#package#^python#python2
replace#package#images}$#&\n rm -r "$pkgdir/usr/share/locale/de" \n  echo "/usr/bin/python2 -m glances" >"$pkgdir/usr/bin/glances"
stevenhoneyman commented 10 years ago

Here's the simplest one I have that definitely was affected by it:

#
# Package: libmikmod
#

remove#global#libpulse
replace#global#--disable-static#& --disable-pulseaudio
ava1ar commented 10 years ago

libmikmod looks like works for me, at least I see same results. From what I discovered, problem mostly affecting this

makedepends|optdepends|depends)
   pattern="${pattern}[<>=]*\(: \|\)[a-z0-9.{$}\-]*" ;& 

If I am removing \(: \|\) part from it, glances customization starts working. Do you remember by chance why do you added \(: \|\) entry here? I see why <>= and [a-z0-9.{$}\-]* are needed, but not \(: \|\).

stevenhoneyman commented 10 years ago

That part covers optdepends which have a description, for example, nmap, I don't need zenmap:

remove#makedepends#pygtk
remove#optdepends#pygtk: zenmap
remove#optdepends#kdebase-runtime: privilege escalation for zenmap
replace#build#.\/configure#& --disable-nls --without-zenmap
removeline#package#rm.*uninstall_zenmap$
ava1ar commented 10 years ago

Hm, I believe we just need to replace pipe with something else, which will work. What do you think about underscore? From what I tried underscore looks like working. Can you try it with your problematic customizations and check if it working? Thanks!

P.S. If underscore will work for you, fill free to push the update with '|' replaced with '_' - I will be out for whole weekend and will not be able to push anything till Sunday's night.

stevenhoneyman commented 10 years ago

Sorry for the late reply - underscore breaks a few things too with variable names people like to use :-1: I've used % and so far so good. I've pushed the commit, but we can change it again if you find something broken (or if I do :laughing: )

ava1ar commented 10 years ago

Thanks, Steven. Looks like my customizations are not affected by changes "|" -> "%", so I am good with the new separator.