ava1ar / customizepkg Goto Github PK
View Code? Open in Web Editor NEWA tool for Arch Linux package manager pacman to modify PKGBUILD automatically
License: GNU General Public License v3.0
A tool for Arch Linux package manager pacman to modify PKGBUILD automatically
License: GNU General Public License v3.0
For example, the package kdeplasma-applets-menubar-archway-bzr:
# ...
build() {
[ -f build ] && rm build
[ -d build ] || mkdir build
cd build
cmake ../$pkgname \
# ...
After running customizepkg:
build() {
[ -f build ] && rm build
patch -Np1 -i remove_right_icon.diff
[ -d build ] || mkdir build
cd build
And then patch breaks, because the diff expects to be in build/, where the source code is.
I'll try and get something in place to fix as soon as I can, but I've had very little time to spend on open source stuff lately. My current broken package is qemu. this breaks the script at line 149:
pkgname=('qemu'
'qemu-block-iscsi'
'qemu-block-rbd'
'qemu-block-gluster'
'libcacard')
I just found out about your tool and it seems to be just the tool I missed for a while, I have only one gripe with it:
It forces me to put another directory in my already-bloated home directory. Therefore I suggest to make use of the XDG Base Directory Standard (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#basics) to locate for the customizepkg directory. For backwards-compatibility we could still look into the old directories, but I would really like it if we have the standard-conforming paths as default in the README.
For example, without setting $XDG_CONFIG_HOME
, the files would now be expected to be in ~/.config/customizepkg
instead of ~/.customizepkg
. For the global configuration, if $XDG_CONFIG_DIRS
is unset, use /etc/xdg/customizepkg.d
instead of /etc/customizepkg
. But to be honest, I think we can let the default for the global directory stay the same and simply use $XDG_CONFIG_DIRS
if it's set.
This has the advantage of making a backup of all user configuration files (of all programs using the xdg-standard) simpler than listing all folders in ~
which should be backed up. This also makes it configurable for users who have their own idea of where config files should go.
If you have a PKGBUILD containing something like:
package() {
rm test/{1,2}
something else
....
}
The sed stops to first }
without changing anything after the rm test/{1,2}
line
This would allow me to not have to specify absolute paths (brittle across multiple hosts).
$ tree ~/.customizepkg/
~/.customizepkg
├── kdeplasma-applets-menubar-archway-bzr
└── kdeplasma-applets-menubar-archway-bzr.files
└── remove_right_icon.diff
$ cat ~/.customizepkg/remove_right_icon.diff
patch#1#remove_right_icon.diff
due to using read -r, you can't do a replacement that has a # in the pattern, because read just recognises the # as the delimiter and you can't escape it because of the use of -r. In my case, this matters because mozc-ut has commented out variables that you are supposed to uncomment to enable features the package can provide, and I would prefer for that process to be automatic. removing the -r would probably fix this for this case, but has a chance of ruining other people's customizations, so I'm not entirely sure what to do.
If you mark a file as executable, the executable bit is lost when it is copied so it will be interpreted as a normal file rather than executed.
After the cp command you could do something like:
# copy the config file to current directory
cp "${CONFIGDIR}/${package}" "./${package}.customize"
if [ -x "${CONFIGDIR}/${package}" ]; then
chmod +x "./${package}.customize"
fi
It seems that the latest version does not support adding a new line, which makes it hard to apply an additional patch. Could you add this functionality to customizepkg?
Thanks!
If ${pkgname}.files folder exists, but empty, customizepkg removes all files from PKGBUILD directory, even if -m set to 0
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 <[email protected]>
# 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 <[email protected]>
# 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)
Line 158 of customizepkg:
eval
fails on the slic3r-git package:
https://aur4.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=slic3r-git
The regular expression is unable to handle the fact that a # appears inside of a quoted string, as in line 118 of the PKGBUILD:
_pkgver="$(awk '/#define SLIC3R_VERSION/ {gsub(/"/, "", $3); print
Any chance we can get this sorted?
When I add files in /etc/customizepkg.d/pkg.files, they get appended to pkg.customize. When the script is executable, these instructions are not interpreted correctly.
Just as a suggestion, why not add another directory for scripts.
ie: /etc/customizepkg.d/pkg.scripts
which would contain scripts that would be run in alphanumeric order? Then I could make /etc/customizepkg.d/pkg not executable and place my script(s) in that directory and still get the files and customizepkg syntax in the main file.
It would be nice to be able to move ~/.customizepkg
to another location. For me, I keep a git repository for my PKGBUILDS and I think it would be pretty cool to include the customizepkg config in that repository as well. Right now that can be achevied simply by symlinking, but then I still have yet another dotfile in my home dir.
Is there any chance for you to add global customizations?
This would be nice for other architectures, i.e. on the raspberry pi to add 'armv6h' to the supported platforms.
This is hardly an issue with customizepkg, but when a PKGBUILD has two sets of checksums customizepkg will modify the first set it finds. But makepkg might use the latter.
This is currently happening with the gqrx-git package, where customizepkg is modifying the md5sums and makepkg is using the sha256sums.
New grep 2.24.1 throws error about insecure usage of $ and ^ in perl type regexp when '-z' is enebled.
This is a fix around pcre mishandling those type of patterns grep commit
Fix: remove '-z' flag (multi-line fields rarely if ever appears in PKGBUILD )
I created /etc/customizepkg.d/linux. But whenever i run pacman -S linux (or yay -S linux), it doesn't compile with PKGBUILD like expected. It just installs normally. What i'm doing wrong?
PKGBUILD without the normal header are ignored. Since they begin with a non-printable character, causing the initial pkgname
parsing to ignore the option. One example is the mutt-sidebar
package.
To work around the issue you can move the pkgname directive below some other unimportant variable declaration in the PKGBUILD.
Before patching a PKGBUILD the patch file was added to PKGBUILD as one of sources which breaks the build script.
PKGBUILD : gpx-git
PKGBUILD.patch : http://pastebin.com/PPiY9kXC
/etc/customizepkg.d/gpx-git : patch#pkgbuild#PKGBUILD.patch
customizepkg output : http://pastebin.com/HG68dSS5
As a solution i can think off putting the modify_file before adding new files from ${CFGDIR}/${package} folder and marking PKGBUILD.patch in modify_file to be ignore in patch including function
I'm creating this issue just to give info to googlers. It is fixed in #29
/usr/bin/customizepkg: line 167: warning: command substitution: ignored null byte in input
/usr/bin/customizepkg: eval: line 167: unexpected EOF while looking for matching `"'
/usr/bin/customizepkg: eval: line 168: syntax error: unexpected end of file
In many PKGBUILD there is an extra subdir in $srcdir in which the build process occurs. Patch option wont work for those packages as it use relative path. In order to fix the issue the absolute path to the pach files should be used.
/usr/bin/customizepkg : patch http://pastebin.com/E9S3wkSw
Only md5sums are currently supported for files, added from ${pkgname}.files folder. Checksum function should be configurable by user.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.