You are not logged in.

#1 2012-03-19 00:50:42

pukku
Member
Registered: 2012-03-19
Posts: 2

Proper way to modify existing files?

Hi! I'm writing a small package for my own purposes to install some keyboard options I want to add to X. I am adding some files to /usr/share/X11/xkb/, but I also need to modify /usr/share/X11/xkb/rules/evdev, /usr/share/X11/xkb/rules/evdev.lst, and possibly /usr/share/X11/xkb/rules/evdev.xml. The modifications are small -- two or three lines generally, but I'm not sure what the best way to make these modifications are.

Based on what I can find on the wiki, I can proceed one of two ways:

* I can create a patch for the files, apply the patch during build() to the source files, and then put them into the package to replace the existing files.

* I can add a .install file, which either applies the patches after install, or uses echo ... >> to add the appropriate lines to the files.

I'm not sure if I'm missing something, or what the best way to apply these changes is? Which of these options is the cleanest to back out of? And how does pacman handle possible interactions with other packages that might want to modify the same files?

I'm tempted towards the second option because if I use the various hooks it might be easier to back out of the changes?

Thanks,
Ricky

Offline

#2 2012-03-19 01:08:57

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Proper way to modify existing files?

Neither of these are sane ideas. If you want to modify files which are owned by a package (any package) and not part of the backup array, you have a few options:

1) rebuild the package owning the files with your changes. you'll have to do this for every release.
2) rebuild the package with those files in the backup array. now you're free to change them and they won't be clobbered on upgrade. But, you'll still need to do this every release.
3) change the files anyways, and add them to NoUpgrade in /etc/pacman.conf

package install scriptlets are not meant to be used to arbitrarily modify files.

Offline

#3 2012-03-19 01:11:37

Meyithi
Member
From: Wirral, UK
Registered: 2009-06-21
Posts: 550
Website

Re: Proper way to modify existing files?

I'd would just pacman -Qo the files I wanted to modify which would tell what package the files belong to and then modify that package using abs.


The mind roams more freely in empty rooms.
dwm - colours - ncmpcpp - system
irc://irc.freenode.net:meyithi

Offline

#4 2012-03-19 01:33:02

pukku
Member
Registered: 2012-03-19
Posts: 2

Re: Proper way to modify existing files?

Ah. It looks like what I want is the NoUpgrade entry in pacman.conf. Then the package would only install the necessary symbols files, and print out instructions (perhaps even a diff) for the changes to the rules files.

Thanks!
Ricky

Offline

Board footer

Powered by FluxBB