Hello,

just a little patch to try to modify <requires> and <utilizes> to support paco in nAlfs.


Index: src/logging.c
===================================================================
--- src/logging.c       (révision 12)
+++ src/logging.c       (révision 14)
@@ -192,41 +192,64 @@
 
 int check_stamp(const char *name)
 {
-       int status = 0;
+       int status = 1;
        char *filename;
-       FILE *fp = NULL;
+       FILE *fp;
 
+// add paco support
+       FILE *paco = NULL;
+       char *paco_cmd;
+       char pkg[130];
 
-       filename = alloc_stamp_filename(name);
+       paco_cmd=alloc_trimmed_str("paco -1x");
+       append_str (&paco_cmd, " ");
+       append_str (&paco_cmd, name);   
+       paco = popen (paco_cmd, "r");
 
-       if (filename == NULL) {
-               return 1;
+       if (paco) {
+               while (fgets(pkg, sizeof pkg, paco));
+               status = pclose(paco);
+               if (status == 0 ) {
+                       Nprint ("Checking Paco : This package (%s) is installed 
: %s", name, pkg);
+               } else { 
+                       Nprint_warn ("Checking Paco : This package (%s) is not 
installed.", name);
+               }
        }
+       xfree (paco_cmd);
 
-       if ((fp = fopen(filename, "r")) != NULL) {
-               char *s;
-               char fullpname[MAX_PACKAGE_NAME_AND_VERSION_BUF_SIZE] = {0};
+       if (status) {
 
-               s = fgets(fullpname, MAX_PACKAGE_NAME_AND_VERSION_BUF_SIZE, fp);
+               filename = alloc_stamp_filename(name);
 
-               fclose(fp);
+               if (filename == NULL) {
+                       return 1;
+               }       
 
-               /* TODO: Check whether fullpname corresponds to name. */
+               if ((fp = fopen(filename, "r")) != NULL) {
+                       char *s;
+                       char fullpname[MAX_PACKAGE_NAME_AND_VERSION_BUF_SIZE] = 
{0};
+       
+                       s = fgets(fullpname, 
MAX_PACKAGE_NAME_AND_VERSION_BUF_SIZE, fp);
 
-               if (s) {
-                       remove_new_line(fullpname);
-                       Nprint("Checking package OK: %s (%s)", name, fullpname);
+                       fclose(fp);
+
+                       /* TODO: Check whether fullpname corresponds to name. */
+
+                       if (s) {
+                               remove_new_line(fullpname);
+                               Nprint("Checking package OK: %s (%s)", name, 
fullpname);
+                       } else {
+                               Nprint_warn("Stamp file empty.");
+                       }
+                       status = 0;
+
                } else {
-                       Nprint_warn("Stamp file empty.");
+                       status = 1;
                }
-               status = 0;
 
-       } else {
-               status = 1;
+               xfree(filename);
        }
 
-       xfree(filename);
-
        return status;
 }
 

-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to