3 years agoImprove error messages output by buffer_copy() pu/fix-buffer-copy-errmsg
Raphaël Hertzog [Fri, 8 Apr 2011 22:54:30 +0000 (00:54 +0200)]
Improve error messages output by buffer_copy()

Those error messages are often seen by users and they are very difficult
to understand both because they are poorly written and because they
are badly translated. The translations are difficult to get right because
they are a combination of 2 separate strings.

To improve the situation, the messages coming from buffer_copy()
are shorter and do not mention the action ("buffer copy"), instead
we rely on the callers (fd_fd_copy(), fd_null_copy(), fd_vbuf_copy(),
fd_md5()) to provide more explanation on what they are trying to do.

It's important for callers to embed the eventual filenames in the error
message to make it actually useful.

A large number of strings have thus been updated. I also added
comments for the translators so that they are aware of how the strings
are combined.

3 years agodpkg-query(1): improve description of --search
Lars Buitinck [Wed, 6 Apr 2011 12:09:00 +0000 (14:09 +0200)]
dpkg-query(1): improve description of --search

3 years agoMerge branch 'sid' (through tag '')
Guillem Jover [Tue, 5 Apr 2011 05:41:33 +0000 (07:41 +0200)]
Merge branch 'sid' (through tag '')


3 years agoRelease
Guillem Jover [Tue, 5 Apr 2011 05:29:24 +0000 (07:29 +0200)]

3 years agodpkg: Rename set_selinux_path_context() to tarobject_set_se_context()
Guillem Jover [Sun, 3 Apr 2011 15:32:25 +0000 (17:32 +0200)]
dpkg: Rename set_selinux_path_context() to tarobject_set_se_context()

This puts it in line with the rest of tarobject filesystem metadata

3 years agodpkg: don't ohshite if lutimes() fails with ENOSYS
Raphaël Hertzog [Sun, 3 Apr 2011 13:27:21 +0000 (15:27 +0200)]
dpkg: don't ohshite if lutimes() fails with ENOSYS

Glibc implements lutimes() on top of utimensat() which is only provided
by Linux >= 2.6.22. With older kernels it returns ENOSYS.

This regression was introduced by commit
b3eb59cf43c286bb6c906c00ef1cdc0ec21f474d which implemented support for
setting timestamps of symlinks.

Reported-by: Michael Prokop <>
3 years agodpkg: fix regression when using -R option
Raphaël Hertzog [Sun, 3 Apr 2011 12:58:06 +0000 (14:58 +0200)]
dpkg: fix regression when using -R option

The regression was introduced in commit
280ac914cc52ee5de079c0833bb1df5005c1e7ab. The variable used for the loop
got incremented twice for each iteration, the net result is that the list
of filenames contains random data on half of the entries.

Reported-by: Craig Sanders <>
3 years agoUpdate German scripts translation
Helge Kreutzmann [Sun, 3 Apr 2011 10:22:24 +0000 (12:22 +0200)]
Update German scripts translation

Update to 515t

3 years agoDpkg::Version: update version_check to forbid versions starting with non digits
Raphaël Hertzog [Sun, 3 Apr 2011 07:52:33 +0000 (09:52 +0200)]
Dpkg::Version: update version_check to forbid versions starting with non digits

Adapted the code to rely on the parsing done by the constructor to split
the version number properly instead of redoing similar regexes in

Updated the test suite accordingly.

3 years agolibdpkg: add non-regression test for version number starting with non-digit
Raphaël Hertzog [Sun, 3 Apr 2011 07:45:20 +0000 (09:45 +0200)]
libdpkg: add non-regression test for version number starting with non-digit

And update the non-regression test for invalid characters to put
the invalid character as the second character and not the first (which
would be caught by the more strict non-digit check).

3 years agoDpkg::Source::Package: Add ‘.gitmodules’ to the default ignore lists
Guillem Jover [Sat, 2 Apr 2011 14:55:40 +0000 (16:55 +0200)]
Dpkg::Source::Package: Add ‘.gitmodules’ to the default ignore lists

