Update to latest git snapshot for bug fixes.

Also:
- Add -doc subpackage.
- Add gecode 5 support, enabling gecode support for all releases.
- Add -python3 patch to adapt to python3.
- Jacop support did not work at all.  Add Requires: jacop, symlink
  to jacop.jar where mp expects to find it, and fix rpath handling
  so libjvm.so can be found.
- Do not invoke rpm to get the jacop version; that is not guaranteed
  to work.
- Build with openblas instead of atlas.
- Run all tests on Fedora and EPEL 7+.
- Numerous small spec file cleanups.
This commit is contained in:
Jerry James 2020-02-21 11:22:02 -07:00
parent 54afbb640c
commit 178c4d4f6e
7 changed files with 1224 additions and 192 deletions

8
.gitignore vendored
View File

@ -1,5 +1,3 @@
/mp-35060ba2a59f2b0f0fd622ed9df678f142f846ed.tar.gz
/mp-9fdb5147068f3b719999210e56b493327f1ca5e7.zip
/mp-3.1.0.tar.gz
/mp-1f39801af085656e4bf72250356a3a70d5d98e73.zip
/mp-1f39801af085656e4bf72250356a3a70d5d98e73.tar.gz
/mp-*.tar.gz
/mp-*.zip
/ampl.github.io.tar.xz

539
mp-gecode5.patch Normal file
View File

