Update of /cvsroot/fink/experimental/dmacks/finkinfo
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27576

Modified Files:
        dpkg.info dpkg.patch 
Log Message:
Run wrappers even if no .deb script


Index: dpkg.patch
===================================================================
RCS file: /cvsroot/fink/experimental/dmacks/finkinfo/dpkg.patch,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- dpkg.patch  18 May 2009 04:26:21 -0000      1.11
+++ dpkg.patch  7 Sep 2009 08:48:21 -0000       1.12
@@ -2646,7 +2646,13 @@
      fputs(" )\n",stderr);
    }
    instdirl= strlen(instdir);
-@@ -261,12 +261,45 @@
+@@ -256,17 +263,66 @@
+ static int do_script(const char *pkg, const char *scriptname, const char 
*scriptpath, struct stat *stab, char *const arglist[], const char *desc, const 
char *name, int warn) {
+   const char *scriptexec;
+   int c1, r;
++  if (scriptpath) // if NULL, just want wrapper side-effect, no actual .deb 
script present
+   setexecute(scriptpath,stab);
+ 
    c1= m_fork();
    if (!c1) {
      const char **narglist;
@@ -2654,6 +2660,7 @@
 +    const char **full_narglist;
 +    char *path_wrapper;
 +    struct stat stab_wrapper;
++    const char *null_script_path = "";  // must be blank string (NULL is 
end-of-array sentinel)
 +    /* FINK LOCAL end */
      for (r=0; arglist[r]; r++) ;
 -    narglist=nfmalloc((r+1)*sizeof(char*));
@@ -2664,7 +2671,9 @@
 +    /* FINK LOCAL end */
      for (r=1; arglist[r-1]; r++)
        narglist[r]= arglist[r];
++    if (scriptpath) { // FINK LOCAL
      scriptexec= preexecscript(scriptpath,narglist);
++    } else { scriptexec = null_script_path; }; // FINK LOCAL was called with 
no actual script path to run
      narglist[0]= scriptexec;
 +    /* FINK LOCAL begin */
 +    // try to set up with wrapper
@@ -2677,19 +2686,98 @@
 +      if (!stat(path_wrapper, &stab_wrapper)) {
 +      if ((stab_wrapper.st_mode & 0555) == 0555) {
 +        // only use it if it exists and is chmod a+rx
-+        debug(dbg_scripts,"Wrapper script '%s' will be used", path_wrapper);
++        debug(dbg_scripts,"Wrapper script '%s' will be used around '%s'", 
path_wrapper, scriptpath);
 +        // it's good! set wrapper as actual runnable thing in narglist array
 +        narglist=full_narglist;
 +        scriptexec= preexecscript(path_wrapper,narglist);
 +        narglist[0]= scriptexec;
 +      } else {
 +        debug(dbg_scripts,"Wrapper script '%s' wrong perms", path_wrapper);
++        if (scriptpath) {
++          debug(dbg_scripts,"...falling back to real script '%s'", 
scriptpath);
++        } else {
++          debug(dbg_scripts,"...skipping over because no real script '%s'", 
scriptpath);
++          exit(0);
++        }
 +      }
 +      } else {
 +      debug(dbg_scripts,"Wrapper script '%s' does not exist", path_wrapper);
++      if (scriptpath) {
++        debug(dbg_scripts,"...falling back to real script '%s'", scriptpath);
++      } else {
++        debug(dbg_scripts,"...skipping over because no real script '%s'", 
scriptpath);
++        exit(0);
++      }
 +      }
 +    }
 +    /* FINK LOCAL end */
      execv(scriptexec,narglist);
      ohshite(desc,name);
    }