Closes: #620490

3 years agoInstall deb-src-control(5) man pages in dpkg-dev
Guillem Jover [Sat, 2 Apr 2011 14:43:14 +0000 (16:43 +0200)]
Install deb-src-control(5) man pages in dpkg-dev

Closes: #620520

3 years agoDpkg::Deps: some typo and consistency fixes in the POD documentation
Raphaël Hertzog [Sat, 2 Apr 2011 08:02:33 +0000 (10:02 +0200)]
Dpkg::Deps: some typo and consistency fixes in the POD documentation

3 years agoDpkg::Deps: Implement new "reset" method
Raphaël Hertzog [Sat, 2 Apr 2011 07:46:49 +0000 (09:46 +0200)]
Dpkg::Deps: Implement new "reset" method

Bump module version to 1.01 due to this.

3 years agoAdd new changelog entry for 1.16.1
Raphaël Hertzog [Sat, 2 Apr 2011 07:22:01 +0000 (09:22 +0200)]
Add new changelog entry for 1.16.1

3 years agoRelease 1.16.0
Guillem Jover [Fri, 1 Apr 2011 21:57:06 +0000 (23:57 +0200)]
Release 1.16.0

3 years agoCorrect and clarify changelog entries
Guillem Jover [Fri, 1 Apr 2011 17:26:51 +0000 (19:26 +0200)]
Correct and clarify changelog entries

3 years agoRegenerate .pot files and merge .po files with them
Guillem Jover [Fri, 1 Apr 2011 20:13:55 +0000 (22:13 +0200)]
Regenerate .pot files and merge .po files with them

3 years agodpkg-divert: Unlink the source file when moving across filesystems
Guillem Jover [Fri, 1 Apr 2011 21:49:24 +0000 (23:49 +0200)]
dpkg-divert: Unlink the source file when moving across filesystems

Otherwise we might leave cruft behind.

Regression introduced in commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea.

3 years agodpkg-divert: Inline rename_mv() into file_rename()
Guillem Jover [Fri, 1 Apr 2011 21:38:20 +0000 (23:38 +0200)]
dpkg-divert: Inline rename_mv() into file_rename()

3 years agodpkg-divert: Move atomic rename logic from rename_mv() to file_copy()
Guillem Jover [Fri, 1 Apr 2011 21:33:15 +0000 (23:33 +0200)]
dpkg-divert: Move atomic rename logic from rename_mv() to file_copy()

This makes file_copy() safe to use by itself, and will allow to pull it
out and use it in other places in the future.

3 years agodpkg-divert: Change file_copy() and rename_mv() to ohshite() on error
Guillem Jover [Fri, 1 Apr 2011 21:18:05 +0000 (23:18 +0200)]
dpkg-divert: Change file_copy() and rename_mv() to ohshite() on error

This has several consequences, the code will not trigger leak detectors
like cppcheck due to ohshite() being marked non-returning, and the error
messages are going to be more descriptive.

Closes: #620380

3 years agoRevert "dpkg-divert: fix minor file descriptor leak found by cppcheck"
Guillem Jover [Fri, 1 Apr 2011 20:53:21 +0000 (22:53 +0200)]
Revert "dpkg-divert: fix minor file descriptor leak found by cppcheck"

This reverts commit bdcee319a90eee494af70e6725fed8b4e8f16584.

3 years agodpkg-genchanges: Do not warn when adding files w/o matching architecture
Guillem Jover [Thu, 24 Mar 2011 02:21:13 +0000 (03:21 +0100)]
dpkg-genchanges: Do not warn when adding files w/o matching architecture

Fix undefined value useage when adding files w/o a matching architecture,
because they are not present in debian/control, this is most commonly the
case due to dpkg-distaddfile.

3 years agolibdpkg: Make buffer_init() and buffer_done() take only one argument
Guillem Jover [Thu, 31 Mar 2011 23:27:30 +0000 (01:27 +0200)]
libdpkg: Make buffer_init() and buffer_done() take only one argument

