From 59813a99ec529322787b3769c122b79cc36978c1 Mon Sep 17 00:00:00 2001 From: Alessandro Barbieri Date: Fri, 29 Apr 2022 01:46:59 +0200 Subject: [PATCH] sci-mathematics/packup: new package, add 0.6 Signed-off-by: Alessandro Barbieri --- sci-mathematics/packup/Manifest | 3 + sci-mathematics/packup/files/packup | 3 + .../packup/files/packup-0.6-c++11.patch | 166 ++++++++++++++++++ .../packup/files/packup-0.6-makefile.patch | 49 ++++++ .../packup-0.6-minisat+-invocation.patch | 14 ++ .../packup/files/packup-0.6-spelling.patch | 14 ++ sci-mathematics/packup/metadata.xml | 11 ++ sci-mathematics/packup/packup-0.6.ebuild | 53 ++++++ 8 files changed, 313 insertions(+) create mode 100644 sci-mathematics/packup/Manifest create mode 100644 sci-mathematics/packup/files/packup create mode 100644 sci-mathematics/packup/files/packup-0.6-c++11.patch create mode 100644 sci-mathematics/packup/files/packup-0.6-makefile.patch create mode 100644 sci-mathematics/packup/files/packup-0.6-minisat+-invocation.patch create mode 100644 sci-mathematics/packup/files/packup-0.6-spelling.patch create mode 100644 sci-mathematics/packup/metadata.xml create mode 100644 sci-mathematics/packup/packup-0.6.ebuild diff --git a/sci-mathematics/packup/Manifest b/sci-mathematics/packup/Manifest new file mode 100644 index 0000000000..6f8e7b3d74 --- /dev/null +++ b/sci-mathematics/packup/Manifest @@ -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 diff --git a/sci-mathematics/packup/files/packup b/sci-mathematics/packup/files/packup new file mode 100644 index 0000000000..793e1b91dc --- /dev/null +++ b/sci-mathematics/packup/files/packup @@ -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 diff --git a/sci-mathematics/packup/files/packup-0.6-c++11.patch b/sci-mathematics/packup/files/packup-0.6-c++11.patch new file mode 100644 index 0000000000..1c894f361a --- /dev/null +++ b/sci-mathematics/packup/files/packup-0.6-c++11.patch @@ -0,0 +1,166 @@ +Author: Mikoláš Janota +Description: compliance to the C++11 standard +Debian-bug: #811793 + +--- a/basic_clset.hh ++++ b/basic_clset.hh +@@ -34,11 +34,7 @@ + #include + #include + +-#include // Location of STL hash extensions +-#include // 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 + #include + +-#include // Location of STL hash extensions +-#include // 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 + #include + +-#include // Location of STL hash extensions +-#include // Location of STL hash extensions + #include // Location of STL hash extensions + + using namespace std; +--- a/cl_types.hh ++++ b/cl_types.hh +@@ -66,7 +66,7 @@ + typedef vector BasicClauseVector; + typedef BasicClauseVector::iterator ClVectIterator; + +-typedef slist BasicClauseSList; ++//typedef slist BasicClauseSList; + + typedef list BasicClauseList; + +--- a/collections.hh ++++ b/collections.hh +@@ -34,7 +34,7 @@ + typedef vector PackageVersionsList; + typedef vector PackageVersionsCNF; + typedef vector PackageVersionList; +-typedef unordered_map< const char*,string,__gnu_cxx::hash, streq > Str2Str; ++typedef unordered_map< const char*,string,std::hash, streq > Str2Str; + typedef unordered_map PackageVersionMap; + typedef unordered_map VariableToPackageVersion; + typedef vector VersionVector; +--- a/common_types.hh ++++ b/common_types.hh +@@ -25,13 +25,9 @@ + #ifndef COMMON_TYPES_H + #define COMMON_TYPES_H + +-#include +-#include ++#include "hash_structs.hh" + #include + #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 ++#include ++#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 ++#include ++#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 + #include + #include // Location of STL list extensions +-#include // Location of STL hash extensions +-#include // Location of STL hash extensions + + using namespace std; +-using namespace __gnu_cxx; // Required for STL hash extensions + + + #ifdef USE_RBTREE_SETS diff --git a/sci-mathematics/packup/files/packup-0.6-makefile.patch b/sci-mathematics/packup/files/packup-0.6-makefile.patch new file mode 100644 index 0000000000..8c715edf39 --- /dev/null +++ b/sci-mathematics/packup/files/packup-0.6-makefile.patch @@ -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 diff --git a/sci-mathematics/packup/files/packup-0.6-minisat+-invocation.patch b/sci-mathematics/packup/files/packup-0.6-minisat+-invocation.patch new file mode 100644 index 0000000000..8420fd173e --- /dev/null +++ b/sci-mathematics/packup/files/packup-0.6-minisat+-invocation.patch @@ -0,0 +1,14 @@ +Author: Ralf Treinen +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) diff --git a/sci-mathematics/packup/files/packup-0.6-spelling.patch b/sci-mathematics/packup/files/packup-0.6-spelling.patch new file mode 100644 index 0000000000..6022f894fc --- /dev/null +++ b/sci-mathematics/packup/files/packup-0.6-spelling.patch @@ -0,0 +1,14 @@ +Author: Ralf Treinen +Description: Fix spelling in message + +--- a/Encoder.cc ++++ b/Encoder.cc +@@ -2123,7 +2123,7 @@ + } + + void Encoder::check_solution() { +- cerr << "cheking solution" <second); diff --git a/sci-mathematics/packup/metadata.xml b/sci-mathematics/packup/metadata.xml new file mode 100644 index 0000000000..981b9c9d33 --- /dev/null +++ b/sci-mathematics/packup/metadata.xml @@ -0,0 +1,11 @@ + + + + + lssndrbarbieri@gmail.com + Alessandro Barbieri + + +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. + + diff --git a/sci-mathematics/packup/packup-0.6.ebuild b/sci-mathematics/packup/packup-0.6.ebuild new file mode 100644 index 0000000000..a7fdd5e9b9 --- /dev/null +++ b/sci-mathematics/packup/packup-0.6.ebuild @@ -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 +}