+@@ -294,8 +350,13 @@
+   if (stat(scriptpath,&stab)) {
+     if (errno == ENOENT) {
+       debug(dbg_scripts,"maintainer_script_installed nonexistent 
%s",scriptname);
+-      return 0;
+-    }
++//    return 0;
++      /* FINK LOCAL begin */
++      // always call do_script (fink adds side-effects), but pass NULL if no 
actual script
++      scriptpath = NULL;
++//  }
++    } else
++      /* FINK LOCAL end */
+     ohshite(_("unable to stat installed %s script 
`%.250s'"),description,scriptpath);
+   }
+   do_script(pkg->name, scriptname, scriptpath, &stab, arglist, _("unable to 
execute %s"), buf, 0);
+@@ -320,8 +381,14 @@
+   if (stat(cidir,&stab)) {
+     if (errno == ENOENT) {
+       debug(dbg_scripts,"maintainer_script_new nonexistent %s 
`%s'",scriptname,cidir);
+-      return 0;
+-    }
++//    return 0;
++      //    }
++      /* FINK LOCAL begin */
++      // always call do_script (fink adds side-effects), but pass NULL if no 
actual script
++      cidir = NULL;
++//  }
++    } else
++      /* FINK LOCAL end */
+     ohshite(_("unable to stat new %s script `%.250s'"),description,cidir);
+   }
+   do_script(pkgname, scriptname, cidir, &stab, arglist, _("unable to execute 
new %s"), buf, 0);
+@@ -348,16 +415,19 @@
+     if (errno == ENOENT) {
+       debug(dbg_scripts,"maintainer_script_alternative nonexistent %s `%s'",
+             scriptname,oldscriptpath);
+-      return 0;
+-    }
++      /* FINK LOCAL begin */
++      // always call do_script (fink adds side-effects), but pass NULL if no 
actual script
++      oldscriptpath = NULL;
++    } else {
++      /* FINK LOCAL end */
+     fprintf(stderr,
+             _("dpkg: warning - unable to stat %s `%.250s': %s\n"),
+             buf,oldscriptpath,strerror(errno));
+-  } else {
++    }
++  }
+     if (!do_script(pkg->name, scriptname, oldscriptpath, &stab, arglist, 
_("unable to execute %s"), buf, PROCWARN))
+       return 1;
+     ensure_diversions();
+-  }
+   fprintf(stderr, _("dpkg - trying script from the new package instead 
...\n"));
+ 
+   arglist= buildarglist(scriptname,
+@@ -367,6 +437,9 @@
+   strcpy(cidirrest,scriptname);
+   sprintf(buf,_("new %s script"),description);
+ 
++  // FINK if old-pkg fails, don't want to allow "success" of new
++  // solely because wrapper worked in new-pkg: loses important
++  // error-state that *should* fail loudly
+   if (stat(cidir,&stab)) {
+     if (errno == ENOENT)
+       ohshit(_("there is no script in the new version of the package - giving 
up"));

Index: dpkg.info
===================================================================
RCS file: /cvsroot/fink/experimental/dmacks/finkinfo/dpkg.info,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- dpkg.info   18 May 2009 04:26:21 -0000      1.12
+++ dpkg.info   7 Sep 2009 08:48:21 -0000       1.13
@@ -12,7 +12,7 @@
 Source2: mirror:sourceforge:fink/gettext-0.14.5.tar.gz
 Source2-MD5: e2f6581626a22a0de66dce1d81d00de3
 PatchFile: %n.patch
-PatchFile-MD5: 0df17df230dd6f43ac614e1acc757eb3
+PatchFile-MD5: fb292518605eb8c4b1e3a17b1e65d367
 PatchScript: <<
  cd %b/..; sed 's|@PREFIX@|%p|g' < %{PatchFile} | patch -p0
  cd %b/../gettext-0.14.5/build-aux; perl -pi -e 's/.*chmod.*777.*$//g' 
ltmain.sh
@@ -106,7 +106,7 @@
 
 Patched to use %p/lib/fink/dpkg-wrappers/ wrappers for .deb scripts
 (for use with the dpkg-wrappers CVS branch of the base-files module)
-NB: if no .deb script, wrapper isn't run.
+NB: wrapper runs even if no .deb script.
 <<
 #
 PostInstScript: <<


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Fink-commits mailing list
[email protected]
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to