These functions only handle the output buffer_data and thus the
read_data argument will never get used.

3 years agodpkg: Set the modification time for unpacked symlinks if possible
Guillem Jover [Thu, 31 Mar 2011 18:13:55 +0000 (20:13 +0200)]
dpkg: Set the modification time for unpacked symlinks if possible

Use lutimes() conditionally as it might not be widely available.

3 years agodpkg: Move lchown() call from tarobject() to tarobject_set_perms()
Guillem Jover [Thu, 31 Mar 2011 18:11:54 +0000 (20:11 +0200)]
dpkg: Move lchown() call from tarobject() to tarobject_set_perms()

This unifies a bit more the tarobject permission handling into a single

3 years agolibdpkg: Move mtime from file_stat back to tar_info
Guillem Jover [Mon, 21 Mar 2011 16:31:55 +0000 (18:31 +0200)]
libdpkg: Move mtime from file_stat back to tar_info

There's never a reason to override the mtime, no point in carrying and
copying it around in file_stat for now.

3 years agodpkg: Use utimes(2) instead of obsolete utime(2)
Guillem Jover [Thu, 31 Mar 2011 17:48:25 +0000 (19:48 +0200)]
dpkg: Use utimes(2) instead of obsolete utime(2)

POSIX.1-2008 marked utime(2) as obsolete. Ideally we'd switch to use
utimensat(2), which would simplify quite a bit the code, but it's not
yet widely available, and using it would imply having to support
fallback code at compilation and run-time. This can be done later on
once we up the POSIX baseline.

3 years agodpkg: Move conditionals to tarobject_set_*() functions
Guillem Jover [Thu, 31 Mar 2011 17:37:14 +0000 (19:37 +0200)]
dpkg: Move conditionals to tarobject_set_*() functions

This will allow to handle the different cases transparently. Pass a
tar_entry to each of the functions.

3 years agodpkg: Rename newtarobject_allmodes() to tarobject_set_perms()
Guillem Jover [Thu, 31 Mar 2011 13:17:10 +0000 (15:17 +0200)]
dpkg: Rename newtarobject_allmodes() to tarobject_set_perms()

3 years agodpkg: Rename newtarobject_utime() to tarobject_set_mtime()
Guillem Jover [Thu, 31 Mar 2011 13:16:48 +0000 (15:16 +0200)]
dpkg: Rename newtarobject_utime() to tarobject_set_mtime()

3 years agodpkg: Factor out newtarobject_allmodes() call
Guillem Jover [Thu, 31 Mar 2011 13:05:11 +0000 (15:05 +0200)]
dpkg: Factor out newtarobject_allmodes() call

3 years agodpkg: Move newtarobject_utime() call out of newtarobject_allmodes()
Guillem Jover [Mon, 21 Mar 2011 16:30:40 +0000 (18:30 +0200)]
dpkg: Move newtarobject_utime() call out of newtarobject_allmodes()

Always call newtarobject_utime() for all tar object types, except

3 years agodpkg: Fix typo in comment ‘cheched’ → ‘checked’
Guillem Jover [Thu, 31 Mar 2011 12:01:32 +0000 (14:01 +0200)]
dpkg: Fix typo in comment ‘cheched’ → ‘checked’

3 years agolibdpkg: Update MD5 implementation with the one from OpenBSD
Guillem Jover [Mon, 21 Mar 2011 16:11:32 +0000 (18:11 +0200)]
libdpkg: Update MD5 implementation with the one from OpenBSD

Add <config.h> and <compat.h> includes. Change <md5.h> include to
"md5.h". Change BYTE_ORDER check to WORDS_BIGENDIAN. Remove __bounded__
gcc attributes on function declarations. Remove file helper

3 years agoRename struct cmdinfo member arg_func to action and call it directly
Guillem Jover [Wed, 16 Mar 2011 13:33:09 +0000 (14:33 +0100)]
Rename struct cmdinfo member arg_func to action and call it directly

