On Mon, Mar 13, 2006 at 10:05:30PM +0200, Lars Wirzenius wrote:
> The problem is that the packages in the removed-but-not-yet-purged state
> still contain empty directories, ones that don't contain conffiles.
> Above, for example, /usr and stuff below it should not be there for
> ttf-bitstream-vera.
Hi.
I have an alternative patch that at least fixes the defoma/ttf-bitstream
case. I haven't tested all the other packages yet. Comments and
testing welcome.
Index: src/help.c
===================================================================
--- src/help.c (Revision 308)
+++ src/help.c (Arbeitskopie)
@@ -403,6 +403,26 @@
putc('\n',stderr);
}
+int hasdirectoryconffiles(struct filenamenode *file, struct pkginfo *pkg) {
+ /* Returns 1 if the directory contains conffiles belonging to pkg, 0
otherwise. */
+ struct conffile *conff;
+ size_t namelen;
+
+ debug(dbg_veryverbose, "hasdirectoryconffiles `%s' (from %s)", file->name,
+ pkg->name);
+ namelen = strlen(file->name);
+ for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
+ if (!strncmp(file->name,conff->name,namelen)) {
+ debug(dbg_veryverbose, "directory %s has conffile %s from %s",
+ file->name, conff->name, pkg->name);
+ return 1;
+ }
+ }
+ debug(dbg_veryverbose, "hasdirectoryconffiles no");
+ return 0;
+}
+
+
int isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg) {
/* Returns 1 if the file is used by packages other than pkg, 0 otherwise. */
struct filepackages *packageslump;
Index: src/main.h
===================================================================
--- src/main.h (Revision 308)
+++ src/main.h (Arbeitskopie)
@@ -203,6 +203,7 @@
const char *ifok, const char *iffallback);
void clear_istobes(void);
int isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
+int hasdirectoryconffiles(struct filenamenode *namenode, struct pkginfo *pkg);
enum debugflags {
dbg_general= 00001,
Index: src/remove.c
===================================================================
--- src/remove.c (Revision 308)
+++ src/remove.c (Arbeitskopie)
@@ -240,7 +240,11 @@
* package which uses it. Other files should only be listed
* in this package (but we don't check).
*/
- if (isdirectoryinuse(namenode,pkg)) continue;
+ if (hasdirectoryconffiles(namenode,pkg)) {
+ push_leftover(&leftover,namenode);
+ continue;
+ }
+ if (isdirectoryinuse(namenode,pkg)) continue;
}
debug(dbg_eachfiledetail, "removal_bulk removing `%s'", fnvb.buf);
if (!rmdir(fnvb.buf) || errno == ENOENT || errno == ELOOP) continue;
@@ -348,6 +352,10 @@
* package which uses it. Other files should only be listed
* in this package (but we don't check).
*/
+ if (hasdirectoryconffiles(namenode,pkg)) {
+ push_leftover(&leftover,namenode);
+ continue;
+ }
if (isdirectoryinuse(namenode,pkg)) continue;
}
Gruesse,
--
Frank Lichtenheld <[EMAIL PROTECTED]>
www: http://www.djpig.de/
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]