sci-mathematics/packup: new package, add 0.6

Signed-off-by: Alessandro Barbieri <lssndrbarbieri@gmail.com>
This commit is contained in:
Alessandro Barbieri
2022-04-29 01:46:59 +02:00
parent 1d6017d595
commit 59813a99ec
8 changed files with 313 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
DIST packup-0.6.1 3539 BLAKE2B 5a98a7a8f9fb760cd394058a0e3b8295a664b9d1c70cd32f6edac20d236c167acfa953c70f2dd8e43de7b7be2f1fc8ade2f1175a6fb4526112bc994237b0d434 SHA512 8b2dab50f1f92c601e4e77fe477e7fef4fd08764cd793f910fe9abe8f18f7dcbc22d4513fa75a125b8f90f32faf3b6bd6d257a9301072046ddd351c436645299
DIST packup-0.6.1.html 6480 BLAKE2B 26fe09b83e7fe55c088163124e3241894d8cad2ee9ca87d56ef17a878655448fc62182bc80cf66f7595861477f4fd17a4ea330a485d9970e36466ef7a10bff06 SHA512 8d8f66250db548e5d5291ea5670349efe7195ff25703e2a47dd76adba0bfa3074a01d0c22b0e9b27285b6116d057190b6ebb48c3dc21cc9cd132e2e6ef3741b7
DIST packup-0.6.tgz 86457 BLAKE2B d7a7540a9d46ab09500ef71862ade6484dc2fc19df0dab8be0b017a53102843539640a2ec6838cb551f4bdf77abede83abb05bd87271c506f5b5b41093278409 SHA512 8aa396f7f53f8ea3eba086df6ab1c4c685277e8fe947d90431d7cc9b70dd04c20771277b92c770e6766a633dfb8e75b36188c706c9cbae31e4afeff85ee60814

View File

@@ -0,0 +1,3 @@
description: CUDF solver based on the Pseudo-Boolean Constraint solver MiniSat+
exec: /usr/bin/packup -u $pref $in $out
cudf-version: 2.0

View File

