[undertaker] Add -picosat patch to adapt to new reentrant picosat API. Fix bogus changelog date.

Jerry James jjames at fedoraproject.org
Wed Jul 31 22:51:25 UTC 2013


commit 10db322d6189204b89f2777a9563e4f2141a5733
Author: Jerry James <jamesjer at betterlinux.com>
Date:   Wed Jul 31 16:51:08 2013 -0600

    Add -picosat patch to adapt to new reentrant picosat API.
    Fix bogus changelog date.

 undertaker-boost_mt.patch |   12 +++---
 undertaker-picosat.patch  |   91 +++++++++++++++++++++++++++++++++++++++++++++
 undertaker.spec           |   17 +++++---
 3 files changed, 107 insertions(+), 13 deletions(-)
---
diff --git a/undertaker-boost_mt.patch b/undertaker-boost_mt.patch
index 65b049e..2c8f06a 100644
--- a/undertaker-boost_mt.patch
+++ b/undertaker-boost_mt.patch
@@ -1,6 +1,6 @@
-diff -up vamos-1.2/undertaker/Makefile~ vamos-1.2/undertaker/Makefile
---- vamos-1.2/undertaker/Makefile~	2011-08-30 12:11:34.000000000 +0200
-+++ vamos-1.2/undertaker/Makefile	2013-07-28 00:56:25.617959197 +0200
+diff -up ./undertaker/Makefile~ ./undertaker/Makefile
+--- ./undertaker/Makefile~	2011-08-30 12:11:34.000000000 +0200
++++ ./undertaker/Makefile	2013-07-28 00:56:25.000000000 +0200
 @@ -13,7 +13,7 @@ CXXFLAGS = $(CFLAGS)
  
  LDFLAGS =
@@ -10,9 +10,9 @@ diff -up vamos-1.2/undertaker/Makefile~ vamos-1.2/undertaker/Makefile
  
  PARSEROBJ = RsfReader.o KconfigWhitelist.o ConfigurationModel.o	\
  		    ModelContainer.o SatChecker.o BlockDefectAnalyzer.o  \
-diff -up vamos-1.2/ziz/Makefile~ vamos-1.2/ziz/Makefile
---- vamos-1.2/ziz/Makefile~	2011-08-24 17:05:15.000000000 +0200
-+++ vamos-1.2/ziz/Makefile	2013-07-28 00:56:36.850027021 +0200
+diff -up ./ziz/Makefile~ ./ziz/Makefile
+--- ./ziz/Makefile~	2011-08-24 17:05:15.000000000 +0200
++++ ./ziz/Makefile	2013-07-28 00:56:36.000000000 +0200
 @@ -3,7 +3,7 @@ LDXX=g++
  DEBUG = -g3
  CFLAGS = -Wall -Wextra -O2 $(DEBUG)
