[opam-devel] [ocaml-platform] opam 1.1.1 to be released shortly

Roberto Di Cosmo roberto at dicosmo.org
Fri Jan 10 17:44:08 GMT 2014


Hi Vsevolod,
   that's great news, a big thank you!!!

I have just sent out a request for help packaging
aspcud, mccs and packup, and now found out that you
almost finished aspcud already :-)

A couple of suggestions :

 - add a comment on https://github.com/ocaml/opam/issues/1074
   mentioning your work on FreeBSD

 - check the patch added by Ralf in the latest version of the
   Debian aspcud package to ensure backwards compatibility of
   the optimization criteria supported by the latest aspcud
   with the legacy criteria supported by the other solvers...
   this basically boils down to adding a few lines to the 
   aspcud bash shell to use a short sed file and convert the
   old criteria in the new language supported by the latest
   aspcud... you'll find attached the modified aspcud and the
   sed file from the Debian package

 - once this is done, you can try to run opam and check whether
   all works fine... it looks for aspcud using "which aspcud"

All the best

--
Roberto
   

On Fri, Jan 10, 2014 at 04:39:51PM +0000, Vsevolod Stakhov wrote:
> JFYI, I have ported aspcud to FreeBSD today (together with gringo and
> clasp). It seems to be working with some test cudf files.
> 
> The most tricky patch was to enable support of the libc++ from LLVM, but
> I hopefully have managed it.
> 
> On 10/01/14 09:59, Anil Madhavapeddy wrote:
> > On 10 Jan 2014, at 07:34, Roberto Di Cosmo <roberto at dicosmo.org> wrote:
> > 
> >> Considering the time frame, and the fact that this kind of issues is
> >> going to come up more and more over time, I do understand that we need
> >> a quicker solution, and the best thing is to ask for help with this 
> >> among our friends OCamlrs...
> > 
> > If someone could point me to what to port, I'd be happy to take a look
> > at OpenBSD and Homebrew ports. I'm CCing Vsevolod who has been interested
> > in a FreeBSD port of aspcud for their new package managers.
> > 
> > What are the differences between the 'paranoid', 'basic' and 'full' user
> > tracks on their website, and does it affect OPAM?
> > 
> > -anil
> > 
> 
> -- 
> Vsevolod Stakhov

-- 
Roberto Di Cosmo
 
------------------------------------------------------------------
Professeur               En delegation a l'INRIA
PPS                      E-mail: roberto at dicosmo.org
Universite Paris Diderot WWW  : http://www.dicosmo.org
Case 7014                Tel  : ++33-(0)1-57 27 92 20
5, Rue Thomas Mann       
F-75205 Paris Cedex 13   Identica: http://identi.ca/rdicosmo
FRANCE.                  Twitter: http://twitter.com/rdicosmo
------------------------------------------------------------------
Attachments:
MIME accepted, Word deprecated
      http://www.gnu.org/philosophy/no-word-attachments.html
------------------------------------------------------------------
Office location:
 
Bureau 3020 (3rd floor)
Batiment Sophie Germain
Avenue de France
Metro Bibliotheque Francois Mitterrand, ligne 14/RER C
-----------------------------------------------------------------
GPG fingerprint 2931 20CE 3A5A 5390 98EC 8BFC FCCA C3BE 39CB 12D3                        
-------------- next part --------------
# new -> count(new)
# removed -> count(removed)
# changed -> count(changed)
# notuptodate -> notuptodate(solution)
# unsat_recommends -> unsat_recommends(solution)
# sum(name) -> sum(name,solution)

s/\([+-]\)\(new\|removed\|changed\)/\1count(\2)/g
s/\([+-]\)\(notuptodate\|unsat_recommends\)\([^(]\|$\)/\1\2(solution)\3/g
s/\([+-]\)sum(\([a-z]*\))/\1sum(\2,solution)/g
-------------- next part --------------
#!/bin/bash

clasp_bin=clasp
unclasp_bin=unclasp
gringo_bin=gringo
cudf2lp_bin=/usr/lib/aspcud/bin/cudf2lp
sharedir=/usr/share/aspcud

trendycriterion="-count(removed),-notuptodate(solution),-unsat_recommends(solution),-count(new)"

if [[ $3 == trendy ]]; then
    criterion=$trendycriterion;
else
    criterion=`sed -f /usr/share/aspcud/misc11-to-misc12 <<< $3`
fi

function enc()
{
	for x in "." "$sharedir/encodings"; do
		[[ -e "$x/$1" ]] && { echo "$x/$1"; return 0; }
	done
	echo "$x"
	return 1
}

function cleanup()
{
	[[ -d "$tmp" ]] && rm -rf "$tmp"
}

function die()
{
	echo "error: $1" >&2
	exit 0
}

function usage()
{
	echo "Usage: ${0} [OPTION]... CUDFIN CUDFOUT [CRITERIA]"
	echo "  -h       print this help"
	echo "  -c OPT   append clasp option OPT"
	echo "  -e ENC   append encoding ENC"
	echo "  -p OPT   append cudf2lp option OPT"
	echo "  -s SOL   choose solver {clasp,unclasp}"
	echo
	echo "Default commandline for clasp:"
	echo -n "$(basename "${0}")"
	for x in "${clasp_opts_def[@]}";  do
		echo " \\"
		echo -n "    -c $x"
	done
	for x in "${gringo_opts_def[@]}";  do
		echo " \\"
		echo -n "    -e $x"
	done
	echo
	echo
	echo "Default commandline for unclasp:"
	echo -n "$(basename "${0}")"
	for x in "${unclasp_opts_def[@]}";  do
		echo " \\"
		echo -n "    -c $x"
	done
	for x in "${ungringo_opts_def[@]}";  do
		echo " \\"
		echo -n "    -e $x"
	done
	echo
}

base="$(dirname "$(readlink -f "$0")")"
PATH=".:$base:$base/../build/release/bin:$PATH"

# default options
solver=""
clasp_opts_def=( "--opt-heu=1" "--sat-prepro" "--restarts=L,128" "--heuristic=VSIDS" "--opt-hierarch=1" "--local-restarts" "--del-max=200000,250" )
unclasp_opts_def=( )
gringo_opts_def=( "$(enc misc2012.lp)" )
ungringo_opts_def=( "$(enc misc2012.lp)" )

cudf_opts=( )
clasp_opts=( )
gringo_opts=( )

unset wrapper_out
unset tmp

while getopts "hc:e:p:s:" flag
do
	case "$flag" in
		"e") gringo_opts=( "${gringo_opts[@]}" "$(enc "$OPTARG")" ) ;;
		"c") clasp_opts=( "${clasp_opts[@]}" "$OPTARG" ) ;;
		"p") cudf_opts=( "${cudf_opts[@]}" "$OPTARG" ) ;;
		"s") solver="$OPTARG" ;;
		"h") usage; exit 0 ;;
		"?") exit 1 ;;
	esac
