[Pkg-ocaml-maint-commits] [SCM] pkglab packaging branch, master, updated. debian/1.4.2-2-8-gd255bfa
Ralf Treinen
treinen at free.fr
Sun Jun 21 18:02:23 UTC 2009
The following commit has been merged in the master branch:
commit 55180da15a34ef484d39fcbab98b60a4b5b189c3
Author: Ralf Treinen <treinen at free.fr>
Date: Sun Jun 21 19:51:46 2009 +0200
compute meaningful exit codes
diff --git a/debian/changelog b/debian/changelog
index 1af9d65..7076fdf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,8 +8,9 @@ pkglab (1.4.2-3) unstable; urgency=low
* Long description of the edos-distcheck package:
- add mention of edos-pscheck and edos-builddebcheck
- proper indentation of itemized list.
+ * Produce meaningful exit code (closes: #525218).
- -- Ralf Treinen <treinen at debian.org> Sun, 21 Jun 2009 18:59:47 +0200
+ -- Ralf Treinen <treinen at debian.org> Sun, 21 Jun 2009 19:47:29 +0200
pkglab (1.4.2-2) unstable; urgency=low
diff --git a/debian/manpages/edos-debcheck.1 b/debian/manpages/edos-debcheck.1
index 03468a3..8f25f65 100644
--- a/debian/manpages/edos-debcheck.1
+++ b/debian/manpages/edos-debcheck.1
@@ -73,6 +73,17 @@ Output results in XML format.TP
.B -help, --help
Display this list of options
+.SH EXIT CODE
+The exit code is 0 when all packages that were asked to be checked
+(either explicitely with the -checkonly option, or because they exist
+in the package pool file) are available and found to be installable,
+it is 1 when a least one of these packages is available but not
+installable, and it is 2 when at least one of the packages is not
+available but all available packages are found to be
+installable. Hence, the exit code 2 can occur only when the -checkonly
+option is used.
+
+
.SH EXAMPLE
Check which packages in a particular distribution are not installable and why:
diff --git a/distcheck/common.ml b/distcheck/common.ml
index d89f6b7..831eade 100644
--- a/distcheck/common.ml
+++ b/distcheck/common.ml
@@ -15,7 +15,10 @@ and quiet = ref false
and output_xml= ref false
and dist_type = ref `Debian
and source_added = ref false
-and pkgs_to_check_only = ref [];;
+and pkgs_to_check_only = ref []
+ (* indicates that some packages that were asked to be checked are *)
+ (* not available. *)
+and packages_are_missing = ref false;;
let db = create_database ();;
let architecture_index = get_architecture_index db;;
@@ -118,6 +121,7 @@ let pkgs_to_check =
pkgs_only
in if missing_package_names <> []
then begin
+ packages_are_missing := true;
prerr_string "Warning: some packages not found:";
List.iter
(fun pn -> prerr_char ' '; prerr_string pn)
@@ -220,6 +224,11 @@ begin
end
) ht;
if !output_xml then print_endline "</results>";
+ (* we return true when all checks have been successful *)
+ Hashtbl.fold
+ (fun _ (result,_) accumulator -> result && accumulator)
+ ht
+ true
end;;
let speclist = [
@@ -235,13 +244,16 @@ let speclist = [
];;
let _ =
- if Util.string_contains Sys.argv.(0) "debcheck" then
- dist_type := `Debian
- else if Util.string_contains Sys.argv.(0) "rpmcheck" then
- dist_type := `RPM
- else if Util.string_contains Sys.argv.(0) "pscheck" then
- dist_type := `Pkgsrc
- else (Printf.eprintf "Warning: unknown name '%s', behaving like debcheck\n%!" Sys.argv.(0); dist_type := `Debian);
- Arg.parse speclist (add_source true) "Distcheck v1.4.1";
+ if Util.string_contains Sys.argv.(0) "debcheck" then
+ dist_type := `Debian
+ else if Util.string_contains Sys.argv.(0) "rpmcheck" then
+ dist_type := `RPM
+ else if Util.string_contains Sys.argv.(0) "pscheck" then
+ dist_type := `Pkgsrc
+ else (Printf.eprintf "Warning: unknown name '%s', behaving like debcheck\n%!" Sys.argv.(0);
+ dist_type := `Debian);
+ Arg.parse speclist (add_source true) "Distcheck v1.4.1";
if not !source_added then add_source true "-";
- show_results (check !pkgs_to_check_only);;
+ exit (if (show_results (check !pkgs_to_check_only))
+ then 0
+ else if !packages_are_missing then 2 else 1);;
--
pkglab packaging
More information about the Pkg-ocaml-maint-commits
mailing list