poldek: poldek/pkgfl.c - new directory auto-dependencies (NFY)
mis
mis at pld-linux.org
Mon Jul 10 00:16:50 CEST 2006
Author: mis Date: Sun Jul 9 22:16:49 2006 GMT
Module: poldek Tag: HEAD
---- Log message:
- new directory auto-dependencies (NFY)
---- Files affected:
poldek/poldek:
pkgfl.c (1.39 -> 1.40)
---- Diffs:
================================================================
Index: poldek/poldek/pkgfl.c
diff -u poldek/poldek/pkgfl.c:1.39 poldek/poldek/pkgfl.c:1.40
--- poldek/poldek/pkgfl.c:1.39 Wed Oct 12 21:25:55 2005
+++ poldek/poldek/pkgfl.c Mon Jul 10 00:16:44 2006
@@ -636,5 +636,65 @@
return path;
}
+/* returns list of directories not belong to filelist itself */
+int pkgfl_owned_and_required_dirs(tn_tuple *fl, tn_array **owned,
+ tn_array **required)
+{
+ const char *dn = NULL;
+ int i, dnlen, r;
+ tn_array *od = NULL, *rd = NULL;
+
+ if (owned)
+ od = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
+
+ if (required)
+ rd = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
+
+ for (i=0; i < n_tuple_size(fl); i++) {
+ struct pkgfl_ent *flent = n_tuple_nth(fl, i);
+
+ if (dn && strncmp(dn, flent->dirname, dnlen) == 0) {
+ if (od)
+ n_array_push(od, flent->dirname);
+ continue;
+ }
+
+ dn = flent->dirname;
+ if (*dn == '/' && *(dn + 1) == '\0') {
+ dn = "";
+ dnlen = 0;
+ continue;
+ }
+
+ dnlen = strlen(dn);
+ if (rd)
+ n_array_push(rd, dn);
+ }
+
+ r = 0;
+ if (od) {
+ *owned = od;
+ for (i = 0; i < n_array_size(od); i++)
+ printf("O %s\n", n_array_nth(od, i));
+ r += i;
+ }
+
+ if (rd) {
+ *required = rd;
+ for (i = 0; i < n_array_size(rd); i++)
+ printf("R %s\n", n_array_nth(rd, i));
+ r += i;
+ }
+ return r;
+}
+
+tn_array *pkgfl_required_directories(tn_tuple *fl)
+{
+ tn_array *required = NULL;
+
+ pkgfl_owned_and_required_dirs(fl, NULL, &required);
+
+ return required;
+}
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/poldek/pkgfl.c?r1=1.39&r2=1.40&f=u
More information about the pld-cvs-commit
mailing list