done

shift $((OPTIND-1))

if [[ -z ${solver} ]]; then
	if echo $(basename "$0") | grep -q "aspuncud"; then
		solver="unclasp"
	elif echo $(basename "$0") | grep -q "aspcud"; then
		solver="clasp"
	fi
fi

case "${solver}" in 
	clasp)
		solver_bin="${clasp_bin}"
		clasp_opts_implicit=( "--stats=2" "--quiet=1,2" )
		;;
	unclasp)
		clasp_opts_def=( "${unclasp_opts_def[@]}" )
		gringo_opts_def=( "${ungringo_opts_def[@]}" )
		solver_bin="${unclasp_bin}"
		clasp_opts_implicit=( "--stats" )
		;;
	*)
		die "error: solver clasp or unclasp expected"
		;;
esac

[[ ${#clasp_opts[*]} -eq 0 ]] && clasp_opts=( "${clasp_opts_def[@]}" )
[[ ${#gringo_opts[*]} -eq 0 ]] && gringo_opts=( "${gringo_opts_def[@]}" )
clasp_opts=( "${clasp_opts[@]}" "${clasp_opts_implicit[@]}" )

if [[ $# -eq 3 ]]; then
	cudf_opts=( "${cudf_opts[@]}" "-c" "$criterion" )
elif echo $(basename "$0") | grep -q "paranoid"; then
	[[ $# -ne 2 ]] && { die "error: exactly two arguments expected"; }
	cudf_opts=( "${cudf_opts[@]}" "-c" "paranoid" )
else
	die "error: exactly three arguments expected"
fi

wrapper_out="$2"

trap cleanup EXIT

test -n "${TMPDIR}" && tmpdir="${TMPDIR}/"
tmp="$(mktemp -d "${tmpdir}outXXXXXX")"

# note this is probably unecessary...
function usrtrap() {
:
}
trap usrtrap USR1 TERM INT

cat <<EOF > "$tmp/parse.py"
#!/usr/bin/python
import signal, re, sys

def ignore(x, y): pass

signal.signal(signal.SIGUSR1, ignore)
signal.signal(signal.SIGTERM, ignore)
signal.signal(signal.SIGINT,  ignore)
signal.signal(signal.SIGPIPE, ignore)

out = open("$wrapper_out", "w")

keep = False
solution = None
try:
	for line in sys.stdin:
		sys.stdout.write(line[:-1][:81])
		sys.stdout.write("\n")
		if keep: 
			solution = line
			keep = False
		if line.startswith("Answer"): keep = True
except: pass

if solution == None: out.write("FAIL\n")
else:
        for m in re.finditer(r'in\\("(?P<pkg>[^,]+)",(?P<ver>[^)]+)\\)', solution):
                out.write("package: " + m.group("pkg") + "\\n")
                out.write("version: " + m.group("ver") + "\\n")
                out.write("installed: true\\n\\n")
out.close()

sys.stdout.write(open("$tmp/clasp_err").read())
sys.stdout.write(open("$tmp/gringo_err").read())
sys.stdout.write(open("$tmp/cudf_err").read())
EOF
chmod +x "$tmp/parse.py"

"${cudf2lp_bin}" "${cudf_opts[@]}"   > "$tmp/cudf_out"   2> "$tmp/cudf_err"   < "$1"
"${gringo_bin}"  "${gringo_opts[@]}" > "$tmp/gringo_out" 2> "$tmp/gringo_err" "$tmp/cudf_out"
"${solver_bin}"  "${clasp_opts[@]}"                      2> "$tmp/clasp_err"  "$tmp/gringo_out" | "$tmp/parse.py"



More information about the opam-devel mailing list