@ -0,0 +1,539 @@
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.ampl.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.ampl
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.ampl.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.ampl 2020-02-13 10:54:58.310164230 -0700
@@ -1,10 +1,10 @@
# Declarations of suffixes and parameters for Gecode.
-# Constraint suffix that specifies consistency level for integer propagators.
-suffix icl integer >= 0 <= 3 IN;
+# Constraint suffix that specifies propagation level for integer propagators.
+suffix ipl integer >= 0 <= 3 IN;
-# Possible values for the icl suffix.
-param icl_val = 0;
-param icl_bnd = 1;
-param icl_dom = 2;
-param icl_def = 3;
+# Possible values for the ipl suffix.
+param ipl_def = 0;
+param ipl_val = 1;
+param ipl_bnd = 2;
+param ipl_dom = 3;
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.cc.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.cc
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.cc.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.cc 2020-02-13 12:00:24.824170732 -0700
@@ -37,11 +37,11 @@ namespace Search = Gecode::Search;
namespace {
-const mp::OptionValueInfo INT_CON_LEVELS[] = {
- {"val", "value propagation or consistency (naive)", Gecode::ICL_VAL},
- {"bnd", "bounds propagation or consistency", Gecode::ICL_BND},
- {"dom", "domain propagation or consistency", Gecode::ICL_DOM},
- {"def", "the default consistency for a constraint", Gecode::ICL_DEF}
+const mp::OptionValueInfo INT_PROP_LEVELS[] = {
+ {"val", "value propagation or consistency (naive)", Gecode::IPL_VAL},
+ {"bnd", "bounds propagation or consistency", Gecode::IPL_BND},
+ {"dom", "domain propagation or consistency", Gecode::IPL_DOM},
+ {"def", "the default propagation for a constraint", Gecode::IPL_DEF}
};
const mp::OptionValueInfo VAR_BRANCHINGS[] = {
@@ -76,14 +76,14 @@ const mp::OptionValueInfo VAR_BRANCHINGS
IntVarBranch::SEL_AFC_MAX
},
{
- "activity_min",
- "lowest activity",
- IntVarBranch::SEL_ACTIVITY_MIN
+ "action_min",
+ "lowest action",
+ IntVarBranch::SEL_ACTION_MIN
},
{
- "activity_max",
- "highest activity",
- IntVarBranch::SEL_ACTIVITY_MAX
+ "action_max",
+ "highest action",
+ IntVarBranch::SEL_ACTION_MAX
},
{
"min_min",
@@ -136,13 +136,13 @@ const mp::OptionValueInfo VAR_BRANCHINGS
IntVarBranch::SEL_AFC_SIZE_MAX
},
{
- "activity_size_min",
- "smallest activity by domain size",
- IntVarBranch::SEL_ACTIVITY_SIZE_MIN},
+ "action_size_min",
+ "smallest action divided by domain size",
+ IntVarBranch::SEL_ACTION_SIZE_MIN},
{
- "activity_size_max",
- "largest activity by domain size",
- IntVarBranch::SEL_ACTIVITY_SIZE_MAX
+ "action_size_max",
+ "largest action divided by domain size",
+ IntVarBranch::SEL_ACTION_SIZE_MAX
},
{
"regret_min_min",
@@ -232,12 +232,12 @@ const mp::OptionValueInfo RESTART_MODES[
namespace mp {
-GecodeProblem::GecodeProblem(int num_vars, Gecode::IntConLevel icl) :
- vars_(space(), num_vars), obj_irt_(Gecode::IRT_NQ), icl_(icl) {
+GecodeProblem::GecodeProblem(int num_vars, Gecode::IntPropLevel ipl) :
+ vars_(space(), num_vars), obj_irt_(Gecode::IRT_NQ), ipl_(ipl) {
}
GecodeProblem::GecodeProblem(bool share, GecodeProblem &s) :
- Gecode::Space(share, s), obj_irt_(s.obj_irt_), icl_(s.icl_) {
+ Gecode::Space(share, s), obj_irt_(s.obj_irt_), ipl_(s.ipl_) {
vars_.update(*this, share, s.vars_);
if (obj_irt_ != Gecode::IRT_NQ)
obj_.update(*this, share, s.obj_);
@@ -255,7 +255,7 @@ void GecodeProblem::SetObj(obj::Type obj
void GecodeProblem::constrain(const Gecode::Space &best) {
if (obj_irt_ != Gecode::IRT_NQ) {
rel(*this, obj_, obj_irt_,
- static_cast<const GecodeProblem&>(best).obj_, icl_);
+ static_cast<const GecodeProblem&>(best).obj_, ipl_);
}
}
@@ -265,19 +265,19 @@ BoolExpr MPToGecodeConverter::Convert(
int index = 0;
for (IteratedLogicalExpr::iterator
i = e.begin(), end = e.end(); i != end; ++i, ++index) {
- args[index] = Gecode::expr(problem_, Visit(*i), icl_);
+ args[index] = Gecode::expr(problem_, Visit(*i), ipl_);
}
Gecode::BoolVar var(problem_, 0, 1);
- rel(problem_, op, args, var, icl_);
+ rel(problem_, op, args, var, ipl_);
return var;
}
LinExpr MPToGecodeConverter::Convert(IteratedExpr e, VarArgFunc f) {
IntVarArgs args;
for (VarArgExpr::iterator i = e.begin(), end = e.end(); i != end; ++i)
- args << Gecode::expr(problem_, Visit(*i), icl_);
+ args << Gecode::expr(problem_, Visit(*i), ipl_);
IntVar result(problem_, Gecode::Int::Limits::min, Gecode::Int::Limits::max);
- f(problem_, args, result, icl_);
+ f(problem_, args, result, ipl_);
return result;
}
@@ -307,15 +307,15 @@ LinExpr MPToGecodeConverter::ConvertExpr
return expr;
}
-Gecode::IntConLevel MPToGecodeConverter::GetICL(int con_index) const {
- if (!icl_suffix_)
- return icl_;
- int value = icl_suffix_.value(con_index);
- assert(value == Gecode::ICL_VAL || value == Gecode::ICL_BND ||
- value == Gecode::ICL_DOM || value == Gecode::ICL_DEF);
- if (value < 0 || value > Gecode::ICL_DEF)
- throw Error("Invalid value \"{}\" for suffix \"icl\"", value);
- return static_cast<Gecode::IntConLevel>(value);
+Gecode::IntPropLevel MPToGecodeConverter::GetIPL(int con_index) const {
+ if (!ipl_suffix_)
+ return ipl_;
+ int value = ipl_suffix_.value(con_index);
+ assert(value == Gecode::IPL_VAL || value == Gecode::IPL_BND ||
+ value == Gecode::IPL_DOM || value == Gecode::IPL_DEF);
+ if (value < 0 || value > Gecode::IPL_DEF)
+ throw Error("Invalid value \"{}\" for suffix \"ipl\"", value);
+ return static_cast<Gecode::IntPropLevel>(value);
}
void MPToGecodeConverter::Convert(const Problem &p) {
@@ -343,19 +343,19 @@ void MPToGecodeConverter::Convert(const
ConvertExpr(obj.linear_expr(), obj.nonlinear_expr()));
}
- icl_suffix_ = p.suffixes(suf::CON).Find<int>("icl");
+ ipl_suffix_ = p.suffixes(suf::CON).Find<int>("ipl");
- class ICLSetter {
+ class IPLSetter {
private:
- Gecode::IntConLevel &icl_;
- Gecode::IntConLevel saved_value_;
+ Gecode::IntPropLevel &ipl_;
+ Gecode::IntPropLevel saved_value_;
public:
- ICLSetter(Gecode::IntConLevel &icl, Gecode::IntConLevel new_value) :
- icl_(icl), saved_value_(icl) {
- icl = new_value;
+ IPLSetter(Gecode::IntPropLevel &ipl, Gecode::IntPropLevel new_value) :
+ ipl_(ipl), saved_value_(ipl) {
+ ipl = new_value;
}
- ~ICLSetter() { icl_ = saved_value_; }
+ ~IPLSetter() { ipl_ = saved_value_; }
};
// Convert algebraic constraints.
@@ -364,21 +364,21 @@ void MPToGecodeConverter::Convert(const
LinExpr con_expr(
ConvertExpr(con.linear_expr(), con.nonlinear_expr()));
double lb = con.lb(), ub = con.ub();
- ICLSetter icl_setter(icl_, GetICL(i));
+ IPLSetter ipl_setter(ipl_, GetIPL(i));
if (lb <= -inf) {
- rel(problem_, con_expr <= CastToInt(ub), icl_);
+ rel(problem_, con_expr <= CastToInt(ub), ipl_);
continue;
}
if (ub >= inf) {
- rel(problem_, con_expr >= CastToInt(lb), icl_);
+ rel(problem_, con_expr >= CastToInt(lb), ipl_);
continue;
}
int int_lb = CastToInt(lb), int_ub = CastToInt(ub);
if (int_lb == int_ub) {
- rel(problem_, con_expr == int_lb, icl_);
+ rel(problem_, con_expr == int_lb, ipl_);
} else {
- rel(problem_, con_expr >= int_lb, icl_);
- rel(problem_, con_expr <= int_ub, icl_);
+ rel(problem_, con_expr >= int_lb, ipl_);
+ rel(problem_, con_expr <= int_ub, ipl_);
}
}
@@ -386,9 +386,9 @@ void MPToGecodeConverter::Convert(const
int num_logical_cons = p.num_logical_cons();
for (int i = 0; i < num_logical_cons; ++i) {
LogicalExpr e = p.logical_con(i).expr();
- ICLSetter icl_setter(icl_, GetICL(p.num_algebraic_cons() + i));
+ IPLSetter ipl_setter(ipl_, GetIPL(p.num_algebraic_cons() + i));
if (e.kind() != expr::ALLDIFF) {
- rel(problem_, Visit(e), icl_);
+ rel(problem_, Visit(e), ipl_);
continue;
}
PairwiseExpr alldiff = Cast<PairwiseExpr>(e);
@@ -399,9 +399,9 @@ void MPToGecodeConverter::Convert(const
if (arg.kind() == expr::VARIABLE)
args[i] = vars[Cast<Variable>(arg).index()];
else
- args[i] = Gecode::expr(problem_, Visit(arg), icl_);
+ args[i] = Gecode::expr(problem_, Visit(arg), ipl_);
}
- distinct(problem_, args, icl_);
+ distinct(problem_, args, ipl_);
}
}
@@ -422,16 +422,16 @@ LinExpr MPToGecodeConverter::VisitIf(IfE
if (false_const && false_const.value() == 0) {
NumericConstant true_const = Cast<NumericConstant>(then_expr);
if (true_const && true_const.value() == 1) {
- Gecode::channel(problem_, Gecode::expr(problem_, condition, icl_), result);
+ Gecode::channel(problem_, Gecode::expr(problem_, condition, ipl_), result);
return result;
}
}
rel(problem_, result, Gecode::IRT_EQ,
- Gecode::expr(problem_, Visit(then_expr), icl_),
- Reify(Gecode::expr(problem_, condition, icl_), Gecode::RM_IMP), icl_);
+ Gecode::expr(problem_, Visit(then_expr), ipl_),
+ Reify(Gecode::expr(problem_, condition, ipl_), Gecode::RM_IMP), ipl_);
rel(problem_, result, Gecode::IRT_EQ,
- Gecode::expr(problem_, Visit(else_expr), icl_),
- Reify(Gecode::expr(problem_, !condition, icl_), Gecode::RM_IMP), icl_);
+ Gecode::expr(problem_, Visit(else_expr), ipl_),
+ Reify(Gecode::expr(problem_, !condition, ipl_), Gecode::RM_IMP), ipl_);
return result;
}
@@ -450,10 +450,10 @@ LinExpr MPToGecodeConverter::VisitCount(
int index = 0;
for (CountExpr::iterator
i = e.begin(), end = e.end(); i != end; ++i, ++index) {
- args[index] = Gecode::expr(problem_, Visit(*i), icl_);
+ args[index] = Gecode::expr(problem_, Visit(*i), ipl_);
}
IntVar result(problem_, 0, e.num_args());
- Gecode::linear(problem_, args, Gecode::IRT_EQ, result, icl_);
+ Gecode::linear(problem_, args, Gecode::IRT_EQ, result, ipl_);
return result;
}
@@ -465,8 +465,8 @@ LinExpr MPToGecodeConverter::VisitNumber
int num_args = e.num_args();
IntVarArgs args(num_args - 1);
for (int i = 1; i < num_args; ++i)
- args[i - 1] = Gecode::expr(problem_, Visit(e.arg(i)), icl_);
- count(problem_, args, Gecode::expr(problem_, Visit(e.arg(0)), icl_),
+ args[i - 1] = Gecode::expr(problem_, Visit(e.arg(i)), ipl_);
+ count(problem_, args, Gecode::expr(problem_, Visit(e.arg(0)), ipl_),
Gecode::IRT_EQ, result);
return result;
}
@@ -492,12 +492,12 @@ BoolExpr MPToGecodeConverter::LogicalExp
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
Gecode::BoolExpr expr = negate ? args[i] == args[j] : args[i] != args[j];
- logical_args[index++] = Gecode::expr(problem, expr, converter_.icl_);
+ logical_args[index++] = Gecode::expr(problem, expr, converter_.ipl_);
}
}
Gecode::BoolVar var(problem, 0, 1);
rel(problem, negate ? Gecode::BOT_OR : Gecode::BOT_AND,
- logical_args, var, converter_.icl_);
+ logical_args, var, converter_.ipl_);
return var;
}
@@ -594,7 +594,7 @@ GecodeSolver::GecodeSolver()
: SolverImpl<Problem>(
"gecode", "gecode " GECODE_VERSION, 20160205, MULTIPLE_SOL),
output_(false), output_frequency_(1), output_count_(0), solve_code_(-1),
- icl_(Gecode::ICL_DEF),
+ ipl_(Gecode::IPL_DEF),
var_branching_(IntVarBranch::SEL_SIZE_MIN),
val_branching_(IntValBranch::SEL_MIN),
decay_(1),
@@ -604,7 +604,7 @@ GecodeSolver::GecodeSolver()
set_version("Gecode " GECODE_VERSION);
- AddSuffix("icl", 0, suf::CON);
+ AddSuffix("ipl", 0, suf::CON);
set_option_header(
"Gecode Options for AMPL\n"
@@ -625,13 +625,13 @@ GecodeSolver::GecodeSolver()
"Output frequency in seconds. The value should be a positive number.",
&GecodeSolver::GetOutputFrequency, &GecodeSolver::SetOutputFrequency);
- AddStrOption("icl",
- "Consistency level for integer propagators. Possible values:\n"
+ AddStrOption("ipl",
+ "Propagation level for integer propagators. Possible values:\n"
"\n"
".. value-table::\n",
- &GecodeSolver::GetEnumOption<Gecode::IntConLevel>,
- &GecodeSolver::SetEnumOption<Gecode::IntConLevel>,
- &icl_, INT_CON_LEVELS);
+ &GecodeSolver::GetEnumOption<Gecode::IntPropLevel>,
+ &GecodeSolver::SetEnumOption<Gecode::IntPropLevel>,
+ &ipl_, INT_PROP_LEVELS);
AddStrOption("var_branching",
"Variable branching. Possible values:\n"
@@ -726,7 +726,7 @@ void GetSolution(GecodeProblem &gecode_p
solution[j] = vars[j].val();
}
-template<template<template<typename> class, typename> class Meta>
+template<template<typename, template<typename> class> class Meta>
GecodeSolver::ProblemPtr GecodeSolver::Search(
Problem &p, GecodeProblem &problem,
Search::Statistics &stats, SolutionHandler &sh) {
@@ -734,7 +734,7 @@ GecodeSolver::ProblemPtr GecodeSolver::S
unsigned solution_limit = solution_limit_;
unsigned num_solutions = 0;
if (problem.has_obj()) {
- Meta<Gecode::BAB, GecodeProblem> engine(&problem, options_);
+ Meta<GecodeProblem, Gecode::BAB> engine(&problem, options_);
while (GecodeProblem *next = engine.next()) {
if (output_)
Output("{:46}\n", next->obj().val());
@@ -748,7 +748,7 @@ GecodeSolver::ProblemPtr GecodeSolver::S
} else {
if (solution_limit == UINT_MAX)
solution_limit = 1;
- Meta<Gecode::DFS, GecodeProblem> engine(&problem, options_);
+ Meta<GecodeProblem, Gecode::DFS> engine(&problem, options_);
std::vector<double> solution;
bool multiple_sol = need_multiple_solutions();
if (multiple_sol)
@@ -775,7 +775,7 @@ void GecodeSolver::Solve(Problem &p, Sol
SetStatus(-1, "");
// Set up an optimization problem in Gecode.
- MPToGecodeConverter converter(p.num_vars(), icl_);
+ MPToGecodeConverter converter(p.num_vars(), ipl_);
converter.Convert(p);
// Post branching.
@@ -787,12 +787,12 @@ void GecodeSolver::Solve(Problem &p, Sol
break;
case IntVarBranch::SEL_AFC_MIN:
case IntVarBranch::SEL_AFC_MAX:
- case IntVarBranch::SEL_ACTIVITY_MIN:
- case IntVarBranch::SEL_ACTIVITY_MAX:
+ case IntVarBranch::SEL_ACTION_MIN:
+ case IntVarBranch::SEL_ACTION_MAX:
case IntVarBranch::SEL_AFC_SIZE_MIN:
case IntVarBranch::SEL_AFC_SIZE_MAX:
- case IntVarBranch::SEL_ACTIVITY_SIZE_MIN:
- case IntVarBranch::SEL_ACTIVITY_SIZE_MAX:
+ case IntVarBranch::SEL_ACTION_SIZE_MIN:
+ case IntVarBranch::SEL_ACTION_SIZE_MAX:
var_branch = IntVarBranch(var_branching_, decay_, 0);
break;
default:
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.h.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.h
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.h.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/solvers/gecode/gecode.h 2020-02-13 11:59:18.839277859 -0700
@@ -52,12 +52,12 @@ class GecodeProblem: public Gecode::Spac
Gecode::IntVar obj_;
Gecode::IntRelType obj_irt_; // IRT_NQ - no objective,
// IRT_LE - minimization, IRT_GR - maximization
- Gecode::IntConLevel icl_;
+ Gecode::IntPropLevel ipl_;
Gecode::Space &space() { return *this; }
public:
- GecodeProblem(int num_vars, Gecode::IntConLevel icl);
+ GecodeProblem(int num_vars, Gecode::IntPropLevel ipl);
GecodeProblem(bool share, GecodeProblem &s);
Gecode::Space *copy(bool share);
@@ -75,8 +75,8 @@ class GecodeProblem: public Gecode::Spac
class MPToGecodeConverter : public ExprVisitor<MPToGecodeConverter, LinExpr> {
private:
GecodeProblem problem_;
- Gecode::IntConLevel icl_;
- IntSuffix icl_suffix_;
+ Gecode::IntPropLevel ipl_;
+ IntSuffix ipl_suffix_;
std::vector<LinExpr> common_exprs_;
typedef Gecode::BoolExpr BoolExpr;
@@ -92,7 +92,7 @@ class MPToGecodeConverter : public ExprV
typedef void (*VarArgFunc)(
Gecode::Home, const Gecode::IntVarArgs &,
- Gecode::IntVar, Gecode::IntConLevel);
+ Gecode::IntVar, Gecode::IntPropLevel);
LinExpr Convert(IteratedExpr e, VarArgFunc f);
@@ -100,7 +100,7 @@ class MPToGecodeConverter : public ExprV
LinExpr ConvertExpr(const LinearExpr &linear, NumericExpr nonlinear);
- Gecode::IntConLevel GetICL(int con_index) const;
+ Gecode::IntPropLevel GetIPL(int con_index) const;
class LogicalExprConverter :
public ExprConverter<LogicalExprConverter, Gecode::BoolExpr> {
@@ -182,8 +182,8 @@ class MPToGecodeConverter : public ExprV
}
public:
- MPToGecodeConverter(int num_vars, Gecode::IntConLevel icl)
- : problem_(num_vars, icl), icl_(icl) {}
+ MPToGecodeConverter(int num_vars, Gecode::IntPropLevel ipl)
+ : problem_(num_vars, ipl), ipl_(ipl) {}
void Convert(const Problem &p);
@@ -297,7 +297,7 @@ class GecodeSolver : public SolverImpl<P
int solve_code_;
std::string status_;
- Gecode::IntConLevel icl_;
+ Gecode::IntPropLevel ipl_;
Gecode::IntVarBranch::Select var_branching_;
Gecode::IntValBranch::Select val_branching_;
double decay_;
@@ -371,20 +371,20 @@ class GecodeSolver : public SolverImpl<P
const Gecode::Search::Options &);
};
-#ifdef HAVE_UNIQUE_PTR
+#ifdef MP_USE_UNIQUE_PTR
typedef std::unique_ptr<GecodeProblem> ProblemPtr;
#else
typedef std::auto_ptr<GecodeProblem> ProblemPtr;
#endif
- template<template<template<typename> class, typename> class Meta>
+ template<template<typename, template<typename> class> class Meta>
ProblemPtr Search(Problem &p, GecodeProblem &gecode_problem,
Gecode::Search::Statistics &stats, SolutionHandler &sh);
public:
GecodeSolver();
- Gecode::IntConLevel icl() const { return icl_; }
+ Gecode::IntPropLevel ipl() const { return ipl_; }
Gecode::IntVarBranch::Select var_branching() const { return var_branching_; }
Gecode::IntValBranch val_branching() const { return val_branching_; }
const Gecode::Search::Options &options() const { return options_; }
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/solvers/gecode-test.cc.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/solvers/gecode-test.cc
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/solvers/gecode-test.cc.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/solvers/gecode-test.cc 2020-02-13 13:40:46.368524259 -0700
@@ -115,22 +115,22 @@ struct OptionValue {
T value;
};
-const OptionValue<Gecode::IntConLevel> INT_CON_LEVELS[] = {
- {"val", Gecode::ICL_VAL},
- {"bnd", Gecode::ICL_BND},
- {"dom", Gecode::ICL_DOM},
- {"def", Gecode::ICL_DEF},
- {0, Gecode::ICL_VAL}
+const OptionValue<Gecode::IntPropLevel> INT_PROP_LEVELS[] = {
+ {"val", Gecode::IPL_VAL},
+ {"bnd", Gecode::IPL_BND},
+ {"dom", Gecode::IPL_DOM},
+ {"def", Gecode::IPL_DEF},
+ {0, Gecode::IPL_VAL}
};
-TEST_F(NLSolverTest, IntConLevelOption) {
- EXPECT_EQ(Gecode::ICL_DEF, solver_.icl());
+TEST_F(NLSolverTest, IntPropLevelOption) {
+ EXPECT_EQ(Gecode::IPL_DEF, solver_.ipl());
unsigned count = 0;
- for (const OptionValue<Gecode::IntConLevel>
- *p = INT_CON_LEVELS; p->name; ++p, ++count) {
- solver_.SetStrOption("icl", p->name);
- EXPECT_EQ(p->name, solver_.GetStrOption("icl"));
- EXPECT_EQ(p->value, solver_.icl());
+ for (const OptionValue<Gecode::IntPropLevel>
+ *p = INT_PROP_LEVELS; p->name; ++p, ++count) {
+ solver_.SetStrOption("ipl", p->name);
+ EXPECT_EQ(p->name, solver_.GetStrOption("ipl"));
+ EXPECT_EQ(p->value, solver_.ipl());
}
EXPECT_EQ(4u, count);
}
@@ -168,8 +168,8 @@ const OptionValue<IntVarBranch::Select>
{"degree_max", IntVarBranch::SEL_DEGREE_MAX},
{"afc_min", IntVarBranch::SEL_AFC_MIN},
{"afc_max", IntVarBranch::SEL_AFC_MAX},
- {"activity_min", IntVarBranch::SEL_ACTIVITY_MIN},
- {"activity_max", IntVarBranch::SEL_ACTIVITY_MAX},
+ {"action_min", IntVarBranch::SEL_ACTION_MIN},
+ {"action_max", IntVarBranch::SEL_ACTION_MAX},
{"min_min", IntVarBranch::SEL_MIN_MIN},
{"min_max", IntVarBranch::SEL_MIN_MAX},
{"max_min", IntVarBranch::SEL_MAX_MIN},
@@ -180,8 +180,8 @@ const OptionValue<IntVarBranch::Select>
{"degree_size_max", IntVarBranch::SEL_DEGREE_SIZE_MAX},
{"afc_size_min", IntVarBranch::SEL_AFC_SIZE_MIN},
{"afc_size_max", IntVarBranch::SEL_AFC_SIZE_MAX},
- {"activity_size_min", IntVarBranch::SEL_ACTIVITY_SIZE_MIN},
- {"activity_size_max", IntVarBranch::SEL_ACTIVITY_SIZE_MAX},
+ {"action_size_min", IntVarBranch::SEL_ACTION_SIZE_MIN},
+ {"action_size_max", IntVarBranch::SEL_ACTION_SIZE_MAX},
{"regret_min_min", IntVarBranch::SEL_REGRET_MIN_MIN},
{"regret_min_max", IntVarBranch::SEL_REGRET_MIN_MAX},
{"regret_max_min", IntVarBranch::SEL_REGRET_MAX_MIN},

442
mp-python3.patch Normal file
View File

@ -0,0 +1,442 @@
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/doc/CMakeLists.txt 2020-02-13 15:45:51.942114727 -0700
@@ -48,7 +48,7 @@ endif ()
add_prefix(doc_deps ../ ${MP_HEADERS})
add_custom_target(doc
- COMMAND python ${BUILD_DOCS}
+ COMMAND python3 ${BUILD_DOCS}
DEPENDS conf.py ${doc_deps} ${amplgsl_docs})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ampl.github.io/
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-linux.py 2020-02-13 15:22:47.654450099 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""
Set up build environment on Ubuntu or other Debian-based
Linux distribution.
@@ -10,7 +10,7 @@ buildbot: install buildbot slave
"""
import platform, re, os, shutil
-from bootstrap import *
+from .bootstrap import *
from subprocess import check_call, Popen, PIPE
if __name__ == '__main__':
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-osx.py 2020-02-13 15:22:24.535839893 -0700
@@ -1,8 +1,7 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Set up build environment on OS X Moutain Lion.
-from __future__ import print_function
-from bootstrap import *
+from .bootstrap import *
import glob, os, sys, tempfile
from subprocess import call, check_call
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap.py 2020-02-13 15:21:39.224603644 -0700
@@ -1,6 +1,5 @@
# Common bootstrap functionality.
-from __future__ import print_function
import glob, os, platform, re, shutil, sys
import tarfile, tempfile, uuid, zipfile
from contextlib import closing
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/bootstrap-windows.py 2020-02-13 15:23:25.110818565 -0700
@@ -1,8 +1,7 @@
# Set up build environment on 64-bit Windows.
-from __future__ import print_function
import os, shutil, tempfile
-from bootstrap import *
+from .bootstrap import *
from glob import glob
from subprocess import check_call, check_output
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/bootstrap/create-ubuntu-image.py 2020-02-13 15:11:03.171308668 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""
Create a base docker image for Ubuntu Lucid.
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/build-docs.py 2020-02-14 10:11:07.288162263 -0700
@@ -1,12 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""Build documentation.
Usage: build-docs.py [extract-docs <file>]
"""
-from __future__ import print_function
import fileutil, mmap, os, re, shutil
-from subprocess import call, check_call, check_output, Popen, PIPE
+from subprocess import check_call, Popen, PIPE
from docopt import docopt
mp_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
@@ -14,21 +13,6 @@ mp_dir = os.path.dirname(os.path.dirname
def run(*args, **kwargs):
check_call(args, **kwargs)
-def create_virtualenv(venv_dir):
- "Create and activate virtualenv in the given directory."
- # File "check" is used to make sure that we don't have
- # a partial environment in case virtualenv was interrupted.
- check_path = os.path.join(venv_dir, 'check')
- if not os.path.exists(check_path):
- run('virtualenv', venv_dir)
- os.mknod(check_path)
- # Activate virtualenv.
- import sysconfig
- scripts_dir = os.path.basename(sysconfig.get_path('scripts'))
- activate_this_file = os.path.join(venv_dir, scripts_dir, 'activate_this.py')
- with open(activate_this_file) as f:
- exec(f.read(), dict(__file__=activate_this_file))
-
def extract_docs(filename, output_dir):
"Extract the AMPLGSL documentation from the code."
output = None
@@ -36,9 +20,9 @@ def extract_docs(filename, output_dir):
if not os.path.exists(output_dir):
os.mkdir(output_dir)
with open(filename, 'r+b') as input:
- map = mmap.mmap(input.fileno(), 0)
- for i in re.finditer(r'/\*\*(.*?)\*/', map, re.DOTALL):
- s = re.sub(r'\n +\* ?', r'\n', i.group(1))
+ mm = mmap.mmap(input.fileno(), 0)
+ for i in re.finditer(rb'/\*\*(.*?)\*/', mm, re.DOTALL):
+ s = re.sub(r'\n +\* ?', r'\n', i.group(1).decode('utf-8'))
s = re.sub(r'\$(.+?)\$', r':math:`\1`', s, flags=re.DOTALL)
m = re.search(r'@file (.*)', s)
if m:
@@ -48,7 +32,7 @@ def extract_docs(filename, output_dir):
output = open(os.path.join(output_dir, filename + '.rst'), 'w')
s = s[:m.start()] + s[m.end():]
output.write(s.rstrip(' '))
- map.close()
+ mm.close()
def get_mp_version():
filename = os.path.join(os.path.dirname(__file__), '..', 'CMakeLists.txt')
@@ -58,13 +42,6 @@ def get_mp_version():
if m:
return m.group(1)
-def pip_install(package, **kwargs):
- "Install package using pip."
- commit = kwargs.get('commit')
- if commit:
- package = 'git+git://github.com/{0}.git@{1}'.format(package, commit)
- run('pip', 'install', '-q', package)
-
def copy_content(src_dir, dst_dir):
"Copy content of the src_dir to dst_dir recursively."
for entry in os.listdir(src_dir):
@@ -77,16 +54,11 @@ def copy_content(src_dir, dst_dir):
shutil.copyfile(src, dst)
def build_docs(workdir, doxygen='doxygen'):
- create_virtualenv(os.path.join(workdir, 'build', 'virtualenv'))
- # Install Sphinx and Breathe.
- pip_install('sphinx==1.3.1')
- pip_install('breathe', check_version='4.1.0')
-
# Clone the ampl.github.io repo.
repo = 'ampl.github.io'
repo_dir = os.path.join(workdir, repo)
if not os.path.exists(repo_dir):
- run('git', 'clone', 'https://github.com/ampl/{}.git'.format(repo), cwd=workdir)
+ shutil.copytree(os.path.join(mp_dir, repo), repo_dir)
# Copy API docs and the database connection guides to the build directory.
# The guides are not stored in the mp repo to avoid polluting history with
@@ -129,7 +101,7 @@ def build_docs(workdir, doxygen='doxygen
JAVADOC_AUTOBRIEF = YES
ALIASES = "rst=\verbatim embed:rst"
ALIASES += "endrst=\endverbatim"
- '''.format(mp_dir))
+ '''.format(mp_dir).encode('utf-8'))
returncode = p.returncode
if returncode == 0:
# Pass the MP version via environment variables rather than command-line
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-demo-packages.py 2020-02-13 15:25:54.934292448 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""Create AMPL demo packages.
Usage:
@@ -8,14 +8,13 @@ Options:
--cache Cache downloaded packages (for debugging).
"""
-from __future__ import print_function
import fileutil, gzip, os, shutil, stat, subprocess
-import tarfile, tempfile, ctxtimer, urllib, zipfile
+import tarfile, tempfile, ctxtimer, urllib.request, urllib.parse, zipfile
from docopt import docopt
from glob import glob
from sets import Set
-from StringIO import StringIO
-from urlparse import urlparse
+from io import StringIO
+from urllib.parse import urlparse
# URL for downloading student versions of AMPL binaries.
student_url = 'http://www.ampl.com/netlib/ampl/student/'
@@ -63,7 +62,7 @@ def retrieve_cached(url, system = None):
print('Using cached version of', filename)
else:
print('Downloading', filename)
- urllib.urlretrieve(url, cached_path)
+ urllib.request.urlretrieve(url, cached_path)
return cached_path
# Extract files from amplcml.zip.
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-packages.py 2020-02-13 15:24:36.877608531 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""Create packages of AMPL solvers and libraries.
@@ -6,7 +6,6 @@ Usage:
create-packages.py [update]
"""
-from __future__ import print_function
import docopt, fileutil, os, re, shutil, subprocess, tempfile, zipfile
project = "ampl"
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/create-solver-package.py 2020-02-13 15:26:12.420997611 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""Create a solver source package for AMPL use.
@@ -6,7 +6,6 @@ Usage:
create-solver-packages.py <solver>
"""
-from __future__ import print_function
import docopt, os, zipfile
mp_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/ctxtimer.py 2020-02-13 15:21:20.295922221 -0700
@@ -1,6 +1,5 @@
# A with statement context based timer.
-from __future__ import print_function
from contextlib import contextmanager
import sys, timeit
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/docopt.py 2020-02-13 15:20:13.337049167 -0700
@@ -81,7 +81,7 @@ def transform(pattern):
while groups:
children = groups.pop(0)
parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
- if any(t in map(type, children) for t in parents):
+ if any(t in list(map(type, children)) for t in parents):
child = [c for c in children if type(c) in parents][0]
children.remove(child)
if type(child) is Either:
@@ -181,12 +181,12 @@ class Option(LeafPattern):
def __init__(self, short=None, long=None, argcount=0, value=False):
assert argcount in (0, 1)
- self.short, self.long, self.argcount = short, long, argcount
+ self.short, self.long, self.argcount = short, int, argcount
self.value = None if value is False and argcount else value
@classmethod
def parse(class_, option_description):
- short, long, argcount, value = None, None, 0, False
+ short, int, argcount, value = None, None, 0, False
options, _, description = option_description.strip().partition(' ')
options = options.replace(',', ' ').replace('=', ' ')
for s in options.split():
@@ -199,7 +199,7 @@ class Option(LeafPattern):
if argcount:
matched = re.findall('\[default: (.*)\]', description, flags=re.I)
value = matched[0] if matched else None
- return class_(short, long, argcount, value)
+ return class_(short, int, argcount, value)
def single_match(self, left):
for n, pattern in enumerate(left):
@@ -300,21 +300,21 @@ class Tokens(list):
def parse_long(tokens, options):
"""long ::= '--' chars [ ( ' ' | '=' ) chars ] ;"""
- long, eq, value = tokens.move().partition('=')
- assert long.startswith('--')
+ int, eq, value = tokens.move().partition('=')
+ assert int.startswith('--')
value = None if eq == value == '' else value
- similar = [o for o in options if o.long == long]
+ similar = [o for o in options if o.long == int]
if tokens.error is DocoptExit and similar == []: # if no exact match
- similar = [o for o in options if o.long and o.long.startswith(long)]
+ similar = [o for o in options if o.long and o.long.startswith(int)]
if len(similar) > 1: # might be simply specified ambiguously 2+ times?
raise tokens.error('%s is not a unique prefix: %s?' %
- (long, ', '.join(o.long for o in similar)))
+ (int, ', '.join(o.long for o in similar)))
elif len(similar) < 1:
argcount = 1 if eq == '=' else 0
- o = Option(None, long, argcount)
+ o = Option(None, int, argcount)
options.append(o)
if tokens.error is DocoptExit:
- o = Option(None, long, argcount, value if argcount else True)
+ o = Option(None, int, argcount, value if argcount else True)
else:
o = Option(similar[0].short, similar[0].long,
similar[0].argcount, similar[0].value)
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/download.py 2020-02-13 15:27:21.146838851 -0700
@@ -1,6 +1,6 @@
# A file downloader.
-import contextlib, os, tempfile, ctxtimer, urllib2, urlparse
+import contextlib, os, tempfile, ctxtimer, urllib.request, urllib.error, urllib.parse
class Downloader:
def __init__(self, dir=None):
@@ -12,18 +12,18 @@ class Downloader:
# with d.download(url) as f:
# use_file(f)
def download(self, url, cookie=None):
- suffix = os.path.splitext(urlparse.urlsplit(url)[2])[1]
+ suffix = os.path.splitext(urllib.parse.urlsplit(url)[2])[1]
fd, filename = tempfile.mkstemp(suffix=suffix, dir=self.dir)
os.close(fd)
with ctxtimer.print_time('Downloading', url, 'to', filename):
- opener = urllib2.build_opener()
+ opener = urllib.request.build_opener()
if cookie:
opener.addheaders.append(('Cookie', cookie))
num_tries = 2
for i in range(num_tries):
try:
f = opener.open(url)
- except urllib2.URLError, e:
+ except urllib.error.URLError as e:
print('Failed to open url', url)
continue
length = f.headers.get('content-length')
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/fileutil.py 2020-02-13 15:23:52.255360892 -0700
@@ -1,6 +1,5 @@
# File utils.
-from __future__ import print_function
import errno, os, shutil, zipfile
# Delete an entire directory tree if it exists.
@@ -31,7 +30,7 @@ def make_archive(archive_name, dirname):
if os.path.islink(path):
zipinfo = zipfile.ZipInfo(path)
zipinfo.create_system = UNIX
- zipinfo.external_attr = 2716663808L
+ zipinfo.external_attr = 2716663808
zip.writestr(zipinfo, os.readlink(path))
else:
zip.write(path, path)
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/get-options.py 2020-02-13 15:11:03.187308399 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# This scripts extract options from solvers and formats them in HTML.
import errno, os, sys
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/travis-build.py 2020-02-13 15:21:02.537221108 -0700
@@ -1,7 +1,6 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Build the project on Travis CI.
-from __future__ import print_function
import os, re, shutil, tarfile, tempfile
from bootstrap import bootstrap
from contextlib import closing
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-dependencies.py 2020-02-13 15:11:03.177308567 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Updates dependencies integrated into the source tree such as C++ Format.
import download, os, re, shutil, zipfile, fileutil
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/support/update-netlib-branch.py 2020-02-13 15:11:03.176308584 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# This script updates the "netlib" branch from the AMPL Solver Library
# repository at rsync ampl.com::ampl/
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/generate-nl-files.py 2020-02-13 15:17:56.691348963 -0700
@@ -1,11 +1,11 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# This scripts generates test .nl files from AMPL model and data files.
from subprocess import Popen, PIPE
def generate_nl_file(stub, *files, **kwargs):
code = ''
- for key, value in kwargs.iteritems():
+ for key, value in kwargs.items():
if key == 'code':
code = value
else:
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/test/support/util.py 2020-02-13 15:18:38.826639813 -0700
@@ -1,5 +1,5 @@
import sys
-from cStringIO import StringIO
+from io import StringIO
# Captures output to stdout in a block.
# Usage:

View File

@ -1,89 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<title>rpms/mp.git - mp</title>
<meta name='generator' content='cgit v0.12'/>
<meta name='robots' content='index, nofollow'/>
<link rel='stylesheet' type='text/css' href='/cgit-data/cgit.css'/>
<link rel='shortcut icon' href='/favicon.ico'/>
<link rel='alternate' title='Atom feed' href='http://pkgs.fedoraproject.org/cgit/rpms/mp.git/atom/mp-strtod.patch?h=master' type='application/atom+xml'/>
<link rel='vcs-git' href='git://pkgs.fedoraproject.org/rpms/mp.git' title='rpms/mp.git Git repository'/>
<link rel='vcs-git' href='ssh://pkgs.fedoraproject.org/rpms/mp.git' title='rpms/mp.git Git repository'/>
<link rel='vcs-git' href='http://pkgs.fedoraproject.org/git/rpms/mp.git' title='rpms/mp.git Git repository'/>
</head>
<body>
<script src="https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js"></script>
<script src="https://apps.fedoraproject.org/fedmenu/js/fedmenu.js"></script>
<script>
var base = 'https://apps.fedoraproject.org/';
var tokens = window.location.href.split('/');
var repo = null;
if (tokens.length > 4 && tokens[4] != '') {
repo = tokens[4].split('.')[0];
}
fedmenu({
'url': base + 'js/data.js',
'mimeType': 'application/javascript',
'position': 'bottom-right',
'package': repo,
});
</script>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/cgit/'><img src='/cgit-data/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/cgit/'>index</a> : <a title='rpms/mp.git' href='/cgit/rpms/mp.git/'>rpms/mp.git</a></td><td class='form'><form method='get' action=''>
<select name='h' onchange='this.form.submit();'>
<option value='epel7'>epel7</option>
<option value='f22'>f22</option>
<option value='f23'>f23</option>
<option value='f24'>f24</option>
<option value='master' selected='selected'>master</option>
<option value='mp2'>mp2</option>
</select> <input type='submit' name='' value='switch'/></form></td></tr>
<tr><td class='sub'>mp</td><td class='sub right'>Jon Ciesla</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit/rpms/mp.git/'>summary</a><a href='/cgit/rpms/mp.git/refs/'>refs</a><a href='/cgit/rpms/mp.git/log/mp-strtod.patch'>log</a><a class='active' href='/cgit/rpms/mp.git/tree/mp-strtod.patch'>tree</a><a href='/cgit/rpms/mp.git/commit/mp-strtod.patch'>commit</a><a href='/cgit/rpms/mp.git/diff/mp-strtod.patch'>diff</a><a href='/cgit/rpms/mp.git/stats/mp-strtod.patch'>stats</a></td><td class='form'><form class='right' method='get' action='/cgit/rpms/mp.git/log/mp-strtod.patch'>
<select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='text' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit/rpms/mp.git/tree/'>root</a>/<a href='/cgit/rpms/mp.git/tree/mp-strtod.patch'>mp-strtod.patch</a></div><div class='content'>blob: f01b748aef5cc0614b25d60ec73df0db0c5f3ab4 (<a href='/cgit/rpms/mp.git/plain/mp-strtod.patch'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
</pre></td>
<td class='lines'><pre><code>diff -up mp-9fdb5147068f3b719999210e56b493327f1ca5e7/src/asl/solvers/asl.h.orig mp-9fdb5147068f3b719999210e56b493327f1ca5e7/src/asl/solvers/asl.h
--- mp-9fdb5147068f3b719999210e56b493327f1ca5e7/src/asl/solvers/asl.h.orig 2016-03-16 18:16:10.961987586 -0300
+++ mp-9fdb5147068f3b719999210e56b493327f1ca5e7/src/asl/solvers/asl.h 2016-03-16 18:17:21.067990271 -0300
@@ -1104,17 +1104,7 @@ QPinfo {
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/include/mp/posix.h.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/include/mp/posix.h
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/include/mp/posix.h.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/include/mp/posix.h 2020-02-13 14:10:43.502102892 -0700
@@ -28,6 +28,7 @@
#endif
#include "format.h"
+#undef strtod
#ifndef FMT_POSIX
# if defined(_WIN32) && !defined(__MINGW32__)
diff -up mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/src/asl/solvers/asl.h.orig mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/src/asl/solvers/asl.h
--- mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/src/asl/solvers/asl.h.orig 2019-12-09 11:21:17.000000000 -0700
+++ mp-51aeb2c386342ed4f48cc78d3df9e4e57a70f667/src/asl/solvers/asl.h 2020-02-13 13:29:55.934445155 -0700
@@ -1103,17 +1103,7 @@ QPinfo {
extern void xunkno_(VOID);
extern void zero_div_ASL(ASL*, real, const char*);
@ -102,9 +31,3 @@
#ifdef __cplusplus
}
</code></pre></td></tr></table>
</div> <!-- class=content -->
<div class='footer'>generated by <a href='http://git.zx2c4.com/cgit/about/'>cgit v0.12</a> at 2016-03-30 10:58:39 (GMT)</div>
</div> <!-- id=cgit -->
</body>
</html>

17
mp.rpmlintrc Normal file
View File

@ -0,0 +1,17 @@
# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON
# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors
# The dictionary is missing some technical terms
addFilter(r'W: spelling-error .* (ilogcp|nl)')
# We require jacop, so this symlink does not dangle
addFilter(r'W: dangling-symlink /usr/lib(64)?/mp/bin/lib/jacop-.*\.jar')
# Source2 does not have an upstream URL
addFilter(r'mp\.spec: W: invalid-url Source2:')
# Documentation is in the mp-doc subpackage
addFilter(r'mp-devel\.[^:]+: W: no-documentation')
# This file may be empty, but links point to it
addFilter(r'mp-doc\.[^:]+: E: zero-length /usr/share/doc/mp-doc/models/compl/changes')

300
mp.spec
View File

@ -3,65 +3,98 @@
# https://lists.centos.org/pipermail/centos-devel/2016-June/014820.html
%if 0%{?fedora}
%global with_jacop 1
# https://github.com/ampl/mp/issues/109
%global with_gecode 0
%global with_jacop 1
%global with_gecode 1
%else
%global with_jacop 0
%if 0%{?rhel} < 8
%global with_gecode 1
%else
%global with_gecode 0
%endif
%if 0%{?rhel}
%global with_jacop 0
%global with_gecode 1
%endif
%if 0%{?rhel} && 0%{?rhel} < 7
%{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro}
%endif
%if 0%{?rhel}
%if 0%{?rhel} && 0%{?rhel} < 8
%{!?_modulesdir: %global _modulesdir %{_datadir}/Modules/modulefiles}
%endif
%global commit 1f39801af085656e4bf72250356a3a70d5d98e73
%global date 20161124
%global commit 71c21a5cac90479b9443ce8e23e68eab944f7bb9
%global date 20200215
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: mp
Version: 3.1.0
Release: 25.%{date}git%{shortcommit}%{?dist}
Release: 26.%{date}git%{shortcommit}%{?dist}
License: MIT and BSD
Summary: An open-source library for mathematical programming
URL: https://github.com/ampl/mp
Source0: https://github.com/ampl/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz
Source1: %{name}.module.in
# The documentation building step wants this. It is a git checkout of
# https://github.com/ampl/ampl.github.io.git, dated 21 Mar 2019,
# commit ccf1ff9f109d09ea0d42c60b6f26323312a99c42
Source2: ampl.github.io.tar.xz
Patch0: %{name}-strtod.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1333344
Patch1: %{name}-%{version}-jni.patch
Patch1: %{name}-%{version}-jni.patch
# Adapt to python 3
Patch2: %{name}-python3.patch
# Adapt to gecode 5.x
# https://github.com/ampl/mp/pull/129
Patch3: %{name}-gecode5.patch
%if 0%{?rhel} && 0%{?rhel} >= 7
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: config(environment-modules)
%else
Requires: environment(modules)
%endif
BuildRequires: atlas-devel
%if 0%{?with_jacop}
Requires: jacop
%endif
# This package bundles an old copy of fmt. The interface has changed
# significantly since then, so porting is nontrivial.
Provides: bundled(fmt) = 3.0.1
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: config(environment-modules)
%else
BuildRequires: environment(modules)
%endif
BuildRequires: chrpath
BuildRequires: cmake3
BuildRequires: environment-modules
BuildRequires: doxygen
BuildRequires: gcc-c++
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: gdb-headless
%else
BuildRequires: gdb
%endif
%if 0%{?with_gecode}
BuildRequires: gecode-devel
%endif
# Need git to satisfy a cmake test if building modules (gsl)
BuildRequires: git-core
%if 0%{?with_jacop}
BuildRequires: jacop
BuildRequires: java-devel
%endif
# Need git to satisfy a cmake test if building modules (gsl)
BuildRequires: git, gdb
BuildRequires: chrpath
BuildRequires: gsl-devel
BuildRequires: gcc-c++
BuildRequires: doxygen
BuildRequires: openblas-devel
BuildRequires: pkgconfig(gsl)
%if 0%{?fedora}
BuildRequires: pkgconfig(odbc)
%endif
%if 0%{?fedora} || 0%{?rhel} == 7
BuildRequires: python%{python3_pkgversion}-breathe
BuildRequires: python%{python3_pkgversion}-sphinx
BuildRequires: python%{python3_pkgversion}-virtualenv
#BuildRequires: python%%{python3_pkgversion}-sphinx-latex
BuildRequires: unixODBC-devel
%endif
%global majver %(cut -d. -f1 <<< %{version})
%description
An open-source library for mathematical programming.
@ -96,75 +129,127 @@ Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
This package contains the header files and development documentation
for %{name}.
This package contains the header files for %{name}.
%if 0%{?fedora} || 0%{?rhel} > 6
%package doc
Summary: Documentation for %{name}
%description doc
This package contains the developer documentation for %{name}.
%endif
%prep
%autosetup -n %{name}-%{commit} -p1
%autosetup -n %{name}-%{commit} -N
%setup -n %{name}-%{commit} -q -T -D -a 2
%patch0 -p1
%patch1 -p1
%if 0%{?fedora} || 0%{?rhel} > 6
%patch2 -p1
%endif
%if 0%{?fedora} || 0%{?rhel} > 7
%patch3 -p1
%endif
%if 0%{?with_jacop}
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-`rpm -q --qf "%%{VERSION}" jacop`.jar
jacopver=$(sed -n 's,^ <version>\(.*\)</version>,\1,p' %{_mavenpomdir}/jacop/jacop.pom)
ln -s %{_javadir}/jacop/jacop.jar thirdparty/jacop/jacop-$jacopver.jar
%endif
fixtimestamp() {
touch -r $1.orig $1
rm -f $1.orig
}
# Fix end of line and character encodings
for fil in $(find ampl.github.io/models -type f); do
type=$(file $fil)
if [[ "$type" =~ "with CRLF" ]]; then
sed -i.orig 's/\r//' $fil
fixtimestamp $fil
fi
if [[ "$type" =~ "ISO-8859" ]]; then
mv $fil $fil.orig
iconv -f ISO8859-1 -t UTF-8 $fil.orig > $fil
fixtimestamp $fil
fi
done
# Fix the invocation name for sphinx
%if 0%{?rhel} == 7
sed -i 's,sphinx-build,&-3.6,' support/build-docs.py
%endif
# python-breathe is broken in EPEL 7 and absent in EPEL 6 and 8, so skip
# building sphinx docs for those distributions.
%if 0%{?rhel}
sed -i 's,returncode == 0,False,' support/build-docs.py
%endif
%build
%if 0%{?fedora} || 0%{?rhel} >= 7
export LIBS="-lgsl -L%{_libdir}/atlas -lsatlas"
export LIBS="-lgsl -lopenblas"
%else
export LIBS="-lgsl -L%{_libdir}/atlas -lcblas -latlas"
%endif
mkdir -p build && pushd build
BUILD="asl,gsl,smpswriter"
%if 0%{?with_gecode}
BUILD="gecode"
BUILD="gecode,$BUILD"
%endif
%if 0%{?with_jacop}
BUILD="$BUILD,jacop"
BUILD="jacop,$BUILD"
%endif
BUILD="$BUILD,gsl,smpswriter"
export CPPFLAGS="-I$PWD/src/asl/solvers"
export CFLAGS="%{optflags} -DNDEBUG"
export CXXFLAGS="%{optflags} -DNDEBUG"
export LDFLAGS="%{__global_ldflags}"
%if 0%{?rhel} && 0%{?rhel} < 7
export CFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG"
export CXXFLAGS="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG"
export LDFLAGS="%{__global_ldflags} -fPIC -pie -Wl,-z,now"
%cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags} -Wl,-z,now -fPIC -pie -Wl,--as-needed" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags} -Wl,-z,relro -fPIC -pie -Wl,-z,now -DNDEBUG" \
-DCMAKE_C_FLAGS_RELEASE:STRING="" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_SKIP_RPATH:BOOL=NO \
-DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD ..
export CFLAGS="$CFLAGS -Wl,-z,relro -fPIC -pie -Wl,-z,now"
export CXXFLAGS="$CXXFLAGS -Wl,-z,relro -fPIC -pie -Wl,-z,now"
export LDFLAGS="$LDFLAGS -fPIC -pie -Wl,-z,now -Wl,--as-needed"
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
# Let cmake create rpaths, so the jacop-using files can find libjvm.so.
# We strip out the ones we don't want with chrpath at install time.
%cmake3 -DCMAKE_INSTALL_PREFIX:PATH=%{_libdir}/%{name} \
-DCMAKE_SHARED_LINKER_FLAGS="%{__global_ldflags}" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="%{optflags}" \
-DCMAKE_C_FLAGS_RELEASE:STRING="%{optflags}" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$LDFLAGS" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="$CXXFLAGS" \
-DCMAKE_C_FLAGS_RELEASE:STRING="$CFLAGS" \
-DCMAKE_SKIP_INSTALL_RPATH:BOOL=NO \
-DCMAKE_SKIP_RPATH:BOOL=NO \
-DBUILD_SHARED_LIBS=ON -DBUILD=$BUILD ..
%endif
-DCMAKE_VERBOSE_MAKEFILE:BOOL=YES \
-DGENERATE_ARITH:BOOL=YES \
-DBUILD_SHARED_LIBS:BOOL=YES \
-DBUILD:STRING=$BUILD ..
%make_build
## Documentation needs online connection to upstream
## and Sphinx 1.1.3
#make doc
%if 0%{?fedora} || 0%{?rhel} > 6
make doc
rm doc/ampl.github.io/models/*/.depend
%endif
popd
%install
#%%make_install
mkdir -p %{buildroot}%{_modulesdir}
sed 's#@BINDIR@#'%{_libdir}/%{name}'#g;' < %{SOURCE1} > \
%{buildroot}%{_modulesdir}/%{name}-%{_arch}
mkdir -p %{buildroot}%{_libdir}/%{name}/bin
mkdir -p %{buildroot}%{_libdir}/%{name}/bin/lib
mkdir -p %{buildroot}%{_includedir}/asl
cp -a include %{buildroot}%{_prefix}
cp -a include %{buildroot}%{_prefix}
install -pm 644 src/asl/*.h %{buildroot}%{_includedir}/asl
install -pm 644 src/asl/solvers/*.h build/src/asl/*.h %{buildroot}%{_includedir}/asl
# Required by coin-or-Couenne
install -pm 644 src/asl/solvers/{opcode,r_opn}.hd %{buildroot}%{_includedir}/asl
install -pm 644 src/asl/solvers/{opcode,r_opn}.hd %{buildroot}%{_includedir}/asl
%if 0%{?with_jacop}
jacopver=$(sed -n 's,^ <version>\(.*\)</version>,\1,p' %{_mavenpomdir}/jacop/jacop.pom)
install -pm 644 build/bin/ampljacop.jar %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/jacop %{buildroot}%{_libdir}/%{name}/bin
ln -s %{_javadir}/jacop/jacop.jar %{buildroot}%{_libdir}/%{name}/bin/lib/jacop-$jacopver.jar
install -pm 755 build/bin/libampljacop.so %{buildroot}%{_libdir}/%{name}/bin
%endif
install -pm 755 build/bin/amplgsl.dll %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/ampltabl.dll %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/arithchk %{buildroot}%{_libdir}/%{name}/bin
@ -172,27 +257,27 @@ install -pm 755 build/bin/cp.dll %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/fullbit.dll %{buildroot}%{_libdir}/%{name}/bin
%if 0%{?with_gecode}
install -pm 755 build/bin/gecode %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/libamplgecode.so %{buildroot}%{_libdir}/%{name}/bin
%endif
install -pm 755 build/bin/gen-expr-info %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/gjh %{buildroot}%{_libdir}/%{name}/bin
%if 0%{?with_jacop}
install -pm 755 build/bin/jacop %{buildroot}%{_libdir}/%{name}/bin
%endif
install -pm 755 build/bin/smpswriter %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/gsl-info %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/libamplsmpswriter.so %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/simpbit.dll %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/smpswriter %{buildroot}%{_libdir}/%{name}/bin
install -pm 755 build/bin/tableproxy%{__isa_bits} %{buildroot}%{_libdir}/%{name}/bin
## Fix symbolic links
## On epel6 'mp' conflicts with 'gmp'
## We need to install libraries in a private lib directory
%if 0%{?rhel} && 0%{?rhel} < 7
install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}/%{name}
ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so.3
ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so
ln -sf %{_libdir}/%{name}/libasl.so.%{version} %{buildroot}%{_libdir}/%{name}/libasl.so.%{majver}
ln -sf libasl.so.%{majver} %{buildroot}%{_libdir}/%{name}/libasl.so
install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir}/%{name}
ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so.3
ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so
ln -sf %{_libdir}/%{name}/libmp.so.%{version} %{buildroot}%{_libdir}/%{name}/libmp.so.%{majver}
ln -sf libmp.so.%{majver} %{buildroot}%{_libdir}/%{name}/libmp.so
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/libasl.so.%{version}
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/amplgsl.dll
@ -201,22 +286,20 @@ chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/cp.dll
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/fullbit.dll
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gecode
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gjh
%if 0%{?with_jacop}
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/jacop
%endif
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/smpswriter
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/gsl-info
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/libamplgecode.so
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/libamplsmpswriter.so
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/smpswriter
chrpath --replace %{_libdir}/%{name} %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
%else
install -pm 755 build/bin/libasl.so* %{buildroot}%{_libdir}
ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.3
ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so
ln -sf libasl.so.%{version} %{buildroot}%{_libdir}/libasl.so.%{majver}
ln -sf libasl.so.%{majver} %{buildroot}%{_libdir}/libasl.so
install -pm 755 build/bin/libmp.so* %{buildroot}%{_libdir}
ln -sf libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so.3
ln -sf libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so
ln -sf libmp.so.%{version} %{buildroot}%{_libdir}/libmp.so.%{majver}
ln -sf libmp.so.%{majver} %{buildroot}%{_libdir}/libmp.so
chrpath --delete %{buildroot}%{_libdir}/libasl.so.%{version}
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/amplgsl.dll
@ -226,13 +309,19 @@ chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/cp.dll
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/fullbit.dll
%if 0%{?with_gecode}
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gecode
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/libamplgecode.so
%endif
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gen-expr-info
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gjh
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/gsl-info
%if 0%{?with_jacop}
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/jacop
rpath=$(dirname $(find %{_jvmdir}/jre/lib -name libjvm.so))
chrpath --replace $rpath %{buildroot}%{_libdir}/%{name}/bin/jacop
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/libampljacop.so
%endif
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/smpswriter
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/libamplsmpswriter.so
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/simpbit.dll
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/smpswriter
chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
%endif
##
@ -241,15 +330,18 @@ chrpath --delete %{buildroot}%{_libdir}/%{name}/bin/tableproxy%{__isa_bits}
# https://github.com/ampl/mp/issues/101
%check
pushd build
%if 0%{?rhel} && 0%{?rhel} > 6
ctest3 --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28
%endif
%if 0%{?rhel} && 0%{?rhel} < 7
# Some of the tests use the SAME FILENAME to store temporary results, so
# running the tests in parallel leads to intermittent test failures, generally
# in either os-test or solver-test. Do not pass the parallel flags to ctest.
%if 0%{?rhel}
%if 0%{?rhel} < 7
# https://github.com/ampl/mp/issues/103
ctest3 --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28
ctest3 --force-new-ctest-process -E gsl
%else
ctest3 --force-new-ctest-process
%endif
%if 0%{?fedora}
ctest --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28
%else
ctest --force-new-ctest-process
%endif
%ldconfig_scriptlets
@ -260,24 +352,44 @@ ctest --force-new-ctest-process --parallel %{?_smp_mflags} -I 4,15,,1,17,28
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/bin/
%if 0%{?rhel} && 0%{?rhel} < 7
%{_libdir}/%{name}/*.so.*
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_libdir}/*.so.*
%{_libdir}/%{name}/libasl.so.3*
%{_libdir}/%{name}/libmp.so.3*
%else
%{_libdir}/libasl.so.3*
%{_libdir}/libmp.so.3*
%endif
%{_modulesdir}/%{name}-%{_arch}
%files devel
%if 0%{?rhel} && 0%{?rhel} < 7
%{_libdir}/%{name}/*.so
%endif
%if 0%{?fedora} || 0%{?rhel} >= 7
%{_libdir}/*.so
%{_libdir}/%{name}/libasl.so
%{_libdir}/%{name}/libmp.so
%else
%{_libdir}/libasl.so
%{_libdir}/libmp.so
%endif
%{_includedir}/asl
%{_includedir}/mp
%if 0%{?fedora} || 0%{?rhel} > 6
%files doc
%license LICENSE.rst
%doc build/doc/ampl.github.io/*
%endif
%changelog
* Fri Feb 21 2020 Jerry James <loganjerry@gmail.com> - 3.1.0-26.20191209git51aeb2c
- Update to latest git snapshot for bug fixes
- Add -doc subpackage
- Add gecode 5 support, enabling gecode support for all releases
- Add -python3 patch to adapt to python3
- Jacop support did not work at all. Add Requires: jacop, symlink to jacop.jar
where mp expects to find it, and fix rpath handling so libjvm.so can be found
- Do not invoke rpm to get the jacop version; that is not guaranteed to work
- Build with openblas instead of atlas
- Run all tests on Fedora and EPEL 7+
- Numerous small spec file cleanups
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-25.20161124git1f39801
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

View File

@ -1 +1,2 @@
SHA512 (mp-1f39801af085656e4bf72250356a3a70d5d98e73.tar.gz) = 2e906be347f912087ec6a799b5b2d7b3ba30b537a4503081a3ff4315e7806bbd73b6fc8ad71dc75c77ce3e505d5298b2f73b76f6fb5a10754cf79dc46447bcc2
SHA512 (mp-71c21a5cac90479b9443ce8e23e68eab944f7bb9.tar.gz) = 7ee0c15b248b1c1ea8aefc7003dae68effe0fb3af8d229988adbf54d1761cae8bd29104d3c68cd40765434f0f225165fbee8f9a3af47ff5021a327459201e296
SHA512 (ampl.github.io.tar.xz) = a908c151b61ebd0a50fdef6ecec9537fa6749a79f2bb1b9cb72baa1578855a60e500d31d66497ced6b581509e15d08d6c9b3c275df73ab5e639dfe6d8d8f5b65