diff --git a/undertaker-picosat.patch b/undertaker-picosat.patch
new file mode 100644
index 0000000..58b3a0a
--- /dev/null
+++ b/undertaker-picosat.patch
@@ -0,0 +1,91 @@
+--- ./undertaker/SatChecker.h.orig	2011-08-24 09:05:15.000000000 -0600
++++ ./undertaker/SatChecker.h	2013-07-31 16:34:25.000000000 -0600
+@@ -48,7 +48,7 @@ namespace Picosat {
+ 
+     /* Include the Limmat library header as C */
+     extern "C" {
+-#include <picosat/picosat.h>
++#include <picosat.h>
+     }
+ };
+ 
+@@ -202,6 +202,8 @@ private:
+     const std::string _sat;
+     clock_t _runtime;
+ 
++    Picosat::PicoSAT *picosat_inst;
++
+     int stringToSymbol(const std::string &key);
+     int newSymbol(void);
+     void addClause(int *clause);
+--- ./undertaker/SatChecker.cpp.orig	2011-08-24 09:05:15.000000000 -0600
++++ ./undertaker/SatChecker.cpp	2013-07-31 16:32:06.000000000 -0600
+@@ -70,13 +70,13 @@ int SatChecker::stringToSymbol(const std
+ }
+ 
+ int SatChecker::newSymbol(void) {
+-    return Picosat::picosat_inc_max_var();
++    return Picosat::picosat_inc_max_var(picosat_inst);
+ }
+ 
+ void SatChecker::addClause(int *clause) {
+     for (int *x = clause; *x; x++)
+-        Picosat::picosat_add(*x);
+-    Picosat::picosat_add(0);
++        Picosat::picosat_add(picosat_inst, *x);
++    Picosat::picosat_add(picosat_inst, 0);
+ }
+ 
+ int SatChecker::notClause(int inner_clause) {
+@@ -299,7 +299,8 @@ void SatChecker::fillSatChecker(std::str
+         std::cout << std::string(expression.begin(), expression.begin()
+                                  + info.length) << endl;
+         */
+-        Picosat::picosat_reset();
++        Picosat::picosat_reset(picosat_inst);
++	picosat_inst = NULL;
+         throw SatCheckerError("SatChecker: Couldn't parse: " + expression);
+     }
+ }
+@@ -308,7 +309,7 @@ void SatChecker::fillSatChecker(tree_par
+     iter_t expression = info.trees.begin()->children.begin();
+     int top_clause = transform_bool_rec(expression);
+     /* This adds the last clause */
+-    Picosat::picosat_assume(top_clause);
++    Picosat::picosat_assume(picosat_inst, top_clause);
+ }
+ 
+ SatChecker::SatChecker(const char *sat, int debug)
+@@ -325,26 +326,26 @@ bool SatChecker::operator()() throw (Sat
+     debug_parser_indent = 0;
+ 
+     try {
+-        Picosat::picosat_init();
++        picosat_inst = Picosat::picosat_init();
+         // try to enable as many features as possible
+-        Picosat::picosat_set_global_default_phase(1);
++        Picosat::picosat_set_global_default_phase(picosat_inst, 1);
+ 
+         fillSatChecker(_sat);
+ 
+-        int res = Picosat::picosat_sat(-1);
++        int res = Picosat::picosat_sat(picosat_inst, -1);
+ 
+         if (res == PICOSAT_SATISFIABLE) {
+             /* Let's get the assigment out of picosat, because we have to
+                reset the sat solver afterwards */
+             std::map<std::string, int>::const_iterator it;
+             for (it = symbolTable.begin(); it != symbolTable.end(); ++it) {
+-                bool selected = Picosat::picosat_deref(it->second) == 1;
++                bool selected = Picosat::picosat_deref(picosat_inst, it->second) == 1;
+                 assignmentTable.insert(std::make_pair(it->first, selected));
+             }
+         }
+ 
+-        Picosat::picosat_reset();
+-
++        Picosat::picosat_reset(picosat_inst);
++        picosat_inst = NULL;
+ 
+     if (res == PICOSAT_UNSATISFIABLE)
+         return false;
diff --git a/undertaker.spec b/undertaker.spec
index 5b2c34f..80e51f4 100644
--- a/undertaker.spec
+++ b/undertaker.spec
@@ -1,6 +1,6 @@
 Name:           undertaker
 Version:        1.2
-Release:        10%{?dist}
+Release:        11%{?dist}
 Summary:        Find always-on and always-off conditional C code
 
 Group:          Development/Languages
@@ -8,7 +8,9 @@ License:        GPLv2 and GPLv3+
 URL:            http://vamos.informatik.uni-erlangen.de/trac/undertaker
 Source0:        http://vamos.informatik.uni-erlangen.de/files/%{name}-%{version}.tar.gz
 # As of F20, Boost doesn't ship -mt DSO's anymore.
-Patch0:		undertaker-boost_mt.patch
+Patch0:         %{name}-boost_mt.patch
+# Adapt to new picosat API
+Patch1:         %{name}-picosat.patch
 
 BuildRequires:  boost-devel
 BuildRequires:  emacs
@@ -70,10 +72,8 @@ Source Elisp code for XEmacs support for %{name}.
 
 %prep
 %setup -q -n vamos-%{version}
-%patch0 -p1
-
-# Fix up one include path
-sed -i 's|picosat/picosat.h|picosat.h|' undertaker/SatChecker.h
+%patch0
+%patch1
 
 # Fix a python path
 sed -i "s|^PYTHONPATH=.*|PYTHONPATH=\""%{python2_sitelib}"\"|" \
@@ -162,6 +162,9 @@ cd $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
 %{_xemacs_sitelispdir}/%{name}/*.el
 
 %changelog
+* Wed Jul 31 2013 Jerry James <loganjerry at gmail.com> - 1.2-11
+- Add -picosat patch to adapt to new reentrant picosat API
+
 * Sat Jul 27 2013 Petr Machata <pmachata at redhat.com> - 1.2-10
 - Rebuild for boost 1.54.0
 - Boost.Wave and Boost.System DSO's do not include -mt suffix anymore
@@ -187,7 +190,7 @@ cd $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}
 - Drop unnecessary BRs
 - Ensure correct LDFLAGS
 
-* Mon Jan  6 2012 Jerry James <loganjerry at gmail.com> - 1.2-3
+* Mon Jan  9 2012 Jerry James <loganjerry at gmail.com> - 1.2-3
 - Rebuild for GCC 4.7
 
 * Sun Nov 20 2011 Jerry James <loganjerry at gmail.com> - 1.2-2


More information about the scm-commits mailing list