@@ -0,0 +1,166 @@
Author: Mikoláš Janota <mikolas.janota@gmail.com>
Description: compliance to the C++11 standard
Debian-bug: #811793
--- a/basic_clset.hh
+++ b/basic_clset.hh
@@ -34,11 +34,7 @@
#include <cmath>
#include <vector>
-#include <ext/hash_map> // Location of STL hash extensions
-#include <ext/hash_set> // Location of STL hash extensions
-
using namespace std;
-using namespace __gnu_cxx; // Required for STL hash extensions
#include "globals.hh"
#include "basic_clause.hh"
--- a/cl_globals.hh
+++ b/cl_globals.hh
@@ -34,11 +34,7 @@
#include <cmath>
#include <vector>
-#include <ext/hash_map> // Location of STL hash extensions
-#include <ext/hash_set> // Location of STL hash extensions
-
using namespace std;
-using namespace __gnu_cxx; // Required for STL hash extensions
#include "globals.hh"
#include "basic_clause.hh"
--- a/cl_registry.hh
+++ b/cl_registry.hh
@@ -34,8 +34,6 @@
#include <cmath>
#include <vector>
-#include <ext/hash_map> // Location of STL hash extensions
-#include <ext/hash_set> // Location of STL hash extensions
#include <ext/algorithm> // Location of STL hash extensions
using namespace std;
--- a/cl_types.hh
+++ b/cl_types.hh
@@ -66,7 +66,7 @@
typedef vector<BasicClause*> BasicClauseVector;
typedef BasicClauseVector::iterator ClVectIterator;
-typedef slist<BasicClause*> BasicClauseSList;
+//typedef slist<BasicClause*> BasicClauseSList;
typedef list<BasicClause*> BasicClauseList;
--- a/collections.hh
+++ b/collections.hh
@@ -34,7 +34,7 @@
typedef vector<PackageVersions> PackageVersionsList;
typedef vector<PackageVersionsList*> PackageVersionsCNF;
typedef vector<PackageVersion> PackageVersionList;
-typedef unordered_map< const char*,string,__gnu_cxx::hash<const char*>, streq > Str2Str;
+typedef unordered_map< const char*,string,std::hash<const char*>, streq > Str2Str;
typedef unordered_map<PackageVersion, Variable, hash_package_version, eq_package_version> PackageVersionMap;
typedef unordered_map<Variable,PackageVersion> VariableToPackageVersion;
typedef vector<Version> VersionVector;
--- a/common_types.hh
+++ b/common_types.hh
@@ -25,13 +25,9 @@
#ifndef COMMON_TYPES_H
#define COMMON_TYPES_H
-#include <ext/hash_set>
-#include <ext/hash_map>
+#include "hash_structs.hh"
#include <string.h>
#include "types.hh"
-using __gnu_cxx::hash;
-using __gnu_cxx::hash_map;
-using __gnu_cxx::hash_set;
using std::string;
using std::vector;
using std::ostream;
@@ -40,8 +36,6 @@
#define CONSTANT const
#define CONTAINS(s,e) ( ((s).find(e))!=(s).end() )
#define SAME_PACKAGE_NAME(n1,n2) (n1.data()==n2.data())
-#define unordered_set hash_set
-#define unordered_map hash_map
typedef unsigned int UINT;
typedef UINT Version;
@@ -115,6 +109,7 @@
{return strcmp(s1, s2) == 0;}
};
+/*
namespace __gnu_cxx
{
template<>
@@ -126,7 +121,9 @@
return h(s.data());
}
};
-} /*end of namespace __gnu_cxx */
+}*/ /*end of namespace __gnu_cxx */
+
+
const char* to_string (KeepValue value);
const char* to_string (Criterion value);
--- a/cudf_msu.cc
+++ b/cudf_msu.cc
@@ -27,8 +27,9 @@
#include "Options.hh"
using std::ifstream;
-static const char* dist_date = ""DISTDATE"";
-static const char* changeset = ""CHANGESET"";
+#define stringify(s) #s
+static const char* dist_date = stringify(DISTDATE);
+static const char* changeset = stringify(CHANGESET);
static const char* release = "0.6";
IDManager id_manager;
--- a/hash_structs.hh
+++ b/hash_structs.hh
@@ -0,0 +1,12 @@
+#ifndef HASH_STRUCTS_123
+#define HASH_STRUCTS_123
+
+#include <unordered_set>
+#include <unordered_map>
+#define hash_multimap unordered_multimap
+#define hash_set unordered_set
+#define hash_map unordered_map
+using std::hash;
+using std::unordered_map;
+using std::unordered_set;
+#endif
--- a/types.hh
+++ b/types.hh
@@ -38,6 +38,12 @@
using namespace std;
+#include <unordered_set>
+#include <unordered_map>
+#define hash_multimap unordered_multimap
+#define hash_set unordered_set
+#define hash_map unordered_map
+
/*----------------------------------------------------------------------------*\
* Values besides 0 and 1
@@ -158,11 +164,8 @@
#include <map>
#include <set>
#include <ext/slist> // Location of STL list extensions
-#include <ext/hash_map> // Location of STL hash extensions
-#include <ext/hash_set> // Location of STL hash extensions
using namespace std;
-using namespace __gnu_cxx; // Required for STL hash extensions
#ifdef USE_RBTREE_SETS

View File

@@ -0,0 +1,49 @@
--- a/Makefile
+++ b/Makefile
@@ -13,18 +13,18 @@
LIBD =
LIBS =
CXX?=g++
-CFLAGS+=-DEXTERNAL_SOLVER
-CFLAGS+=-DNDEBUG -DNCHECK
-CFLAGS+=-O3
-CFLAGS += -Wall -DBUILDDATE='"$(BUILDDATE)"' -DDISTDATE='"$(DISTDATE)"'
-CFLAGS += -DCHANGESET='"$(CHANGESET)"' -DRELDATE='"$(RELDATE)"'
-CFLAGS+=-D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wno-parentheses -Wno-deprecated
+CXXFLAGS+=-DEXTERNAL_SOLVER
+CXXFLAGS+=-DNDEBUG -DNCHECK
+CXXFLAGS+=-std=c++11
+CXXFLAGS += -Wall -DBUILDDATE='"$(BUILDDATE)"' -DDISTDATE='"$(DISTDATE)"'
+CXXFLAGS += -DCHANGESET='"$(CHANGESET)"' -DRELDATE='"$(RELDATE)"'
+CXXFLAGS+=-D __STDC_LIMIT_MACROS -D __STDC_FORMAT_MACROS -Wno-parentheses -Wno-deprecated
LIBS+=-lz
#LNFLAGS+=-static
# comment out if arbitrary precision not needed
LIBS+=-lgmpxx -lgmp
-CFLAGS+=-DGMPDEF
+CXXFLAGS+=-DGMPDEF
.PHONY: build all objs
@@ -32,17 +32,17 @@
$(XTRGT): objs
@echo Linking: $@
- @$(CXX) $(COBJS) $(LNFLAGS) $(LIBD) $(LIBS) -o $@
+ @$(CXX) $(CXXFLAGS) -fPIE $(CPPFLAGS) $(COBJS) $(LDFLAGS) $(LIBD) $(LIBS) -o $@
objs: Lexer.o p.tab.o $(COBJS)
depend:
- makedepend -- -I. $(CFLAGS) -- *.cc
+ makedepend -- -I. $(CXXFLAGS) -- *.cc
## Build rule
%.o: %.cc
@echo Compiling: $@
- @$(CXX) -I. $(CFLAGS) -c -o $@ $<
+ @$(CXX) -I. $(CPPFLAGS) $(CXXFLAGS) -fPIC $(LDFLAGS) -c -o $@ $<
## This needs bison and ragel, comment in if parsing changes
#Lexer.cc: p.tab.cc l.rl Lexer.hh

View File

@@ -0,0 +1,14 @@
Author: Ralf Treinen <treinen@debian.org>
Description: invoke minisat+ with switch for old-format input
--- a/ExternalWrapper.cc
+++ b/ExternalWrapper.cc
@@ -33,7 +33,7 @@
:min_cost(LONG_MAX)
,solution_value (-1)
,_id_manager(id_manager)
-,solver_command("minisat+ -cs -ansi")
+,solver_command("minisat+ -cs -ansi -old-fmt")
,multiplication_string("*")
,temporary_directory("/tmp")
,leave_temporary_files(false)

View File

@@ -0,0 +1,14 @@
Author: Ralf Treinen <treinen@debian.org>
Description: Fix spelling in message
--- a/Encoder.cc
+++ b/Encoder.cc
@@ -2123,7 +2123,7 @@
}
void Encoder::check_solution() {
- cerr << "cheking solution" <<endl;
+ cerr << "checking solution" <<endl;
// Package dependencies
FOR_EACH(PackageUnits::const_iterator,i,needed_units) {
CONSTANT UnitVector &uv = *(i->second);

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>lssndrbarbieri@gmail.com</email>
<name>Alessandro Barbieri</name>
</maintainer>
<longdescription lang="en">
packup solves the package upgradability problem specified in CUDF [TZ09] with the use of an external solver. By default minisat+ [ES06] is used but a different solver can be used by specifying the pertaining command line option.
</longdescription>
</pkgmetadata>

View File

@@ -0,0 +1,53 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit optfeature toolchain-funcs
DESCRIPTION="PACKage Upgradability Problem solver"
HOMEPAGE="https://sat.inesc-id.pt/~mikolas/sw/packup/"
SRC_URI="
https://sat.inesc-id.pt/~mikolas/sw/${PN}/${P}.tgz
https://sat.inesc-id.pt/~mikolas/sw/${PN}/${P}.1
https://sat.inesc-id.pt/~mikolas/sw/${PN}/${P}.1.html
"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64"
RDEPEND="
dev-libs/gmp
sys-libs/zlib
"
DEPEND="
${RDEPEND}
sci-mathematics/minisat+
"
PATCHES=(
"${FILESDIR}/${P}-makefile.patch"
"${FILESDIR}/${P}-spelling.patch"
"${FILESDIR}/${P}-c++11.patch"
"${FILESDIR}/${P}-minisat+-invocation.patch"
)
src_compile() {
tc-export CXX
emake all
}
src_install() {
dobin packup
dodoc README.txt
docinto html
dodoc "${DISTDIR}/${P}.1.html"
doman "${DISTDIR}/${P}.1"
insinto /usr/share/cudf/solvers
doins "${FILESDIR}/packup"
}
pkg_postinst() {
optfeature "optional solver minisatp" sci-mathematics/minisatp
}