poldek: poldek/pkgdir/pkgdir.c - exposed repo details to external ...

mis mis at pld-linux.org
Mon Feb 18 22:03:37 CET 2008


Author: mis                          Date: Mon Feb 18 21:03:37 2008 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- exposed repo details to external fetchers (needed by vfsvn script)

---- Files affected:
poldek/poldek/pkgdir:
   pkgdir.c (1.51 -> 1.52) 

---- Diffs:

================================================================
Index: poldek/poldek/pkgdir/pkgdir.c
diff -u poldek/poldek/pkgdir/pkgdir.c:1.51 poldek/poldek/pkgdir/pkgdir.c:1.52
--- poldek/poldek/pkgdir/pkgdir.c:1.51	Mon Jul  9 14:59:54 2007
+++ poldek/poldek/pkgdir/pkgdir.c	Mon Feb 18 22:03:32 2008
@@ -273,6 +273,15 @@
     return mod;
 }
 
+/* TODO: prepare pkg_prefix like pkgdir_open_ext() does */
+static void env_source(const struct source *src, const char *idxpath)
+{
+    setenv("POLDEK_SOURCE_PATH", idxpath, 1);
+    setenv("POLDEK_SOURCE_PREFIX", src->pkg_prefix, 1);
+    setenv("POLDEK_SOURCE_TYPE", src->type, 1);
+    if (src->name)
+        setenv("POLDEK_SOURCE_NAME", src->name, 1);
+}
 
 int pkgdir_update_a(const struct source *src)
 {
@@ -280,7 +289,7 @@
     enum pkgdir_uprc            uprc = PKGDIR_UPRC_NIL;
     char idxpath[PATH_MAX];
     int  rc;
-    
+
     n_assert(src->path);
 	if ((mod = find_module(src->type)) == NULL)
 		return 0;
@@ -292,6 +301,7 @@
 
     pkgdir__make_idxpath(idxpath, sizeof(idxpath), src->path, src->type,
                          src->compress);
+    env_source(src, idxpath);
     rc = mod->update_a(src, idxpath, &uprc);
     
     if (rc && uprc == PKGDIR_UPRC_UPTODATE) 
@@ -299,6 +309,14 @@
     return rc;
 }
 
+static void env_pkgdir(const struct pkgdir *pkgdir)
+{
+    setenv("POLDEK_SOURCE_PATH", pkgdir->idxpath, 1);
+    setenv("POLDEK_SOURCE_PREFIX", pkgdir->path, 1);
+    setenv("POLDEK_SOURCE_TYPE", pkgdir->type, 1);
+    if (pkgdir->name)
+        setenv("POLDEK_SOURCE_NAME", pkgdir->name, 1);
+}
 
 int pkgdir_update(struct pkgdir *pkgdir)
 {
@@ -308,6 +326,8 @@
 	if (pkgdir->mod->update == NULL)
 		return 0;
 
+    env_pkgdir(pkgdir);
+
 	rc = pkgdir->mod->update(pkgdir, &uprc);
     if (rc) {
         if (uprc == PKGDIR_UPRC_UPTODATE) 
@@ -366,8 +386,6 @@
     return mod->default_compr;
 }
 
-
-
 struct pkgdir *pkgdir_srcopen(const struct source *src, unsigned flags)
 {
     struct pkgdir *pkgdir;
@@ -399,7 +417,6 @@
     return pkgdir_open_ext(path, pkg_prefix, type, name, NULL, 0, NULL);
 }
 
-
 struct pkgdir *pkgdir_open_ext(const char *path, const char *pkg_prefix,
                                const char *type, const char *name,
                                const char *compress, 
@@ -444,7 +461,7 @@
 
     else
         pkgdir->path = n_strdup(idxpath);
-    
+
     pkgdir->idxpath = n_strdup(idxpath);
     pkgdir->compress = compress ? n_strdup(compress) : NULL;
     pkgdir->pkgs = pkgs = pkgs_array_new_ex(2048, pkg_strcmp_name_evr_rev);
@@ -458,6 +475,7 @@
     pkgdir->avlangs_h = pkgdir__avlangs_new();
     rc = 1;
 
+    env_pkgdir(pkgdir);
     saved_flags = pkgdir->flags;
     if (mod->open) {
         if (!mod->open(pkgdir, flags)) {
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/pkgdir/pkgdir.c?r1=1.51&r2=1.52&f=u



More information about the pld-cvs-commit mailing list