poldek: poldek/pkgdir/pkgdir_clean.c, poldek/pkgdir/pkgdir_dirinde...

mis mis at pld-linux.org
Mon Jun 25 00:47:32 CEST 2007


Author: mis                          Date: Sun Jun 24 22:47:32 2007 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- remove dirindexes with --clean

---- Files affected:
poldek/poldek/pkgdir:
   pkgdir_clean.c (1.11 -> 1.12) , pkgdir_dirindex.c (1.12 -> 1.13) , source.c (1.42 -> 1.43) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgdir/pkgdir_clean.c
diff -u poldek/poldek/pkgdir/pkgdir_clean.c:1.11 poldek/poldek/pkgdir/pkgdir_clean.c:1.12
--- poldek/poldek/pkgdir/pkgdir_clean.c:1.11	Sun May 15 17:51:17 2005
+++ poldek/poldek/pkgdir/pkgdir_clean.c	Mon Jun 25 00:47:27 2007
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis at k2.net.pl>
+  Copyright (C) 2000 - 2007 Pawel A. Gajda <mis at pld-linux.org>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License, version 2 as
@@ -82,7 +82,7 @@
         rc = 0;
         
         if ((tmp_vflock = vf_lockdir(dn))) {
-            msgn(1, _("Cleaning up %s..."), dn);
+            msgn(2, _("Cleaning up %s..."), dn);
             rc = do_unlink(dirpath, test);
             vf_lock_release(tmp_vflock);
         }
@@ -120,7 +120,7 @@
         }
 
         if (msg_displayed == 0) {
-            msgn(1, _("Cleaning up %s..."), dirpath);
+            msgn(2, _("Cleaning up %s..."), dirpath);
             msg_displayed = 1;
         }
 

================================================================
Index: poldek/poldek/pkgdir/pkgdir_dirindex.c
diff -u poldek/poldek/pkgdir/pkgdir_dirindex.c:1.12 poldek/poldek/pkgdir/pkgdir_dirindex.c:1.13
--- poldek/poldek/pkgdir/pkgdir_dirindex.c:1.12	Sun Jun 24 13:48:07 2007
+++ poldek/poldek/pkgdir/pkgdir_dirindex.c	Mon Jun 25 00:47:27 2007
@@ -59,6 +59,8 @@
 
 #define PREFIXLEN 2
 
+const char *pkgdir_dirindex_basename = "dirindex";
+
 struct pkgdir_dirindex {
     struct tndb *db;
     tn_alloc *na;
@@ -346,14 +348,16 @@
         ofpath = dn;
     }
 
-    n_snprintf(tmp2, sizeof(tmp2), "%s/dirindex.%s.tndb", ofpath, pkgdir->type);
+    n_snprintf(tmp2, sizeof(tmp2), "%s/%s.%s.tndb", pkgdir_dirindex_basename,
+               ofpath, pkgdir->type);
     n_snprintf(tmp2, sizeof(tmp2), "%s", ofpath);
     DBGF("path = %s\n", ofpath);
     n = vf_cachepath(path, size, ofpath);
     DBGF("cache path = %s\n", path);
 
     n_assert(n > 0);
-    n += n_snprintf(&path[n], size - n, "/dirindex.%s.tndb", pkgdir->type);
+    n += n_snprintf(&path[n], size - n, "/%s.%s.tndb", pkgdir_dirindex_basename,
+                    pkgdir->type);
     DBGF("result = %s\n", path);
     n_assert(n > 0);
     

================================================================
Index: poldek/poldek/pkgdir/source.c
diff -u poldek/poldek/pkgdir/source.c:1.42 poldek/poldek/pkgdir/source.c:1.43
--- poldek/poldek/pkgdir/source.c:1.42	Sat Jun 23 21:12:30 2007
+++ poldek/poldek/pkgdir/source.c	Mon Jun 25 00:47:27 2007
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis at k2.net.pl>
+  Copyright (C) 2000 - 2007 Pawel A. Gajda <mis at pld-linux.org>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License, version 2 as
@@ -40,8 +40,9 @@
 #include "i18n.h"
 #include "conf.h"
 
-#define SOURCE_DEFAULT_PRI 0
+extern const char *pkgdir_dirindex_basename;
 
+#define SOURCE_DEFAULT_PRI 0
 
 const char source_TYPE_GROUP[] = "group";
 const char *poldek_conf_PKGDIR_DEFAULT_TYPE = "pndir";
@@ -862,11 +863,9 @@
 int do_source_clean(struct source *src, const char *idxdir,
                     const char *idxbn, unsigned flags)
 {
-    int   urltype;
+    int urltype = vf_url_type(idxdir);
 
     n_assert(src->type);
-    if ((urltype = vf_url_type(idxdir)) == VFURL_UNKNOWN)
-        return 1;
 
     DBGF("%s: %s, %s\n", src->path, idxdir, idxbn);
 
@@ -910,12 +909,15 @@
         
         n_basedirnam(path, &dn, &bn);
         rc = do_source_clean(src, dn, bn, flags);
+        /* should be able to pass multiple masks at once, TODO */
+        rc = do_source_clean(src, dn, pkgdir_dirindex_basename, flags);
+        
     }
 
     if (src->pkg_prefix && (flags & PKGSOURCE_CLEANPKG)) 
         rc = do_source_clean(src, src->pkg_prefix, NULL, flags);
 
-    /* in fact we don't really care about the result */
+    /* we don't really care about the result */
     return rc;
 }
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/pkgdir_clean.c?r1=1.11&r2=1.12&f=u
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/pkgdir_dirindex.c?r1=1.12&r2=1.13&f=u
    http://cvs.pld-linux.org/poldek/poldek/pkgdir/source.c?r1=1.42&r2=1.43&f=u



More information about the pld-cvs-commit mailing list