This avoids a temporary variable, given that now the function is
strongly prototyped.

3 years agoUse new action_func typedef instead of ad-hoc function casts
Guillem Jover [Wed, 16 Mar 2011 13:22:36 +0000 (14:22 +0100)]
Use new action_func typedef instead of ad-hoc function casts

3 years agoMake all command line action functions return int
Guillem Jover [Wed, 16 Mar 2011 13:22:34 +0000 (14:22 +0100)]
Make all command line action functions return int

This will allow using type-safe function pointers instead of casting
them around. Replace all exit(3) calls with return statements. Remove
DPKG_ATTR_NORET from function declarations, all functions are expected
to return now.

3 years agodpkg: Pass default return value to reportbroken_retexitstatus()
Guillem Jover [Thu, 24 Mar 2011 02:57:44 +0000 (03:57 +0100)]
dpkg: Pass default return value to reportbroken_retexitstatus()

This will allow to pass arbitrary values from the command actions when
there's not been any reported error.

3 years agodpkg-source: temporarily drop Package-List field generation
Raphaël Hertzog [Fri, 1 Apr 2011 19:26:02 +0000 (21:26 +0200)]
dpkg-source: temporarily drop Package-List field generation

That way we can discuss it further until there's consensus on its design
and upload 1.16.0 immediately.

3 years agodpkg-divert: fix minor file descriptor leak found by cppcheck
Raphaël Hertzog [Fri, 1 Apr 2011 18:45:46 +0000 (20:45 +0200)]
dpkg-divert: fix minor file descriptor leak found by cppcheck

Reported-by: Niels Thykier <>
3 years agodpkg-source: extend the Package-List field based on the feedback received
Raphaël Hertzog [Sat, 26 Mar 2011 08:24:58 +0000 (09:24 +0100)]
dpkg-source: extend the Package-List field based on the feedback received

Integrate the architecture field with spaces replaced by commas. It will
be used by the wanna-build team to see if the source package builds
Architecture: all packages. The reprepro maintainer also had a similar
use case for this information.

Put the type of the package in a dedicated field rather than a prefix of
the package name. Suggested by Bastian Blank.

See feedback at

3 years agoDpkg::Source::Patch: don't choke on empty patches
Raphaël Hertzog [Thu, 24 Mar 2011 22:53:37 +0000 (23:53 +0100)]
Dpkg::Source::Patch: don't choke on empty patches

Commit 255e73e11d1365fbb1e8d78287fad751a8ebc6e5 introduced a regression
with empty patches by assuming that a patch analysis would always give
back at least one filename.

Reported-by: Niels Thykier <>
3 years agoDpkg::Changelog::Debian::Entry: ignore whitespaces after options in header
Raphaël Hertzog [Thu, 24 Mar 2011 15:04:30 +0000 (16:04 +0100)]
Dpkg::Changelog::Debian::Entry: ignore whitespaces after options in header

3 years agodpkg-source: strip spaces around newlines in Uploaders
Raphaël Hertzog [Thu, 24 Mar 2011 14:45:22 +0000 (15:45 +0100)]
dpkg-source: strip spaces around newlines in Uploaders

3 years agodpkg(1): remove a duplicate word in the german translation
Raphaël Hertzog [Thu, 24 Mar 2011 14:29:54 +0000 (15:29 +0100)]
dpkg(1): remove a duplicate word in the german translation

Concerns the explanation of --get-selections.

3 years agoFix two typos in changelog
Raphaël Hertzog [Thu, 24 Mar 2011 14:26:04 +0000 (15:26 +0100)]
Fix two typos in changelog

3 years agodpkg-source: add new Package-List field to .dsc files
Raphaël Hertzog [Thu, 24 Mar 2011 13:39:56 +0000 (14:39 +0100)]
dpkg-source: add new Package-List field to .dsc files

This field has been requested by ftpmasters so that they can install
overrides for all binary packages as soon as they have approved
the source package. It contains a the list of packages that the source
can build along with their sections and priorities.

It looks like this:

   src:foo admin optional
   foo admin optional
   foo-common admin optional
   udeb:foo-udeb debian-installer extra

3 years agoDpkg::Control::Fields: define the place of the Built-Using field
Raphaël Hertzog [Thu, 24 Mar 2011 11:18:50 +0000 (12:18 +0100)]
Dpkg::Control::Fields: define the place of the Built-Using field

Commit a8cb927edb7dbd67c7a6084685998818b811caec forgot to add the
Built-Using field in %FIELD_ORDER.

3 years agoUpdate German translation of manual pages
Helge Kreutzmann [Wed, 23 Mar 2011 18:43:34 +0000 (19:43 +0100)]
Update German translation of manual pages

Update to 2010t.

3 years agodpkg-gencontrol: add support for Built-Using field
Mark Hymers [Tue, 22 Mar 2011 15:50:16 +0000 (15:50 +0000)]
dpkg-gencontrol: add support for Built-Using field

And teach dpkg-deb to not complain about it.

Signed-off-by: Raphaël Hertzog <>
3 years agodpkg: use the correct mtime when installing a file with statoverrides
Raphaël Hertzog [Mon, 21 Mar 2011 07:23:49 +0000 (08:23 +0100)]
dpkg: use the correct mtime when installing a file with statoverrides

Regression introduced by commit ceb07b08dad4d5eead630064f45c7e7ded00a341.

Reported-by: Marc A. Donges
3 years agoFix minor error in German dpkg translation
Sven Joachim [Thu, 17 Mar 2011 15:21:13 +0000 (16:21 +0100)]
Fix minor error in German dpkg translation

3 years agodpkg-divert: fix return value of rename_mv
Raphaël Hertzog [Thu, 17 Mar 2011 13:35:53 +0000 (14:35 +0100)]
dpkg-divert: fix return value of rename_mv

This is a regression introduced by the C rewrite of dpkg-divert
(commit 02b12d75f1eff7c184fafb5a663a0421e9a645ea) that made it unable to
rename files when that rename implies a copy on another file system.

The code has provision to do a copy when a simple rename is not enough
but the associated function erroneously returned a failure value when
that operation was performed.

Reported-by: Durk Strooisma
3 years agopkg_parse_copy(): fix references to variables in a comment
Raphaël Hertzog [Wed, 16 Mar 2011 07:00:44 +0000 (08:00 +0100)]
pkg_parse_copy(): fix references to variables in a comment

The comment still used the old names of variables from before the code had
been factored in a separate function (in commit

3 years agolibdpkg: Do not lose reverse dependencies when parsing control data
Guillem Jover [Tue, 15 Mar 2011 23:54:13 +0000 (00:54 +0100)]
libdpkg: Do not lose reverse dependencies when parsing control data

Regression introduced in commit 58df02f9d39c1e7b1c7f49026a649f125b87140d.

3 years agoUpdate German translation of manual pages
Helge Kreutzmann [Tue, 15 Mar 2011 16:00:27 +0000 (17:00 +0100)]
Update German translation of manual pages

Update to 2008t0f0u.

3 years agoAdd armhf support to ostable and triplettable
Guillem Jover [Tue, 15 Mar 2011 00:24:28 +0000 (01:24 +0100)]
Add armhf support to ostable and triplettable

Closes: #594179

3 years agodpkg-split: fix a gcc warning
Raphaël Hertzog [Mon, 14 Mar 2011 13:49:26 +0000 (14:49 +0100)]
dpkg-split: fix a gcc warning

The refactoring made in commit 86cbf575b13d049504402f72d221fa1538c2e53b
was supposed to add the cast for the argument matching
the %jx specifier (and not %s).

3 years agoGerman dpkg translation update
Sven Joachim [Mon, 14 Mar 2011 12:09:18 +0000 (13:09 +0100)]
German dpkg translation update

Update to 1020t.

3 years agobuild: Update po/ for new/renamed source files
Sven Joachim [Mon, 14 Mar 2011 12:08:45 +0000 (13:08 +0100)]
build: Update po/ for new/renamed source files

lib/dpkg/dir.c (commit 20fdb395cc721a5060c5623eda956d73ea840a21)
src/infodb.c (commit 9f7f2a958321d41725c0ae7f46c434fe4cbf3c6a)

lib/dpkg/database.c → lib/dpkg/pkg-db.c (commit

3 years agodpkg-split: Fix typo
Sven Joachim [Mon, 14 Mar 2011 12:08:21 +0000 (13:08 +0100)]
dpkg-split: Fix typo

3 years agoUse off_t and %jd or %jx to handle file sizes and offsets
Guillem Jover [Mon, 14 Mar 2011 01:15:38 +0000 (02:15 +0100)]
Use off_t and %jd or %jx to handle file sizes and offsets

This allows to support large files on 32-bit systems were a ‘long int’
type might not be of at least 64-bits. For printing %jd or %jx is used,
and the value is cast to intmax_t.

3 years agoUse size_t and %zu to handle memory sizes and offsets
Guillem Jover [Mon, 14 Mar 2011 02:01:43 +0000 (03:01 +0100)]
Use size_t and %zu to handle memory sizes and offsets

3 years agolibdpkg: Replace OtoL() with OtoM() converting to intmax_t
Guillem Jover [Mon, 14 Mar 2011 01:58:28 +0000 (02:58 +0100)]
libdpkg: Replace OtoL() with OtoM() converting to intmax_t

This allows storing at least 64-bit integers on 32-bit systems, and thus
large file support.

3 years agodpkg-split: Make decompose_filename() and setpartsize() use strtoimax()
Guillem Jover [Mon, 14 Mar 2011 04:21:49 +0000 (05:21 +0100)]
dpkg-split: Make decompose_filename() and setpartsize() use strtoimax()

This will allow parsing large numbers, required for large file support.

3 years agodpkg-split: Replace unsignedlong() with parse_intmax()
Guillem Jover [Mon, 14 Mar 2011 01:12:57 +0000 (02:12 +0100)]
dpkg-split: Replace unsignedlong() with parse_intmax()

3 years agobuild: Check for %j and %z format modifiers support
Guillem Jover [Mon, 14 Mar 2011 00:55:50 +0000 (01:55 +0100)]
build: Check for %j and %z format modifiers support

We use those to create binary output, so we require them to be working.

3 years agodpkg-split: Use a constant expression to declare an array
Guillem Jover [Sun, 13 Mar 2011 22:32:30 +0000 (23:32 +0100)]
dpkg-split: Use a constant expression to declare an array

Although usually the compiler should replace strlen(literal) with a
built-in, it might not, and it's more predictable to use a constant
expression using sizeof() instead to avoid making it a variable
length array. This fixes a warning with latest gcc and -Wvla.

3 years agoInline rerr() into its only current call site
Guillem Jover [Mon, 14 Mar 2011 06:16:31 +0000 (07:16 +0100)]
Inline rerr() into its only current call site

3 years agoInline werr() into its only current call site
Guillem Jover [Sun, 13 Mar 2011 22:30:19 +0000 (23:30 +0100)]
Inline werr() into its only current call site

3 years agodpkg-deb: Use fdio instead of stdio
Guillem Jover [Sun, 13 Mar 2011 22:10:28 +0000 (23:10 +0100)]
dpkg-deb: Use fdio instead of stdio

Prefer fdio for binary data.

3 years agodpkg-split: Do not slurp into memory the whole package parts
Guillem Jover [Sun, 13 Mar 2011 22:05:54 +0000 (23:05 +0100)]
dpkg-split: Do not slurp into memory the whole package parts

Use buffered I/O when reassembling split packages. This will make
possible to handle parts > 2 GiB on 32 bit systems.

3 years agolibdpkg: Add missing <errno.h> needed by fd_null_copy()
Guillem Jover [Sun, 13 Mar 2011 21:38:38 +0000 (22:38 +0100)]
libdpkg: Add missing <errno.h> needed by fd_null_copy()

3 years agou-a: Do not unneedingly initialize variables to NULL
Guillem Jover [Sun, 13 Mar 2011 20:56:42 +0000 (21:56 +0100)]
u-a: Do not unneedingly initialize variables to NULL

Those get initialized unconditionally later on in the code.

This was spotted by a run with the clang static analyzer.

3 years agodpkg-query: Return a valid width even if opening /dev/tty failed
Guillem Jover [Sun, 13 Mar 2011 20:51:21 +0000 (21:51 +0100)]
dpkg-query: Return a valid width even if opening /dev/tty failed

This was spotted by a run with the clang static analyzer.

3 years agobuild: Add -Wformat-security and -Wpointer-arith to default warnings
Guillem Jover [Sun, 13 Mar 2011 20:41:01 +0000 (21:41 +0100)]
build: Add -Wformat-security and -Wpointer-arith to default warnings

3 years agodselect: Use a format string in printf() instead of only a variable
Guillem Jover [Sun, 13 Mar 2011 20:41:38 +0000 (21:41 +0100)]
dselect: Use a format string in printf() instead of only a variable

This fixes a warning with -Wformat-security.

3 years agodpkg: Add comment about why writeback code ignores return values
Guillem Jover [Sun, 13 Mar 2011 17:38:21 +0000 (18:38 +0100)]
dpkg: Add comment about why writeback code ignores return values

Suggested-by: Sven Mueller <>
3 years agoMove pkgadmindir() and pkgadminfile() to the filesdb module
Guillem Jover [Sun, 13 Mar 2011 17:27:56 +0000 (18:27 +0100)]
Move pkgadmindir() and pkgadminfile() to the filesdb module

These functions are not really part of the modstatdb module, and by
moving them out they get detangled and will make it possible to extend
them w/o pulling additional code into binaries not using the functions.

3 years agoMake admindir file local everywhere
Guillem Jover [Sun, 13 Mar 2011 18:56:01 +0000 (19:56 +0100)]
Make admindir file local everywhere

The interface to get and set the database directory is dpkg_db_get_dir()
and dpkg_db_set_dir().

3 years agoDo not pass admindir to database initialization functions
Guillem Jover [Sun, 13 Mar 2011 07:45:25 +0000 (08:45 +0100)]
Do not pass admindir to database initialization functions

Use dpkg_db_get_dir() and dpkg_db_get_path() to globally retrieve the
database directory instead of passing it around.

3 years agolibdpkg: Use dpkg_db_get_path() instead of trig_get_triggersdir()
Guillem Jover [Sun, 13 Mar 2011 21:13:04 +0000 (22:13 +0100)]
libdpkg: Use dpkg_db_get_path() instead of trig_get_triggersdir()

Remove now unused trig_get_triggersdir().

3 years agoUse dpkg_db_set_dir() instead of pkgadmindir_init()
Guillem Jover [Sun, 13 Mar 2011 18:17:55 +0000 (19:17 +0100)]
Use dpkg_db_set_dir() instead of pkgadmindir_init()

Remove now unused pkgadmindir_init().

3 years agoUse dpkg_db_get_path() instead of using m_asprintf() and admindir
Guillem Jover [Sun, 13 Mar 2011 18:53:28 +0000 (19:53 +0100)]
Use dpkg_db_get_path() instead of using m_asprintf() and admindir

3 years agoUse dpkg_db_get_path() instead of ad-hoc building the string with varbuf
Guillem Jover [Sun, 13 Mar 2011 18:51:55 +0000 (19:51 +0100)]
Use dpkg_db_get_path() instead of ad-hoc building the string with varbuf

3 years agolibdpkg: Add new dbdir module
Guillem Jover [Sun, 13 Mar 2011 07:45:25 +0000 (08:45 +0100)]
libdpkg: Add new dbdir module

3 years agodselect: Use modstatdb_can_lock() in refreshmenu() instead of ad-hoc code
Guillem Jover [Sun, 13 Mar 2011 06:41:30 +0000 (07:41 +0100)]
dselect: Use modstatdb_can_lock() in refreshmenu() instead of ad-hoc code

3 years agolibdpkg: Refactor modstatdb_can_lock() out from modstatdb_lock()
Guillem Jover [Sun, 13 Mar 2011 06:40:09 +0000 (07:40 +0100)]
libdpkg: Refactor modstatdb_can_lock() out from modstatdb_lock()

3 years agolibdpkg: Handle EACCES as a permission error in modstatdb_lock()
Guillem Jover [Sun, 13 Mar 2011 21:02:01 +0000 (22:02 +0100)]
libdpkg: Handle EACCES as a permission error in modstatdb_lock()

The current code only considers EPERM, but EACCES is also a valid error
concerning permission issues from open(2).

3 years agolibdpkg: Reset dblockfd on modstatdb_unlock()
Guillem Jover [Sun, 13 Mar 2011 06:38:03 +0000 (07:38 +0100)]
libdpkg: Reset dblockfd on modstatdb_unlock()

This will allow locking again the database after having previously
unlocked it.

3 years agoMake modstatdb locking functions not take an admindir argument
Guillem Jover [Sun, 13 Mar 2011 05:48:27 +0000 (06:48 +0100)]
Make modstatdb locking functions not take an admindir argument

Initialize the lockfile on modstatdb_init() via the fnis array. Make
sure we call modstatdb_init() and modstatdb_done() in case we are not
calling modstatdb_open() and modstatdb_shutdown().

3 years agolibdpkg: Refactor modstatdb init/done sequence into new functions
Guillem Jover [Sun, 13 Mar 2011 05:29:08 +0000 (06:29 +0100)]
libdpkg: Refactor modstatdb init/done sequence into new functions

Move variable path initialization and destruction code to the new
modstatdb_init() and modstatdb_done(). Add a boolean variable to protect
the funtions from reiterated calls.

3 years agolibdpkg: Rename modstatdb_init() to modstatdb_open()
Guillem Jover [Sun, 13 Mar 2011 05:29:08 +0000 (06:29 +0100)]
libdpkg: Rename modstatdb_init() to modstatdb_open()

We'll need to reuse the modstatdb_init() function name for further

3 years agolibdpkg: Rename database module to pkg-db
Guillem Jover [Sun, 13 Mar 2011 05:09:10 +0000 (06:09 +0100)]
libdpkg: Rename database module to pkg-db

This matches the namespace for the provided functions, and disambiguates
what kind of database it's refering to.

3 years agolibdpkg: Rename hashreport() to pkg_db_report()
Guillem Jover [Sun, 13 Mar 2011 05:06:33 +0000 (06:06 +0100)]
libdpkg: Rename hashreport() to pkg_db_report()

3 years agolibdpkg: Move non pkg_db related functions to the pkg module
Guillem Jover [Sun, 13 Mar 2011 05:01:39 +0000 (06:01 +0100)]
libdpkg: Move non pkg_db related functions to the pkg module

The pkgbin_blank, pkg_blank and pkg_is_informative are not strictly
part of the pkg_db module, and can be used w/o the latter.

3 years agolibdpkg: Move blankversion() to new version module
Guillem Jover [Sun, 13 Mar 2011 04:53:37 +0000 (05:53 +0100)]
libdpkg: Move blankversion() to new version module

3 years agolibdpkg: Change file_unlock() to act directly on its new arguments
Guillem Jover [Sun, 13 Mar 2011 04:40:43 +0000 (05:40 +0100)]
libdpkg: Change file_unlock() to act directly on its new arguments

This switches the function from unlocking the file via the popped
cleanup to do the action itself.