[Pkg-erlang-commits] r1165 - in erlang/trunk/debian: . manpages scripts
sgolovan at alioth.debian.org
sgolovan at alioth.debian.org
Sun Jan 10 18:54:29 UTC 2010
Author: sgolovan
Date: 2010-01-10 18:54:28 +0000 (Sun, 10 Jan 2010)
New Revision: 1165
Modified:
erlang/trunk/debian/changelog
erlang/trunk/debian/control
erlang/trunk/debian/manpages/erlang-depends.1
erlang/trunk/debian/scripts/erlang-depends.in
Log:
[erlang]
* Fixed erlang-manpages package section.
* Made erlang-depends add only substvars which are requested in
debian/control file. This minimizes number of warnings from dh_gencontrol.
Also, improved descriptions of the functions in erlang-depends escript.
Modified: erlang/trunk/debian/changelog
===================================================================
--- erlang/trunk/debian/changelog 2009-12-28 21:54:40 UTC (rev 1164)
+++ erlang/trunk/debian/changelog 2010-01-10 18:54:28 UTC (rev 1165)
@@ -1,8 +1,11 @@
erlang (1:13.b.3-dfsg-3) UNRELEASED; urgency=low
- * NOT RELEASED YET
+ * Fixed erlang-manpages package section.
+ * Made erlang-depends add only substvars which are requested in
+ debian/control file. This minimizes number of warnings from dh_gencontrol.
+ Also, improved descriptions of the functions in erlang-depends escript.
- -- Sergei Golovan <sgolovan at debian.org> Sun, 20 Dec 2009 14:46:14 +0300
+ -- Sergei Golovan <sgolovan at debian.org> Sun, 20 Dec 2009 15:07:53 +0300
erlang (1:13.b.3-dfsg-2) unstable; urgency=low
Modified: erlang/trunk/debian/control
===================================================================
--- erlang/trunk/debian/control 2009-12-28 21:54:40 UTC (rev 1164)
+++ erlang/trunk/debian/control 2010-01-10 18:54:28 UTC (rev 1165)
@@ -257,6 +257,7 @@
functions.
Package: erlang-manpages
+Section: doc
Architecture: all
Suggests: erlang
Description: Erlang/OTP manual pages
Modified: erlang/trunk/debian/manpages/erlang-depends.1
===================================================================
--- erlang/trunk/debian/manpages/erlang-depends.1 2009-12-28 21:54:40 UTC (rev 1164)
+++ erlang/trunk/debian/manpages/erlang-depends.1 2010-01-10 18:54:28 UTC (rev 1165)
@@ -125,7 +125,7 @@
.\" ========================================================================
.\"
.IX Title "ERLANG-DEPENDS 1"
-.TH ERLANG-DEPENDS 1 "2009\-07\-02" "1:13.b.1\-dfsg\-4" "Erlang packages for Debian GNU/Linux"
+.TH ERLANG-DEPENDS 1 "2010\-01\-10" "1:13.b.3\-dfsg\-3" "Erlang packages for Debian GNU/Linux"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -141,12 +141,12 @@
the substitution variables for Erlang-dependent packages.
.PP
The most useful variable is ${erlang:Depends}. It expands into the list of
-Erlang packages which modules are used in the building package. It is
+Erlang packages which modules are used in the building package. It was
introduced in version 1:13.b.1\-dfsg\-3 of erlang-dev package.
.PP
Also, ${erlang\-abi:Depends} substitution adds current erlang \s-1ABI\s0 virtual
package to substvar files. It is useful if your package uses C-based
-extensions which may break in case of \s-1ABI\s0 changes. It is introduced in
+extensions which may break in case of \s-1ABI\s0 changes. It was introduced in
version 1:11.b.4\-4 of erlang\-dev package.
.PP
If you want to fine tune your package dependencies then you may want to use
Modified: erlang/trunk/debian/scripts/erlang-depends.in
===================================================================
--- erlang/trunk/debian/scripts/erlang-depends.in 2009-12-28 21:54:40 UTC (rev 1164)
+++ erlang/trunk/debian/scripts/erlang-depends.in 2010-01-10 18:54:28 UTC (rev 1165)
@@ -8,25 +8,25 @@
-define(VERSION, "@SOURCE_VERSION@").
-define(ABI_VERSION, "@ABI_VERSION@").
-% The list of HiPE enabled architectures (with added 'all' architecture), isn't used yet
+% The list of HiPE enabled architectures (with added 'all' architecture),
+% isn't used yet
-define(HIPE_ARCHES, split("@HIPE_ARCHES@ all", $\ )).
-% Since all packages required built application to run may be unavailable on build stage
-% it's necessary to list all module-package relationships explicitly:
+% Since all packages required built application to run may be unavailable
+% on build stage it's necessary to list all module-package relationships
+% explicitly:
-define(MODULES, [@MODULES@ {"erlang", "erlang-base"}]).
% The erlang packages list (suffixes only)
-define(PACKAGES, [@PACKAGES@]).
-
% main/1 --
%
% Generate debhelper substitution variables for Erlang-dependent
% packages.
%
% Arguments:
-% Options List of debhelper options (-v, -a, -i, -p*, -N*) or
-% -h.
+% Options List of debhelper options (-v, -a, -i, -p*, -N*) or -h.
%
% Result:
% None.
@@ -62,49 +62,50 @@
end
end, {0, [], [], []}, Options),
lists:foreach(
- fun(Package) ->
+ fun({Package, Variables}) ->
PkgDir = case TmpDir of
[] ->
filename:join("debian", Package);
_ ->
TmpDir
end,
- delsubstvar(Verbosity, Package, "erlang-abi:Depends"),
- addsubstvar(Verbosity, Package, "erlang-abi:Depends",
- "erlang-abi-" ++ ?ABI_VERSION),
- delsubstvar(Verbosity, Package, "erlang-base:Depends"),
- addsubstvar(Verbosity, Package, "erlang-base:Depends",
- "erlang-base (>= " ++ ?VERSION ++
- ") | erlang-base-hipe (>= " ++ ?VERSION ++ ")"),
+ deladdsubstvar(Verbosity, Package, Variables, "erlang-abi:Depends",
+ "erlang-abi-" ++ ?ABI_VERSION),
+ deladdsubstvar(Verbosity, Package, Variables, "erlang-base:Depends",
+ "erlang-base (>= " ++ ?VERSION ++
+ ") | erlang-base-hipe (>= " ++ ?VERSION ++ ")"),
+ delsubstvar(Verbosity, Package, "erlang:Depends"),
+ Variables2 = Variables ++
+ case lists:member("erlang:Depends", Variables) of
+ true ->
+ Deps = ordsets:to_list(
+ lists:foldl(
+ fun(M, Acc) ->
+ case lists:keysearch(M, 1, ?MODULES) of
+ {value, {_, P}} ->
+ ordsets:add_element(P, Acc);
+ _ ->
+ io:format("WARNING: Module ~s not found~n", [M]),
+ Acc
+ end
+ end, ordsets:new(),
+ get_remote_modules(Verbosity, PkgDir, Exclude))),
+ Dep = join(lists:map(
+ fun(D) ->
+ "${" ++ D ++ ":Depends}"
+ end, Deps), ", "),
+ addsubstvar(Verbosity, Package, "erlang:Depends", Dep),
+ lists:map(fun(D) ->
+ D ++ ":Depends"
+ end, Deps);
+ _ ->
+ []
+ end,
lists:foreach(
fun(Pkg) ->
- delsubstvar(Verbosity, Package, "erlang-" ++ Pkg ++ ":Depends"),
- addsubstvar(Verbosity, Package, "erlang-" ++ Pkg ++ ":Depends",
- "erlang-" ++ Pkg ++ " (>= " ++ ?VERSION ++ ")")
- end, ?PACKAGES),
- Deps = lists:foldl(
- fun(M, Acc) ->
- case lists:keysearch(M, 1, ?MODULES) of
- {value, {_, P}} ->
- ordsets:add_element(P, Acc);
- _ ->
- io:format("WARNING: Module ~s not found~n", [M]),
- Acc
- end
- end, ordsets:new(),
- get_remote_modules(Verbosity, PkgDir, Exclude)),
- delsubstvar(Verbosity, Package, "erlang:Depends"),
- case join(lists:map(
- fun(D) ->
- "${" ++ D ++ ":Depends}"
- end, ordsets:to_list(Deps)), ", ") of
- [] ->
- ok;
- Dep ->
- % Add substvar only if it isn't empty
-
- addsubstvar(Verbosity, Package, "erlang:Depends", Dep)
- end
+ deladdsubstvar(Verbosity, Package, Variables2, "erlang-" ++ Pkg ++ ":Depends",
+ "erlang-" ++ Pkg ++ " (>= " ++ ?VERSION ++ ")")
+ end, ?PACKAGES)
end, get_packages(NewOptions)).
% usage/0 --
@@ -115,7 +116,7 @@
% None.
%
% Result:
-% None.
+% ok.
%
% Side effects:
% Usage is printed to stdout.
@@ -134,7 +135,7 @@
" -Ptmpdir, --tmpdir=tmpdir~n"
" Use \"tmpdir\" for package build directory~n").
-% get_remote_modules/3
+% get_remote_modules/3 --
%
% Return a difference between all modules used in the application and
% the local modules which dependencies are satisfied automagically.
@@ -148,7 +149,7 @@
% The list of remote modules.
%
% Side effects:
-% None.
+% Application files are taken from filesystem.
get_remote_modules(Verbosity, Dir, Exclude) ->
Mods = ordsets:to_list(ordsets:subtract(get_modules(Dir, Exclude),
@@ -162,7 +163,7 @@
end,
Mods.
-% get_modules/2
+% get_modules/2 --
%
% Return an ordset of all modules found in the application.
%
@@ -174,7 +175,7 @@
% The ordset of all used modules.
%
% Side effects:
-% None.
+% Application files are taken from filesystem.
get_modules(Dir, Exclude) ->
Modules = lists:map(fun({M, _F, _A}) ->
@@ -182,7 +183,7 @@
end, get_imports(Dir, Exclude)),
ordsets:from_list(Modules).
-% get_local_modules/2
+% get_local_modules/2 --
%
% Return an ordset of local modules found in the application (it is
% constructed from BEAM filenames).
@@ -195,7 +196,7 @@
% The ordset of all local modules.
%
% Side effects:
-% None.
+% Files are taken from filesystem.
get_local_modules(Dir, Exclude) ->
Files = lists:filter(fun(File) ->
@@ -211,7 +212,7 @@
end, Files),
ordsets:from_list(Basenames).
-% get_imports/2
+% get_imports/2 --
%
% Get imports from all BEAM files in the specified directory and below.
%
@@ -223,7 +224,7 @@
% A list of imports from all found BEAM files.
%
% Side effects:
-% None.
+% Files are taken from filesystem.
get_imports(Dir, Exclude) ->
Files = lists:filter(fun(File) ->
@@ -446,21 +447,52 @@
halt(1)
end.
+% deladdsubstvar/5 --
+%
+% Delete a substitution variable from a substvar file and add a
+% dependency to it if this substvar is present in a specified list of
+% variables for a given package in debian/ directory.
+%
+% Arguments:
+% Verbosity Verbosity level (0 - silence, 1 - print action)
+% Package Name of a package (file Package ++ ".substvars" is used).
+% Variables List of requested variables for the package.
+% Substvar Name of a substitution variable to add/change.
+% Dependency An added substitution dependency string.
+%
+% Results:
+% ok or halt.
+%
+% Side effects:
+% File "debian/" ++ Package ++ ".substvars" is overwritten. The specified
+% dependency string is either deleted or replaced. Program is halted in
+% case of error.
+
+deladdsubstvar(Verbosity, Package, Variables, Substvar, Dependency) ->
+ delsubstvar(Verbosity, Package, Substvar),
+ case lists:member(Substvar, Variables) of
+ true ->
+ addsubstvar(Verbosity, Package, Substvar, Dependency);
+ _ ->
+ ok
+ end.
+
% get_packages/1 --
%
% Parses debhelper command line options and debian/control file and
-% returns packages to act on.
+% returns packages with requested substvars to act on.
%
% Arguments:
% ArgList Dephelper options (only -a, -i, -p, -N options are
% recognised).
%
% Results:
-% {ok, [Package_names]} to work on or error message and halt if
+% {ok, [{Package,Vars}]} to work on or error message and halt if
% debian/control is unreadable or unknown option is specified.
%
% Side effects:
-% Program is halted in case of error.
+% Program is halted in case of error, packages info is taken from
+% an external file.
get_packages(ArgList) ->
ControlFile = filename:join("debian", "control"),
@@ -499,36 +531,57 @@
halt(1)
end
end, {all, [], []}, ArgList),
- StrData = binary_to_list(BinData),
+ % Join up continuation lines
+
+ StrData = re:replace(BinData, "\\n( |\\t)", "\\1", [global, {return, list}]),
+
% Add an extra empty line for the case if debian/config doesn't have a trailing LF
Tokens = split(StrData, $\n) ++ [[]],
- {_Arch, _Package, Packages, AllPackages} =
- lists:foldl(fun(Line, {A, P, Ps, APs}) ->
+ {_Arch, _Package, _Vars, Packages, AllPackages} =
+ lists:foldl(fun(Line, {A, P, Vs, Ps, APs}) ->
case Line of
"Package: " ++ Pkg ->
- {A, string:strip(Pkg), Ps, APs};
+ {A, string:strip(Pkg), Vs, Ps, APs};
"Architecture: " ++ Arc ->
- {string:strip(Arc), P, Ps, APs};
+ {string:strip(Arc), P, Vs, Ps, APs};
+ "Pre-Depends: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Depends: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Recommends: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Suggests: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Enhances: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Breaks: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Conflicts: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Provides: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
+ "Replaces: " ++ Deps ->
+ {A, P, Vs ++ find_vars(Deps), Ps, APs};
"" ->
case P of
"" ->
% Two LF in a row or the end of a source package
- {"", "", Ps, APs};
+ {"", "", [], Ps, APs};
_ ->
case lists:member(P, Excluded) of
true ->
% The package is excluded by -Npackage
- {"", "", Ps, APs};
+ {"", "", [], Ps, APs};
_ ->
case lists:member(P, Explicit) of
true ->
% The package is explicitly required
- {"", "", Ps ++ [P], APs};
+ {"", "", [], Ps ++ [{P, Vs}], APs};
_ ->
case A of
"all" ->
@@ -537,11 +590,11 @@
% Arch independent packages
% are requested
- {"", "", Ps ++ [P], APs};
+ {"", "", [], Ps ++ [{P, Vs}], APs};
all ->
- {"", "", Ps, APs ++ [P]};
+ {"", "", [], Ps, APs ++ [{P, Vs}]};
_ ->
- {"", "", Ps, APs}
+ {"", "", [], Ps, APs}
end;
_ ->
case Arches of
@@ -549,20 +602,20 @@
% Arch dependent packages
% are requested
- {"", "", Ps ++ [P], APs};
+ {"", "", [], Ps ++ [{P, Vs}], APs};
all ->
- {"", "", Ps, APs ++ [P]};
+ {"", "", [], Ps, APs ++ [{P, Vs}]};
_ ->
- {"", "", Ps, APs}
+ {"", "", [], Ps, APs}
end
end
end
end
end;
_ ->
- {A, P, Ps, APs}
+ {A, P, Vs, Ps, APs}
end
- end, {"", "", [], []}, Tokens),
+ end, {"", "", [], [], []}, Tokens),
case {Arches, Packages} of
{all, []} ->
% There aren't explicitly requested packages
@@ -576,6 +629,30 @@
halt(1)
end.
+% find_vars/1 --
+%
+% Find substitution variables in dependencies line and return list of
+% their names.
+%
+% Arguments:
+% Dependencies Dependencies line from debian/control
+%
+% Result:
+% List of substvars names (inside ${}).
+%
+% Side effects:
+% None.
+
+find_vars(Dependencies) ->
+ case re:run(Dependencies, "\\$\\{(\\S*)\\}", [global, {capture, all_but_first, list}]) of
+ {match, Captured} ->
+ lists:foldl(fun(M, Acc) ->
+ Acc ++ M
+ end, [], Captured);
+ _ ->
+ []
+ end.
+
% files/3 --
%
% Return all files in a directory which names match a given expression.
@@ -583,7 +660,7 @@
% and a bit modified.)
%
% Arguments:
-% Dir Directory from which to serach
+% Dir Directory from which to search
% Re Regular expression for filename matching
% Recursive Whether to search for files recursively
%
@@ -591,11 +668,30 @@
% A list of filenames.
%
% Side effects:
-% None.
+% File and directory names are taken from filesystem.
files(Dir, Re, Recursive) ->
find_files(Dir, Re, Recursive, []).
+% find_files/4 --
+%
+% Find all files in a directory which names match a given expression,
+% prepend them to a given list of files and return the total files list.
+% (This procedure is borrowed from http://erlang.org/examples/examples-2.0.html
+% and a bit modified.)
+%
+% Arguments:
+% Dir Directory from which to search
+% Re Regular expression for filename matching
+% Recursive Whether to search for files recursively
+% L List of already found files
+%
+% Result:
+% A list of filenames.
+%
+% Side effects:
+% File and directory names are taken from filesystem.
+
find_files(Dir, Re, Recursive, L) ->
case file:list_dir(Dir) of
{ok, Files} ->
@@ -604,7 +700,29 @@
L
end.
-find_files([File | T], Dir, Re, Recursive, L) ->
+% find_files/5 --
+%
+% Check all specified filenames if they match a given expressions and
+% prepend matched ones to a given list of filenames. If the file type is
+% directory and search is recursive then descend into it and add found
+% filenames to the result too. Return the total files list.
+% (This procedure is borrowed from http://erlang.org/examples/examples-2.0.html
+% and a bit modified.)
+%
+% Arguments:
+% _FL List of files in directory Dir
+% Dir Directory from which to search
+% Re Regular expression for filename matching
+% Recursive Whether to search for files recursively
+% L List of already found files
+%
+% Result:
+% A list of filenames.
+%
+% Side effects:
+% File and directory names are taken from filesystem.
+
+find_files(_FL = [File | T], Dir, Re, Recursive, L) ->
FullName = filename:join(Dir, File),
case file_type(FullName) of
regular ->
@@ -642,7 +760,7 @@
% A file type.
%
% Side effects:
-% None.
+% File info is taken from the filesystem.
file_type(File) ->
case file:read_file_info(File) of
More information about the Pkg-erlang-commits
mailing list