Bug#687643: apt-cudf specifies a version number for install requests even when not needed
Package: apt-cudf
Version: 3.0.2-1
Severity: normal
Dear Maintainer,
the code that translates EDSP into CUDF in apt-cudf always adds a version
number to the packages on the request line; this behaviour is
incorrect, as it prevents the search for relaxed installation
solutions when apt-cudf-get is used in conjunction with it.
A patch is attached.
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.5-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages apt-cudf depends on:
ii aspcud [cudf-solver] 2011.03.17.dfsg-6
ii libbz2-1.0 1.0.6-4
ii libc6 2.13-35
ii libpcre3 1:8.31-1
ii mccs [cudf-solver] 1:1.1-2
ii packup [cudf-solver] 0.6-1
ii perl 5.14.2-13
ii zlib1g 1:1.2.7.dfsg-13
apt-cudf recommends no packages.
apt-cudf suggests no packages.
-- no debconf information
diff --git a/applications/apt-cudf.ml b/applications/apt-cudf.ml
index ffbb872..5ae7fdc 100644
--- a/applications/apt-cudf.ml
+++ b/applications/apt-cudf.ml
@@ -63,27 +63,37 @@ let print_progress ?i msg =
Format.printf "Message: %s@." msg
;;
+
+(* Debian specific assumption: only one version of a package
+ can be installed at a given time.
+ Hence, when a remove request is issued without version constraint,
+ we return (candidate.Cudf.package,None) that designates the only
+ package installed.
+ *)
+
let make_request tables universe native_arch request =
let to_cudf (p,v) = (p,Debian.Debcudf.get_cudf_version tables (p,v)) in
+ let get_candidate (name,constr) =
+ try
+ List.find
+ (fun pkg ->
+ try (Cudf.lookup_package_property pkg "apt-candidate") = "true"
+ with Not_found -> false)
+ (CudfAdd.who_provides universe (name,constr))
+ with Not_found ->
+ print_error "Package %s does not have a suitable candidate" name
+ in
let select_packages ?(remove=false) l =
List.map (fun ((n,a),c) ->
let (name,constr) = Boilerplate.debvpkg ~native_arch to_cudf ((n,a),c) in
- let candidate =
- try
- List.find (fun pkg ->
- if request.Edsp.strict_pin then
- try (Cudf.lookup_package_property pkg "apt-candidate") = "true"
- with Not_found -> false
- else
- true
- ) (CudfAdd.who_provides universe (name,constr))
- with Not_found ->
- print_error "Package %s does not have a suitable candidate" n
- in
if remove then
- (candidate.Cudf.package,None)
+ (name,None)
else
- (candidate.Cudf.package,Some(`Eq,candidate.Cudf.version))
+ match constr, request.Edsp.strict_pin with
+ None, false -> (name, None)
+ | _, _ -> (name,Some(`Eq,(get_candidate (name,constr)).Cudf.version))
+ (* FIXME: when apt will accept version constraints different from `Eq,
+ we will need to pass them through. *)
) l
in
if request.Edsp.upgrade || request.Edsp.distupgrade then
Reply to: