On Tue, Feb 10, 2015 at 06:53:52PM +0300, Kirill Proskurin wrote: > Hello. > > I'm trying to understand how deb package update happens in details. > Is it transaction of some kind? Atomic? Temp dirs and move? And so on. I > cant find any info about this in official docs and in Google in general.
The "official" page for dpkg is: https://wiki.debian.org/Teams/Dpkg which doesn't have a high-level design document as far as I can see. In that case, the documentation is the code :) > > I want to package our in house php code in deb and deploy it in production > servers. But nature of this code implies what there is shouldn't be any race > of mix of old\new files. There are a number of solutions to this. If your code can open and retain a filehandle to the code it uses (I don't know if PHP does this already, so you probably want to look at how PHP works), then you're safe to delete and overwrite the files (which I suspect is what dpkg will do). The running application will retain access to the deleted files until it closes them (e.g. application restart). If your code is opening and closing files and you want to ensure that it only has access to a consistent set of files (everything from package version A -OR- everything from package version B), then consider locking (the application locks files when it opens them and unlocks them when it closes them; your package locks all the files in the pre-inst (which will cause the application to block, waiting for the lock to be released), installs the files and unlocks them in the post-inst (at which point the application resumes processing with the new files)). You will want to audit your application, though, and check that it's not going to be holding a file open for ages and blocking the package upgrade. > > -- > Best regards, > Proskurin Kirill > > > -- > To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject > of "unsubscribe". Trouble? Contact listmas...@lists.debian.org > Archive: https://lists.debian.org/54da2990.6020...@gmail.com >
signature.asc
Description: Digital signature