[SCM] dpkg's main repository branch, master, updated. 1.16.0.2-55-gfa406fa

2011-04-29 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fa406fa856d9ec898d171e51a6e6c5e5c9677d00
Author: Guillem Jover guil...@debian.org
Date:   Fri Apr 29 09:31:39 2011 +0200

dpkg: Move dpkg/tarfn.h inclusion from cleanup.c to archives.h

The former is not using any declarations from tarfn.h, but the latter
is.

diff --git a/src/archives.h b/src/archives.h
index 803aadd..eb0e468 100644
--- a/src/archives.h
+++ b/src/archives.h
@@ -23,6 +23,8 @@
 
 #include stdbool.h
 
+#include dpkg/tarfn.h
+
 struct tarcontext {
   int backendpipe;
   struct pkginfo *pkg;
diff --git a/src/cleanup.c b/src/cleanup.c
index 1adb551..91ffb2c 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -37,7 +37,6 @@
 #include dpkg/i18n.h
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
-#include dpkg/tarfn.h
 #include dpkg/myopt.h
 
 #include filesdb.h

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.2-60-g9b2cc7a

2011-04-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2ecaea9677e9d4307aabfbecc00a77e99a05457b
Author: Guillem Jover guil...@debian.org
Date:   Sat Apr 30 21:01:27 2011 +0200

s-s-d: Return status_unknown on error reading from the pid file

Otherwise the variable was uninitialized.

diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 2fba385..d50e0e0 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1243,6 +1243,8 @@ do_pidfile(const char *name)
 
if (fscanf(f, %d, pid) == 1)
pid_status = pid_check(pid);
+   else
+   pid_status = status_unknown;
fclose(f);
 
if (pid_status == status_dead)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.2-60-g9b2cc7a

2011-04-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 9b2cc7aa3187091bf2cbbb734fb77a7c52bec969
Author: Guillem Jover guil...@debian.org
Date:   Sat Apr 30 21:03:16 2011 +0200

dselect: Mark ‘y’ variables as unused for getyx() and getmaxyx()

The ncurses library does not provide a way to only retrieve the ‘x’
variable, so we have to pass a dummy ‘y’ which we are not going to
use, for which the compiler emits a warning.

diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc
index d973f8c..3804475 100644
--- a/dselect/basecmds.cc
+++ b/dselect/basecmds.cc
@@ -159,7 +159,7 @@ void baselist::displayerror(const char* str) {
 
 
 void baselist::displayhelp(const struct helpmenuentry *helpmenu, int key) {
-  int maxx, maxy, i, y, x, nextkey;
+  int maxx, maxy, i, nextkey;
 
   getmaxyx(stdscr,maxy,maxx);
   wbkgdset(stdscr, ' ' | helpscreen_attr);
@@ -170,6 +170,8 @@ void baselist::displayhelp(const struct helpmenuentry 
*helpmenu, int key) {
 while (hme-key  hme-key != key)
   hme++;
 if (hme-key) {
+  int x, y DPKG_ATTR_UNUSED;
+
   attrset(helpscreen_attr);
   mvaddstr(1,0, gettext(hme-msg-text));
   attrset(title_attr);
diff --git a/dselect/baselist.cc b/dselect/baselist.cc
index d272c10..cb876d7 100644
--- a/dselect/baselist.cc
+++ b/dselect/baselist.cc
@@ -332,7 +332,8 @@ void baselist::wordwrapinfo(int offset, const char *m) {
   waddnstr(infopad, m, l);
   waddch(infopad,'\n'); wrapping= 0;
 } else {
-  int x,y;
+  int x, y DPKG_ATTR_UNUSED;
+
   if (wrapping) {
 getyx(infopad, y,x);
 if (x+1 = usemax) {
diff --git a/dselect/main.cc b/dselect/main.cc
index 5c87b03..b00bb12 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -386,7 +386,7 @@ dme(int i, int so)
   gettext(me-option),
   gettext(me-menuent));
 
-  int y,x;
+  int x, y DPKG_ATTR_UNUSED;
   getmaxyx(stdscr,y,x);
 
   attrset(so ? A_REVERSE : A_NORMAL);
@@ -401,7 +401,7 @@ refreshmenu(void)
 
   curseson(); cbreak(); noecho(); nonl(); keypad(stdscr,TRUE);
 
-  int y,x;
+  int x, y DPKG_ATTR_UNUSED;
   getmaxyx(stdscr,y,x);
 
   clear();
diff --git a/dselect/pkgdisplay.cc b/dselect/pkgdisplay.cc
index bf370a8..67750b3 100644
--- a/dselect/pkgdisplay.cc
+++ b/dselect/pkgdisplay.cc
@@ -190,7 +190,7 @@ void packagelist::setwidths() {
 }
 
 void packagelist::redrawtitle() {
-  int x,y;
+  int x, y DPKG_ATTR_UNUSED;
 
   if (title_height) {
 mywerase(titlewin);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.16.0.2-2-gbd1d6cd

2011-05-04 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit bd1d6cd247f8e5eb7f2465c0d686cba363c64a57
Author: Guillem Jover guil...@debian.org
Date:   Wed May 4 10:01:44 2011 +0200

Release 1.16.0.3

diff --git a/debian/changelog b/debian/changelog
index 854972c..db016b3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,9 @@
-dpkg (1.16.0.3) UNRELEASED; urgency=low
+dpkg (1.16.0.3) unstable; urgency=medium
 
   * Allow again Priority field values not known to dpkg. Regression
 introduced in 1.16.0.
 
- -- Guillem Jover guil...@debian.org  Wed, 04 May 2011 09:39:09 +0200
+ -- Guillem Jover guil...@debian.org  Wed, 04 May 2011 10:01:30 +0200
 
 dpkg (1.16.0.2) unstable; urgency=high
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, sid, updated. 1.16.0.2-2-gbd1d6cd

2011-05-04 Thread Guillem Jover
The following commit has been merged in the sid branch:
commit d84b36a81088721b340e52664aa2c3379fea2a9a
Author: Guillem Jover guil...@debian.org
Date:   Wed May 4 09:41:37 2011 +0200

libdpkg: Allow again unknown Priority field values

The code was not properly advancing the end of the value string when
reaching the fallback case (on values not known for the Priority field),
and the validation for junk after the first word was failing on the
actual first word.

This change reverts to the previous behaviour of blindly accepting the
whole value string for a field, regardless of it being multiword, when
it's the fallback case.

Regression introduced in commit b3f669039f128d715ac7ac71abaeac86f0954112.

Analysis-by: Raphaël Hertzog hert...@debian.org
Analysis-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 5fe55fe..854972c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dpkg (1.16.0.3) UNRELEASED; urgency=low
+
+  * Allow again Priority field values not known to dpkg. Regression
+introduced in 1.16.0.
+
+ -- Guillem Jover guil...@debian.org  Wed, 04 May 2011 09:39:09 +0200
+
 dpkg (1.16.0.2) unstable; urgency=high
 
   * Fix dpkg-split --auto to not fail when opening the new depot file.
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index 4376581..b56dc1e 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -48,9 +48,14 @@ parse_nv_next(struct parsedb_state *ps, const struct pkginfo 
*pigp,
   if (nv == NULL)
 parse_error(ps, pigp, _('%.50s' is not allowed for %s), str_start, what);
 
-  str_end = str_start + nv-length;
-  while (isspace(str_end[0]))
-str_end++;
+  /* We got the fallback value, skip further string validation. */
+  if (nv-length == 0) {
+str_end = NULL;
+  } else {
+str_end = str_start + nv-length;
+while (isspace(str_end[0]))
+  str_end++;
+  }
   *strp = str_end;
 
   return nv-value;
@@ -64,7 +69,7 @@ parse_nv_last(struct parsedb_state *ps, const struct pkginfo 
*pkg,
   int value;
 
   value = parse_nv_next(ps, pkg, what, nv_head, str);
-  if (str[0] != '\0')
+  if (str != NULL  str[0] != '\0')
 parse_error(ps, pkg, _(junk after %s), what);
 
   return value;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository annotated tag, 1.16.0.3, created. 1.16.0.3

2011-05-04 Thread Guillem Jover
The annotated tag, 1.16.0.3 has been created
at  a9d53c5dc31da9fc9e9b33f2119a20e1981ebf18 (tag)
   tagging  bd1d6cd247f8e5eb7f2465c0d686cba363c64a57 (commit)
  replaces  1.16.0.2
 tagged by  Guillem Jover
on  Wed May 4 10:31:03 2011 +0200

- Shortlog 
Release 1.16.0.3
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEABECAAYFAk3BDsgACgkQuW9ciZ2SjJvr/wCg8Qm11Nw6KVdAsbSBm7TGTrr1
WrAAn1916PThZC4ipeZ4p3jg2XvmnV0P
=F3LH
-END PGP SIGNATURE-

Guillem Jover (2):
  libdpkg: Allow again unknown Priority field values
  Release 1.16.0.3

---

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-62-gcbde7fa

2011-05-04 Thread Guillem Jover
The following commit has been merged in the master branch:
commit cbde7fa861fa6851cdbc56ae70b73332ab9db935
Merge: 140527fc6129f0e4f2a7c64f28d8d19fe5e60b3f 
bd1d6cd247f8e5eb7f2465c0d686cba363c64a57
Author: Guillem Jover guil...@debian.org
Date:   Wed May 4 11:00:11 2011 +0200

Merge branch 'sid' (through tag '1.16.0.3')

Conflicts:
debian/changelog

diff --combined debian/changelog
index bc414e9,db016b3..5934c8e
--- a/debian/changelog
+++ b/debian/changelog
@@@ -1,68 -1,10 +1,75 @@@
 +dpkg (1.16.1) UNRELEASED; urgency=low
 +
 +  [ Raphaël Hertzog ]
 +  * Dpkg::Deps: Implement new reset method and bump module version to 1.01
 +due to this.
 +  * Improved description of --search in dpkg-query(1). Closes: #621066
 +Thanks to Lars Buitinck larsm...@gmail.com for the patch.
 +  * Let update-alternatives fsync() its administrative files before
 +moving them in place to avoid empty files with some filesystems.
 +LP: #344019
 +  * Tighten the regexp used by dpkg-source to ignore the .pc directory of
 +quilt. Thanks to Mike Hommey for noticing the problem.
 +
 +  [ Guillem Jover ]
 +  * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520
 +  * Add ‘.gitmodules’ to the default dpkg-source ignore lists. Closes: #620490
 +  * Document in dpkg-query(1) man page that on --listfiles each list of
 +files per package name is separated by a blank line. Same goes for
 +--status and --print-avail.
 +  * Use execvp(3) unconditionally in command_exec(). Making the call always
 +fallback to use the system shell in case of error, such as with empty
 +maintainer scripts. Thanks to Jonathan Nieder jrnie...@gmail.com.
 +Closes: #622094
 +  * Improve deb-split(5) format description by splitting debian-split
 +member contents into a list.
 +  * Switch to debhelper compatibility level 7.
 +- Use dh_prep instead of deprecated “dh_clean -k”.
 +  * Bump Standards-Version to 3.9.2 (no changes needed).
 +  * Generate filenames following current conventions on “dpkg-split --join”,
 +by including the architecture in the debian-split member of a split
 +package and using underscores to separate filename parts.
 +  * Support conffiles with spaces when diffing them. Closes: #147583
 +  * Allow installing packages with bogus versions with new
 +--force-bad-version.
 +  * Do not fail when unpacking a diverted hardlink. Closes: #245322
 +Based on a patch by Christopher Baines cbain...@gmail.com.
 +  * Document in dpkg-deb(1) that --fsys-tarfile will always process the
 +input archive sequentially. Closes: #616609
 +  * Remove long non-functional --new and --old dpkg-deb option handling
 +from dpkg which were being treated as dpkg commands.
 +  * Remove reference to --nocheck dpkg-deb option from dpkg man page as
 +the latter does not pass it to the former.
 +  * Clarify the current dpkg behaviour when running the dpkg-deb and
 +dpkg-query back-ends, of not passing through back-end specific options
 +when running them from dpkg. Closes: #610940
 +  * Use “unselected” as an adjective in dpkg output messages instead of
 +“deselected”. Closes: #231089
 +  * Clarify exit status in dpkg-split and start-stop-daemon --help output.
 +  * Clarify “EXIT STATUS” section in man pages by using a table.
 +  * Add a --status command to start-stop-daemon returning LSB Init Script
 +status action exit codes.
 +  * Add start-stop-daemon process name kernel limits for Solaris, NetBSD,
 +OpenBSD, FreeBSD and Darwin.
 +
 +  [ Updated dpkg translations ]
 +  * German (Sven Joachim). Closes: #620312
 +
 +  [ Updated man page translations ]
 +  * German (Helge Kreutzmann).
 +
 +  [ Updated scripts translations ]
 +  * German (Helge Kreutzmann).
 +
 + -- Raphaël Hertzog hert...@debian.org  Sat, 02 Apr 2011 09:21:26 +0200
 +
+ dpkg (1.16.0.3) unstable; urgency=medium
+ 
+   * Allow again Priority field values not known to dpkg. Regression
+ introduced in 1.16.0.
+ 
+  -- Guillem Jover guil...@debian.org  Wed, 04 May 2011 10:01:30 +0200
+ 
  dpkg (1.16.0.2) unstable; urgency=high
  
* Fix dpkg-split --auto to not fail when opening the new depot file.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-65-gff6e32d

2011-05-05 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2c9a342dc4e1ad3e9e58ac89957b9068664d1930
Author: Guillem Jover guil...@debian.org
Date:   Thu May 5 14:49:49 2011 +0200

dpkg: Fix wrong matching for check on directory containing conffiles

On package removal, keep only directories actually containing conffiles,
and not directories just matching the substring in the conffile or the
directory itself. The directory itself is not matched either as strictly
speaking it is not contained in itself, and it should already be in the
leftover lists.

Previously when checking for directory ‘/foo’ the following conffiles
would match:

  /foo
  /foobar
  /foo/bar

Now only the following will match:

  /foo/bar

Spotted-by: Ondřej Surý ond...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 5934c8e..1c5abbe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -51,6 +51,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 status action exit codes.
   * Add start-stop-daemon process name kernel limits for Solaris, NetBSD,
 OpenBSD, FreeBSD and Darwin.
+  * On package removal, keep only directories actually containing conffiles,
+and not directories just matching the substring in the conffile or the
+directory itself. Thanks to Ondřej Surý ond...@debian.org.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/help.c b/src/help.c
index 1be86e6..e0fefae 100644
--- a/src/help.c
+++ b/src/help.c
@@ -474,7 +474,8 @@ hasdirectoryconffiles(struct filenamenode *file, struct 
pkginfo *pkg)
pkg-name);
   namelen = strlen(file-name);
   for (conff= pkg-installed.conffiles; conff; conff= conff-next) {
-  if (!strncmp(file-name,conff-name,namelen)) {
+  if (strncmp(file-name, conff-name, namelen) == 0 
+  conff-name[namelen] == '/') {
debug(dbg_veryverbose, directory %s has conffile %s from %s,
  file-name, conff-name, pkg-name);
return true;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-65-gff6e32d

2011-05-05 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fda21f829bebed12e1a4ec0dccac7434a643c6b5
Author: Guillem Jover guil...@debian.org
Date:   Fri May 6 05:05:51 2011 +0200

dpkg: Rename hasdirectoryconffiles() to dir_has_conffiles()

diff --git a/src/help.c b/src/help.c
index e0fefae..8f6a2fc 100644
--- a/src/help.c
+++ b/src/help.c
@@ -465,12 +465,12 @@ void clear_istobes(void) {
  * false otherwise.
  */
 bool
-hasdirectoryconffiles(struct filenamenode *file, struct pkginfo *pkg)
+dir_has_conffiles(struct filenamenode *file, struct pkginfo *pkg)
 {
   struct conffile *conff;
   size_t namelen;
 
-  debug(dbg_veryverbose, hasdirectoryconffiles `%s' (from %s), file-name,
+  debug(dbg_veryverbose, dir_has_conffiles '%s' (from %s), file-name,
pkg-name);
   namelen = strlen(file-name);
   for (conff= pkg-installed.conffiles; conff; conff= conff-next) {
@@ -481,7 +481,7 @@ hasdirectoryconffiles(struct filenamenode *file, struct 
pkginfo *pkg)
return true;
   }
   }
-  debug(dbg_veryverbose, hasdirectoryconffiles no);
+  debug(dbg_veryverbose, dir_has_conffiles no);
   return false;
 }
 
diff --git a/src/main.h b/src/main.h
index cba98ef..177fb1c 100644
--- a/src/main.h
+++ b/src/main.h
@@ -249,7 +249,7 @@ void post_postinst_tasks(struct pkginfo *pkg, enum 
pkgstatus new_status);
 
 void clear_istobes(void);
 bool isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
-bool hasdirectoryconffiles(struct filenamenode *namenode, struct pkginfo *pkg);
+bool dir_has_conffiles(struct filenamenode *namenode, struct pkginfo *pkg);
 
 void log_action(const char *action, struct pkginfo *pkg);
 
diff --git a/src/remove.c b/src/remove.c
index 3d4879b..ac57dd2 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -253,7 +253,7 @@ removal_bulk_remove_files(struct pkginfo *pkg)
 /* Only delete a directory or a link to one if we're the only
  * package which uses it. Other files should only be listed
  * in this package (but we don't check). */
-   if (hasdirectoryconffiles(namenode,pkg)) {
+if (dir_has_conffiles(namenode, pkg)) {
  push_leftover(leftover,namenode);
  continue;
}
@@ -332,7 +332,7 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
   /* Only delete a directory or a link to one if we're the only
* package which uses it. Other files should only be listed
* in this package (but we don't check). */
-  if (hasdirectoryconffiles(namenode,pkg)) {
+  if (dir_has_conffiles(namenode, pkg)) {
push_leftover(leftover,namenode);
continue;
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-65-gff6e32d

2011-05-05 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ff6e32d3588cf11258a7d0a2311461971abe51f3
Author: Guillem Jover guil...@debian.org
Date:   Fri May 6 05:06:54 2011 +0200

dpkg: Rename isdirectoryinuse() to dir_is_used_by_others()

This clarifies the action performed by the function, which could be
easily confused as being used by the given package, instead of by other
packages.

diff --git a/src/help.c b/src/help.c
index 8f6a2fc..4a2256f 100644
--- a/src/help.c
+++ b/src/help.c
@@ -490,17 +490,17 @@ dir_has_conffiles(struct filenamenode *file, struct 
pkginfo *pkg)
  * false otherwise.
  */
 bool
-isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg)
+dir_is_used_by_others(struct filenamenode *file, struct pkginfo *pkg)
 {
   struct filepackages_iterator *iter;
   struct pkginfo *other_pkg;
 
-  debug(dbg_veryverbose, isdirectoryinuse `%s' (except %s), file-name,
+  debug(dbg_veryverbose, dir_is_used_by_others '%s' (except %s), file-name,
 pkg ? pkg-name : none);
 
   iter = filepackages_iter_new(file);
   while ((other_pkg = filepackages_iter_next(iter))) {
-debug(dbg_veryverbose, isdirectoryinuse considering %s ...,
+debug(dbg_veryverbose, dir_is_used_by_others considering %s ...,
   other_pkg-name);
 if (other_pkg == pkg)
   continue;
@@ -508,7 +508,7 @@ isdirectoryinuse(struct filenamenode *file, struct pkginfo 
*pkg)
   }
   filepackages_iter_free(iter);
 
-  debug(dbg_veryverbose, isdirectoryinuse no);
+  debug(dbg_veryverbose, dir_is_used_by_others no);
   return false;
 }
 
diff --git a/src/main.h b/src/main.h
index 177fb1c..12d12e7 100644
--- a/src/main.h
+++ b/src/main.h
@@ -248,7 +248,7 @@ void post_postinst_tasks_core(struct pkginfo *pkg);
 void post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status);
 
 void clear_istobes(void);
-bool isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
+bool dir_is_used_by_others(struct filenamenode *namenode, struct pkginfo *pkg);
 bool dir_has_conffiles(struct filenamenode *namenode, struct pkginfo *pkg);
 
 void log_action(const char *action, struct pkginfo *pkg);
diff --git a/src/processarc.c b/src/processarc.c
index 2ee685f..6e7ea09 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -888,7 +888,8 @@ void process_archive(const char *filename) {
 if (!stat(namenode-name,stab)  S_ISDIR(stab.st_mode)) {
   debug(dbg_eachfiledetail, process_archive: %s is a directory,
namenode-name);
-  if (isdirectoryinuse(namenode,pkg)) continue;
+  if (dir_is_used_by_others(namenode, pkg))
+continue;
 }
 
 if (lstat(fnamevb.buf, oldfs)) {
diff --git a/src/remove.c b/src/remove.c
index ac57dd2..a33518d 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -257,7 +257,8 @@ removal_bulk_remove_files(struct pkginfo *pkg)
  push_leftover(leftover,namenode);
  continue;
}
-   if (isdirectoryinuse(namenode,pkg)) continue;
+if (dir_is_used_by_others(namenode, pkg))
+  continue;
   }
   debug(dbg_eachfiledetail, removal_bulk removing `%s', fnvb.buf);
   if (!rmdir(fnvb.buf) || errno == ENOENT || errno == ELOOP) continue;
@@ -336,7 +337,8 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
push_leftover(leftover,namenode);
continue;
   }
-  if (isdirectoryinuse(namenode,pkg)) continue;
+  if (dir_is_used_by_others(namenode, pkg))
+continue;
 }
 
 debug(dbg_eachfiledetail, removal_bulk removing `%s', fnvb.buf);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2f003686fdd46eb524a08715c8a8988c6d13cea3
Author: Guillem Jover guil...@debian.org
Date:   Sat May 7 12:27:27 2011 +0200

Group Build-Depends lines by purpose

Build tools, i18n tools, compression, security and UI libraries, and
perl packages for the test suite.

diff --git a/debian/control b/debian/control
index b9e6d31..d03ac7e 100644
--- a/debian/control
+++ b/debian/control
@@ -9,10 +9,11 @@ Homepage: http://wiki.debian.org/Teams/Dpkg
 Vcs-Browser: http://git.debian.org/?p=dpkg/dpkg.git
 Vcs-Git: git://git.debian.org/git/dpkg/dpkg.git
 Standards-Version: 3.9.2
-Build-Depends: debhelper (= 7), pkg-config,
+Build-Depends: debhelper (= 7), pkg-config, flex,
  gettext (= 0.18), po4a (= 0.33.1),
- libncursesw5-dev, zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev, flex,
+ zlib1g-dev (= 1:1.1.3-19.1), libbz2-dev,
  libselinux1-dev (= 1.28-4) [linux-any],
+ libncursesw5-dev,
  libtimedate-perl, libio-string-perl
 
 Package: libdpkg-dev

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ec5615cdd134654d0e7049cdd5925aa9a83034ba
Author: Guillem Jover guil...@debian.org
Date:   Sat May 7 11:16:08 2011 +0200

dpkg-deb: Pass the real file descriptors to compression functions

Instead of duping them to the stdin and stdout file descriptors, pass
them directly. If the compression functions need the file descriptors
on stdin and stdout, then they will take care of setting them up. This
is only the case when using the external compression binaries.

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 0e40222..60318db 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -474,8 +474,7 @@ do_build(const char *const *argv)
   /* And run gzip to compress our control archive. */
   c2 = subproc_fork();
   if (!c2) {
-m_dup2(p1[0],0); m_dup2(gzfd,1); close(p1[0]); close(gzfd);
-compress_filter(compressor_gzip, 0, 1, 9, _(control member));
+compress_filter(compressor_gzip, p1[0], gzfd, 9, _(control member));
   }
   close(p1[0]);
   subproc_wait_check(c2, gzip -9c, 0);
@@ -504,12 +503,17 @@ do_build(const char *const *argv)
 dpkg_ar_member_put_mem(debar, arfd, DEBMAGIC, deb_magic, 
strlen(deb_magic));
 dpkg_ar_member_put_file(debar, arfd, ADMINMEMBER, gzfd, -1);
   }
+  close(gzfd);
 
-  /* Control is done, now we need to archive the data. Start by creating
-   * a new temporary file. Immediately unlink the temporary file so others
-   * can't mess with it. */
-  if (!oldformatflag) {
-close(gzfd);
+  /* Control is done, now we need to archive the data. */
+  if (oldformatflag) {
+/* In old format, the data member is just concatenated after the
+ * control member, so we do not need a temporary file and can use
+ * the compression file descriptor. */
+gzfd = arfd;
+  } else {
+/* Start by creating a new temporary file. Immediately unlink the
+ * temporary file so others can't mess with it. */
 tfbuf = path_make_temp_template(dpkg-deb);
 gzfd = mkstemp(tfbuf);
 if (gzfd == -1)
@@ -538,9 +542,7 @@ do_build(const char *const *argv)
   c2 = subproc_fork();
   if (!c2) {
 close(p1[1]);
-m_dup2(p2[0],0); close(p2[0]);
-m_dup2(oldformatflag ? arfd : gzfd, 1);
-compress_filter(compressor, 0, 1, compress_level, _(data member));
+compress_filter(compressor, p2[0], gzfd, compress_level, _(data member));
   }
   close(p2[0]);
 
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 659d334..5992bc8 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -112,6 +112,7 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
   int dummy;
   pid_t c1=0,c2,c3;
   int p1[2], p2[2];
+  int p2_out;
   int arfd;
   struct stat stab;
   char nlc;
@@ -269,14 +270,18 @@ extracthalf(const char *debar, const char *dir, const 
char *taroption,
   }
   close(p1[1]);
 
-  if (taroption) m_pipe(p2);
+  if (taroption) {
+m_pipe(p2);
+p2_out = p2[1];
+  } else {
+p2_out = 1;
+  }
 
   c2 = subproc_fork();
   if (!c2) {
-m_dup2(p1[0], 0);
-if (admininfo) close(p1[0]);
-if (taroption) { m_dup2(p2[1],1); close(p2[0]); close(p2[1]); }
-decompress_filter(decompressor, 0, 1, _(data));
+if (taroption)
+  close(p2[0]);
+decompress_filter(decompressor, p1[0], p2_out, _(data));
   }
   close(p1[0]);
   close(arfd);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 269bbee973c46e1be0aaef82cb7e19bbc9a95aa7
Author: Guillem Jover guil...@debian.org
Date:   Sat May 7 11:27:06 2011 +0200

libdpkg: Switch the compression filter functions to always return

This makes the compression and decompression functions be closer to the
buffer api, which always return. For non-blocking I/O, the caller has to
setup a child process.

When using external binaries, we make the filter functions setup that
child process transparently so that the API is uniform.

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index 60318db..a88cb0e 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -475,6 +475,7 @@ do_build(const char *const *argv)
   c2 = subproc_fork();
   if (!c2) {
 compress_filter(compressor_gzip, p1[0], gzfd, 9, _(control member));
+exit(0);
   }
   close(p1[0]);
   subproc_wait_check(c2, gzip -9c, 0);
@@ -543,6 +544,7 @@ do_build(const char *const *argv)
   if (!c2) {
 close(p1[1]);
 compress_filter(compressor, p2[0], gzfd, compress_level, _(data member));
+exit(0);
   }
   close(p2[0]);
 
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 5992bc8..b458c1f 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -282,6 +282,7 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
 if (taroption)
   close(p2[0]);
 decompress_filter(decompressor, p1[0], p2_out, _(data));
+exit(0);
   }
   close(p1[0]);
   close(arfd);
diff --git a/lib/dpkg/compress.c b/lib/dpkg/compress.c
index 59c40df..2bf53c5 100644
--- a/lib/dpkg/compress.c
+++ b/lib/dpkg/compress.c
@@ -42,47 +42,51 @@
 #include dpkg/buffer.h
 #include dpkg/command.h
 #include dpkg/compress.h
+#include dpkg/subproc.h
 
-static void DPKG_ATTR_NORET DPKG_ATTR_SENTINEL
+static void DPKG_ATTR_SENTINEL
 fd_fd_filter(int fd_in, int fd_out, const char *desc, const char *file, ...)
 {
va_list args;
struct command cmd;
+   pid_t pid;
 
-   if (fd_in != 0) {
-   m_dup2(fd_in, 0);
-   close(fd_in);
-   }
-   if (fd_out != 1) {
-   m_dup2(fd_out, 1);
-   close(fd_out);
-   }
+   pid = subproc_fork();
+   if (pid != 0) {
+   if (fd_in != 0) {
+   m_dup2(fd_in, 0);
+   close(fd_in);
+   }
+   if (fd_out != 1) {
+   m_dup2(fd_out, 1);
+   close(fd_out);
+   }
 
-   command_init(cmd, file, desc);
-   command_add_arg(cmd, file);
-   va_start(args, file);
-   command_add_argv(cmd, args);
-   va_end(args);
+   command_init(cmd, file, desc);
+   command_add_arg(cmd, file);
+   va_start(args, file);
+   command_add_argv(cmd, args);
+   va_end(args);
 
-   command_exec(cmd);
+   command_exec(cmd);
+   }
+   subproc_wait_check(pid, desc, 0);
 }
 
 /*
  * No compressor (pass-through).
  */
 
-static void DPKG_ATTR_NORET
+static void
 decompress_none(int fd_in, int fd_out, const char *desc)
 {
fd_fd_copy(fd_in, fd_out, -1, _(%s: decompression), desc);
-   exit(0);
 }
 
-static void DPKG_ATTR_NORET
+static void
 compress_none(int fd_in, int fd_out, int compress_level, const char *desc)
 {
fd_fd_copy(fd_in, fd_out, -1, _(%s: compression), desc);
-   exit(0);
 }
 
 struct compressor compressor_none = {
@@ -98,7 +102,7 @@ struct compressor compressor_none = {
  */
 
 #ifdef WITH_ZLIB
-static void DPKG_ATTR_NORET
+static void
 decompress_gzip(int fd_in, int fd_out, const char *desc)
 {
char buffer[4096];
@@ -130,11 +134,9 @@ decompress_gzip(int fd_in, int fd_out, const char *desc)
 
if (close(fd_out))
ohshite(_(%s: internal gzip write error), desc);
-
-   exit(0);
 }
 
-static void DPKG_ATTR_NORET
+static void
 compress_gzip(int fd_in, int fd_out, int compress_level, const char *desc)
 {
char buffer[4096];
@@ -177,17 +179,15 @@ compress_gzip(int fd_in, int fd_out, int compress_level, 
const char *desc)
errmsg = zError(err);
ohshit(_(%s: internal gzip write error: %s), desc, errmsg);
}
-
-   exit(0);
 }
 #else
-static void DPKG_ATTR_NORET
+static void
 decompress_gzip(int fd_in, int fd_out, const char *desc)
 {
fd_fd_filter(fd_in, fd_out, desc, GZIP, -dc, NULL);
 }
 
-static void DPKG_ATTR_NORET
+static void
 compress_gzip(int fd_in, int fd_out, int compress_level, const char *desc)
 {
char combuf[6];
@@ -210,7 +210,7 @@ struct compressor compressor_gzip = {
  */
 
 #ifdef WITH_BZ2
-static void DPKG_ATTR_NORET
+static void
 decompress_bzip2(int fd_in, int fd_out, const char *desc)
 {
char buffer[4096];
@@ -242,11 +242,9 @@ decompress_bzip2(int fd_in, int fd_out, const char *desc)
 
if (close(fd_out))
ohshite

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7e7236f7e19f1b4e238359d887756e7044328891
Author: Guillem Jover guil...@debian.org
Date:   Tue May 3 10:28:26 2011 +0200

libdpkg: Expand buffer_copy_TYPE macro instances

This makes the code easier to debug, as it will be able to track
correct code lines, it also allows to more easily see the code
duplication explicitly, and makes the code slightly more clear as
it's using the real structure member and type names.

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 0a6ab19..0ac9e46 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -204,28 +204,46 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
return totalread;
 }
 
-#define buffer_copy_TYPE(name, type1, name1, type2, name2) \
-off_t \
-buffer_copy_##name(type1 n1, int typeIn, \
-   type2 n2, int typeOut, \
-   off_t limit, const char *desc, ...) \
-{ \
-   va_list args; \
-   struct buffer_data read_data = { .arg.name1 = n1, .type = typeIn }; \
-   struct buffer_data write_data = { .arg.name2 = n2, .type = typeOut }; \
-   struct varbuf v = VARBUF_INIT; \
-   off_t ret; \
-\
-   va_start(args, desc); \
-   varbuf_vprintf(v, desc, args); \
-   va_end(args); \
-\
-   ret = buffer_copy(read_data, write_data, limit, v.buf); \
-\
-   varbuf_destroy(v); \
-\
-   return ret; \
+off_t
+buffer_copy_IntInt(int Iin, int Tin,
+   int Iout, int Tout,
+   off_t limit, const char *desc, ...)
+{
+   va_list args;
+   struct buffer_data read_data = { .type = Tin, .arg.i = Iin };
+   struct buffer_data write_data = { .type = Tout, .arg.i = Iout };
+   struct varbuf v = VARBUF_INIT;
+   off_t ret;
+
+   va_start(args, desc);
+   varbuf_vprintf(v, desc, args);
+   va_end(args);
+
+   ret = buffer_copy(read_data, write_data, limit, v.buf);
+
+   varbuf_destroy(v);
+
+   return ret;
 }
 
-buffer_copy_TYPE(IntInt, int, i, int, i);
-buffer_copy_TYPE(IntPtr, int, i, void *, ptr);
+off_t
+buffer_copy_IntPtr(int Iin, int Tin,
+   void *Pout, int Tout,
+   off_t limit, const char *desc, ...)
+{
+   va_list args;
+   struct buffer_data read_data = { .type = Tin, .arg.i = Iin };
+   struct buffer_data write_data = { .type = Tout, .arg.ptr = Pout };
+   struct varbuf v = VARBUF_INIT;
+   off_t ret;
+
+   va_start(args, desc);
+   varbuf_vprintf(v, desc, args);
+   va_end(args);
+
+   ret = buffer_copy(read_data, write_data, limit, v.buf);
+
+   varbuf_destroy(v);
+
+   return ret;
+}

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fbc930968e396694b293ee35177c9305f407cf30
Author: Guillem Jover guil...@debian.org
Date:   Mon May 2 21:53:35 2011 +0200

libdpkg: Rename struct buffer_write_md5ctx to buffer_md5_ctx

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 0ac9e46..950e1a6 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -36,7 +36,7 @@
 #include dpkg/fdio.h
 #include dpkg/buffer.h
 
-struct buffer_write_md5ctx {
+struct buffer_md5_ctx {
struct MD5Context ctx;
char *hash;
 };
@@ -44,9 +44,9 @@ struct buffer_write_md5ctx {
 static void
 buffer_md5_init(struct buffer_data *data)
 {
-   struct buffer_write_md5ctx *ctx;
+   struct buffer_md5_ctx *ctx;
 
-   ctx = m_malloc(sizeof(struct buffer_write_md5ctx));
+   ctx = m_malloc(sizeof(*ctx));
ctx-hash = data-arg.ptr;
data-arg.ptr = ctx;
MD5Init(ctx-ctx);
@@ -66,12 +66,12 @@ buffer_init(struct buffer_data *data)
 static void
 buffer_md5_done(struct buffer_data *data)
 {
-   struct buffer_write_md5ctx *ctx;
+   struct buffer_md5_ctx *ctx;
unsigned char digest[16], *p = digest;
char *hash;
int i;
 
-   ctx = (struct buffer_write_md5ctx *)data-arg.ptr;
+   ctx = (struct buffer_md5_ctx *)data-arg.ptr;
hash = ctx-hash;
MD5Final(digest, ctx-ctx);
for (i = 0; i  16; ++i) {
@@ -108,7 +108,7 @@ buffer_write(struct buffer_data *data, const void *buf, 
off_t length)
case BUFFER_WRITE_NULL:
break;
case BUFFER_WRITE_MD5:
-   MD5Updatestruct buffer_write_md5ctx 
*)data-arg.ptr)-ctx), buf, length);
+   MD5Updatestruct buffer_md5_ctx *)data-arg.ptr)-ctx), 
buf, length);
break;
default:
internerr(unknown data type '%i' in buffer_write,

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 751c399e50a087fb5c6367cbfd5a551e3ac676c9
Author: Guillem Jover guil...@debian.org
Date:   Mon May 9 19:59:21 2011 +0200

libdpkg: Remove unneeded checks on buffer_copy loop termination

The while loop checks unnecessarily for bytesread and byteswritten
being = 0, but that's always going to be true, as in case of read or
write error the code breaks out of the loop.

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 950e1a6..3654f4f 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -166,7 +166,7 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
 
buffer_init(write_data);
 
-   while (bytesread = 0  byteswritten = 0  bufsize  0) {
+   while (bufsize  0) {
bytesread = buffer_read(read_data, buf, bufsize);
if (bytesread  0)
break;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e8c1a5863572eac719e36b2e409002871e6eee4a
Author: Guillem Jover guil...@debian.org
Date:   Sun May 1 08:06:53 2011 +0200

libdpkg: Add new buffer_skip_Int() and switch fd_null_copy() to it

Add a new buffer_skip() function and the externally visible
buffer_skip_Int(), this way we hide the implementation details
of fd_null_copy().

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 3654f4f..c99af0f 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -25,6 +25,7 @@
 
 #include sys/types.h
 
+#include errno.h
 #include string.h
 #include unistd.h
 #include stdlib.h
@@ -247,3 +248,45 @@ buffer_copy_IntPtr(int Iin, int Tin,
 
return ret;
 }
+
+static off_t
+buffer_skip(struct buffer_data *input, off_t limit, const char *desc)
+{
+   struct buffer_data output;
+
+   switch (input-type) {
+   case BUFFER_READ_FD:
+   if (lseek(input-arg.i, limit, SEEK_CUR) != -1)
+   return limit;
+   if (errno != ESPIPE)
+   ohshite(_(failed to seek %s), desc);
+   break;
+   default:
+   internerr(unknown data type '%i' in buffer_skip\n,
+ input-type);
+   }
+
+   output.type = BUFFER_WRITE_NULL;
+   output.arg.ptr = NULL;
+
+   return buffer_copy(input, output, limit, desc);
+}
+
+off_t
+buffer_skip_Int(int I, int T, off_t limit, const char *desc_fmt, ...)
+{
+   va_list args; \
+   struct buffer_data input = { .type = T, .arg.i = I };
+   struct varbuf v = VARBUF_INIT;
+   off_t ret;
+
+   va_start(args, desc_fmt);
+   varbuf_vprintf(v, desc_fmt, args);
+   va_end(args);
+
+   ret = buffer_skip(input, limit, v.buf);
+
+   varbuf_destroy(v);
+
+   return ret;
+}
diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index 071c08e..c81ef1c 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -26,8 +26,6 @@
 
 #include sys/types.h
 
-#include errno.h
-
 #include dpkg/macros.h
 
 DPKG_BEGIN_DECLS
@@ -60,13 +58,7 @@ struct buffer_data {
buffer_copy_IntPtr(fd, BUFFER_READ_FD, buf, BUFFER_WRITE_VBUF, \
   limit, __VA_ARGS__)
 # define fd_null_copy(fd, limit, ...) \
-   if (lseek(fd, limit, SEEK_CUR) == -1) { \
-   if (errno != ESPIPE) \
-   ohshite(__VA_ARGS__); \
-   buffer_copy_IntPtr(fd, BUFFER_READ_FD, \
-  NULL, BUFFER_WRITE_NULL, \
-  limit, __VA_ARGS__); \
-   }
+   buffer_skip_Int(fd, BUFFER_READ_FD, limit, __VA_ARGS__)
 
 off_t buffer_copy_IntPtr(int i, int typeIn, void *p, int typeOut,
  off_t limit, const char *desc,
@@ -74,6 +66,8 @@ off_t buffer_copy_IntPtr(int i, int typeIn, void *p, int 
typeOut,
 off_t buffer_copy_IntInt(int i1, int typeIn, int i2, int typeOut,
  off_t limit, const char *desc,
  ...) DPKG_ATTR_PRINTF(6);
+off_t buffer_skip_Int(int I, int T, off_t limit, const char *desc_fmt, ...)
+  DPKG_ATTR_PRINTF(4);
 off_t buffer_hash(const void *buf, void *hash, int typeOut, off_t length);
 
 DPKG_END_DECLS

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-75-g0e0f59a

2011-05-10 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0e0f59a882ce329de880d4a75f30787e261e2cb3
Author: Jonathan Nieder jrnie...@gmail.com
Date:   Sat May 7 11:33:42 2011 +0200

libdpkg: Use new DPKG_BUFFER_SIZE macro instead of hard-coded literal

Signed-off-by: Jonathan Nieder jrnie...@gmail.com
Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index c81ef1c..436a22e 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -30,6 +30,8 @@
 
 DPKG_BEGIN_DECLS
 
+#define DPKG_BUFFER_SIZE 4096
+
 #define BUFFER_WRITE_VBUF  1
 #define BUFFER_WRITE_FD2
 #define BUFFER_WRITE_NULL  3
diff --git a/lib/dpkg/compress.c b/lib/dpkg/compress.c
index 2bf53c5..eb01c5e 100644
--- a/lib/dpkg/compress.c
+++ b/lib/dpkg/compress.c
@@ -105,7 +105,7 @@ struct compressor compressor_none = {
 static void
 decompress_gzip(int fd_in, int fd_out, const char *desc)
 {
-   char buffer[4096];
+   char buffer[DPKG_BUFFER_SIZE];
gzFile gzfile = gzdopen(fd_in, r);
 
if (gzfile == NULL)
@@ -139,7 +139,7 @@ decompress_gzip(int fd_in, int fd_out, const char *desc)
 static void
 compress_gzip(int fd_in, int fd_out, int compress_level, const char *desc)
 {
-   char buffer[4096];
+   char buffer[DPKG_BUFFER_SIZE];
char combuf[6];
int err;
gzFile gzfile;
@@ -213,7 +213,7 @@ struct compressor compressor_gzip = {
 static void
 decompress_bzip2(int fd_in, int fd_out, const char *desc)
 {
-   char buffer[4096];
+   char buffer[DPKG_BUFFER_SIZE];
BZFILE *bzfile = BZ2_bzdopen(fd_in, r);
 
if (bzfile == NULL)
@@ -247,7 +247,7 @@ decompress_bzip2(int fd_in, int fd_out, const char *desc)
 static void
 compress_bzip2(int fd_in, int fd_out, int compress_level, const char *desc)
 {
-   char buffer[4096];
+   char buffer[DPKG_BUFFER_SIZE];
char combuf[6];
int err;
BZFILE *bzfile;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ea81b2b144f70de7a0652b654de4d2fe765ff327
Author: Guillem Jover guil...@debian.org
Date:   Thu May 12 02:52:17 2011 +0200

dpkg: Add debug output on match in dir_is_used_by_others()

The debug output was not balanced, and was only printing when no match
happened, making the output confusing.

diff --git a/src/help.c b/src/help.c
index 4a2256f..35bf940 100644
--- a/src/help.c
+++ b/src/help.c
@@ -504,6 +504,8 @@ dir_is_used_by_others(struct filenamenode *file, struct 
pkginfo *pkg)
   other_pkg-name);
 if (other_pkg == pkg)
   continue;
+
+debug(dbg_veryverbose, dir_is_used_by_others yes);
 return true;
   }
   filepackages_iter_free(iter);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 216b7a30bab31817dca09ba2c7c629883cee1efa
Author: Guillem Jover guil...@debian.org
Date:   Thu May 12 02:57:30 2011 +0200

dpkg: On purge correctly remove a symlink pointing to a directory

The code was treating symlinks to directories as directories, but then
it was trying to rmdir(2) them, which failed. In such case just verify
it's a symlink and unlink(2) them instead.

diff --git a/debian/changelog b/debian/changelog
index 7ce1bfb..9188364 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * On package removal, keep only directories actually containing conffiles,
 and not directories just matching the substring in the conffile or the
 directory itself. Thanks to Ondřej Surý ond...@debian.org.
+  * On purge correctly remove symlinks acting as directories, when they are
+not being used by any other package's files.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/remove.c b/src/remove.c
index a33518d..bb959cb 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -362,6 +362,15 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
 }
 if (errno != ENOTDIR) ohshite(_(cannot remove `%.250s'),fnvb.buf);
 
+if (lstat(fnvb.buf, stab) == 0  S_ISLNK(stab.st_mode)) {
+  debug(dbg_eachfiledetail, removal_bulk is a symlink to a directory);
+
+  if (unlink(fnvb.buf))
+ohshite(_(cannot remove '%.250s'), fnvb.buf);
+
+  continue;
+}
+
 push_leftover(leftover,namenode);
 continue;
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7337447704d69a553cf44f462ad7c22e4026646c
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 03:32:32 2011 +0200

libdpkg: Rename cu_closefile to cu_closestream

This should make it clear we are referring to a stdio stream, and not
the future planned ‘struct file’.

diff --git a/lib/dpkg/cleanup.c b/lib/dpkg/cleanup.c
index 98bf100..edf2b8f 100644
--- a/lib/dpkg/cleanup.c
+++ b/lib/dpkg/cleanup.c
@@ -37,7 +37,7 @@ cu_closepipe(int argc, void **argv)
 }
 
 void
-cu_closefile(int argc, void **argv)
+cu_closestream(int argc, void **argv)
 {
FILE *f = (FILE *)(argv[0]);
 
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index a3f5e70..a0aa520 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -119,7 +119,7 @@ void statusfd_send(const char *fmt, ...) 
DPKG_ATTR_PRINTF(1);
 
 /*** cleanup.c ***/
 
-void cu_closefile(int argc, void **argv);
+void cu_closestream(int argc, void **argv);
 void cu_closepipe(int argc, void **argv);
 void cu_closedir(int argc, void **argv);
 void cu_closefd(int argc, void **argv);
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index e4ba631..bc8728f 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -418,7 +418,7 @@ trk_explicit_interest_change(const char *trig,  struct 
pkginfo *pkg, int signum)
if (!nf)
ohshite(_(unable to create new trigger interest file 
`%.250s'),
newfn.buf);
-   push_cleanup(cu_closefile, ~ehflag_normaltidy, NULL, 0, 1, nf);
+   push_cleanup(cu_closestream, ~ehflag_normaltidy, NULL, 0, 1, nf);
 
while (trk_explicit_f  trk_explicit_fgets(buf, sizeof(buf)) = 0) {
if (!strcmp(buf, pkg-name))
@@ -533,7 +533,7 @@ trig_file_interests_save(void)
if (!nf)
ohshite(_(unable to create new file triggers file `%.250s'),
triggersnewfilefile);
-   push_cleanup(cu_closefile, ~ehflag_normaltidy, NULL, 0, 1, nf);
+   push_cleanup(cu_closestream, ~ehflag_normaltidy, NULL, 0, 1, nf);
 
for (tfi = filetriggers.head; tfi; tfi = tfi-inoverall.next)
fprintf(nf, %s %s\n, trigh.namenode_name(tfi-fnn),
@@ -581,7 +581,7 @@ trig_file_interests_ensure(void)
triggersfilefile);
}
 
-   push_cleanup(cu_closefile, ~0, NULL, 0, 1, f);
+   push_cleanup(cu_closestream, ~0, NULL, 0, 1, f);
while (fgets_checked(linebuf, sizeof(linebuf), f, triggersfilefile) = 
0) {
space = strchr(linebuf, ' ');
if (!space || linebuf[0] != '/')
@@ -711,7 +711,7 @@ trig_parse_ci(const char *file, trig_parse_cicb *interest,
return; /* No file is just like an empty one. */
ohshite(_(unable to open triggers ci file `%.250s'), file);
}
-   push_cleanup(cu_closefile, ~0, NULL, 0, 1, f);
+   push_cleanup(cu_closestream, ~0, NULL, 0, 1, f);
 
while ((l = fgets_checked(linebuf, sizeof(linebuf), f, file)) = 0) {
for (cmd = linebuf; cisspace(*cmd); cmd++);
diff --git a/src/filesdb.c b/src/filesdb.c
index 476dc13..4355340 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -513,7 +513,7 @@ write_filelist_except(struct pkginfo *pkg, struct 
fileinlist *list,
   file= fopen(newvb.buf,w+);
   if (!file)
 ohshite(_(unable to create updated files list file for package 
%s),pkg-name);
-  push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)file);
+  push_cleanup(cu_closestream, ehflag_bombout, NULL, 0, 1, (void *)file);
   while (list) {
 if (!(leaveout  (list-namenode-flags  fnnf_elide_other_lists))) {
   fputs(list-namenode-name,file);
diff --git a/src/processarc.c b/src/processarc.c
index 8b9de93..00af6d4 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -560,7 +560,7 @@ void process_archive(const char *filename) {
   strcpy(cidirrest,CONFFILESFILE);
   conff= fopen(cidir,r);
   if (conff) {
-push_cleanup(cu_closefile, ehflag_bombout, NULL, 0, 1, (void *)conff);
+push_cleanup(cu_closestream, ehflag_bombout, NULL, 0, 1, (void *)conff);
 while (fgets(conffilenamebuf,MAXCONFFILENAME-2,conff)) {
   struct filepackages_iterator *iter;
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit d6f176b4b8ad5fdf77f05704ee4c1abb3fa23ab4
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 03:33:53 2011 +0200

dpkg: Make fd variable passed to cu_closefd static

The push_cleanup() call takes a pointer to the fd variable which resides
in the stack. In case of error and stack unwinding due to longjmp, the
value of fd might get overwritten by subsequent stack usage. Thus this
kind of variables need to be static so that their value cannot change
on stack rollback.

diff --git a/src/filesdb.c b/src/filesdb.c
index 4355340..e383955 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -276,7 +276,7 @@ pkg_files_add_file(struct pkginfo *pkg, const char 
*filename,
 void
 ensure_packagefiles_available(struct pkginfo *pkg)
 {
-  int fd;
+  static int fd;
   const char *filelistfile;
   struct fileinlist **lendp;
   struct stat stat_buf;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f65316a5ec488a52cb7d5fa98824c21629de26b6
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 03:39:35 2011 +0200

libdpkg: Use new writedb flags instead of independent bool variables

Using bool to pass flags to a function already taking several arguments
is generally a bad interface, as it's not clear from the call sites what
each of them refer to. Switch to a proper enum with named flags instead.

diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index dc97dc4..4df78f6 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -95,7 +95,7 @@ static void cleanupdates(void) {
 }
 
 if (cstatus = msdbrw_write) {
-  writedb(statusfile,0,1);
+  writedb(statusfile, wdb_must_sync);
 
   for (i=0; icdn; i++) {
 strcpy(updatefnrest, cdlist[i]-d_name);
@@ -301,7 +301,7 @@ void modstatdb_checkpoint(void) {
   int i;
 
   assert(cstatus = msdbrw_write);
-  writedb(statusfile,0,1);
+  writedb(statusfile, wdb_must_sync);
 
   for (i=0; inextupdate; i++) {
 sprintf(updatefnrest, IMPORTANTFMT, i);
@@ -318,7 +318,7 @@ void modstatdb_checkpoint(void) {
 
 void modstatdb_shutdown(void) {
   if (cflags = msdbrw_available_write)
-writedb(availablefile, 1, 0);
+writedb(availablefile, wdb_dump_available);
 
   switch (cstatus) {
   case msdbrw_write:
diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h
index 1ddde86..353183f 100644
--- a/lib/dpkg/dpkg-db.h
+++ b/lib/dpkg/dpkg-db.h
@@ -299,7 +299,14 @@ const char *versiondescribe(const struct versionrevision*,
 void writerecord(FILE*, const char*,
  const struct pkginfo *, const struct pkgbin *);
 
-void writedb(const char *filename, bool available, bool mustsync);
+enum writedb_flags {
+  /* Dump ‘available’ in-core structures, not ‘status’. */
+  wdb_dump_available = 001,
+  /* Must sync the written file. */
+  wdb_must_sync = 002,
+};
+
+void writedb(const char *filename, enum writedb_flags flags);
 
 /* Note: The varbufs must have been initialized and will not be
  * NUL-terminated. */
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index 4f44543..0e7d682 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -399,7 +399,7 @@ writerecord(FILE *file, const char *filename,
 }
 
 void
-writedb(const char *filename, bool available, bool mustsync)
+writedb(const char *filename, enum writedb_flags flags)
 {
   static char writebuf[8192];
 
@@ -412,7 +412,7 @@ writedb(const char *filename, bool available, bool mustsync)
   struct varbuf vb = VARBUF_INIT;
   int old_umask;
 
-  which = available ? available : status;
+  which = (flags  wdb_dump_available) ? available : status;
   m_asprintf(oldfn, %s%s, filename, OLDDBEXT);
   m_asprintf(newfn, %s%s, filename, NEWDBEXT);
 
@@ -427,7 +427,7 @@ writedb(const char *filename, bool available, bool mustsync)
 
   it = pkg_db_iter_new();
   while ((pigp = pkg_db_iter_next(it)) != NULL) {
-pifp= available ? pigp-available : pigp-installed;
+pifp = (flags  wdb_dump_available) ? pigp-available : pigp-installed;
 /* Don't dump records which have no useful content. */
 if (!pkg_is_informative(pigp, pifp))
   continue;
@@ -441,7 +441,7 @@ writedb(const char *filename, bool available, bool mustsync)
   }
   pkg_db_iter_free(it);
   varbuf_destroy(vb);
-  if (mustsync) {
+  if (flags  wdb_must_sync) {
 if (fflush(file))
   ohshite(_(failed to flush %s database to '%.250s'), which, filename);
 if (fsync(fileno(file)))
@@ -458,7 +458,7 @@ writedb(const char *filename, bool available, bool mustsync)
 ohshite(_(failed to install '%.250s' as '%.250s' containing %s database),
 newfn, filename, which);
 
-  if (mustsync)
+  if (flags  wdb_must_sync)
 dir_sync_path_parent(filename);
 
   free(newfn);
diff --git a/src/update.c b/src/update.c
index 76b2372..227c9d1 100644
--- a/src/update.c
+++ b/src/update.c
@@ -90,7 +90,7 @@ updateavailable(const char *const *argv)
  NULL);
 
   if (!f_noact) {
-writedb(availfile, 1, 0);
+writedb(availfile, wdb_dump_available);
 modstatdb_unlock();
   }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ad07629757599f8f27ec63864b0c34fd7515882c
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 17:33:14 2011 +0200

dpkg: Do not preserve and check for conffiles on leftover dir removal

The function removal_bulk_remove_leftover_dirs() was supposed to be
called only w/ left over dirs, but removal_bulk_remove_configfiles()
does not remove them from the file list when unlinking.

Do not check if the directory needs to be preserved if the package has
conffiles inside, because it should have none, although it would match
given that the file list still contains conffiles.

Do not preserve any lingering conffiles in the file list as they are
no longer on disk anyway.

diff --git a/src/remove.c b/src/remove.c
index bb959cb..a3a8d2c 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -316,7 +316,10 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
 debug(dbg_eachfile, removal_bulk `%s' flags=%o,
   namenode-name, namenode-flags);
 if (namenode-flags  fnnf_old_conff) {
-  push_leftover(leftover,namenode);
+  /* This can only happen if removal_bulk_remove_configfiles() got
+   * interrupted half way. */
+  debug(dbg_eachfiledetail, removal_bulk expecting only left over dirs, 
+ignoring conffile '%s', namenode-name);
   continue;
 }
 
@@ -333,10 +336,6 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
   /* Only delete a directory or a link to one if we're the only
* package which uses it. Other files should only be listed
* in this package (but we don't check). */
-  if (dir_has_conffiles(namenode, pkg)) {
-   push_leftover(leftover,namenode);
-   continue;
-  }
   if (dir_is_used_by_others(namenode, pkg))
 continue;
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0582645c283f39a602201dc0cf0fc8a6e986fe76
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 17:07:53 2011 +0200

dpkg: Change write_filelist_except() to take a mask intead of a bool

This generalizes the function to exclude any desired file namenode
flag and not just fnnf_elide_other_lists. It also gets rid of the
bool variable which is generally a bad interface to change function
behaviour when it should really be a named flag or a mask.

diff --git a/src/filesdb.c b/src/filesdb.c
index e383955..efe860b 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -492,12 +492,12 @@ void ensure_allinstfiles_available_quiet(void) {
 }
 
 /*
- * If leaveout is nonzero, will not write any file whose filenamenode
- * has the fnnf_elide_other_lists flag set.
+ * If mask is nonzero, will not write any file whose filenamenode
+ * has any flag bits set in mask.
  */
 void
 write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
-  bool leaveout)
+  enum fnnflags mask)
 {
   static struct varbuf newvb;
   const char *listfile;
@@ -515,7 +515,7 @@ write_filelist_except(struct pkginfo *pkg, struct 
fileinlist *list,
 ohshite(_(unable to create updated files list file for package 
%s),pkg-name);
   push_cleanup(cu_closestream, ehflag_bombout, NULL, 0, 1, (void *)file);
   while (list) {
-if (!(leaveout  (list-namenode-flags  fnnf_elide_other_lists))) {
+if (!(mask  (list-namenode-flags  mask))) {
   fputs(list-namenode-name,file);
   putc('\n',file);
 }
diff --git a/src/filesdb.h b/src/filesdb.h
index cf850b0..e85bb75 100644
--- a/src/filesdb.h
+++ b/src/filesdb.h
@@ -164,7 +164,7 @@ void ensure_allinstfiles_available_quiet(void);
 void note_must_reread_files_inpackage(struct pkginfo *pkg);
 struct filenamenode *findnamenode(const char *filename, enum fnnflags flags);
 void write_filelist_except(struct pkginfo *pkg, struct fileinlist *list,
-   bool leaveout);
+   enum fnnflags mask);
 
 struct reversefilelistiter { struct fileinlist *todo; };
 
diff --git a/src/processarc.c b/src/processarc.c
index 00af6d4..00438ce 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -1264,7 +1264,8 @@ void process_archive(const char *filename) {
   /* Found one. We delete remove the list entry for this file,
* (and any others in the same package) and then mark the package
* as requiring a reread. */
-  write_filelist_except(otherpkg, otherpkg-clientdata-files, 1);
+  write_filelist_except(otherpkg, otherpkg-clientdata-files,
+fnnf_elide_other_lists);
   ensure_package_clientdata(otherpkg);
   debug(dbg_veryverbose, process_archive overwrote from %s, 
otherpkg-name);
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e67e071e5836c7bd79bb5a1561ecda760f09a01f
Author: Guillem Jover guil...@debian.org
Date:   Sun May 15 17:38:18 2011 +0200

dpkg: On purge remove the conffiles from the file list file

This makes sure the files list is correct after the conffiles have been
removed from disk and the status db has been updated.

diff --git a/src/remove.c b/src/remove.c
index a3a8d2c..f0a98bd 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -305,6 +305,9 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
   static struct varbuf fnvb;
   struct stat stab;
 
+  /* We may have modified this previously. */
+  ensure_packagefiles_available(pkg);
+
   modstatdb_note(pkg);
   push_checkpoint(~ehflag_bombout, ehflag_normaltidy);
 
@@ -498,6 +501,9 @@ static void removal_bulk_remove_configfiles(struct pkginfo 
*pkg) {
   pop_cleanup(ehflag_normaltidy); /* closedir */
 }
 
+/* Remove the conffiles from the file list file. */
+write_filelist_except(pkg, pkg-clientdata-files, fnnf_old_conff);
+
 pkg-installed.conffiles = NULL;
 modstatdb_note(pkg);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-91-g799d385

2011-05-15 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 799d38599c1326c2e4c0b9360b19721c05f8c55f
Author: Guillem Jover guil...@debian.org
Date:   Fri May 6 06:08:30 2011 +0200

dpkg: Keep parent directories of directories kept during removal

When a directory is kept during removal to be later dealt with during
purge, due to the directory containing conffiles from the same package,
it not being empty, etc, we should keep all its parent to make sure
when the subsequent trial is performed they are properly cleaned up.

Closes: #454694

Based-on-patch-by: Ondřej Surý ond...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 9188364..271085f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -63,6 +63,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 directory itself. Thanks to Ondřej Surý ond...@debian.org.
   * On purge correctly remove symlinks acting as directories, when they are
 not being used by any other package's files.
+  * Do not lose track of parent directories on removal so that they can
+be properly cleaned up on purge if not used by any other package.
+Based on a patch by Ondřej Surý ond...@debian.org. Closes: #454694
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/help.c b/src/help.c
index 35bf940..88fa396 100644
--- a/src/help.c
+++ b/src/help.c
@@ -514,6 +514,37 @@ dir_is_used_by_others(struct filenamenode *file, struct 
pkginfo *pkg)
   return false;
 }
 
+/*
+ * Returns true if the file is used by pkg, false otherwise.
+ */
+bool
+dir_is_used_by_pkg(struct filenamenode *file, struct pkginfo *pkg,
+   struct fileinlist *list)
+{
+  struct fileinlist *node;
+  size_t namelen;
+
+  debug(dbg_veryverbose, dir_is_used_by_pkg '%s' (by %s),
+file-name, pkg ? pkg-name : none);
+
+  namelen = strlen(file-name);
+
+  for (node = list; node; node = node-next) {
+debug(dbg_veryverbose, dir_is_used_by_pkg considering %s ...,
+  node-namenode-name);
+
+if (strncmp(file-name, node-namenode-name, namelen) == 0 
+node-namenode-name[namelen] == '/') {
+  debug(dbg_veryverbose, dir_is_used_by_pkg yes);
+  return true;
+}
+  }
+
+  debug(dbg_veryverbose, dir_is_used_by_pkg no);
+
+  return false;
+}
+
 void oldconffsetflags(const struct conffile *searchconff) {
   struct filenamenode *namenode;
 
diff --git a/src/main.h b/src/main.h
index 0d4f45d..0abada1 100644
--- a/src/main.h
+++ b/src/main.h
@@ -249,6 +249,8 @@ void post_postinst_tasks(struct pkginfo *pkg, enum 
pkgstatus new_status);
 
 void clear_istobes(void);
 bool dir_is_used_by_others(struct filenamenode *namenode, struct pkginfo *pkg);
+bool dir_is_used_by_pkg(struct filenamenode *namenode, struct pkginfo *pkg,
+struct fileinlist *list);
 bool dir_has_conffiles(struct filenamenode *namenode, struct pkginfo *pkg);
 
 void log_action(const char *action, struct pkginfo *pkg);
diff --git a/src/remove.c b/src/remove.c
index f0a98bd..36160e6 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -257,6 +257,10 @@ removal_bulk_remove_files(struct pkginfo *pkg)
  push_leftover(leftover,namenode);
  continue;
}
+if (dir_is_used_by_pkg(namenode, pkg, leftover)) {
+  push_leftover(leftover, namenode);
+  continue;
+}
 if (dir_is_used_by_others(namenode, pkg))
   continue;
   }
@@ -339,6 +343,10 @@ static void removal_bulk_remove_leftover_dirs(struct 
pkginfo *pkg) {
   /* Only delete a directory or a link to one if we're the only
* package which uses it. Other files should only be listed
* in this package (but we don't check). */
+  if (dir_is_used_by_pkg(namenode, pkg, leftover)) {
+push_leftover(leftover, namenode);
+continue;
+  }
   if (dir_is_used_by_others(namenode, pkg))
 continue;
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5c32f0c0e4c537fc00bf3ccace8799fe27a522aa
Author: Guillem Jover guil...@debian.org
Date:   Sun May 22 16:07:49 2011 +0200

libdpkg: Properly pop the cleanup handler in trk_explicit_interest_change

In case of error all cleanup handlers will get called but the nf FILE
variable might have been already closed, which would cause the
subsequent fclose() to fail, this will not be fatal as the return
value for fclose() in the cleanup handler is not checked, but it's
still not correct.

Refactor trk_explicit_interest_change() into
trk_explicit_interest_remove(), trk_explicit_interest_flush() and
trk_explicit_interest_commit() to reflow the function and make it
clearer by sharing the main code path.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index ae0f5b9..2a1cc36 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -404,6 +404,37 @@ trk_explicit_activate_awaiter(struct pkginfo *aw)
 }
 
 static void
+trk_explicit_interest_flush(const char *newfilename, FILE *nf)
+{
+   if (ferror(nf))
+   ohshite(_(unable to write new trigger interest file `%.250s'),
+   newfilename);
+   if (fflush(nf))
+   ohshite(_(unable to flush new trigger interest file '%.250s'),
+   newfilename);
+   if (fsync(fileno(nf)))
+   ohshite(_(unable to sync new trigger interest file '%.250s'),
+   newfilename);
+}
+
+static void
+trk_explicit_interest_commit(const char *newfilename)
+{
+   if (rename(newfilename, trk_explicit_fn.buf))
+   ohshite(_(unable to install new trigger interest file 
`%.250s'),
+   trk_explicit_fn.buf);
+}
+
+static void
+trk_explicit_interest_remove(const char *newfilename)
+{
+   if (unlink(newfilename))
+   ohshite(_(cannot remove `%.250s'), newfilename);
+   if (unlink(trk_explicit_fn.buf))
+   ohshite(_(cannot remove `%.250s'), trk_explicit_fn.buf);
+}
+
+static void
 trk_explicit_interest_change(const char *trig,  struct pkginfo *pkg, int 
signum)
 {
static struct varbuf newfn;
@@ -432,34 +463,18 @@ trk_explicit_interest_change(const char *trig,  struct 
pkginfo *pkg, int signum)
empty = false;
}
 
-   if (empty) {
-   /* The triggers interest file is no longer needed, drop it */
-   fclose(nf); /* We don't care if it fails */
-   if (unlink(newfn.buf))
-   ohshite(_(cannot remove `%.250s'), newfn.buf);
-   if (unlink(trk_explicit_fn.buf))
-   ohshite(_(cannot remove `%.250s'), 
trk_explicit_fn.buf);
-   dir_sync_path(triggersdir);
-   return;
-   }
+   if (!empty)
+   trk_explicit_interest_flush(newfn.buf, nf);
 
-   if (ferror(nf))
-   ohshite(_(unable to write new trigger interest file `%.250s'),
-   newfn.buf);
-   if (fflush(nf))
-   ohshite(_(unable to flush new trigger interest file '%.250s'),
-   newfn.buf);
-   if (fsync(fileno(nf)))
-   ohshite(_(unable to sync new trigger interest file '%.250s'),
-   newfn.buf);
pop_cleanup(ehflag_normaltidy);
if (fclose(nf))
ohshite(_(unable to close new trigger interest file `%.250s'),
newfn.buf);
 
-   if (rename(newfn.buf, trk_explicit_fn.buf))
-   ohshite(_(unable to install new trigger interest file 
`%.250s'),
-   trk_explicit_fn.buf);
+   if (empty)
+   trk_explicit_interest_remove(newfn.buf);
+   else
+   trk_explicit_interest_commit(newfn.buf);
 
dir_sync_path(triggersdir);
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 104882f7fef02d53e1b868e746b8e9ff313eb1f5
Author: Guillem Jover guil...@debian.org
Date:   Tue May 24 06:55:34 2011 +0200

libdpkg: Do not fail on current file removal in trk_explicit_interest_change

In case the new trigger interest file is empty and as such not needed
any longer, do not fail if the current file is not present.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 2a1cc36..81619fc 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -430,7 +430,7 @@ trk_explicit_interest_remove(const char *newfilename)
 {
if (unlink(newfilename))
ohshite(_(cannot remove `%.250s'), newfilename);
-   if (unlink(trk_explicit_fn.buf))
+   if (unlink(trk_explicit_fn.buf)  errno != ENOENT)
ohshite(_(cannot remove `%.250s'), trk_explicit_fn.buf);
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b8038ef4721d53bb037583b9355a1f00dbcdc740
Author: Guillem Jover guil...@debian.org
Date:   Sun May 22 16:11:40 2011 +0200

libdpkg: Properly reset filetriggers_edited in trig_file_interests_save

The function was not resetting filetriggers_edited when no triggers were
left, and duplicated part of the existing functionality.

Refactor into trig_file_interests_remove() and
trig_file_interests_update() to make them use the same main code path.

Regression introduced in commit 83b591340ec92cf0e9814e8403da7711cbbc6b46.

diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 81619fc..50b6012 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -550,23 +550,19 @@ edited:
filetriggers_edited = 1;
 }
 
-void
-trig_file_interests_save(void)
+static void
+trig_file_interests_remove(void)
+{
+   if (unlink(triggersfilefile)  errno != ENOENT)
+   ohshite(_(cannot remove `%.250s'), triggersfilefile);
+}
+
+static void
+trig_file_interests_update(void)
 {
struct trigfileint *tfi;
FILE *nf;
 
-   if (filetriggers_edited = 0)
-   return;
-
-   if (!filetriggers.head) {
-   /* No file trigger left, drop the file */
-   if (unlink(triggersfilefile)  errno != ENOENT)
-   ohshite(_(cannot remove `%.250s'), triggersfilefile);
-   dir_sync_path(triggersdir);
-   return;
-   }
-
nf = fopen(triggersnewfilefile, w);
if (!nf)
ohshite(_(unable to create new file triggers file `%.250s'),
@@ -594,6 +590,18 @@ trig_file_interests_save(void)
if (rename(triggersnewfilefile, triggersfilefile))
ohshite(_(unable to install new file triggers file as 
`%.250s'),
triggersfilefile);
+}
+
+void
+trig_file_interests_save(void)
+{
+   if (filetriggers_edited = 0)
+   return;
+
+   if (!filetriggers.head)
+   trig_file_interests_remove();
+   else
+   trig_file_interests_update();
 
dir_sync_path(triggersdir);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 588077fdbc350d0733ce5cb8a298d317cfda1926
Author: Guillem Jover guil...@debian.org
Date:   Sat May 21 06:59:44 2011 +0200

Dpkg::Source::Package: Add ‘.hgsigs’ to the default ignore lists

Closes: #627462

Based-on-patch-by: Jakub Wilk jw...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 00a4d69..df49cca 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not lose track of parent directories on removal so that they can
 be properly cleaned up on purge if not used by any other package.
 Based on a patch by Ondřej Surý ond...@debian.org. Closes: #454694
+  * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
+Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index 30b47ed..7eeadfe 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -50,7 +50,7 @@ our $diff_ignore_default_regexp = '
 (?:^|/)(?:DEADJOE|\.arch-inventory|\.(?:bzr|cvs|hg|git)ignore)$|
 # File or directory names that should be ignored
 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|
-\.hg(?:tags)?|_darcs|\.git(?:attributes|modules)?|
+\.hg(?:tags|sigs)?|_darcs|\.git(?:attributes|modules)?|
 \.shelf|_MTN|\.be|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
 ';
 # Take out comments and newlines
@@ -81,6 +81,7 @@ our @tar_ignore_default_pattern = qw(
 .gitmodules
 .hg
 .hgignore
+.hgsigs
 .hgtags
 .shelf
 .svn

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e4cb12a710457b103a7544c4de5e9fc1b2bd24d8
Author: Guillem Jover guil...@debian.org
Date:   Sat May 21 10:38:32 2011 +0200

libdpkg: Do not allow blank lines in field values

Blank lines in this case mean, lines containing only spaces and tabs.
This ensure the Perl and C parsers match, and it follows RFC-2822 style
format, and Debian policy.

Closes: #308082

diff --git a/debian/changelog b/debian/changelog
index df49cca..60d859e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -70,6 +70,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 Based on a patch by Ondřej Surý ond...@debian.org. Closes: #454694
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
 Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
+  * Do not allow blank lines in field values. Closes: #308082
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index a611515..f71c438 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -380,6 +380,8 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
 /* Loop per field. */
 for (;;) {
+  bool blank_line;
+
   fs.fieldstart = dataptr - 1;
   while (!EOF_mmap(dataptr, endptr)  !isspace(c)  c!=':'  
c!=MSDOS_EOF_CHAR)
 c= getc_mmap(dataptr);
@@ -412,9 +414,16 @@ int parsedb(const char *filename, enum parsedbflags flags,
 parse_error(ps, new_pkg,
 _(MSDOS EOF char in value of field `%.*s' (missing 
newline?)),
 fs.fieldlen, fs.fieldstart);
+
+  blank_line = false;
+
   fs.valuestart = dataptr - 1;
   for (;;) {
 if (c == '\n' || c == MSDOS_EOF_CHAR) {
+  if (blank_line)
+parse_error(ps, new_pkg,
+_(blank line in value of field '%.*s'),
+fs.fieldlen, fs.fieldstart);
   ps.lno++;
  if (EOF_mmap(dataptr, endptr)) break;
   c= getc_mmap(dataptr);
@@ -422,11 +431,16 @@ int parsedb(const char *filename, enum parsedbflags flags,
   if (EOF_mmap(dataptr, endptr) || c == '\n' || !isspace(c)) break;
   ungetc_mmap(c,dataptr, data);
   c= '\n';
-} else if (EOF_mmap(dataptr, endptr)) {
+  blank_line = true;
+} else if (blank_line  !isspace(c)) {
+  blank_line = false;
+}
+
+if (EOF_mmap(dataptr, endptr))
   parse_error(ps, new_pkg,
   _(EOF during value of field `%.*s' (missing final 
newline)),
   fs.fieldlen, fs.fieldstart);
-}
+
 c= getc_mmap(dataptr);
   }
   fs.valuelen = dataptr - fs.valuestart - 1;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-98-g2ed0a42

2011-05-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2ed0a42cb3863e2ce0199e13242fa3b769ca773d
Author: Guillem Jover guil...@debian.org
Date:   Tue May 24 06:19:28 2011 +0200

libdpkg: Do not warn on missing Architecture in config-files state

dpkg before commit 2ef42b027e4267432a41343e28f102b1dae668d2 (versions
older than 1.10.19) did not keep the Architecture field in the status
file, and as such removed (but not purged) packages might still be
around in live systems lacking the Architecture field. Let's shut up
the warning for now.

Closes: #604241

Analysis-by: Raphael Hertzog hert...@debian.org
Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 60d859e..365ea39 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -71,6 +71,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
 Based on a patch by Jakub Wilk jw...@debian.org. Closes: #627462
   * Do not allow blank lines in field values. Closes: #308082
+  * Do not warn on missing architecture on packages in config-files state,
+but then make sure the architecture field is usable. Closes: #604241
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index f71c438..58b3110 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -177,11 +177,19 @@ pkg_parse_verify(struct parsedb_state *ps,
 parse_ensure_have_field(ps, pkg, pkgbin-description, description);
 parse_ensure_have_field(ps, pkg, pkgbin-maintainer, maintainer);
 parse_must_have_field(ps, pkg, pkgbin-version.version, version);
+  }
 
+  /* XXX: Versions before dpkg 1.10.19 did not preserve the Architecture
+   * field in the status file. So there's still live systems with packages
+   * in stat_configfiles, ignore those too for now. */
+  if ((ps-flags  pdb_recordavailable) ||
+  pkg-status  stat_halfinstalled) {
 /* We always want usable architecture information (as long as the package
  * is in such a state that it make sense), so that it can be used safely
  * on string comparisons and the like. */
 parse_ensure_have_field(ps, pkg, pkgbin-arch, architecture);
+  } else if (pkgbin-arch == NULL) {
+pkgbin-arch = ;
   }
 
   /* Check the Config-Version information:

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-99-g0d55f02

2011-05-25 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0d55f02275c0439622bb58f3b3c6658aef51fb11
Author: Guillem Jover guil...@debian.org
Date:   Wed May 25 08:51:50 2011 +0200

libdpkg: Fix fd_fd_filter to execute the filter on the child

There was a logic error in the pid check, and the filter code was being
executed in the parent instead of the child.

Regression introduced in commit 269bbee973c46e1be0aaef82cb7e19bbc9a95aa7.

Reported-by: Sven Joachim svenj...@gmx.de

diff --git a/lib/dpkg/compress.c b/lib/dpkg/compress.c
index eb01c5e..01becfd 100644
--- a/lib/dpkg/compress.c
+++ b/lib/dpkg/compress.c
@@ -52,7 +52,7 @@ fd_fd_filter(int fd_in, int fd_out, const char *desc, const 
char *file, ...)
pid_t pid;
 
pid = subproc_fork();
-   if (pid != 0) {
+   if (pid == 0) {
if (fd_in != 0) {
m_dup2(fd_in, 0);
close(fd_in);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-116-g1165f68

2011-06-14 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 1165f6821681075eeed66ca9cf1e889a057f636c
Author: Ludovic Brenta ludo...@ludovic-brenta.org
Date:   Wed Jun 15 06:48:10 2011 +0200

dpkg-gencontrol: Run du with --apparent-size for the Installed-Size field

This will give consistent results independent of build system.

Even though this will keep not providing accurate enough information
for the field's purpose and as such some times the size reported will
be less than the space eventually used, having the value changing
depending on the build system is just bogus.

Closes: #630533

Signed-off-by: Guillem Jover guil...@debian.org

diff --git a/debian/changelog b/debian/changelog
index 96857d2..5e7f3dc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -92,6 +92,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not allow blank lines in field values. Closes: #308082
   * Do not warn on missing architecture on packages in config-files state,
 but then make sure the architecture field is usable. Closes: #604241
+  * Run du with --apparent-size when generating the Installed-Size field in
+dpkg-gencontrol to get consistent results independent of build system.
+Thanks to Ludovic Brenta ludo...@ludovic-brenta.org. Closes: #630533
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 224d57b..f0e6964 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -301,7 +301,8 @@ if (!defined($substvars-get('Installed-Size'))) {
 if (!$c) {
 chdir($packagebuilddir) ||
 syserr(_g(chdir for du to \`%s'), $packagebuilddir);
-exec(du, -k, -s, .) or syserr(_g(unable to execute %s), 
du);
+exec(du, -k, -s, --apparent-size, .) or
+syserr(_g(unable to execute %s), du);
 }
 my $duo = '';
 while (DU) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-132-gb6ca9bc

2011-06-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b6ca9bcdb5887e30fe65ecd2105da9dcd55a351c
Author: Guillem Jover guil...@debian.org
Date:   Wed Jun 29 04:11:32 2011 +0200

dpkg: Unpack missing shared directories when the package is replaced

When unpacking a directory missing in the file system with that path
shared by at least one other package, from a package that is Replaced
by other packages, assume the missing path is a shared directory and
avoid setting ‘keepexisting’ and as such returning prematurely from
tarobject(), because in that case we need to recreate the lost
directory. As a side effect this also prevents printing the message
“Replaced by files in installed package” which is bogus in this case,
as directories are always shared.

Regression introduced in commit 00e5640a99be03aba40c9e08a663b90d8f8aa797.

Closes: #631808

diff --git a/debian/changelog b/debian/changelog
index 902e952..eac87b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -113,6 +113,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Run du with --apparent-size when generating the Installed-Size field in
 dpkg-gencontrol to get consistent results independent of build system.
 Thanks to Ludovic Brenta ludo...@ludovic-brenta.org. Closes: #630533
+  * Do not fail to unpack shared directories missing on the file system
+from packages being replaced by other packages. Closes: #631808
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/src/archives.c b/src/archives.c
index 878095c..7ea26f4 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -583,6 +583,15 @@ tarobject(void *ctx, struct tar_entry *ti)
   continue;
   }
 
+  /* If the new object is a directory and the previous object does
+   * not exist assume it's also a directory and skip further checks.
+   * XXX: Ideally with more information about the installed files we
+   * could perform more clever checks. */
+  if (statr != 0  ti-type == tar_filetype_dir) {
+debug(dbg_eachfile, tarobject ... assuming shared directory);
+continue;
+  }
+
   /* Nope? Hmm, file conflict, perhaps. Check Replaces. */
   switch (otherpkg-clientdata-replacingfilesandsaid) {
   case 2:
@@ -636,6 +645,7 @@ tarobject(void *ctx, struct tar_entry *ti)
 nifd-namenode-flags = ~fnnf_new_inarchive;
 keepexisting = true;
   } else {
+/* At this point we are replacing something without a Replaces. */
 if (!statr  S_ISDIR(stab.st_mode)) {
   forcibleerr(fc_overwritedir,
   _(trying to overwrite directory '%.250s' 
@@ -644,16 +654,12 @@ tarobject(void *ctx, struct tar_entry *ti)
   versiondescribe(otherpkg-installed.version,
   vdew_nonambig));
 } else {
-  /* At this point we are replacing something without a Replaces.
-   * If the new object is a directory and the previous object does
-   * not exist assume it's also a directory and don't complain. */
-  if (!(statr  ti-type == tar_filetype_dir))
-forcibleerr(fc_overwrite,
-_(trying to overwrite '%.250s', 
-  which is also in package %.250s %.250s),
-nifd-namenode-name, otherpkg-name,
-versiondescribe(otherpkg-installed.version,
-vdew_nonambig));
+  forcibleerr(fc_overwrite,
+  _(trying to overwrite '%.250s', 
+which is also in package %.250s %.250s),
+  nifd-namenode-name, otherpkg-name,
+  versiondescribe(otherpkg-installed.version,
+  vdew_nonambig));
 }
   }
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, squeeze, updated. 1.15.8.11-4-gd460aac

2011-06-30 Thread Guillem Jover
The following commit has been merged in the squeeze branch:
commit d460aac069a68f1115c8a26f07c147e42816e2b1
Author: Guillem Jover guil...@debian.org
Date:   Wed Jun 29 04:11:32 2011 +0200

dpkg: Unpack missing shared directories when the package is replaced

Cherry picked from commit b6ca9bcdb5887e30fe65ecd2105da9dcd55a351c.

When unpacking a directory missing in the file system with that path
shared by at least one other package, from a package that is Replaced
by other packages, assume the missing path is a shared directory and
avoid setting ‘keepexisting’ and as such returning prematurely from
tarobject(), because in that case we need to recreate the lost
directory. As a side effect this also prevents printing the message
“Replaced by files in installed package” which is bogus in this case,
as directories are always shared.

Regression introduced in commit 00e5640a99be03aba40c9e08a663b90d8f8aa797.

Closes: #631808

diff --git a/debian/changelog b/debian/changelog
index 58e170a..8e859c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,9 @@
 dpkg (1.15.8.12) UNRELEASED; urgency=low
 
+  [ Guillem Jover ]
+  * Do not fail to unpack shared directories missing on the file system
+from packages being replaced by other packages. Closes: #631808
+
   [ Updated man page translations ]
   * German (Helge Kreutzmann). Minor fixe(s).
 
diff --git a/src/archives.c b/src/archives.c
index 63d713a..7189045 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -565,6 +565,15 @@ tarobject(void *ctx, struct tar_entry *ti)
   continue;
   }
 
+  /* If the new object is a directory and the previous object does
+   * not exist assume it's also a directory and skip further checks.
+   * XXX: Ideally with more information about the installed files we
+   * could perform more clever checks. */
+  if (statr != 0  ti-type == tar_filetype_dir) {
+debug(dbg_eachfile, tarobject ... assuming shared directory);
+continue;
+  }
+
   /* Nope ?  Hmm, file conflict, perhaps.  Check Replaces. */
   switch (otherpkg-clientdata-replacingfilesandsaid) {
   case 2:
@@ -618,6 +627,7 @@ tarobject(void *ctx, struct tar_entry *ti)
 nifd-namenode-flags = ~fnnf_new_inarchive;
 keepexisting = true;
   } else {
+/* At this point we are replacing something without a Replaces. */
 if (!statr  S_ISDIR(stab.st_mode)) {
   forcibleerr(fc_overwritedir,
   _(trying to overwrite directory '%.250s' 
@@ -626,16 +636,12 @@ tarobject(void *ctx, struct tar_entry *ti)
   versiondescribe(otherpkg-installed.version,
   vdew_nonambig));
 } else {
-  /* WTA: At this point we are replacing something without a Replaces.
-   * if the new object is a directory and the previous object does not
-   * exist assume it's also a directory and don't complain. */
-  if (!(statr  ti-type == tar_filetype_dir))
-forcibleerr(fc_overwrite,
-_(trying to overwrite '%.250s', 
-  which is also in package %.250s %.250s),
-nifd-namenode-name, otherpkg-name,
-versiondescribe(otherpkg-installed.version,
-vdew_nonambig));
+  forcibleerr(fc_overwrite,
+  _(trying to overwrite '%.250s', 
+which is also in package %.250s %.250s),
+  nifd-namenode-name, otherpkg-name,
+  versiondescribe(otherpkg-installed.version,
+  vdew_nonambig));
 }
   }
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6ab502b6a7a3718b697e7c1020fcd5d7f9fd2d67
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 07:11:06 2011 +0200

dpkg: Use braces on ‘if’ to avoid ambiguous ‘else’

Warning introduced in commit fc625d161382abc41b984ca9ee1e32ad4f295c67.

diff --git a/src/archives.c b/src/archives.c
index c9afe72..ff1d273 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -619,11 +619,12 @@ tarobject(void *ctx, struct tar_entry *ti)
  conff = conff-next) {
   if (!conff-obsolete)
 continue;
-  if (stat(conff-name, stabtmp))
+  if (stat(conff-name, stabtmp)) {
 if (errno == ENOENT || errno == ENOTDIR || errno == ELOOP)
   continue;
 else
   ohshite(_(cannot stat file '%s'), conff-name);
+  }
   if (stabtmp.st_dev == stab.st_dev 
   stabtmp.st_ino == stab.st_ino)
 break;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 87809163331a320f9562d75591fcc6c954b9f80c
Author: Guillem Jover guil...@debian.org
Date:   Fri Jun 17 17:00:30 2011 +0200

dpkg-deb: Always chdir(2) in the childs to not change the global state

To not disturb the global program state we should always chdir(2) in the
childs that actually need it. This will allow in the future to switch
this code to be part of a library.

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index b458c1f..365be5d 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -288,19 +288,6 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
   close(arfd);
   if (taroption) close(p2[1]);
 
-  if (taroption  dir) {
-if (chdir(dir)) {
-  if (errno == ENOENT) {
-if (mkdir(dir, 0777))
-  ohshite(_(failed to create directory));
-if (chdir(dir))
-  ohshite(_(failed to chdir to directory after creating it));
-  } else {
-ohshite(_(failed to chdir to directory));
-  }
-}
-  }
-
   if (taroption) {
 c3 = subproc_fork();
 if (!c3) {
@@ -314,6 +301,18 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
 
   unsetenv(TAR_OPTIONS);
 
+  if (dir) {
+if (chdir(dir)) {
+  if (errno != ENOENT)
+ohshite(_(failed to chdir to directory));
+
+  if (mkdir(dir, 0777))
+ohshite(_(failed to create directory));
+  if (chdir(dir))
+ohshite(_(failed to chdir to directory after creating it));
+}
+  }
+
   execlp(TAR, tar, buffer, -, NULL);
   ohshite(_(unable to execute %s (%s)), tar, TAR);
 }
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index c20466d..6f43f55 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -54,13 +54,13 @@ static void cu_info_prepare(int argc, void **argv) {
   struct stat stab;
 
   dir = argv[0];
-  if (chdir(/))
-ohshite(_(failed to chdir to `/' for cleanup));
   if (lstat(dir, stab)  errno == ENOENT)
 return;
 
   pid = subproc_fork();
   if (pid == 0) {
+if (chdir(/))
+  ohshite(_(failed to chdir to `/' for cleanup));
 execlp(RM, rm, -rf, dir, NULL);
 ohshite(_(unable to execute %s (%s)), _(rm command for cleanup), RM);
   }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4da4c894719c7d33a3e44645630f63172cfd4c99
Author: Guillem Jover guil...@debian.org
Date:   Wed May 4 02:02:57 2011 +0200

libdpkg: Add missing symbols to the version script

diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index 3997fb6..c72ffec 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -54,6 +54,7 @@ LIBDPKG_PRIVATE {
 
str_escape_fmt;
str_strip_quotes;
+   str_quote_meta;
 
# Variable buffer support
varbuf_init;
@@ -219,6 +220,10 @@ LIBDPKG_PRIVATE {
parsedb;
writedb;
 
+   dpkg_db_set_dir;
+   dpkg_db_get_dir;
+   dpkg_db_get_path;
+
# Log based package on-disk database support
modstatdb_init;
modstatdb_is_locked;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit cd92cc77e5103b31ce15b746bd71095b859ac08b
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 2 02:04:28 2011 +0200

libdpkg: Add missing macros for program names

Specifically for dpkg-divert, dpkg-statoverride and dpkg-trigger.

diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index a0aa520..d191233 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -83,8 +83,11 @@ DPKG_BEGIN_DECLS
 #define MAXTRIGDIRECTIVE 256
 
 #define BACKENDdpkg-deb
-#define DPKGQUERY  dpkg-query
 #define SPLITTER   dpkg-split
+#define DPKGQUERY  dpkg-query
+#define DPKGDIVERT dpkg-divert
+#define DPKGSTAT   dpkg-statoverride
+#define DPKGTRIGGERdpkg-trigger
 #define DPKG   dpkg
 #define DEBSIGVERIFY   /usr/bin/debsig-verify
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0fc0d6d598c045c77d056b40446208448b9ec6e2
Author: Guillem Jover guil...@debian.org
Date:   Fri Jul 1 04:22:51 2011 +0200

libdpkg: Do not require programs to define printforhelp

Instead define it in myopt.c and initialize it through a new argument to
myopt().

diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 9543412..4512a98 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -126,7 +126,7 @@ usage(const struct cmdinfo *cip, const char *value)
 }
 
 const char thisname[]= BACKEND;
-const char printforhelp[]=
+static const char printforhelp[] =
   N_(Type dpkg-deb --help for help about manipulating *.deb files;\n
  Type dpkg --help for help about installing and deinstalling packages.);
 
@@ -190,7 +190,7 @@ int main(int argc, const char *const *argv) {
   textdomain(PACKAGE);
 
   standard_startup();
-  myopt(argv, cmdinfos);
+  myopt(argv, cmdinfos, printforhelp);
 
   if (!cipaction) badusage(_(need an action option));
 
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index 860fca5..e92ba29 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -101,7 +101,7 @@ usage(const struct cmdinfo *cip, const char *value)
 }
 
 const char thisname[]= SPLITTER;
-const char printforhelp[]= N_(Type dpkg-split --help for help.);
+static const char printforhelp[] = N_(Type dpkg-split --help for help.);
 
 struct partqueue *queue= NULL;
 
@@ -160,7 +160,7 @@ int main(int argc, const char *const *argv) {
   textdomain(PACKAGE);
 
   standard_startup();
-  myopt(argv, cmdinfos);
+  myopt(argv, cmdinfos, printforhelp);
 
   if (!cipaction) badusage(_(need an action option));
 
diff --git a/dselect/main.cc b/dselect/main.cc
index b00bb12..15c86a9 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -58,7 +58,7 @@
 #include pkglist.h
 
 const char thisname[]= DSELECT;
-const char printforhelp[]= N_(Type dselect --help for help.);
+static const char printforhelp[] = N_(Type dselect --help for help.);
 
 modstatdb_rw readwrite;
 int expertmode= 0;
@@ -517,7 +517,7 @@ main(int, const char *const *argv)
   push_error_context_func(dselect_catch_fatal_error, print_fatal_error, 0);
 
   loadcfgfile(DSELECT, cmdinfos);
-  myopt(argv,cmdinfos);
+  myopt(argv, cmdinfos, printforhelp);
 
   admindir = dpkg_db_set_dir(admindir);
 
diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index c72ffec..c3311e6 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -134,7 +134,6 @@ LIBDPKG_PRIVATE {
loadcfgfile;
myopt;
badusage;
-   # printforhelp; # XXX variable, do not require external
# thisname; # XXX variable, do not require external
cipaction;  # XXX variable, do not export
setaction;
diff --git a/lib/dpkg/myopt.c b/lib/dpkg/myopt.c
index ea8a310..4181a90 100644
--- a/lib/dpkg/myopt.c
+++ b/lib/dpkg/myopt.c
@@ -35,6 +35,8 @@
 #include dpkg/string.h
 #include dpkg/myopt.h
 
+static const char *printforhelp;
+
 void
 badusage(const char *fmt, ...)
 {
@@ -198,11 +200,16 @@ void loadcfgfile(const char *prog, const struct cmdinfo* 
cmdinfos) {
   }
 }
 
-void myopt(const char *const **argvp, const struct cmdinfo *cmdinfos) {
+void
+myopt(const char *const **argvp, const struct cmdinfo *cmdinfos,
+  const char *help_str)
+{
   const struct cmdinfo *cip;
   const char *p, *value;
   int l;
 
+  printforhelp = help_str;
+
   ++(*argvp);
   while ((p= **argvp)  *p == '-') {
 ++(*argvp);
diff --git a/lib/dpkg/myopt.h b/lib/dpkg/myopt.h
index d8e32fa..230fd89 100644
--- a/lib/dpkg/myopt.h
+++ b/lib/dpkg/myopt.h
@@ -48,14 +48,13 @@ struct cmdinfo {
   action_func *action;
 };
 
-extern const char printforhelp[];
-
 void badusage(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
 
 #define MAX_CONFIG_LINE 1024
 
 void myfileopt(const char* fn, const struct cmdinfo* cmdinfos);
-void myopt(const char *const **argvp, const struct cmdinfo *cmdinfos);
+void myopt(const char *const **argvp, const struct cmdinfo *cmdinfos,
+   const char *help_str);
 void loadcfgfile(const char *prog, const struct cmdinfo *cmdinfos);
 
 /**
diff --git a/src/divertcmd.c b/src/divertcmd.c
index 5ea6c65..d88ecd0 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -47,7 +47,8 @@
 
 
 const char thisname[] = dpkg-divert;
-const char printforhelp[] = N_(Use --help for help about querying packages.);
+static const char printforhelp[] = N_(
+Use --help for help about querying packages.);
 
 static const char *admindir;
 
@@ -698,7 +699,7 @@ main(int argc, const char * const *argv)
textdomain(PACKAGE);
 
standard_startup();
-   myopt(argv, cmdinfos);
+   myopt(argv, cmdinfos, printforhelp);
 
admindir = dpkg_db_set_dir(admindir);
 
diff --git a/src/main.c b/src/main.c
index 000e589..fbda5f1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -167,7 +167,7 @@ usage(const struct cmdinfo *ci, const char *value)
 
 const

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 9fe0a1b16d3045534f7863aed2e35f5177156a15
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 2 02:00:51 2011 +0200

Use new dpkg_set_progname and dpkg_get_progname instead of thisname

The current implementation demanded libdpkg users to define thisname
themselves, which is not really a nice interface to offer to programs.

Closes: #631757

diff --git a/debian/changelog b/debian/changelog
index 2c153dc..e4e9444 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -116,6 +116,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 Thanks to Ludovic Brenta ludo...@ludovic-brenta.org. Closes: #630533
   * Do not fail to unpack shared directories missing on the file system
 from packages being replaced by other packages. Closes: #631808
+  * Do not require programs to define thisname, provide two new functions
+to handle the program name (dpkg_set_progname and dpkg_get_progname).
+Closes: #631757
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 4512a98..5aa6c4d 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -125,7 +125,6 @@ usage(const struct cmdinfo *cip, const char *value)
   exit(0);
 }
 
-const char thisname[]= BACKEND;
 static const char printforhelp[] =
   N_(Type dpkg-deb --help for help about manipulating *.deb files;\n
  Type dpkg --help for help about installing and deinstalling packages.);
@@ -189,6 +188,7 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
+  dpkg_set_progname(BACKEND);
   standard_startup();
   myopt(argv, cmdinfos, printforhelp);
 
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index e92ba29..c6d956d 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -100,7 +100,6 @@ usage(const struct cmdinfo *cip, const char *value)
   exit(0);
 }
 
-const char thisname[]= SPLITTER;
 static const char printforhelp[] = N_(Type dpkg-split --help for help.);
 
 struct partqueue *queue= NULL;
@@ -159,6 +158,7 @@ int main(int argc, const char *const *argv) {
   bindtextdomain(PACKAGE, LOCALEDIR);
   textdomain(PACKAGE);
 
+  dpkg_set_progname(SPLITTER);
   standard_startup();
   myopt(argv, cmdinfos, printforhelp);
 
diff --git a/dselect/main.cc b/dselect/main.cc
index 15c86a9..fa58def 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -57,7 +57,6 @@
 #include bindings.h
 #include pkglist.h
 
-const char thisname[]= DSELECT;
 static const char printforhelp[] = N_(Type dselect --help for help.);
 
 modstatdb_rw readwrite;
@@ -514,6 +513,8 @@ main(int, const char *const *argv)
   bindtextdomain(DSELECT, LOCALEDIR);
   textdomain(DSELECT);
 
+  dpkg_set_progname(DSELECT);
+
   push_error_context_func(dselect_catch_fatal_error, print_fatal_error, 0);
 
   loadcfgfile(DSELECT, cmdinfos);
diff --git a/lib/dpkg/dpkg.h b/lib/dpkg/dpkg.h
index d191233..3bfbd7a 100644
--- a/lib/dpkg/dpkg.h
+++ b/lib/dpkg/dpkg.h
@@ -98,6 +98,7 @@ DPKG_BEGIN_DECLS
 
 #define FIND_EXPRSTARTCHARS -(),!
 
+#include dpkg/progname.h
 #include dpkg/ehandle.h
 
 /*** from startup.c ***/
diff --git a/lib/dpkg/ehandle.c b/lib/dpkg/ehandle.c
index f73648d..c2fbd6f 100644
--- a/lib/dpkg/ehandle.c
+++ b/lib/dpkg/ehandle.c
@@ -31,6 +31,7 @@
 
 #include dpkg/macros.h
 #include dpkg/i18n.h
+#include dpkg/progname.h
 #include dpkg/ehandle.h
 
 /* 6x255 for inserted strings (%.255s c in fmt; and %s with limited length 
arg)
@@ -91,13 +92,13 @@ run_error_handler(void)
  * abort. Hopefully the user can fix the situation (out of disk, out
  * of memory, etc). */
 fprintf(stderr, _(%s: unrecoverable fatal error, aborting:\n %s\n),
-thisname, errmsg);
+dpkg_get_progname(), errmsg);
 exit(2);
   }
 
   if (econtext == NULL) {
 fprintf(stderr, _(%s: outside error context, aborting:\n %s\n),
-thisname, errmsg);
+dpkg_get_progname(), errmsg);
 exit(2);
   } else if (econtext-handler_type == handler_type_func) {
 econtext-handler.func();
@@ -179,7 +180,8 @@ push_error_context(void)
 static void
 print_cleanup_error(const char *emsg, const char *contextstring)
 {
-  fprintf(stderr, _(%s: error while cleaning up:\n %s\n),thisname,emsg);
+  fprintf(stderr, _(%s: error while cleaning up:\n %s\n),
+  dpkg_get_progname(), emsg);
 }
 
 static void
@@ -197,7 +199,7 @@ run_cleanups(struct error_context *econ, int flagsetin)
   if (++preventrecurse  3) {
 onerr_abort++;
 fprintf(stderr, _(%s: too many nested errors during error recovery!!\n),
-thisname);
+dpkg_get_progname());
 flagset= 0;
   } else {
 flagset= flagsetin;
@@ -347,7 +349,7 @@ catch_fatal_error(void)
 void
 print_fatal_error(const char *emsg, const char *contextstring)
 {
-  fprintf(stderr, _(%s: error: %s\n), thisname, emsg);
+  fprintf(stderr, _(%s: error: %s\n), dpkg_get_progname(), emsg

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 16354a961ce86778a3e0ca56f2fa5314855ccf3c
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 3 03:12:40 2011 +0200

Fix printforhelp string in dpkg-divert and dpkg-statoverride

diff --git a/src/divertcmd.c b/src/divertcmd.c
index 595e25a..efd08b5 100644
--- a/src/divertcmd.c
+++ b/src/divertcmd.c
@@ -47,7 +47,7 @@
 
 
 static const char printforhelp[] = N_(
-Use --help for help about querying packages.);
+Use --help for help about diverting files.);
 
 static const char *admindir;
 
diff --git a/src/statcmd.c b/src/statcmd.c
index fcbbba0..b59d1b8 100644
--- a/src/statcmd.c
+++ b/src/statcmd.c
@@ -49,7 +49,7 @@
 #include filesdb.h
 
 static const char printforhelp[] = N_(
-Use --help for help about querying packages.);
+Use --help for help about overriding file stat information.);
 
 static void DPKG_ATTR_NORET
 printversion(const struct cmdinfo *cip, const char *value)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 01d9ba9dfa1695ab12bd4a09f9f35a6e18c09788
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 2 02:23:27 2011 +0200

Fix comment header lines describing the subproject

diff --git a/dselect/bindings.h b/dselect/bindings.h
index 7a7fe6f..2566e49 100644
--- a/dselect/bindings.h
+++ b/dselect/bindings.h
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
- * dselect - selection of Debian packages
+ * dselect - Debian package maintenance user interface
  * bindings.h - keybindings class header file
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
diff --git a/dselect/dselect-curses.h b/dselect/dselect-curses.h
index f670d27..6a3ffdb 100644
--- a/dselect/dselect-curses.h
+++ b/dselect/dselect-curses.h
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
- * dselect - selection of Debian packages
+ * dselect - Debian package maintenance user interface
  * dselect-curses.h - curses header wrapper
  *
  * Copyright © 2009 Guillem Jover guil...@debian.org
diff --git a/dselect/dselect.h b/dselect/dselect.h
index 1d05e44..1c8589d 100644
--- a/dselect/dselect.h
+++ b/dselect/dselect.h
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
- * dselect - selection of Debian packages
+ * dselect - Debian package maintenance user interface
  * dselect.h - external definitions for this program
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
diff --git a/dselect/pkglist.h b/dselect/pkglist.h
index 2169255..5c538e9 100644
--- a/dselect/pkglist.h
+++ b/dselect/pkglist.h
@@ -1,5 +1,5 @@
 /* -*- c++ -*-
- * dselect - selection of Debian packages
+ * dselect - Debian package maintenance user interface
  * pkglist.h - external definitions for package list handling
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c
index b12b487..f514ddc 100644
--- a/lib/dpkg/dbmodify.c
+++ b/lib/dpkg/dbmodify.c
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * dbmodify.c - routines for managing dpkg database updates
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
diff --git a/lib/dpkg/fdio.c b/lib/dpkg/fdio.c
index bfc2d16..a3f46a3 100644
--- a/lib/dpkg/fdio.c
+++ b/lib/dpkg/fdio.c
@@ -1,5 +1,5 @@
 /*
- * libdpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * fdio.c - safe file descriptor based input/output
  *
  * Copyright © 2009-2010 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/fdio.h b/lib/dpkg/fdio.h
index 3a4e8ee..fd5bdaa 100644
--- a/lib/dpkg/fdio.h
+++ b/lib/dpkg/fdio.h
@@ -1,5 +1,5 @@
 /*
- * libdpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * fdio.h - safe file descriptor based input/output
  *
  * Copyright © 2009-2010 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/glob.c b/lib/dpkg/glob.c
index f2a6e50..92da6a3 100644
--- a/lib/dpkg/glob.c
+++ b/lib/dpkg/glob.c
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * glob.c - file globing functions
  *
  * Copyright © 2009, 2010 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/glob.h b/lib/dpkg/glob.h
index 5cd44f2..eaf2af7 100644
--- a/lib/dpkg/glob.h
+++ b/lib/dpkg/glob.h
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * glob.h - file globing functions
  *
  * Copyright © 2009, 2010 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/log.c b/lib/dpkg/log.c
index b8e5e9f..00b2f68 100644
--- a/lib/dpkg/log.c
+++ b/lib/dpkg/log.c
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * log.c - logging related functions
  *
  * Copyright © 2005 Scott James Remnant sc...@netsplit.com
diff --git a/lib/dpkg/pkg-array.c b/lib/dpkg/pkg-array.c
index 0f1d9bf..20ff02e 100644
--- a/lib/dpkg/pkg-array.c
+++ b/lib/dpkg/pkg-array.c
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * pkg-array.c - primitives for pkg array handling
  *
  * Copyright © 1995,1996 Ian Jackson i...@chiark.greenend.org.uk
diff --git a/lib/dpkg/pkg-array.h b/lib/dpkg/pkg-array.h
index 68724c3..4e4eff5 100644
--- a/lib/dpkg/pkg-array.h
+++ b/lib/dpkg/pkg-array.h
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * pkg-array.h - primitives for pkg array handling
  *
  * Copyright © 2009 Guillem Jover guil...@debian.org
diff --git a/lib/dpkg/pkg-list.c b/lib/dpkg/pkg-list.c
index 70baa08..fa7bc14 100644
--- a/lib/dpkg/pkg-list.c
+++ b/lib/dpkg/pkg-list.c
@@ -1,5 +1,5 @@
 /*
- * dpkg - main program for package management
+ * libdpkg - Debian packaging suite library routines
  * pkg-list.c - primitives for pkg linked list handling

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit b81ec0a39b7ccba925fb0fb8f0664a0671dbc2dc
Author: Guillem Jover guil...@debian.org
Date:   Mon Jul 4 03:19:04 2011 +0200

libdpkg: Rename variable r to pid in subproc_fork()

diff --git a/lib/dpkg/subproc.c b/lib/dpkg/subproc.c
index 4b9c1e5..4006ffe 100644
--- a/lib/dpkg/subproc.c
+++ b/lib/dpkg/subproc.c
@@ -80,21 +80,21 @@ print_subproc_error(const char *emsg, const char 
*contextstring)
 pid_t
 subproc_fork(void)
 {
-   pid_t r;
+   pid_t pid;
 
-   r = fork();
-   if (r == -1) {
+   pid = fork();
+   if (pid == -1) {
onerr_abort++;
ohshite(_(fork failed));
}
-   if (r  0)
-   return r;
+   if (pid  0)
+   return pid;
 
/* Push a new error context, so that we don't do the other cleanups,
 * because they'll be done by/in the parent process. */
push_error_context_func(catch_fatal_error, print_subproc_error, NULL);
 
-   return r;
+   return pid;
 }
 
 int

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 668ab0d8ab99dcc7a63d58bc1d859d857e3e939e
Author: Guillem Jover guil...@debian.org
Date:   Mon Jul 4 04:10:32 2011 +0200

libdpkg: Rename sigaction variables in subproc module to sa and sa_save

diff --git a/lib/dpkg/subproc.c b/lib/dpkg/subproc.c
index 4006ffe..f38eafe 100644
--- a/lib/dpkg/subproc.c
+++ b/lib/dpkg/subproc.c
@@ -36,21 +36,22 @@
 #include dpkg/subproc.h
 
 static int catch_signals[] = { SIGQUIT, SIGINT };
-static struct sigaction uncatch_signals[array_count(catch_signals)];
+static struct sigaction sa_save[array_count(catch_signals)];
 
 void
 subproc_signals_setup(const char *name)
 {
+   struct sigaction sa;
size_t i;
-   struct sigaction catchsig;
 
onerr_abort++;
-   memset(catchsig, 0, sizeof(catchsig));
-   catchsig.sa_handler = SIG_IGN;
-   sigemptyset(catchsig.sa_mask);
-   catchsig.sa_flags = 0;
+   memset(sa, 0, sizeof(sa));
+   sigemptyset(sa.sa_mask);
+   sa.sa_handler = SIG_IGN;
+   sa.sa_flags = 0;
+
for (i = 0; i  array_count(catch_signals); i++)
-   if (sigaction(catch_signals[i], catchsig, uncatch_signals[i]))
+   if (sigaction(catch_signals[i], sa, sa_save[i]))
ohshite(_(unable to ignore signal %s before running 
%.250s),
strsignal(catch_signals[i]), name);
push_cleanup(subproc_signals_cleanup, ~0, NULL, 0, 0);
@@ -63,7 +64,7 @@ subproc_signals_cleanup(int argc, void **argv)
size_t i;
 
for (i = 0; i  array_count(catch_signals); i++) {
-   if (sigaction(catch_signals[i], uncatch_signals[i], NULL)) {
+   if (sigaction(catch_signals[i], sa_save[i], NULL)) {
fprintf(stderr, _(error un-catching signal %s: %s\n),
strsignal(catch_signals[i]), strerror(errno));
onerr_abort++;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit cf22cf6118035ab8ee5cc25e5298a987073c8dc8
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 3 03:23:11 2011 +0200

libdpkg: Rename myopt module to options

diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index a88cb0e..75132ee 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -48,7 +48,7 @@
 #include dpkg/subproc.h
 #include dpkg/compress.h
 #include dpkg/ar.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-deb.h
 
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 365be5d..2dde994 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -47,7 +47,7 @@
 #include dpkg/command.h
 #include dpkg/compress.h
 #include dpkg/ar.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-deb.h
 
diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index 6f43f55..2bd0a5d 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -44,7 +44,7 @@
 #include dpkg/buffer.h
 #include dpkg/path.h
 #include dpkg/subproc.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-deb.h
 
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 5aa6c4d..49cf5e5 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -42,7 +42,7 @@
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
 #include dpkg/compress.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-deb.h
 
diff --git a/dpkg-split/info.c b/dpkg-split/info.c
index 30e0c27..6066f73 100644
--- a/dpkg-split/info.c
+++ b/dpkg-split/info.c
@@ -37,7 +37,7 @@
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
 #include dpkg/ar.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-split.h
 
diff --git a/dpkg-split/join.c b/dpkg-split/join.c
index 03017c8..95ed64a 100644
--- a/dpkg-split/join.c
+++ b/dpkg-split/join.c
@@ -33,7 +33,7 @@
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
 #include dpkg/buffer.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-split.h
 
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index c6d956d..c4e7b33 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -37,7 +37,7 @@
 #include dpkg/i18n.h
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-split.h
 
diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c
index 5372434..e758feb 100644
--- a/dpkg-split/queue.c
+++ b/dpkg-split/queue.c
@@ -39,7 +39,7 @@
 #include dpkg/dpkg-db.h
 #include dpkg/dir.h
 #include dpkg/buffer.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-split.h
 
diff --git a/dpkg-split/split.c b/dpkg-split/split.c
index d4fe4bc..1b40f34 100644
--- a/dpkg-split/split.c
+++ b/dpkg-split/split.c
@@ -43,7 +43,7 @@
 #include dpkg/subproc.h
 #include dpkg/buffer.h
 #include dpkg/ar.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dpkg-split.h
 
diff --git a/dselect/main.cc b/dselect/main.cc
index fa58def..6508b1f 100644
--- a/dselect/main.cc
+++ b/dselect/main.cc
@@ -51,7 +51,7 @@
 #include dpkg/i18n.h
 #include dpkg/dpkg.h
 #include dpkg/dpkg-db.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 #include dselect.h
 #include bindings.h
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index a1c8f8e..7950835 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -43,9 +43,9 @@ libdpkg_a_SOURCES = \
log.c \
md5.c md5.h \
mlib.c \
-   myopt.c \
namevalue.c \
nfmalloc.c \
+   options.c \
parse.c \
parsehelp.c \
path.c \
@@ -83,8 +83,8 @@ pkginclude_HEADERS = \
file.h \
glob.h \
macros.h \
-   myopt.h \
namevalue.h \
+   options.h \
parsedump.h \
path.h \
pkg.h \
diff --git a/lib/dpkg/myopt.c b/lib/dpkg/options.c
similarity index 99%
rename from lib/dpkg/myopt.c
rename to lib/dpkg/options.c
index 4181a90..3575e29 100644
--- a/lib/dpkg/myopt.c
+++ b/lib/dpkg/options.c
@@ -1,6 +1,6 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * myopt.c - my very own option parsing
+ * options.c - option parsing functions
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  * Copyright © 2000,2002 Wichert Akkerman wich...@deephackmode.org
@@ -33,7 +33,7 @@
 #include dpkg/i18n.h
 #include dpkg/dpkg.h
 #include dpkg/string.h
-#include dpkg/myopt.h
+#include dpkg/options.h
 
 static const char *printforhelp;
 
diff --git a/lib/dpkg/myopt.h b/lib/dpkg/options.h
similarity index 94%
rename from lib/dpkg/myopt.h
rename to lib/dpkg/options.h
index 230fd89..ba415bf 100644
--- a/lib/dpkg/myopt.h
+++ b/lib/dpkg/options.h
@@ -1,6 +1,6 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * myopt.h - declarations for my very own option parsing
+ * options.h - option parsing functions
  *
  * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk
  *
@@ -18,8 +18,8 @@
  * along with this program.  If not, see http://www.gnu.org/licenses/.
  */
 
-#ifndef MYOPT_H
-#define MYOPT_H
+#ifndef

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e342a8fc3bc777971f76aff0f89b8b121876a532
Author: Guillem Jover guil...@debian.org
Date:   Sun Jul 3 21:29:43 2011 +0200

Use “command line” instead of commandline or command-line

diff --git a/TODO b/TODO
index e1b1f18..6af952e 100644
--- a/TODO
+++ b/TODO
@@ -69,7 +69,6 @@ TODO
- Check position of short option before long option.
- Use [option...] instead of [options] and friends?
- Fix dpkg man page, refs to dpkg-deb and dpkg-split, etc.
-   - Fix «commandline» vs «command line».
- Fix «.  ».
 
  * L10n:
diff --git a/debian/usertags b/debian/usertags
index 0a0d9c1..9353bc8 100644
--- a/debian/usertags
+++ b/debian/usertags
@@ -27,7 +27,7 @@ file-metadata File metadata tracking (perm, 
acl, cap, hash).
 trivial[TRIVIAL]   Bug should be trivial to fix.
 perf   [PERF]  Performance problems.
 new-field  Request for new control file fields.
-new-option Request for new command-line option.
+new-option Request for new command line option.
 deb-format Changes to the binary (.deb) format.
 dsc-format Changes to the source (.dsc) format.
 arch   [ARCH]  Updates to ‘cputable’, ‘ostable’ and porting
@@ -155,7 +155,7 @@ usercategory dpkg-class [hidden]
   + Performance issue [perf]
   + Trivial fix [trivial]
   + New control field [new-field]
-  + New command-line option [new-option]
+  + New command line option [new-option]
   + Binary package format [deb-format]
   + Source package format [dsc-format]
   + Architecture specific issue [arch]
diff --git a/doc/README.api b/doc/README.api
index fe575ad..6cd8eb2 100644
--- a/doc/README.api
+++ b/doc/README.api
@@ -31,7 +31,7 @@ What: custom changelog parsers in /usr/lib/dpkg/parsechangelog
 Status: stable
 Version: 2.0
 Description:
- Since dpkg 1.14.16, the set of command-line options that custom
+ Since dpkg 1.14.16, the set of command line options that custom
  changelog parsers must support has been expanded (see
  dpkg-parsechangelog(1)). For compatibility, changelog parsers supporting
  only the old options are supported in lenny. In lenny+1, that support
diff --git a/doc/triggers.txt b/doc/triggers.txt
index 77668ed..75579fa 100644
--- a/doc/triggers.txt
+++ b/doc/triggers.txt
@@ -312,7 +312,7 @@ by dpkg-trigger).  dpkg-deb will be changed to warn about 
unrecognised
 trigger names syntaxes and unrecognised trigger control directives.
 
 
-New command-line interfaces to dpkg tools
+New command line interfaces to dpkg tools
 -
 
 See dpkg(1).
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index 2d83146..f752a4e 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -1,5 +1,5 @@
 .\ Authors: Ian Jackson, Raphaël Hertzog
-.TH dpkg\-source 1 2011-03-04 Debian Project dpkg utilities
+.TH dpkg\-source 1 2011-07-03 Debian Project dpkg utilities
 .SH NAME
 dpkg\-source \- Debian source package (.dsc) manipulation tool
 .
@@ -57,7 +57,7 @@ additional parameters might be accepted.
 
 \fBdpkg\-source\fP will build the source package with the first format
 found in this ordered list:
-the format indicated with the \fI\-\-format\fP command-line option,
+the format indicated with the \fI\-\-format\fP command line option,
 the format indicated in \fBdebian/source/format\fP,
 1.0. The fallback to 1.0 is deprecated and will be removed at some
 point in the future, you should always document the desired source format
diff --git a/man/dselect.1 b/man/dselect.1
index cddf29e..d20d499 100644
--- a/man/dselect.1
+++ b/man/dselect.1
@@ -1,4 +1,4 @@
-.TH dselect 1 2010-03-07 Debian Project Debian
+.TH dselect 1 2011-07-03 Debian Project Debian
 .SH NAME
 dselect \- Debian package management frontend
 .
@@ -38,15 +38,15 @@ package \fBapt\fP.
 Normally \fBdselect\fP is invoked without parameters. An interactive
 menu is presented, offering the user a list of actions. If an action
 is given as argument, then that action is started immediately. Several
-commandline parameters are still available to modify the running behaviour
+command line parameters are still available to modify the running behaviour
 of \fBdselect\fP or show additional information about the program.
 .
 .SH OPTIONS
-All options can be specified both on the commandline and in the \fBdselect\fP
+All options can be specified both on the command line and in the \fBdselect\fP
 configuration file \fI/etc/dpkg/dselect.cfg\fP or the files on the
 configuration directory \fI/etc/dpkg/dpkg.cfg.d/\fP. Each line in the
 configuration file is either an option (exactly the same as the
-commandline option but without leading dashes) or a comment (if it starts
+command line option but without leading dashes) or a comment (if it starts
 with a \fB#\fR).
 .br
 .TP
diff --git a/man/dselect.cfg.5 b/man/dselect.cfg.5
index c6cfbed..8770a95

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ec206bf34be3733a665840432f70faf149f2c008
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 2 01:58:33 2011 +0200

libdpkg: Add new progname module handling functions

diff --git a/configure.ac b/configure.ac
index 390a868..9b33080 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,11 +80,12 @@ DPKG_FUNC_C99_SNPRINTF
 DPKG_CHECK_DECL([offsetof], [stddef.h])
 DPKG_CHECK_DECL([WCOREDUMP], [sys/wait.h])
 DPKG_CHECK_DECL([TIOCNOTTY], [sys/ioctl.h])
+DPKG_CHECK_PROGNAME
 DPKG_CHECK_COMPAT_FUNCS([getopt getopt_long obstack_free \
  strnlen strerror strsignal asprintf \
  scandir alphasort unsetenv])
 AC_CHECK_FUNCS([strtoul strtoimax isascii bcopy memcpy setsid getdtablesize \
-lutimes posix_fadvise])
+getprogname getexecname lutimes posix_fadvise])
 
 DPKG_MMAP
 
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 04c4be9..a1c8f8e 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -56,6 +56,7 @@ libdpkg_a_SOURCES = \
pkg-list.c \
pkg-queue.c \
pkg-show.c \
+   progname.c \
progress.c \
string.c \
subproc.c \
@@ -92,6 +93,7 @@ pkginclude_HEADERS = \
pkg-list.h \
pkg-queue.h \
pkg-show.h \
+   progname.h \
progress.h \
string.h \
subproc.h \
diff --git a/lib/dpkg/libdpkg.Versions b/lib/dpkg/libdpkg.Versions
index c3311e6..b035276 100644
--- a/lib/dpkg/libdpkg.Versions
+++ b/lib/dpkg/libdpkg.Versions
@@ -1,5 +1,9 @@
 LIBDPKG_0 {
 global:
+   # Program name
+   dpkg_set_progname;
+   dpkg_get_progname;
+
# Ar support
dpkg_ar_normalize_name;
 
diff --git a/lib/dpkg/progname.c b/lib/dpkg/progname.c
new file mode 100644
index 000..0d4ef37
--- /dev/null
+++ b/lib/dpkg/progname.c
@@ -0,0 +1,83 @@
+/*
+ * libdpkg - Debian packaging suite library routines
+ * progname.c - program name handling functions
+ *
+ * Copyright © 2011 Guillem Jover guil...@debian.org
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#include config.h
+#include compat.h
+
+#include errno.h
+#include string.h
+#include stdlib.h
+
+#include dpkg/progname.h
+
+static const char *progname;
+
+/**
+ * Set the program name.
+ *
+ * This function will set the program name which will be used by error
+ * reporting functions, among others.
+ *
+ * @param name The new program name.
+ */
+void
+dpkg_set_progname(const char *name)
+{
+   const char *last_slash;
+
+   last_slash = strrchr(name, '/');
+   if (last_slash == NULL)
+   progname = name;
+   else
+   progname = last_slash + 1;
+}
+
+#if defined(HAVE___PROGNAME)
+extern const char *__progname;
+#endif
+
+/**
+ * Get the program name.
+ *
+ * The program name might have been set previously by dpkg_set_progname(),
+ * but if not this function will try to initialize it by system dependant
+ * means, so it's half safe to not call dpkg_set_progname() at all. At worst
+ * the function might return NULL in that case.
+ *
+ * @return A pointer to a static buffer with the program name.
+ */
+const char *
+dpkg_get_progname(void)
+{
+   if (progname == NULL) {
+#if defined(HAVE_PROGRAM_INVOCATION_SHORT_NAME)
+   progname = program_invocation_short_name;
+#elif defined(HAVE___PROGNAME)
+   progname = __progname;
+#elif defined(HAVE_GETPROGNAME)
+   progname = getprogname();
+#elif defined(HAVE_GETEXECNAME)
+   /* getexecname(3) returns an absolute path, normalize it. */
+   dpkg_set_progname(getexecname());
+#endif
+   }
+
+   return progname;
+}
diff --git a/lib/dpkg/dir.h b/lib/dpkg/progname.h
similarity index 70%
copy from lib/dpkg/dir.h
copy to lib/dpkg/progname.h
index ad8fa83..14034b9 100644
--- a/lib/dpkg/dir.h
+++ b/lib/dpkg/progname.h
@@ -1,8 +1,8 @@
 /*
  * libdpkg - Debian packaging suite library routines
- * dir.h - directory handling routines
+ * progname.h - program name handling functions
  *
- * Copyright © 2010 Guillem Jover guil...@debian.org
+ * Copyright © 2011 Guillem Jover guil...@debian.org
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,19 +18,16 @@
  * along

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 23cd39aae01f1b3b1aee834befa02201e8824819
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 09:04:32 2011 +0200

libdpkg: Rename catch_signals to signo_ignores in subproc module

diff --git a/lib/dpkg/subproc.c b/lib/dpkg/subproc.c
index f38eafe..e00141c 100644
--- a/lib/dpkg/subproc.c
+++ b/lib/dpkg/subproc.c
@@ -35,8 +35,8 @@
 #include dpkg/dpkg.h
 #include dpkg/subproc.h
 
-static int catch_signals[] = { SIGQUIT, SIGINT };
-static struct sigaction sa_save[array_count(catch_signals)];
+static int signo_ignores[] = { SIGQUIT, SIGINT };
+static struct sigaction sa_save[array_count(signo_ignores)];
 
 void
 subproc_signals_setup(const char *name)
@@ -50,10 +50,10 @@ subproc_signals_setup(const char *name)
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
 
-   for (i = 0; i  array_count(catch_signals); i++)
-   if (sigaction(catch_signals[i], sa, sa_save[i]))
+   for (i = 0; i  array_count(signo_ignores); i++)
+   if (sigaction(signo_ignores[i], sa, sa_save[i]))
ohshite(_(unable to ignore signal %s before running 
%.250s),
-   strsignal(catch_signals[i]), name);
+   strsignal(signo_ignores[i]), name);
push_cleanup(subproc_signals_cleanup, ~0, NULL, 0, 0);
onerr_abort--;
 }
@@ -63,10 +63,10 @@ subproc_signals_cleanup(int argc, void **argv)
 {
size_t i;
 
-   for (i = 0; i  array_count(catch_signals); i++) {
-   if (sigaction(catch_signals[i], sa_save[i], NULL)) {
+   for (i = 0; i  array_count(signo_ignores); i++) {
+   if (sigaction(signo_ignores[i], sa_save[i], NULL)) {
fprintf(stderr, _(error un-catching signal %s: %s\n),
-   strsignal(catch_signals[i]), strerror(errno));
+   strsignal(signo_ignores[i]), strerror(errno));
onerr_abort++;
}
}

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7dcd875e084213fa65c09cd23a3e45edfbfcb94b
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 06:17:19 2011 +0200

deb-control(5): Add missing escaping to field dashes

diff --git a/debian/changelog b/debian/changelog
index eed3e05..52ef7a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -123,6 +123,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 - Rename “USAGE” dselect(1) section to “ACTIONS” and clarify they can
   be performed interactively or from command line.
 - Add missing built-in methods to dselect(1).
+- Add missing escaping to field dashes in deb-control(5).
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/deb-control.5 b/man/deb-control.5
index 8afc724..42c4473 100644
--- a/man/deb-control.5
+++ b/man/deb-control.5
@@ -230,14 +230,14 @@ and
 fields.
 .
 .TP
-.BR Built-Using:  package list
+.BR Built\-Using:  package list
 This field lists extra source packages that were used during the build of this
 binary package.  This is an indication to the archive maintenance software that
 these extra source packages must be kept whilst this binary package is
 maintained.  This field must be a list of source package names with strict (=)
 version relationships.  Note that the archive maintenance software is likely to
 refuse to accept an upload which declares a
-.B Built-Using
+.B Built\-Using
 relationship which cannot be satisfied within the archive.
 .
 .SH EXAMPLE

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 0a9586213086723c5962bbfa6659df240c77433c
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 06:19:02 2011 +0200

man: Use dashes instead of underscores for variable text

This makes the text more clear by avoiding the clashes when italics
are rendered as underlined text.

diff --git a/debian/changelog b/debian/changelog
index 52ef7a3..0fd1cee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -124,6 +124,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   be performed interactively or from command line.
 - Add missing built-in methods to dselect(1).
 - Add missing escaping to field dashes in deb-control(5).
+- Use dashes instead of underscores for variable text.
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/deb-control.5 b/man/deb-control.5
index 42c4473..8a4f8c9 100644
--- a/man/deb-control.5
+++ b/man/deb-control.5
@@ -89,7 +89,7 @@ The name of the distribution this package is originating from.
 .TP
 .BR Bugs:  url
 The url of the bug tracking system for this package. The current used format
-is \fBbts_type://bts_address\fP, like \fBdebbugs://bugs.debian.org\fP.
+is \fBbts-type://bts-address\fP, like \fBdebbugs://bugs.debian.org\fP.
 .TP
 .BR Homepage:  url
 The upstream project home page URL.
diff --git a/man/deb-src-control.5 b/man/deb-src-control.5
index 94a0aa4..0ef7f17 100644
--- a/man/deb-src-control.5
+++ b/man/deb-src-control.5
@@ -66,7 +66,7 @@ The upstream project home page URL.
 .TP
 .BR Bugs:  url
 The url of the bug tracking system for this package. The current used format
-is \fBbts_type://bts_address\fP, like \fBdebbugs://bugs.debian.org\fP. This
+is \fBbts-type://bts-address\fP, like \fBdebbugs://bugs.debian.org\fP. This
 field is usually not needed.
 
 .TP
diff --git a/man/deb-version.5 b/man/deb-version.5
index da9372f..79076f9 100644
--- a/man/deb-version.5
+++ b/man/deb-version.5
@@ -2,12 +2,12 @@
 .\ The copyright given below is that of the whole policy, but probably
 .\ incomplete.
 .\ Conversion to roff by Frank Lichtenheld
-.TH deb\-version 5 2008-08-18 Debian Project Debian
+.TH deb\-version 5 2011-07-04 Debian Project Debian
 .SH NAME
 deb\-version \- Debian package version number format
 .
 .SH SYNOPSIS
-.RI [  epoch :]  upstream_version  [\- debian_revision  ]
+.RI [  epoch :]  upstream-version  [\- debian-revision  ]
 .SH DESCRIPTION
 Version numbers as used for Debian binary and source packages
 consist of three components. These are:
@@ -15,14 +15,14 @@ consist of three components. These are:
 .I epoch
 This is a single (generally small) unsigned integer.  It
 may be omitted, in which case zero is assumed.  If it is
-omitted then the \fIupstream_version\fP may not
+omitted then the \fIupstream-version\fP may not
 contain any colons.
 .IP
 It is provided to allow mistakes in the version numbers
 of older versions of a package, and also a package's
 previous version numbering schemes, to be left behind.
 .TP
-.I upstream_version
+.I upstream-version
 This is the main part of the version number.  It is
 usually the version number of the original (upstream)
 package from which the \fI.deb\fP file has been made,
@@ -33,48 +33,48 @@ package management system's format and comparison
 scheme.
 .IP
 The comparison behavior of the package management system
-with respect to the \fIupstream_version\fP is
-described below.  The \fIupstream_version\fP
+with respect to the \fIupstream-version\fP is
+described below. The \fIupstream-version\fP
 portion of the version number is mandatory.
 .IP
-The \fIupstream_version\fP may contain only
+The \fIupstream-version\fP may contain only
 alphanumerics (A-Za-z0-9) and the characters
 .BR .   +   \-   :   ~
 (full stop, plus, hyphen, colon, tilde) and should
 start with a digit.  If there is no
-\fIdebian_revision\fP then hyphens are not allowed;
+\fIdebian-revision\fP then hyphens are not allowed;
 if there is no \fIepoch\fP then colons are not
 allowed.
 .TP
-.I debian_revision
+.I debian-revision
 This part of the version number specifies the version of
 the Debian package based on the upstream version.  It
 may contain only alphanumerics and the characters
 .BR +   .   ~
 (plus, full stop, tilde) and is
 compared in the same way as the
-\fIupstream_version\fP is.
+\fIupstream-version\fP is.
 .IP
 It is optional; if it isn't present then the
-\fIupstream_version\fP may not contain a hyphen.
+\fIupstream-version\fP may not contain a hyphen.
 This format represents the case where a piece of
 software was written specifically to be turned into a
 Debian package, and so there is only one debianisation
 of it and therefore no revision indication is required.
 .IP
 It is conventional to restart the
-\fIdebian_revision\fP at '1' each time time the
-\fIupstream_version\fP is increased.
+\fIdebian-revision\fP at '1' each time time the
+\fIupstream-version\fP is increased.
 .IP
 Dpkg

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 86878684cd098e4ca6f879492842e24eb9a6
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 6 16:46:54 2011 +0200

dpkg-query(1): Clarify that several fields are not dselect specific

These apply to most dpkg front-ends not just dselect.

diff --git a/debian/changelog b/debian/changelog
index 0fd1cee..c3106de 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -125,6 +125,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 - Add missing built-in methods to dselect(1).
 - Add missing escaping to field dashes in deb-control(5).
 - Use dashes instead of underscores for variable text.
+- Clarify that several front-end fields are not dselect specific in
+  dpkg-query(1).
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/dpkg-query.1 b/man/dpkg-query.1
index afc6fbc..0612725 100644
--- a/man/dpkg-query.1
+++ b/man/dpkg-query.1
@@ -156,11 +156,11 @@ fields or fields stored in the binary package end up in 
it):
 \fBDescription\fP
 \fBEnhances\fP
 \fBEssential\fP
-\fBFilename\fP (internal, dselect related)
+\fBFilename\fP (internal, front-end related)
 \fBHomepage\fP
 \fBInstalled\-Size\fP
-\fBMD5sum\fP (internal, dselect related)
-\fBMSDOS\-Filename\fP (internal, dselect related)
+\fBMD5sum\fP (internal, front-end related)
+\fBMSDOS\-Filename\fP (internal, front-end related)
 \fBMaintainer\fP
 \fBOrigin\fP
 \fBPackage\fP
@@ -171,7 +171,7 @@ fields or fields stored in the binary package end up in it):
 \fBReplaces\fP
 \fBRevision\fP (obsolete)
 \fBSection\fP
-\fBSize\fP (internal, dselect related)
+\fBSize\fP (internal, front-end related)
 \fBSource\fP
 \fBStatus\fP (internal)
 \fBSuggests\fP

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 971e0bd2005b06ab718a90e77067f7c6ff01c0b3
Author: Guillem Jover guil...@debian.org
Date:   Wed Jul 6 16:45:26 2011 +0200

dselect(1): Add missing built-in methods

diff --git a/debian/changelog b/debian/changelog
index 190476d..eed3e05 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -122,6 +122,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Man pages cleanup:
 - Rename “USAGE” dselect(1) section to “ACTIONS” and clarify they can
   be performed interactively or from command line.
+- Add missing built-in methods to dselect(1).
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/dselect.1 b/man/dselect.1
index b422193..a7ffea7 100644
--- a/man/dselect.1
+++ b/man/dselect.1
@@ -135,10 +135,10 @@ of available actions if running interactively:
 Choose and configure an access method to access package repositories.
 .sp
 By default, \fBdselect\fP provides several methods such
-as \fIfloppy\fP, \fIharddisk\fP or \fIcdrom\fP, but other packages
-may provide additional methods, eg. the \fIapt\fP access method provided
-by the \fBapt\fP package or \fImulti_cd\fP by the \fBdpkg\-multicd\fP
-package.
+as \fIcdrom\fP, \fImulti_cd\fP, \fInfs\fP, \fImulti_nfs\fP, \fIharddisk\fP,
+\fImounted\fP, \fImulti_mount\fP, \fIfloppy\fP or \fIftp\fP, but other
+packages may provide additional methods, eg. the \fIapt\fP access method
+provided by the \fBapt\fP package.
 .sp
 The use of the \fIapt\fP access method is strongly recommended.
 .sp

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 9e53fcc54bddbbab53e964f3339bd712e41806e5
Author: Guillem Jover guil...@debian.org
Date:   Mon Jul 4 18:55:03 2011 +0200

Refer to Sources and Packages files as part of a repository

Instead of as being of exclusive use or owned by APT, which has never
been the case. Those files existed long before APT even existed.

diff --git a/debian/changelog b/debian/changelog
index c3106de..d183637 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -127,6 +127,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 - Use dashes instead of underscores for variable text.
 - Clarify that several front-end fields are not dselect specific in
   dpkg-query(1).
+  * Refer to Sources and Packages files as part of a repository instead of
+as being of exclusive use or owned by APT, which has never been the case.
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/dpkg-query.1 b/man/dpkg-query.1
index 0612725..5237166 100644
--- a/man/dpkg-query.1
+++ b/man/dpkg-query.1
@@ -1,4 +1,4 @@
-.TH dpkg\-query 1 2011-04-28 Debian Project dpkg suite
+.TH dpkg\-query 1 2011-07-04 Debian Project dpkg suite
 .SH NAME
 dpkg\-query \- a tool to query the dpkg database
 .
@@ -175,7 +175,7 @@ fields or fields stored in the binary package end up in it):
 \fBSource\fP
 \fBStatus\fP (internal)
 \fBSuggests\fP
-\fBTag\fP (usually not in the .deb but in APT's Packages files)
+\fBTag\fP (usually not in the .deb but in the repository Packages files)
 \fBTriggers-Awaited\fP (internal)
 \fBTriggers-Pending\fP (internal)
 \fBVersion\fP
diff --git a/scripts/Dpkg/Control.pm b/scripts/Dpkg/Control.pm
index b3b8939..01d8d28 100644
--- a/scripts/Dpkg/Control.pm
+++ b/scripts/Dpkg/Control.pm
@@ -66,12 +66,12 @@ in a Debian source package.
 
 =item CTRL_INDEX_SRC
 
-Corresponds to an entry in a Sources file of an APT source package
+Corresponds to an entry in a Sources file of a source package
 repository.
 
 =item CTRL_INDEX_PKG
 
-Corresponds to an entry in a Packages file of an APT binary package
+Corresponds to an entry in a Packages file of a binary package
 repository.
 
 =item CTRL_PKG_SRC
@@ -153,9 +153,9 @@ sub set_options {
 } elsif ($t == CTRL_CHANGELOG) {
 $$self-{'name'} = _g(parsed version of changelog);
 } elsif ($t == CTRL_INDEX_SRC) {
-$$self-{'name'} = sprintf(_g(entry of APT's %s file), 
Sources);
+$$self-{'name'} = sprintf(_g(entry in repository's %s file), 
Sources);
 } elsif ($t == CTRL_INDEX_PKG) {
-$$self-{'name'} = sprintf(_g(entry of APT's %s file), 
Packages);
+$$self-{'name'} = sprintf(_g(entry in repository's %s file), 
Packages);
 } elsif ($t == CTRL_PKG_SRC) {
 $$self-{'name'} = sprintf(_g(%s file), .dsc);
 } elsif ($t == CTRL_PKG_DEB) {
diff --git a/scripts/Dpkg/Control/Types.pm b/scripts/Dpkg/Control/Types.pm
index 56ddeca..a1a6590 100644
--- a/scripts/Dpkg/Control/Types.pm
+++ b/scripts/Dpkg/Control/Types.pm
@@ -38,8 +38,8 @@ use constant {
 CTRL_UNKNOWN = 0,
 CTRL_INFO_SRC = 1,  # First control block in debian/control
 CTRL_INFO_PKG = 2,  # Subsequent control blocks in debian/control
-CTRL_INDEX_SRC = 4, # Entry in APT's Packages files
-CTRL_INDEX_PKG = 8, # Entry in APT's Sources files
+CTRL_INDEX_SRC = 4, # Entry in repository's Packages files
+CTRL_INDEX_PKG = 8, # Entry in repository's Sources files
 CTRL_PKG_SRC = 16,  # .dsc file of source package
 CTRL_PKG_DEB = 32,  # DEBIAN/control in binary packages
 CTRL_FILE_CHANGES = 64, # .changes file

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-160-gc819a40

2011-07-07 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 37b01269a3735a3213d5fe5fce377d5360f55ff7
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 05:41:06 2011 +0200

dselect(1): Rename USAGE section to ACTIONS

Document the ways actions can be performed, either interactively or from
the command line.

diff --git a/debian/changelog b/debian/changelog
index e4e9444..190476d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -119,6 +119,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not require programs to define thisname, provide two new functions
 to handle the program name (dpkg_set_progname and dpkg_get_progname).
 Closes: #631757
+  * Man pages cleanup:
+- Rename “USAGE” dselect(1) section to “ACTIONS” and clarify they can
+  be performed interactively or from command line.
 
   [ Bill Allombert]
   * Add support for Build-Features: build-arch. Closes: #229357
diff --git a/man/dselect.1 b/man/dselect.1
index d20d499..b422193 100644
--- a/man/dselect.1
+++ b/man/dselect.1
@@ -125,11 +125,12 @@ Print a brief help text and exit successfully.
 .B \-\-version
 Print version information and exit successfully.
 .
-.SH USAGE
+.SH ACTIONS
 When
 .B dselect
-is started interactively, it prompts the user with a menu of available
-actions:
+is started it can perform the following actions, either directly if it
+was specified on the command line or by prompting the user with a menu
+of available actions if running interactively:
 .SS access
 Choose and configure an access method to access package repositories.
 .sp

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-196-g5b9ecc1

2011-07-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5b9ecc1b953c78614b2aee49687bec216de748f7
Author: Guillem Jover guil...@debian.org
Date:   Mon Jul 25 05:12:35 2011 +0200

Add build-indep and build-arch targets as aliases for build

The current build target is responsible for the generation of
architecture dependent and independent files. The architecture
independent files are just sed'ed and as such they take insignificant
build time, so splitting that from the general build process does not
seem worth the trouble or complexity. Renaming the current build
target to build-arch though would be incorrect.

diff --git a/debian/changelog b/debian/changelog
index 900a7d2..9cee55b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -158,6 +158,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Refer to Sources and Packages files as part of a repository instead of
 as being of exclusive use or owned by APT, which has never been the case.
   * Unify somewhat dpkg-maintscript-helper --help output with other commands.
+  * Add build-indep and build-arch targets as aliases for build in
+debian/rules.
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
   [ Bill Allombert]
diff --git a/debian/rules b/debian/rules
index 2503f80..8d6aee1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -58,7 +58,7 @@ build-tree/config.status: configure
--with-bz2
 
 # Build the package in build-tree
-build: build-tree/config.status
+build-indep build-arch build: build-tree/config.status
dh_testdir
 
cd build-tree  $(MAKE)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-196-g5b9ecc1

2011-07-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit dac802bce2e7fa909dac09d87f6fadb6074b9097
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 19:08:18 2011 +0200

dpkg-deb: Use CONTROLFILE instead of a literal string

diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index cd67d78..c7ab5e6 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -184,12 +184,12 @@ info_list(const char *debar, const char *dir)
   free(cdlist);
 
   varbuf_trunc(controlfile, dirlen);
-  varbuf_add_str(controlfile, control);
+  varbuf_add_str(controlfile, CONTROLFILE);
   varbuf_end_str(controlfile);
   cc = fopen(controlfile.buf, r);
   if (!cc) {
 if (errno != ENOENT)
-  ohshite(_(failed to read `%.255s' (in `%.255s')), control, dir);
+  ohshite(_(failed to read `%.255s' (in `%.255s')), CONTROLFILE, dir);
 fputs(_((no `control' file in control archive!)\n), stdout);
   } else {
 lines= 1;
@@ -203,7 +203,7 @@ info_list(const char *debar, const char *dir)
   putc('\n', stdout);
 
 if (ferror(cc))
-  ohshite(_(failed to read `%.255s' (in `%.255s')), control, dir);
+  ohshite(_(failed to read `%.255s' (in `%.255s')), CONTROLFILE, dir);
 fclose(cc);
   }
 
@@ -270,7 +270,7 @@ info_field(const char *debar, const char *dir, const char 
*const *fields,
   }
   if (ferror(cc)) ohshite(_(failed during read of `control' component));
   if (fclose(cc))
-ohshite(_(error closing the '%s' component), control);
+ohshite(_(error closing the '%s' component), CONTROLFILE);
   if (doing) putc('\n',stdout);
   m_output(stdout, _(standard output));
   varbuf_destroy(controlfile);
@@ -326,7 +326,7 @@ do_field(const char *const *argv)
   if (*argv) {
 info_field(debar, dir, argv, argv[1] != NULL);
   } else {
-static const char *const controlonly[] = { control, NULL };
+static const char *const controlonly[] = { CONTROLFILE, NULL };
 info_spew(debar, dir, controlonly);
   }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-196-g5b9ecc1

2011-07-24 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 9b22745f0a7127b7a171308f73e3079c535923f7
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 7 19:18:04 2011 +0200

dpkg-deb: Construct control components paths with printf variants

The output of dpkg-deb -I, -f and -W is not performance critical, and
code simplicity trumps over the tiny performance improvements that using
the explicit string functions or keeping the extracted control directory
in the varbuf might imply in these cases.

diff --git a/dpkg-deb/info.c b/dpkg-deb/info.c
index c7ab5e6..65ea6fa 100644
--- a/dpkg-deb/info.c
+++ b/dpkg-deb/info.c
@@ -99,10 +99,7 @@ info_spew(const char *debar, const char *dir, const char 
*const *argv)
 
   while ((component = *argv++) != NULL) {
 varbuf_reset(controlfile);
-varbuf_add_str(controlfile, dir);
-varbuf_add_char(controlfile, '/');
-varbuf_add_str(controlfile, component);
-varbuf_end_str(controlfile);
+varbuf_printf(controlfile, %s/%s, dir, component);
 
 fd = open(controlfile.buf, O_RDONLY);
 if (fd = 0) {
@@ -136,20 +133,17 @@ info_list(const char *debar, const char *dir)
   FILE *cc;
   struct stat stab;
   int c;
-  size_t dirlen;
 
   cdn = scandir(dir, cdlist, ilist_select, alphasort);
   if (cdn == -1)
 ohshite(_(cannot scan directory `%.255s'), dir);
-  varbuf_add_str(controlfile, dir);
-  varbuf_add_char(controlfile, '/');
-  dirlen = controlfile.used;
 
   for (n = 0; n  cdn; n++) {
 cdep = cdlist[n];
-varbuf_trunc(controlfile, dirlen);
-varbuf_add_str(controlfile, cdep-d_name);
-varbuf_end_str(controlfile);
+
+varbuf_reset(controlfile);
+varbuf_printf(controlfile, %s/%s, dir, cdep-d_name);
+
 if (stat(controlfile.buf, stab))
   ohshite(_(cannot stat `%.255s' (in `%.255s')), cdep-d_name, dir);
 if (S_ISREG(stab.st_mode)) {
@@ -183,9 +177,8 @@ info_list(const char *debar, const char *dir)
   }
   free(cdlist);
 
-  varbuf_trunc(controlfile, dirlen);
-  varbuf_add_str(controlfile, CONTROLFILE);
-  varbuf_end_str(controlfile);
+  varbuf_reset(controlfile);
+  varbuf_printf(controlfile, %s/%s, dir, CONTROLFILE);
   cc = fopen(controlfile.buf, r);
   if (!cc) {
 if (errno != ENOENT)
@@ -215,19 +208,16 @@ static void
 info_field(const char *debar, const char *dir, const char *const *fields,
bool showfieldname)
 {
-  struct varbuf controlfile = VARBUF_INIT;
   FILE *cc;
+  char *controlfile;
   char fieldname[MAXFIELDNAME+1];
   char *pf;
   const char *const *fp;
   int c, lno, fnl;
   bool doing;
 
-  varbuf_add_str(controlfile, dir);
-  varbuf_add_char(controlfile, '/');
-  varbuf_add_str(controlfile, CONTROLFILE);
-  varbuf_end_str(controlfile);
-  cc = fopen(controlfile.buf, r);
+  m_asprintf(controlfile, %s/%s, dir, CONTROLFILE);
+  cc = fopen(controlfile, r);
   if (!cc)
 ohshite(_(could not open the `control' component));
   doing = true;
@@ -273,14 +263,14 @@ info_field(const char *debar, const char *dir, const char 
*const *fields,
 ohshite(_(error closing the '%s' component), CONTROLFILE);
   if (doing) putc('\n',stdout);
   m_output(stdout, _(standard output));
-  varbuf_destroy(controlfile);
+  free(controlfile);
 }
 
 int
 do_showinfo(const char *const *argv)
 {
-  struct varbuf controlfile = VARBUF_INIT;
   const char *debar, *dir;
+  char *controlfile;
   struct pkginfo *pkg;
   struct pkg_format_node *fmt = pkg_format_parse(showformat);
 
@@ -289,14 +279,11 @@ do_showinfo(const char *const *argv)
 
   info_prepare(argv, debar, dir, 1);
 
-  varbuf_add_str(controlfile, dir);
-  varbuf_add_char(controlfile, '/');
-  varbuf_add_str(controlfile, CONTROLFILE);
-  varbuf_end_str(controlfile);
-  parsedb(controlfile.buf,
+  m_asprintf(controlfile, %s/%s, dir, CONTROLFILE);
+  parsedb(controlfile,
   pdb_recordavailable | pdb_rejectstatus | pdb_ignorefiles, pkg);
   pkg_format_show(fmt, pkg, pkg-available);
-  varbuf_destroy(controlfile);
+  free(controlfile);
 
   return 0;
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-205-g773e6dc

2011-07-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 99b890c2eb6bfe955d85aedd40841366826c2f73
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 30 18:27:39 2011 +0200

build: Use the detected perl to invoke dpkg-architecture.pl

This will help building dpkg on systems where perl is not at
/usr/bin/perl, which we were already taking into consideration for the
resulting scripts but not during build.

diff --git a/debian/changelog b/debian/changelog
index e8069ad..4ee6e9c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -165,6 +165,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Unify somewhat dpkg-maintscript-helper --help output with other commands.
   * Add build-indep and build-arch targets as aliases for build in
 debian/rules.
+  * Use the perl interpreter found by configure to call dpkg-architecture.pl
+in the m4 DPKG_ARCHITECTURE macro.
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
   [ Bill Allombert]
diff --git a/m4/dpkg-arch.m4 b/m4/dpkg-arch.m4
index ddeeae0..b94a883 100644
--- a/m4/dpkg-arch.m4
+++ b/m4/dpkg-arch.m4
@@ -6,9 +6,10 @@
 # Use dpkg-architecture from the source tree to set sh_var using DEB_VAR for
 # the target architecture, to avoid duplicating its logic.
 AC_DEFUN([_DPKG_ARCHITECTURE], [
+AC_REQUIRE([DPKG_PROG_PERL])dnl
 AC_REQUIRE([AC_CANONICAL_HOST])dnl
 $2=$(cd $srcdir/scripts; \
-PERL5LIB=$(pwd) ./dpkg-architecture.pl -t$host -q$1 2/dev/null)
+PERL5LIB=$(pwd) $PERL dpkg-architecture.pl -t$host -q$1 2/dev/null)
 ])# _DPKG_ARCHITECURE
 
 # DPKG_CPU_TYPE

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-205-g773e6dc

2011-07-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c90b620cd8c2836a3f5058dfa1527f9d7b5cf46e
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 30 18:14:27 2011 +0200

build: Move DPKG_ARCHITECTURE macro call to the end

This puts together all build machinery checks, and will allow
DPKG_ARCHITECTURE to use the detected perl interpreter w/o needing
to call DPKG_PROG_PERL really early in the configure script.

diff --git a/configure.ac b/configure.ac
index 8079f36..c844b3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,6 @@ AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
 
 AC_USE_SYSTEM_EXTENSIONS
-DPKG_ARCHITECTURE
 
 AM_INIT_AUTOMAKE([1.8 foreign nostdinc])
 
@@ -89,10 +88,12 @@ AC_CHECK_FUNCS([strtoul strtoimax isascii bcopy memcpy 
setsid getdtablesize \
 
 DPKG_MMAP
 
+# Checks for the build machinery.
 AC_DEFINE(LIBDPKG_VOLATILE_API, 1, [Acknowledge the volatility of the API.])
 DPKG_COMPILER_WARNINGS
 DPKG_COMPILER_OPTIMISATIONS
 DPKG_LINKER_OPTIMISATIONS
+DPKG_ARCHITECTURE
 
 AC_CONFIG_FILES([ Makefile
  dpkg-deb/Makefile

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-205-g773e6dc

2011-07-30 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 773e6dcc0e8fcbd0f185f95d27184e9979a2411e
Author: Guillem Jover guil...@debian.org
Date:   Sat Jul 30 18:35:03 2011 +0200

build: Error out if the host dpkg architecture cannot be determined

Continuing will only produce a buggy dpkg.

diff --git a/m4/dpkg-arch.m4 b/m4/dpkg-arch.m4
index b94a883..8a490fa 100644
--- a/m4/dpkg-arch.m4
+++ b/m4/dpkg-arch.m4
@@ -57,7 +57,11 @@ AC_DEFUN([DPKG_ARCHITECTURE],
 DPKG_OS_TYPE
 AC_MSG_CHECKING([dpkg architecture name])
 _DPKG_ARCHITECTURE([DEB_HOST_ARCH], [dpkg_arch])
-AC_MSG_RESULT([$dpkg_arch])
+if test x$dpkg_arch = x; then
+   AC_MSG_ERROR([cannot determine host dpkg architecture])
+else
+   AC_MSG_RESULT([$dpkg_arch])
+fi
 AC_DEFINE_UNQUOTED(ARCHITECTURE, ${dpkg_arch},
[Set this to the canonical dpkg architecture name.])
 ])# DPKG_ARCHITECTURE

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 8561eeb48292a0495d13335d7f088fe66e8ea167
Author: Guillem Jover guil...@debian.org
Date:   Mon Jun 20 19:11:20 2011 +0200

dpkg-deb: Add new -v, --verbose option

Change --extract to honour --verbose and behave as --vextract.

Closes: #293280

diff --git a/debian/changelog b/debian/changelog
index f195a80..255790c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -175,6 +175,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 debian/rules.
   * Use the perl interpreter found by configure to call dpkg-architecture.pl
 in the m4 DPKG_ARCHITECTURE macro.
+  * Add new --verbose option to dpkg-deb and change --extract to honour it.
+Closes: #293280
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
   [ Updated dpkg translations ]
diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h
index 7ae4ccf..fb96742 100644
--- a/dpkg-deb/dpkg-deb.h
+++ b/dpkg-deb/dpkg-deb.h
@@ -31,6 +31,7 @@ action_func do_extract;
 action_func do_vextract;
 action_func do_fsystarfile;
 
+extern int opt_verbose;
 extern int debugflag, nocheckflag, oldformatflag;
 
 void extracthalf(const char *debar, const char *dir,
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 2dde994..7e1ba96 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -377,11 +377,16 @@ do_control(const char *const *argv)
 int
 do_extract(const char *const *argv)
 {
-  return controlextractvextract(0, xp, argv);
+  if (opt_verbose)
+return controlextractvextract(0, xpv, argv);
+  else
+return controlextractvextract(0, xp, argv);
 }
 
 int
 do_vextract(const char *const *argv)
 {
-  return controlextractvextract(0, xpv, argv);
+  /* XXX: Backward compatibility. */
+  opt_verbose = 1;
+  return do_extract(argv);
 }
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index 49cf5e5..fb2fd06 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -96,6 +96,7 @@ usage(const struct cmdinfo *cip, const char *value)
   printf(_(
 Options:\n
   --showformat=formatUse alternative format for --show.\n
+  -v, --verboseEnable verbose output.\n
   -D   Enable debugging output.\n
   --old, --new Select archive format.\n
   --nocheckSuppress control file check (build bad\n
@@ -130,6 +131,7 @@ static const char printforhelp[] =
  Type dpkg --help for help about installing and deinstalling packages.);
 
 int debugflag=0, nocheckflag=0, oldformatflag=BUILDOLDPKGFORMAT;
+int opt_verbose = 0;
 struct compressor *compressor = compressor_gzip;
 int compress_level = -1;
 
@@ -171,6 +173,7 @@ static const struct cmdinfo cmdinfos[]= {
   { new,   0,   0, oldformatflag, NULL, NULL,  0 },
   { old,   0,   0, oldformatflag, NULL, NULL,  1 },
   { debug, 'D', 0, debugflag, NULL, NULL,  1 },
+  { verbose,   'v', 0, opt_verbose,   NULL, NULL,  1 },
   { nocheck,   0,   0, nocheckflag,   NULL, NULL,  1 },
   { compression,   'z', 1, NULL,   NULL, set_compress_level 
},
   { compress_type, 'Z', 1, NULL,   NULL, setcompresstype  },
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 99cdc8e..4afc326 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -139,7 +139,9 @@ modified to match the contents of the package.
 .BR \-X ,  \-\-vextract  \fIarchive directory\fP
 Is like
 .BR \-\-extract  ( \-x )
-but prints a listing of the files extracted as it goes.
+with
+.BR \-\-verbose  ( \-v )
+which prints a listing of the files extracted as it goes.
 .TP
 .BR \-\-fsys\-tarfile  \fIarchive\fP
 Extracts the filesystem tree data from a binary package and sends it
@@ -213,6 +215,10 @@ Inhibits
 usual checks on the proposed contents of an archive. You can build
 any archive you want, no matter how broken, this way.
 .TP
+.BR \-v ,  \-\-verbose
+Enables verbose output. This currently only affects \fB\-\-extract\fP making
+it behave like \fB\-\-vextract\fP.
+.TP
 .BR \-D ,  \-\-debug
 Enables debugging output. This is not very interesting.
 .

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 02c28c63a34e252d75f893cb0869f9480f603822
Author: Guillem Jover guil...@debian.org
Date:   Tue Apr 26 07:35:16 2011 +0200

dpkg-deb: Add --raw-extract option combining --control and --extract

This allows to extract the control and file system members of a .deb
into a single directory using the same layout dpkg-deb -b expects for
building a package.

Closes: #552123

diff --git a/debian/changelog b/debian/changelog
index 255790c..1b72f8e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -177,6 +177,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 in the m4 DPKG_ARCHITECTURE macro.
   * Add new --verbose option to dpkg-deb and change --extract to honour it.
 Closes: #293280
+  * Add new --raw-extract option to dpkg-deb combining --control and
+--extract. Closes: #552123
   * Fix possible segfault of dpkg in findbreakcycle(). LP: #733414
 
   [ Updated dpkg translations ]
diff --git a/dpkg-deb/dpkg-deb.h b/dpkg-deb/dpkg-deb.h
index fb96742..1605967 100644
--- a/dpkg-deb/dpkg-deb.h
+++ b/dpkg-deb/dpkg-deb.h
@@ -29,6 +29,7 @@ action_func do_info;
 action_func do_field;
 action_func do_extract;
 action_func do_vextract;
+action_func do_raw_extract;
 action_func do_fsystarfile;
 
 extern int opt_verbose;
diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index 7e1ba96..f80955e 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -390,3 +390,35 @@ do_vextract(const char *const *argv)
   opt_verbose = 1;
   return do_extract(argv);
 }
+
+int
+do_raw_extract(const char *const *argv)
+{
+  const char *debar, *dir;
+  char *control_dir;
+
+  debar = *argv++;
+  if (debar == NULL)
+badusage(_(--%s needs a .deb filename argument), cipaction-olong);
+
+  dir = *argv++;
+  if (dir == NULL)
+badusage(_(--%s needs a target directory.\n
+   Perhaps you should be using dpkg --install ?),
+ cipaction-olong);
+  else if (*argv)
+badusage(_(--%s takes at most two arguments (.deb and directory)),
+ cipaction-olong);
+
+  m_asprintf(control_dir, %s/%s, dir, EXTRACTCONTROLDIR);
+
+  if (opt_verbose)
+extracthalf(debar, dir, xpv, 0);
+  else
+extracthalf(debar, dir, xp, 0);
+  extracthalf(debar, control_dir, x, 1);
+
+  free(control_dir);
+
+  return 0;
+}
diff --git a/dpkg-deb/main.c b/dpkg-deb/main.c
index fb2fd06..88f765c 100644
--- a/dpkg-deb/main.c
+++ b/dpkg-deb/main.c
@@ -79,6 +79,8 @@ usage(const struct cmdinfo *cip, const char *value)
   -e|--control deb [directory] Extract control info.\n
   -x|--extract deb directory   Extract files.\n
   -X|--vextract deb directory  Extract  list files.\n
+  -R|--raw-extract deb directory\n
+   Extract control info and files.\n
   --fsys-tarfile deb Output filesystem tarfile.\n
 \n));
 
@@ -167,6 +169,7 @@ static const struct cmdinfo cmdinfos[]= {
   ACTION(field, 'f', 0, do_field),
   ACTION(extract,   'x', 0, do_extract),
   ACTION(vextract,  'X', 0, do_vextract),
+  ACTION(raw-extract,   'R', 0, do_raw_extract),
   ACTION(fsys-tarfile,  0,   0, do_fsystarfile),
   ACTION(show,  'W', 0, do_showinfo),
 
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 4afc326..bd13e56 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -143,6 +143,13 @@ with
 .BR \-\-verbose  ( \-v )
 which prints a listing of the files extracted as it goes.
 .TP
+.BR \-R ,  \-\-raw\-extract  \fIarchive directory\fP
+Extracts the filesystem tree from a package archive into a specified
+directory, and the control information files into a DEBIAN subdirectory
+of the specified directory.
+
+The target directory (but not its parents) will be created if necessary.
+.TP
 .BR \-\-fsys\-tarfile  \fIarchive\fP
 Extracts the filesystem tree data from a binary package and sends it
 to standard output in

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 842e66ae6790805d87b51129b560d1a6b0e526b3
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 2 04:56:00 2011 +0200

libdpkg: Remove trailing semicolons from getc_mmap and ungetc_mmap

Those are unnecessary as these are function macros which need to be
followed by semicolons on the call sites.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 58b3110..898f996 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -369,8 +369,8 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
   pdone= 0;
 #define EOF_mmap(dataptr, endptr)  (dataptr = endptr)
-#define getc_mmap(dataptr) *dataptr++;
-#define ungetc_mmap(c, dataptr, data)  dataptr--;
+#define getc_mmap(dataptr) *dataptr++
+#define ungetc_mmap(c, dataptr, data)  dataptr--
 
   /* Loop per package. */
   for (;;) {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3d8951fdf5cc2fe3209540bc43c489208db8c306
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 14 04:37:31 2011 +0200

libdpkg: Move dataptr and endptr from parsedb() to struct parsedb_state

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 3b32572..e5048f9 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -311,6 +311,10 @@ pkg_parse_copy(struct parsedb_state *ps,
   }
 }
 
+#define EOF_mmap(ps)   ((ps)-dataptr = (ps)-endptr)
+#define getc_mmap(ps)  *(ps)-dataptr++
+#define ungetc_mmap(c, ps) (ps)-dataptr--
+
 /**
  * Parse an RFC-822 style file.
  *
@@ -325,7 +329,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
   struct pkginfo *new_pkg, *db_pkg;
   struct pkgbin *new_pkgbin, *db_pkgbin;
   int pdone;
-  char *data, *dataptr, *endptr;
+  char *data;
   struct stat st;
   struct parsedb_state ps;
   struct field_state fs;
@@ -355,25 +359,22 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
   if (st.st_size  0) {
 #ifdef USE_MMAP
-dataptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
-if (dataptr == MAP_FAILED)
+ps.dataptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+if (ps.dataptr == MAP_FAILED)
   ohshite(_(can't mmap package info file `%.255s'),filename);
 #else
-dataptr = m_malloc(st.st_size);
+ps.dataptr = m_malloc(st.st_size);
 
-if (fd_read(fd, dataptr, st.st_size)  0)
+if (fd_read(fd, ps.dataptr, st.st_size)  0)
   ohshite(_(reading package info file '%.255s'), filename);
 #endif
-data= dataptr;
-endptr = dataptr + st.st_size;
+data = ps.dataptr;
+ps.endptr = ps.dataptr + st.st_size;
   } else {
-data= dataptr= endptr= NULL;
+data = ps.dataptr = ps.endptr = NULL;
   }
 
   pdone= 0;
-#define EOF_mmap(dataptr, endptr)  (dataptr = endptr)
-#define getc_mmap(dataptr) *dataptr++
-#define ungetc_mmap(c, dataptr, data)  dataptr--
 
   /* Loop per package. */
   for (;;) {
@@ -383,22 +384,26 @@ int parsedb(const char *filename, enum parsedbflags flags,
 pkg_blank(new_pkg);
 
 /* Skip adjacent new lines. */
-while(!EOF_mmap(dataptr, endptr)) {
-  c= getc_mmap(dataptr); if (c!='\n'  c!=MSDOS_EOF_CHAR ) break;
+while (!EOF_mmap(ps)) {
+  c = getc_mmap(ps);
+  if (c != '\n'  c != MSDOS_EOF_CHAR)
+break;
   ps.lno++;
 }
-if (EOF_mmap(dataptr, endptr)) break;
+if (EOF_mmap(ps))
+  break;
 
 /* Loop per field. */
 for (;;) {
   bool blank_line;
 
-  fs.fieldstart = dataptr - 1;
-  while (!EOF_mmap(dataptr, endptr)  !isspace(c)  c!=':'  
c!=MSDOS_EOF_CHAR)
-c= getc_mmap(dataptr);
-  fs.fieldlen = dataptr - fs.fieldstart - 1;
-  while (!EOF_mmap(dataptr, endptr)  c != '\n'  isspace(c)) c= 
getc_mmap(dataptr);
-  if (EOF_mmap(dataptr, endptr))
+  fs.fieldstart = ps.dataptr - 1;
+  while (!EOF_mmap(ps)  !isspace(c)  c != ':'  c != MSDOS_EOF_CHAR)
+c = getc_mmap(ps);
+  fs.fieldlen = ps.dataptr - fs.fieldstart - 1;
+  while (!EOF_mmap(ps)  c != '\n'  isspace(c))
+c = getc_mmap(ps);
+  if (EOF_mmap(ps))
 parse_error(ps,
 _(EOF after field name `%.*s'), fs.fieldlen, 
fs.fieldstart);
   if (c == '\n')
@@ -413,11 +418,11 @@ int parsedb(const char *filename, enum parsedbflags flags,
 _(field name `%.*s' must be followed by colon),
 fs.fieldlen, fs.fieldstart);
   /* Skip space after ‘:’ but before value and EOL. */
-  while(!EOF_mmap(dataptr, endptr)) {
-c= getc_mmap(dataptr);
+  while (!EOF_mmap(ps)) {
+c = getc_mmap(ps);
 if (c == '\n' || !isspace(c)) break;
   }
-  if (EOF_mmap(dataptr, endptr))
+  if (EOF_mmap(ps))
 parse_error(ps,
 _(EOF before value of field `%.*s' (missing final 
newline)),
 fs.fieldlen, fs.fieldstart);
@@ -428,7 +433,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
 
   blank_line = false;
 
-  fs.valuestart = dataptr - 1;
+  fs.valuestart = ps.dataptr - 1;
   for (;;) {
 if (c == '\n' || c == MSDOS_EOF_CHAR) {
   if (blank_line)
@@ -436,32 +441,35 @@ int parsedb(const char *filename, enum parsedbflags flags,
 _(blank line in value of field '%.*s'),
 fs.fieldlen, fs.fieldstart);
   ps.lno++;
- if (EOF_mmap(dataptr, endptr)) break;
-  c= getc_mmap(dataptr);
+  if (EOF_mmap(ps))
+break;
+  c = getc_mmap(ps);
   /* Found double EOL, or start of new field. */
-  if (EOF_mmap(dataptr, endptr) || c == '\n' || !isspace(c)) break;
-  ungetc_mmap(c,dataptr, data);
+  if (EOF_mmap(ps) || c == '\n' || !isspace(c))
+break;
+  ungetc_mmap(c, ps);
   c= '\n

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7d06ea566bafe5d2914adbfa4820342f35829a37
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 14 17:21:55 2011 +0200

libdpkg: Refactor RFC-822 stanza parsing into new parse_stanza()

This generalizes the stanza parsing so that it can be used by other
parts of the code.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index e5048f9..7ddced1 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -315,6 +315,128 @@ pkg_parse_copy(struct parsedb_state *ps,
 #define getc_mmap(ps)  *(ps)-dataptr++
 #define ungetc_mmap(c, ps) (ps)-dataptr--
 
+typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs,
+  struct pkginfo *pkg, struct pkgbin *pkgbin);
+
+/**
+ * Parse an RFC-822 style stanza.
+ */
+static bool
+parse_stanza(struct parsedb_state *ps, struct field_state *fs,
+ parse_field_func *parse_field,
+ struct pkginfo *pkg, struct pkgbin *pkgbin)
+{
+  int c;
+
+  /* Skip adjacent new lines. */
+  while (!EOF_mmap(ps)) {
+c = getc_mmap(ps);
+if (c != '\n'  c != MSDOS_EOF_CHAR)
+  break;
+ps-lno++;
+  }
+
+  /* Nothing relevant parsed, bail out. */
+  if (EOF_mmap(ps))
+return false;
+
+  /* Loop per field. */
+  for (;;) {
+bool blank_line;
+
+/* Scan field name. */
+fs-fieldstart = ps-dataptr - 1;
+while (!EOF_mmap(ps)  !isspace(c)  c != ':'  c != MSDOS_EOF_CHAR)
+  c = getc_mmap(ps);
+fs-fieldlen = ps-dataptr - fs-fieldstart - 1;
+
+/* Skip spaces before ‘:’. */
+while (!EOF_mmap(ps)  c != '\n'  isspace(c))
+  c = getc_mmap(ps);
+
+/* Validate ‘:’. */
+if (EOF_mmap(ps))
+  parse_error(ps,
+  _(EOF after field name `%.*s'), fs-fieldlen, 
fs-fieldstart);
+if (c == '\n')
+  parse_error(ps,
+  _(newline in field name `%.*s'), fs-fieldlen, 
fs-fieldstart);
+if (c == MSDOS_EOF_CHAR)
+  parse_error(ps,
+  _(MSDOS EOF (^Z) in field name `%.*s'),
+  fs-fieldlen, fs-fieldstart);
+if (c != ':')
+  parse_error(ps,
+  _(field name `%.*s' must be followed by colon),
+  fs-fieldlen, fs-fieldstart);
+
+/* Skip space after ‘:’ but before value and EOL. */
+while (!EOF_mmap(ps)) {
+  c = getc_mmap(ps);
+  if (c == '\n' || !isspace(c))
+break;
+}
+if (EOF_mmap(ps))
+  parse_error(ps,
+  _(EOF before value of field `%.*s' (missing final 
newline)),
+  fs-fieldlen, fs-fieldstart);
+if (c == MSDOS_EOF_CHAR)
+  parse_error(ps,
+  _(MSDOS EOF char in value of field `%.*s' (missing 
newline?)),
+  fs-fieldlen, fs-fieldstart);
+
+blank_line = false;
+
+/* Scan field value. */
+fs-valuestart = ps-dataptr - 1;
+for (;;) {
+  if (c == '\n' || c == MSDOS_EOF_CHAR) {
+if (blank_line)
+  parse_error(ps,
+  _(blank line in value of field '%.*s'),
+  fs-fieldlen, fs-fieldstart);
+ps-lno++;
+
+if (EOF_mmap(ps))
+  break;
+c = getc_mmap(ps);
+
+/* Found double EOL, or start of new field. */
+if (EOF_mmap(ps) || c == '\n' || !isspace(c))
+  break;
+
+ungetc_mmap(c, ps);
+c = '\n';
+blank_line = true;
+  } else if (blank_line  !isspace(c)) {
+blank_line = false;
+  }
+
+  if (EOF_mmap(ps))
+parse_error(ps,
+_(EOF during value of field `%.*s' (missing final 
newline)),
+fs-fieldlen, fs-fieldstart);
+
+  c = getc_mmap(ps);
+}
+fs-valuelen = ps-dataptr - fs-valuestart - 1;
+
+/* Trim ending space on value. */
+while (fs-valuelen  isspace(*(fs-valuestart + fs-valuelen - 1)))
+  fs-valuelen--;
+
+parse_field(ps, fs, pkg, pkgbin);
+
+if (EOF_mmap(ps) || c == '\n' || c == MSDOS_EOF_CHAR)
+  break;
+  } /* Loop per field. */
+
+  if (c == '\n')
+ps-lno++;
+
+  return true;
+}
+
 /**
  * Parse an RFC-822 style file.
  *
@@ -378,100 +500,12 @@ int parsedb(const char *filename, enum parsedbflags 
flags,
 
   /* Loop per package. */
   for (;;) {
-int c;
-
 memset(fs.fieldencountered, 0, sizeof(fs.fieldencountered));
 pkg_blank(new_pkg);
 
-/* Skip adjacent new lines. */
-while (!EOF_mmap(ps)) {
-  c = getc_mmap(ps);
-  if (c != '\n'  c != MSDOS_EOF_CHAR)
-break;
-  ps.lno++;
-}
-if (EOF_mmap(ps))
+if (!parse_stanza(ps, fs, pkg_parse_field, new_pkg, new_pkgbin))
   break;
 
-/* Loop per field. */
-for (;;) {
-  bool blank_line;
-
-  fs.fieldstart = ps.dataptr - 1;
-  while (!EOF_mmap(ps)  !isspace(c)  c != ':'  c != MSDOS_EOF_CHAR)
-c = getc_mmap(ps);
-  fs.fieldlen = ps.dataptr - fs.fieldstart - 1;
-  while (!EOF_mmap(ps)  c != '\n'  isspace(c

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 926a204c1609d35de3a6500f8e96c9db0c315de4
Author: Guillem Jover guil...@debian.org
Date:   Thu Jul 14 03:58:45 2011 +0200

libdpkg: Add pkg and pkgbin to struct parsedb_state

We are passing these variables as arguments most of the time for
parse_error() and parse_warn() calls which are not run-time frequent,
this also unties somewhat the code from the package structures.

diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index b56dc1e..124d2d4 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -34,7 +34,7 @@
 #include dpkg/triglib.h
 
 static int
-parse_nv_next(struct parsedb_state *ps, const struct pkginfo *pigp,
+parse_nv_next(struct parsedb_state *ps,
   const char *what, const struct namevalue *nv_head,
   const char **strp)
 {
@@ -42,11 +42,11 @@ parse_nv_next(struct parsedb_state *ps, const struct 
pkginfo *pigp,
   const struct namevalue *nv;
 
   if (str_start[0] == '\0')
-parse_error(ps, pigp, _(%s is missing), what);
+parse_error(ps, _(%s is missing), what);
 
   nv = namevalue_find_by_name(nv_head, str_start);
   if (nv == NULL)
-parse_error(ps, pigp, _('%.50s' is not allowed for %s), str_start, what);
+parse_error(ps, _('%.50s' is not allowed for %s), str_start, what);
 
   /* We got the fallback value, skip further string validation. */
   if (nv-length == 0) {
@@ -62,15 +62,15 @@ parse_nv_next(struct parsedb_state *ps, const struct 
pkginfo *pigp,
 }
 
 static int
-parse_nv_last(struct parsedb_state *ps, const struct pkginfo *pkg,
+parse_nv_last(struct parsedb_state *ps,
   const char *what, const struct namevalue *nv_head,
   const char *str)
 {
   int value;
 
-  value = parse_nv_next(ps, pkg, what, nv_head, str);
+  value = parse_nv_next(ps, what, nv_head, str);
   if (str != NULL  str[0] != '\0')
-parse_error(ps, pkg, _(junk after %s), what);
+parse_error(ps, _(junk after %s), what);
 
   return value;
 }
@@ -84,7 +84,7 @@ f_name(struct pkginfo *pigp, struct pkgbin *pifp,
 
   e = pkg_name_is_illegal(value, NULL);
   if (e != NULL)
-parse_error(ps, pigp, _(invalid package name (%.250s)), e);
+parse_error(ps, _(invalid package name (%.250s)), e);
   /* We use the new name, as pkg_db_find() may have done a tolower for us. */
   pigp-name = pkg_db_find(value)-name;
 }
@@ -99,9 +99,9 @@ f_filecharf(struct pkginfo *pigp, struct pkgbin *pifp,
   int allowextend;
 
   if (!*value)
-parse_error(ps, pigp, _(empty file details field `%s'), fip-name);
+parse_error(ps, _(empty file details field `%s'), fip-name);
   if (!(ps-flags  pdb_recordavailable))
-parse_error(ps, pigp,
+parse_error(ps,
 _(file details field `%s' not allowed in status file),
fip-name);
   allowextend= !pigp-files;
@@ -114,7 +114,7 @@ f_filecharf(struct pkginfo *pigp, struct pkgbin *pifp,
 fdp= *fdpp;
 if (!fdp) {
   if (!allowextend)
-parse_error(ps, pigp,
+parse_error(ps,
 _(too many values in file details field `%s' 
   (compared to others)), fip-name);
   fdp= nfmalloc(sizeof(struct filedetails));
@@ -128,7 +128,7 @@ f_filecharf(struct pkginfo *pigp, struct pkgbin *pifp,
 cpos= space;
   }
   if (*fdpp)
-parse_error(ps, pigp,
+parse_error(ps,
 _(too few values in file details field `%s' 
   (compared to others)), fip-name);
 }
@@ -151,7 +151,7 @@ f_boolean(struct pkginfo *pigp, struct pkgbin *pifp,
   if (!*value)
 return;
 
-  boolean = parse_nv_last(ps, pigp, _(yes/no in boolean field),
+  boolean = parse_nv_last(ps, _(yes/no in boolean field),
   booleaninfos, value);
   PKGPFIELD(pifp, fip-integer, bool) = boolean;
 }
@@ -171,7 +171,7 @@ f_priority(struct pkginfo *pigp, struct pkgbin *pifp,
const char *value, const struct fieldinfo *fip)
 {
   if (!*value) return;
-  pigp-priority = parse_nv_last(ps, pigp, _(word in `priority' field),
+  pigp-priority = parse_nv_last(ps, _(word in `priority' field),
  priorityinfos, value);
   if (pigp-priority == pri_other) pigp-otherpriority= nfstrsave(value);
 }
@@ -182,18 +182,18 @@ f_status(struct pkginfo *pigp, struct pkgbin *pifp,
  const char *value, const struct fieldinfo *fip)
 {
   if (ps-flags  pdb_rejectstatus)
-parse_error(ps, pigp,
+parse_error(ps,
 _(value for `status' field not allowed in this context));
   if (ps-flags  pdb_recordavailable)
 return;
 
-  pigp-want = parse_nv_next(ps, pigp,
+  pigp-want = parse_nv_next(ps,
  _(first (want) word in `status' field),
  wantinfos, value);
-  pigp-eflag = parse_nv_next(ps, pigp,
+  pigp-eflag = parse_nv_next(ps,
   _(second (error) word in `status' field),
   eflaginfos, value

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-231-gf3a8ea5

2011-08-01 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 98aea15132c085be3901956986afaa46bf0456b1
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 2 04:54:42 2011 +0200

libdpkg: Make parse_stanza() a public function

Make public also the required parse helper macros and structures. At
least parse_EOF() will be needed for other callers to get out of the
loop when parsing multi-stanza files.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 491d9dd..46f3528 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -93,15 +93,6 @@ static const struct nickname nicknames[] = {
   { .nick = NULL }
 };
 
-struct field_state {
-  const char *fieldstart;
-  const char *valuestart;
-  struct varbuf value;
-  int fieldlen;
-  int valuelen;
-  int *fieldencountered;
-};
-
 /**
  * Parse the field and value into the package being constructed.
  */
@@ -311,17 +302,10 @@ pkg_parse_copy(struct parsedb_state *ps,
   }
 }
 
-#define parse_EOF(ps)  ((ps)-dataptr = (ps)-endptr)
-#define parse_getc(ps) *(ps)-dataptr++
-#define parse_ungetc(c, ps)(ps)-dataptr--
-
-typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs,
-  struct pkginfo *pkg, struct pkgbin *pkgbin);
-
 /**
  * Parse an RFC-822 style stanza.
  */
-static bool
+bool
 parse_stanza(struct parsedb_state *ps, struct field_state *fs,
  parse_field_func *parse_field,
  struct pkginfo *pkg, struct pkgbin *pkgbin)
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 08c34cd..12eb4ca 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -34,6 +34,26 @@ struct parsedb_state {
int lno;
 };
 
+#define parse_EOF(ps)  ((ps)-dataptr = (ps)-endptr)
+#define parse_getc(ps) *(ps)-dataptr++
+#define parse_ungetc(c, ps)(ps)-dataptr--
+
+struct field_state {
+   const char *fieldstart;
+   const char *valuestart;
+   struct varbuf value;
+   int fieldlen;
+   int valuelen;
+   int *fieldencountered;
+};
+
+typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs,
+  struct pkginfo *pkg, struct pkgbin *pkgbin);
+
+bool parse_stanza(struct parsedb_state *ps, struct field_state *fs,
+  parse_field_func *parse_field,
+  struct pkginfo *pkg, struct pkgbin *pkgbin);
+
 #define PKGIFPOFF(f) (offsetof(struct pkgbin, f))
 #define PKGPFIELD(pifp,of,type) (*(type*)((char*)(pifp)+(of)))
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-243-gfb18783

2011-08-04 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 6ee5e8af9dbcd2ef161e1174827ea4e48da09870
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 5 05:21:01 2011 +0200

libdpkg: Refactor parse_open() and parse_close() from parsedb()

This will allow code using parse_stanza() to avoid having to reimplement
the opening and closing logic.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index d05e996..13b447b 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -303,6 +303,53 @@ pkg_parse_copy(struct parsedb_state *ps,
 }
 
 /**
+ * Open a file for RFC-822 parsing.
+ */
+void
+parse_open(struct parsedb_state *ps, const char *filename,
+   enum parsedbflags flags)
+{
+  static int fd;
+  struct stat st;
+
+  ps-filename = filename;
+  ps-flags = flags;
+  ps-lno = 0;
+
+  fd = open(filename, O_RDONLY);
+  if (fd == -1)
+ohshite(_(failed to open package info file `%.255s' for reading),
+filename);
+
+  push_cleanup(cu_closefd, ~ehflag_normaltidy, NULL, 0, 1, fd);
+
+  if (fstat(fd, st) == -1)
+ohshite(_(can't stat package info file `%.255s'), filename);
+
+  if (st.st_size  0) {
+#ifdef USE_MMAP
+ps-dataptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+if (ps-dataptr == MAP_FAILED)
+  ohshite(_(can't mmap package info file `%.255s'), filename);
+#else
+ps-dataptr = m_malloc(st.st_size);
+
+if (fd_read(fd, ps-dataptr, st.st_size)  0)
+  ohshite(_(reading package info file '%.255s'), filename);
+#endif
+ps-data = ps-dataptr;
+ps-endptr = ps-dataptr + st.st_size;
+  } else {
+ps-data = ps-dataptr = ps-endptr = NULL;
+  }
+
+  pop_cleanup(ehflag_normaltidy);
+
+  if (close(fd))
+ohshite(_(failed to close after read: `%.255s'), filename);
+}
+
+/**
  * Parse an RFC-822 style stanza.
  */
 bool
@@ -422,6 +469,21 @@ parse_stanza(struct parsedb_state *ps, struct field_state 
*fs,
 }
 
 /**
+ * Close an RFC-822 parser context.
+ */
+void
+parse_close(struct parsedb_state *ps)
+{
+  if (ps-data != NULL) {
+#ifdef USE_MMAP
+munmap(ps-data, ps-endptr - ps-data);
+#else
+free(ps-data);
+#endif
+  }
+}
+
+/**
  * Parse an RFC-822 style file.
  *
  * donep may be NULL.
@@ -430,24 +492,19 @@ parse_stanza(struct parsedb_state *ps, struct field_state 
*fs,
 int parsedb(const char *filename, enum parsedbflags flags,
 struct pkginfo **donep)
 {
-  static int fd;
   struct pkginfo tmp_pkg;
   struct pkginfo *new_pkg, *db_pkg;
   struct pkgbin *new_pkgbin, *db_pkgbin;
   int fieldencountered[array_count(fieldinfos)];
   int pdone;
-  char *data;
-  struct stat st;
   struct parsedb_state ps;
   struct field_state fs;
 
-  ps.filename = filename;
-  ps.flags = flags;
-  ps.lno = 0;
-
   memset(fs, 0, sizeof(fs));
   fs.fieldencountered = fieldencountered;
 
+  parse_open(ps, filename, flags);
+
   new_pkg = tmp_pkg;
   if (flags  pdb_recordavailable)
 new_pkgbin = new_pkg-available;
@@ -457,35 +514,6 @@ int parsedb(const char *filename, enum parsedbflags flags,
   ps.pkg = new_pkg;
   ps.pkgbin = new_pkgbin;
 
-  fd= open(filename, O_RDONLY);
-  if (fd == -1) ohshite(_(failed to open package info file `%.255s' for 
reading),filename);
-
-  push_cleanup(cu_closefd, ~ehflag_normaltidy, NULL, 0, 1, fd);
-
-  if (fstat(fd, st) == -1)
-ohshite(_(can't stat package info file `%.255s'),filename);
-
-  if (st.st_size  0) {
-#ifdef USE_MMAP
-ps.dataptr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
-if (ps.dataptr == MAP_FAILED)
-  ohshite(_(can't mmap package info file `%.255s'),filename);
-#else
-ps.dataptr = m_malloc(st.st_size);
-
-if (fd_read(fd, ps.dataptr, st.st_size)  0)
-  ohshite(_(reading package info file '%.255s'), filename);
-#endif
-data = ps.dataptr;
-ps.endptr = ps.dataptr + st.st_size;
-  } else {
-data = ps.dataptr = ps.endptr = NULL;
-  }
-
-  pop_cleanup(ehflag_normaltidy);
-  if (close(fd))
-ohshite(_(failed to close after read: `%.255s'), filename);
-
   pdone= 0;
 
   /* Loop per package. */
@@ -520,13 +548,9 @@ int parsedb(const char *filename, enum parsedbflags flags,
 if (parse_EOF(ps))
   break;
   }
-  if (data != NULL) {
-#ifdef USE_MMAP
-munmap(data, st.st_size);
-#else
-free(data);
-#endif
-  }
+
+  parse_close(ps);
+
   varbuf_destroy(fs.value);
   if (donep  !pdone) ohshit(_(no package information in 
`%.255s'),filename);
 
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 12eb4ca..3563adb 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -28,6 +28,7 @@ struct parsedb_state {
enum parsedbflags flags;
struct pkginfo *pkg;
struct pkgbin *pkgbin;
+   char *data;
char *dataptr;
char *endptr;
const char *filename;
@@ -47,6 +48,10 @@ struct field_state {
int *fieldencountered;
 };
 
+void parse_open(struct parsedb_state *ps, const char *filename,
+enum parsedbflags flags);
+void parse_close(struct

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-243-gfb18783

2011-08-04 Thread Guillem Jover
The following commit has been merged in the master branch:
commit fb18783ce260a07d3f3a5f5a3a81640a45a9d089
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 5 06:23:59 2011 +0200

libdpkg: Initialize ps-pkg and ps-pkgbin to NULL in parse_open()

This guarantees the parsedb_state variable is in a sane state after
the parse_open() call.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 13b447b..5760eba 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -315,6 +315,8 @@ parse_open(struct parsedb_state *ps, const char *filename,
   ps-filename = filename;
   ps-flags = flags;
   ps-lno = 0;
+  ps-pkg = NULL;
+  ps-pkgbin = NULL;
 
   fd = open(filename, O_RDONLY);
   if (fd == -1)

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-248-ge84c47a

2011-08-08 Thread Guillem Jover
The following commit has been merged in the master branch:
commit e84c47aa298e9bd501f2ea353b4483f02c249eb8
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 9 07:19:09 2011 +0200

libdpkg: Use a generic pointer to pass the parsed object data around

This will allow code not parsing binary package control files to be
able to easily reuse the parser, by supplying their own object
structure.

Unfortunately this sacrifices the type-safety of the parse_stanza()
and parse_field() functions, but that only affects one variable,
which should be an acceptable tradeoff given the gain in code reuse.

diff --git a/lib/dpkg/parse.c b/lib/dpkg/parse.c
index 5760eba..c31b1f6 100644
--- a/lib/dpkg/parse.c
+++ b/lib/dpkg/parse.c
@@ -94,12 +94,24 @@ static const struct nickname nicknames[] = {
 };
 
 /**
+ * Package object being parsed.
+ *
+ * Structure used to hold the parsed data for the package being constructed,
+ * before it gets properly inserted into the package database.
+ */
+struct pkg_parse_object {
+  struct pkginfo *pkg;
+  struct pkgbin *pkgbin;
+};
+
+/**
  * Parse the field and value into the package being constructed.
  */
 static void
 pkg_parse_field(struct parsedb_state *ps, struct field_state *fs,
-struct pkginfo *pkg, struct pkgbin *pkgbin)
+void *parse_obj)
 {
+  struct pkg_parse_object *pkg_obj = parse_obj;
   const struct nickname *nick;
   const struct fieldinfo *fip;
   int *ip;
@@ -125,7 +137,7 @@ pkg_parse_field(struct parsedb_state *ps, struct 
field_state *fs,
 varbuf_add_buf(fs-value, fs-valuestart, fs-valuelen);
 varbuf_end_str(fs-value);
 
-fip-rcall(pkg, pkgbin, ps, fs-value.buf, fip);
+fip-rcall(pkg_obj-pkg, pkg_obj-pkgbin, ps, fs-value.buf, fip);
   } else {
 struct arbitraryfield *arp, **larpp;
 
@@ -133,7 +145,7 @@ pkg_parse_field(struct parsedb_state *ps, struct 
field_state *fs,
   parse_error(ps,
   _(user-defined field name `%.*s' too short),
   fs-fieldlen, fs-fieldstart);
-larpp = pkgbin-arbs;
+larpp = pkg_obj-pkgbin-arbs;
 while ((arp = *larpp) != NULL) {
   if (!strncasecmp(arp-name, fs-fieldstart, fs-fieldlen))
 parse_error(ps,
@@ -356,8 +368,7 @@ parse_open(struct parsedb_state *ps, const char *filename,
  */
 bool
 parse_stanza(struct parsedb_state *ps, struct field_state *fs,
- parse_field_func *parse_field,
- struct pkginfo *pkg, struct pkgbin *pkgbin)
+ parse_field_func *parse_field, void *parse_obj)
 {
   int c;
 
@@ -458,7 +469,7 @@ parse_stanza(struct parsedb_state *ps, struct field_state 
*fs,
 while (fs-valuelen  isspace(*(fs-valuestart + fs-valuelen - 1)))
   fs-valuelen--;
 
-parse_field(ps, fs, pkg, pkgbin);
+parse_field(ps, fs, parse_obj);
 
 if (parse_EOF(ps) || c == '\n' || c == MSDOS_EOF_CHAR)
   break;
@@ -497,6 +508,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
   struct pkginfo tmp_pkg;
   struct pkginfo *new_pkg, *db_pkg;
   struct pkgbin *new_pkgbin, *db_pkgbin;
+  struct pkg_parse_object pkg_obj;
   int fieldencountered[array_count(fieldinfos)];
   int pdone;
   struct parsedb_state ps;
@@ -516,6 +528,9 @@ int parsedb(const char *filename, enum parsedbflags flags,
   ps.pkg = new_pkg;
   ps.pkgbin = new_pkgbin;
 
+  pkg_obj.pkg = new_pkg;
+  pkg_obj.pkgbin = new_pkgbin;
+
   pdone= 0;
 
   /* Loop per package. */
@@ -523,7 +538,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
 memset(fieldencountered, 0, sizeof(fieldencountered));
 pkg_blank(new_pkg);
 
-if (!parse_stanza(ps, fs, pkg_parse_field, new_pkg, new_pkgbin))
+if (!parse_stanza(ps, fs, pkg_parse_field, pkg_obj))
   break;
 
 if (pdone  donep)
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index 3563adb..45735c3 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -53,11 +53,10 @@ void parse_open(struct parsedb_state *ps, const char 
*filename,
 void parse_close(struct parsedb_state *ps);
 
 typedef void parse_field_func(struct parsedb_state *ps, struct field_state *fs,
-  struct pkginfo *pkg, struct pkgbin *pkgbin);
+  void *parse_obj);
 
 bool parse_stanza(struct parsedb_state *ps, struct field_state *fs,
-  parse_field_func *parse_field,
-  struct pkginfo *pkg, struct pkgbin *pkgbin);
+  parse_field_func *parse_field, void *parse_obj);
 
 #define PKGIFPOFF(f) (offsetof(struct pkgbin, f))
 #define PKGPFIELD(pifp,of,type) (*(type*)((char*)(pifp)+(of)))

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ffc6888c5721e5e4451d8135827936fca761b157
Author: Guillem Jover guil...@debian.org
Date:   Sun Aug 14 22:45:20 2011 +0200

deb-src-control(5): Use linux-any in example control stanza

Instead of using the negated list of not supported architectures, just
use the positive form, which should be considered current best practice.

diff --git a/man/deb-src-control.5 b/man/deb-src-control.5
index 6fc32f9..76e2f9e 100644
--- a/man/deb-src-control.5
+++ b/man/deb-src-control.5
@@ -300,7 +300,7 @@ Vcs\-Browser: http://git.debian.org/?p=dpkg/dpkg.git
 Vcs\-Git: git://git.debian.org/git/dpkg/dpkg.git
 Standards\-Version: 3.7.3
 Build\-Depends: pkg\-config, debhelper (= 4.1.81),
- libselinux1\-dev (= 1.28\-4) [!hurd\-i386 !kfreebsd\-i386 !kfreebsd\-amd64]
+ libselinux1\-dev (= 1.28\-4) [!linux\-any]
 
 Package: dpkg\-dev
 Section: utils

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5c6be96b1c88c40d002a25295891ec81d8764f90
Author: Guillem Jover guil...@debian.org
Date:   Sun Aug 14 23:28:07 2011 +0200

dpkg-deb(1): Clarify the default compression-levels

diff --git a/debian/changelog b/debian/changelog
index 7259c77..24d45c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -191,6 +191,7 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 been fsync()ed and cannot be executed causing ETXTBSY when trying
 to open the to be installed paths for writing.
 Thanks to Jonathan Nieder jrnie...@gmail.com. Closes: #635683
+  * Clarify the default dpkg-deb compression-levels on the man page.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/man/dpkg-deb.1 b/man/dpkg-deb.1
index 4bf7ad6..26b684c 100644
--- a/man/dpkg-deb.1
+++ b/man/dpkg-deb.1
@@ -195,8 +195,8 @@ explanation of the \fB\-\-showformat\fP option in
 The default for this field is ${Package}\\t${Version}\\n.
 .TP
 .BI \-z compress-level
-Specify which compression level to pass to the compressor backend program,
-when building a package.
+Specify which compression level to use on the compressor backend, when
+building a package (default is 9 for gzip and bzip2, 6 for xz and lzma).
 .TP
 .BI \-Z compress-type
 Specify which compression type to use when building a package. Allowed

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 62449a0a27ab1231ed81267f7ee5421b9f7fcb0c
Author: Guillem Jover guil...@debian.org
Date:   Sun Aug 14 23:45:36 2011 +0200

Expand numeric literals and word abbreviation in usage error output

This avoids unneeded abbreviations, uses correct english, and should
help translators.

diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index df900a0..35c2d86 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -155,7 +155,7 @@ sub load_override_extra
 usage() and exit 1 if not $result;
 
 if (not @ARGV = 1  @ARGV = 3) {
-usageerr(_g(1 to 3 args expected));
+usageerr(_g(one to three arguments expected));
 }
 
 my $type = defined($options{type}) ? $options{type} : 'deb';
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index 8c4e46d..777fec3 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -299,7 +299,7 @@ sub main {
 my (@out);
 
 GetOptions(@Option_spec) or usage;
-@ARGV = 1  @ARGV = 3 or usageerr(_g(1 to 3 args expected\n));
+@ARGV = 1  @ARGV = 3 or usageerr(_g(one to three arguments 
expected));
 
 push @ARGV, undef  if @ARGV  2;
 push @ARGV, '' if @ARGV  3;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 4fdbd69d7b8ca2fff39798a6e6fc5fa3e229c66b
Author: Guillem Jover guil...@debian.org
Date:   Mon Aug 15 00:01:53 2011 +0200

dpkg-parsechangelog: Remove duplicate program name from usage error output

diff --git a/scripts/dpkg-parsechangelog.pl b/scripts/dpkg-parsechangelog.pl
index 34bf3fb..2ab7608 100755
--- a/scripts/dpkg-parsechangelog.pl
+++ b/scripts/dpkg-parsechangelog.pl
@@ -114,7 +114,7 @@ while (@ARGV) {
 }
 }
 
-@ARGV  usageerr(_g(%s takes no non-option arguments), $progname);
+@ARGV  usageerr(_g(takes no non-option arguments));
 
 my $count = 0;
 my @fields = changelog_parse(%options);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 36954c36abe3ce8e42b3c231579ef9e497f0da6d
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 19 12:59:35 2011 +0200

Dpkg::Compression: Change default values depending on the compressor used

This makes dpkg-source use more appropriate default compression values
depending on the compressor used.

Prompted-by: Timo Juhani Lindfors timo.lindf...@iki.fi

diff --git a/debian/changelog b/debian/changelog
index 9f29809..ec2e9ae 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -193,6 +193,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
 Thanks to Jonathan Nieder jrnie...@gmail.com. Closes: #635683
   * Clarify the default dpkg-deb compression-levels on the man page.
   * Clarify dpkg --update-avail usage error message. Closes: #628055
+  * Change Dpkg::Compression default values depending on the compressor
+used, and as such dpkg-source inherits this functionality.
+Prompted by Timo Juhani Lindfors timo.lindf...@iki.fi.
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index d339303..e124fe6 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -153,7 +153,7 @@ dpkg\-dev 1.15.5.
 Compression level to use. As with \fB\-Z\fP it only affects newly created
 files. Supported values are:
 .IR 1  to  9 ,  best , and  fast .
-\fI9\fP is the default.
+The default is \fI9\fP for gzip and bzip2, \fI6\fP for xz and lzma.
 .TP
 .BR \-i [\fIregexp\fP],  \-\-diff\-ignore [=\fIregexp\fP]
 You may specify a perl regular expression to match files you want
diff --git a/scripts/Dpkg/Compression.pm b/scripts/Dpkg/Compression.pm
index 0a5ed94..c83fb4e 100644
--- a/scripts/Dpkg/Compression.pm
+++ b/scripts/Dpkg/Compression.pm
@@ -18,7 +18,7 @@ package Dpkg::Compression;
 use strict;
 use warnings;
 
-our $VERSION = 1.00;
+our $VERSION = 1.01;
 
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
@@ -54,26 +54,30 @@ my $COMP = {
file_ext = gz,
comp_prog = [ gzip, --no-name, --rsyncable ],
decomp_prog = [ gunzip ],
+   default_level = 9,
 },
 bzip2 = {
file_ext = bz2,
comp_prog = [ bzip2 ],
decomp_prog = [ bunzip2 ],
+   default_level = 9,
 },
 lzma = {
file_ext = lzma,
comp_prog = [ 'xz', '--format=lzma' ],
decomp_prog = [ 'unxz', '--format=lzma' ],
+   default_level = 6,
 },
 xz = {
file_ext = xz,
comp_prog = [ xz ],
decomp_prog = [ unxz ],
+   default_level = 6,
 },
 };
 
 our $default_compression = gzip;
-our $default_compression_level = 9;
+our $default_compression_level = undef;
 
 =item $compression_re_file_ext
 
@@ -117,6 +121,7 @@ sub compression_is_supported {
 Returns the requested property of the compression method. Returns undef if
 either the property or the compression method doesn't exist. Valid
 properties currently include file_ext for the file extension,
+default_level for the default compression level,
 comp_prog for the name of the compression program and decomp_prog for
 the name of the decompression program.
 
@@ -173,25 +178,29 @@ sub compression_set_default {
 =item my $level = compression_get_default_level()
 
 Return the default compression level used when compressing data. It's 9
-unless Ccompression_set_default_level has been used to change it.
+for gzip and bzip2, 6 for xz and lzma, unless
+Ccompression_set_default_level has been used to change it.
 
 =item compression_set_default_level($level)
 
-Change the default compression level. Errors out if the
+Change the default compression level. Passing undef as the level will
+reset it to the compressor specific default, otherwise errors out if the
 level is not valid (see Ccompression_is_valid_level).
-either a number between 1 and 9 or fast
-or best.
 
 =cut
 
 sub compression_get_default_level {
-return $default_compression_level;
+if (defined $default_compression_level) {
+return $default_compression_level;
+} else {
+return compression_get_property($default_compression, default_level);
+}
 }
 
 sub compression_set_default_level {
 my ($level) = @_;
 error(_g(%s is not a compression level), $level)
-unless compression_is_valid_level($level);
+unless !defined($level) or compression_is_valid_level($level);
 $default_compression_level = $level;
 }
 
diff --git a/scripts/t/850_Dpkg_Compression.t b/scripts/t/850_Dpkg_Compression.t
index b792905..a8054f6 100644
--- a/scripts/t/850_Dpkg_Compression.t
+++ b/scripts/t/850_Dpkg_Compression.t
@@ -13,11 +13,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see http://www.gnu.org/licenses/.
 
-use Test::More tests = 9;
+use Test::More tests = 13;
 
 use strict;
 use warnings;
 
+use_ok('Dpkg::Compression');
 use_ok('Dpkg::Compression::FileHandle');
 
 my $tmpdir = t.tmp

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 31242e1aaabe7750b2b68ee96306e2cbdfd767bb
Author: Guillem Jover guil...@debian.org
Date:   Sat Aug 20 12:30:35 2011 +0200

u-a: Rename get_all_alternatives() to altdb_get_namelist()

This makes it clear we are referring to the filenames in the database
directory.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 9b0548a..0bea4b5 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -399,7 +399,7 @@ filter_altdir(const struct dirent *entry)
 }
 
 static int
-get_all_alternatives(struct dirent ***table)
+altdb_get_namelist(struct dirent ***table)
 {
int count;
 
@@ -480,7 +480,7 @@ config_all(void)
struct dirent **table;
int i, count;
 
-   count = get_all_alternatives(table);
+   count = altdb_get_namelist(table);
for (i = 0; i  count; i++) {
subcall(prog_path, --config, table[i]-d_name, NULL);
printf(\n);
@@ -2204,7 +2204,7 @@ main(int argc, char **argv)
alt_map_obj = alternative_map_new(NULL, NULL);
alt_map_links = alternative_map_new(NULL, NULL);
alt_map_parent = alternative_map_new(NULL, NULL);
-   count = get_all_alternatives(table);
+   count = altdb_get_namelist(table);
for (i = 0; i  count; i++) {
struct slave_link *sl;
struct alternative *a_new = alternative_new(table[i]-d_name);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit a27a8e1989b0937e9eee18c2153524c755aba058
Author: Guillem Jover guil...@debian.org
Date:   Sat Aug 20 09:51:13 2011 +0200

Do not use possessive «'s» after ‘s’ or ‘x’

diff --git a/debian/changelog b/debian/changelog
index 9aed1a7..9f29809 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1906,7 +1906,7 @@ dpkg (1.15.0) experimental; urgency=low
 - Cleanup and split of header files.
 
   [ Raphaël Hertzog ]
-  * Enhance dpkg-shlibdeps's error message when a library can't be found to
+  * Enhance dpkg-shlibdeps' error message when a library can't be found to
 include the ELF format of the desired library. Closes: #474671
   * dpkg-gensymbols now refuses empty values for the the -v -P and -e
 parameters.
@@ -2717,7 +2717,7 @@ dpkg (1.14.16) unstable; urgency=low
 is used. That way we're consistent with the definition of that variable
 in deb-substvars(5). Closes: #433477
   * Add support of Dm-Upload-Allowed field. Closes: #453400
-  * Fix dpkg-shlibdeps's filtering of duplicated dependencies in fields of
+  * Fix dpkg-shlibdeps' filtering of duplicated dependencies in fields of
 lesser priority (when -d is used).
   * Fix behaviour of dpkg-shlibdeps when the same binary was passed multiple
 times for use in different dependency fields (-d option).
diff --git a/man/dpkg-shlibdeps.1 b/man/dpkg-shlibdeps.1
index 96906e6..9bbc8eb 100644
--- a/man/dpkg-shlibdeps.1
+++ b/man/dpkg-shlibdeps.1
@@ -277,8 +277,8 @@ the RPATH of the binary, directories listed in 
/etc/ld.so.conf,
 directories listed in the LD_LIBRARY_PATH environment variable, and
 standard public directories (/lib, /usr/lib, /lib32, /usr/lib32, /lib64,
 /usr/lib64). Then it checks those directories in the package's build tree
-of the binary being analyzed, in the packages's build trees indicated with
-the \-S command-line option, in other packages's build trees that contains
+of the binary being analyzed, in the packages' build trees indicated with
+the \-S command-line option, in other packages' build trees that contains
 a DEBIAN/shlibs or DEBIAN/symbols file and finally in the root directory.
 If the library is not found in any of those directories, then you get this
 error.
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 46295c0..6503ce5 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -116,7 +116,7 @@
 #endif
 
 #if defined(OSLinux)
-/* This comes from TASK_COMM_LEN defined in Linux's include/linux/sched.h. */
+/* This comes from TASK_COMM_LEN defined in Linux' include/linux/sched.h. */
 #define PROCESS_NAME_SIZE 15
 #elif defined(OSsunos)
 #define PROCESS_NAME_SIZE 15
@@ -416,7 +416,7 @@ usage(void)
   -a|--startas pathname   program to start (default is executable)\n
   -r|--chroot directory   chroot to directory before starting\n
   -d|--chdir directorychange to directory (default is /)\n
-  -N|--nicelevel incr add incr to the process's nice level\n
+  -N|--nicelevel incr add incr to the process' nice level\n
   -P|--procsched policy[:prio]\n
 use policy with prio for the kernel\n
   process scheduler (default prio is 0)\n

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit ca9a2b79f85a8ed72308b5a2877ca8cfbda0b243
Author: Guillem Jover guil...@debian.org
Date:   Sat Aug 20 12:21:22 2011 +0200

u-a: Refactor scandir() namelist free into new altdb_free_namelist()

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 0bea4b5..863c03c 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -410,6 +410,14 @@ altdb_get_namelist(struct dirent ***table)
return count;
 }
 
+static void
+altdb_free_namelist(struct dirent **table, int n)
+{
+   while (n--)
+   free(table[n]);
+   free(table);
+}
+
 static int
 spawn(const char *prog, const char *args[])
 {
@@ -484,9 +492,8 @@ config_all(void)
for (i = 0; i  count; i++) {
subcall(prog_path, --config, table[i]-d_name, NULL);
printf(\n);
-   free(table[i]);
}
-   free(table);
+   altdb_free_namelist(table, count);
 }
 
 static bool
@@ -2211,7 +2218,6 @@ main(int argc, char **argv)
 
if (!alternative_load(a_new, true)) {
alternative_free(a_new);
-   free(table[i]);
continue;
}
alternative_map_add(alt_map_obj, a_new-master_name, a_new);
@@ -2221,10 +2227,8 @@ main(int argc, char **argv)
alternative_map_add(alt_map_links, sl-link, a_new);
alternative_map_add(alt_map_parent, sl-name, a_new);
}
-
-   free(table[i]);
}
-   free(table);
+   altdb_free_namelist(table, count);
 
/* Check that caller don't mix links between alternatives and don't mix
 * alternatives between slave/master, and that the various parameters

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit abda47fbe81e53da7d0a46237895bd225373d022
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 19 22:32:19 2011 +0200

u-a: Move alternative map loading to the actions that make use of them

This will reduce start up time, by not doing unneeded operations.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 2d3ed75..2dd16f3 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2100,8 +2100,6 @@ main(int argc, char **argv)
struct fileset *fileset = NULL;
/* Path of alternative we are offering. */
char *path = NULL, *current_choice = NULL;
-   /* Alternatives maps for checks */
-   struct alternative_map *alt_map_obj, *alt_map_links, *alt_map_parent;
const char *new_choice = NULL;
int i = 0;
 
@@ -2251,22 +2249,21 @@ main(int argc, char **argv)
   --config, --set, --set-selections, --install, 
   --remove, --all, --remove-all or --auto));
 
-   /* Load infos about all alternatives to be able to check for mistakes. 
*/
-   alt_map_obj = alternative_map_new(NULL, NULL);
-   alternative_map_load_names(alt_map_obj);
-
-   alt_map_links = alternative_map_new(NULL, NULL);
-   alt_map_parent = alternative_map_new(NULL, NULL);
-   alternative_map_load_tree(alt_map_links, alt_map_parent);
-
/* Check that caller don't mix links between alternatives and don't mix
 * alternatives between slave/master, and that the various parameters
 * are fine. */
if (strcmp(action, install) == 0) {
+   struct alternative_map *alt_map_links, *alt_map_parent;
struct alternative *found;
struct stat st;
struct slave_link *sl;
 
+   /* Load information about all alternatives to be able to
+* check for mistakes. */
+   alt_map_links = alternative_map_new(NULL, NULL);
+   alt_map_parent = alternative_map_new(NULL, NULL);
+   alternative_map_load_tree(alt_map_links, alt_map_parent);
+
found = alternative_map_find(alt_map_parent,
 inst_alt-master_name);
if (found  strcmp(found-master_name,
@@ -2358,8 +2355,12 @@ main(int argc, char **argv)
config_all();
exit(0);
} else if (strcmp(action, get-selections) == 0) {
+   struct alternative_map *alt_map_obj;
struct alternative_map *am;
 
+   alt_map_obj = alternative_map_new(NULL, NULL);
+   alternative_map_load_names(alt_map_obj);
+
for (am = alt_map_obj; am  am-item; am = am-next) {
char *current;
 
@@ -2372,7 +2373,11 @@ main(int argc, char **argv)
 
exit(0);
} else if (strcmp(action, set-selections) == 0) {
+   struct alternative_map *alt_map_obj;
+
log_msg(run with %s, get_argv_string(argc, argv));
+   alt_map_obj = alternative_map_new(NULL, NULL);
+   alternative_map_load_names(alt_map_obj);
alternative_set_selections(alt_map_obj, stdin, _(standard 
input));
exit(0);
}

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 774e918754bc7d801e802ea6ccbd9b5673799d8c
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 19 18:38:10 2011 +0200

u-a: Split alternative map loading into two functions

This will allow only loading them when needed, instead of doing it
for any action.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 863c03c..2d3ed75 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1867,6 +1867,51 @@ alternative_map_add(struct alternative_map *am, const 
char *key, struct alternat
}
 }
 
+static void
+alternative_map_load_names(struct alternative_map *alt_map_obj)
+{
+   struct dirent **table;
+   int i, count;
+
+   count = altdb_get_namelist(table);
+   for (i = 0; i  count; i++) {
+   struct alternative *a_new = alternative_new(table[i]-d_name);
+
+   if (!alternative_load(a_new, true)) {
+   alternative_free(a_new);
+   continue;
+   }
+   alternative_map_add(alt_map_obj, a_new-master_name, a_new);
+   }
+   altdb_free_namelist(table, count);
+}
+
+static void
+alternative_map_load_tree(struct alternative_map *alt_map_links,
+  struct alternative_map *alt_map_parent)
+{
+   struct dirent **table;
+   int i, count;
+
+   count = altdb_get_namelist(table);
+   for (i = 0; i  count; i++) {
+   struct slave_link *sl;
+   struct alternative *a_new = alternative_new(table[i]-d_name);
+
+   if (!alternative_load(a_new, true)) {
+   alternative_free(a_new);
+   continue;
+   }
+   alternative_map_add(alt_map_links, a_new-master_link, a_new);
+   alternative_map_add(alt_map_parent, a_new-master_name, a_new);
+   for (sl = a_new-slaves; sl; sl = sl-next) {
+   alternative_map_add(alt_map_links, sl-link, a_new);
+   alternative_map_add(alt_map_parent, sl-name, a_new);
+   }
+   }
+   altdb_free_namelist(table, count);
+}
+
 static const char *
 get_argv_string(int argc, char **argv)
 {
@@ -2057,9 +2102,8 @@ main(int argc, char **argv)
char *path = NULL, *current_choice = NULL;
/* Alternatives maps for checks */
struct alternative_map *alt_map_obj, *alt_map_links, *alt_map_parent;
-   struct dirent **table;
const char *new_choice = NULL;
-   int i = 0, count;
+   int i = 0;
 
setlocale(LC_ALL, );
bindtextdomain(dpkg, LOCALEDIR);
@@ -2209,26 +2253,11 @@ main(int argc, char **argv)
 
/* Load infos about all alternatives to be able to check for mistakes. 
*/
alt_map_obj = alternative_map_new(NULL, NULL);
+   alternative_map_load_names(alt_map_obj);
+
alt_map_links = alternative_map_new(NULL, NULL);
alt_map_parent = alternative_map_new(NULL, NULL);
-   count = altdb_get_namelist(table);
-   for (i = 0; i  count; i++) {
-   struct slave_link *sl;
-   struct alternative *a_new = alternative_new(table[i]-d_name);
-
-   if (!alternative_load(a_new, true)) {
-   alternative_free(a_new);
-   continue;
-   }
-   alternative_map_add(alt_map_obj, a_new-master_name, a_new);
-   alternative_map_add(alt_map_links, a_new-master_link, a_new);
-   alternative_map_add(alt_map_parent, a_new-master_name, a_new);
-   for (sl = a_new-slaves; sl; sl = sl-next) {
-   alternative_map_add(alt_map_links, sl-link, a_new);
-   alternative_map_add(alt_map_parent, sl-name, a_new);
-   }
-   }
-   altdb_free_namelist(table, count);
+   alternative_map_load_tree(alt_map_links, alt_map_parent);
 
/* Check that caller don't mix links between alternatives and don't mix
 * alternatives between slave/master, and that the various parameters

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 46aadad359a9e4204cfe707f47e3cfceef47e709
Author: Guillem Jover guil...@debian.org
Date:   Fri Aug 19 22:59:53 2011 +0200

u-a: Refactor --install argument checking into a new function

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 2dd16f3..73ac954 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2083,6 +2083,108 @@ alternative_evolve(struct alternative *a, struct 
alternative *b,
}
 }
 
+/**
+ * Check the alternative installation arguments.
+ *
+ * That the caller doesn't mix links between alternatives, doesn't mix
+ * alternatives between slave/master, and that the various parameters
+ * are fine.
+ */
+static void
+alternative_check_install_args(struct alternative *inst_alt,
+   struct fileset *fileset)
+{
+   struct alternative_map *alt_map_links, *alt_map_parent;
+   struct alternative *found;
+   struct slave_link *sl;
+   struct stat st;
+
+   /* Load information about all alternatives to check for mistakes. */
+   alt_map_links = alternative_map_new(NULL, NULL);
+   alt_map_parent = alternative_map_new(NULL, NULL);
+   alternative_map_load_tree(alt_map_links, alt_map_parent);
+
+   found = alternative_map_find(alt_map_parent, inst_alt-master_name);
+   if (found  strcmp(found-master_name, inst_alt-master_name) != 0) {
+   error(_(alternative %s can't be master: it is a slave of %s),
+ inst_alt-master_name, found-master_name);
+   }
+
+   found = alternative_map_find(alt_map_links, inst_alt-master_link);
+   if (found  strcmp(found-master_name, inst_alt-master_name) != 0) {
+   found = alternative_map_find(alt_map_parent,
+found-master_name);
+   error(_(alternative link %s is already managed by %s.),
+ inst_alt-master_link, found-master_name);
+   }
+
+   if (inst_alt-master_link[0] != '/')
+   error(_(alternative link is not absolute as it should be: %s),
+ inst_alt-master_link);
+
+   if (fileset-master_file[0] != '/')
+   error(_(alternative path is not absolute as it should be: %s),
+ fileset-master_file);
+
+   if (stat(fileset-master_file, st) == -1  errno == ENOENT)
+   error(_(alternative path %s doesn't exist.),
+ fileset-master_file);
+
+   if (strpbrk(inst_alt-master_name, / \t))
+   error(_(alternative name (%s) must not contain '/' 
+   and spaces.), inst_alt-master_name);
+
+   for (sl = inst_alt-slaves; sl; sl = sl-next) {
+   const char *file = fileset_get_slave(fileset, sl-name);
+
+   found = alternative_map_find(alt_map_parent, sl-name);
+   if (found 
+   strcmp(found-master_name, inst_alt-master_name) != 0) {
+   char *msg;
+
+   if (strcmp(found-master_name, sl-name) == 0)
+   msg = _(it is a master alternative.);
+   else
+   xasprintf(msg, _(it is a slave of %s),
+ found-master_name);
+   error(_(alternative %s can't be slave of %s: %s),
+ sl-name, inst_alt-master_name, msg);
+   }
+
+   found = alternative_map_find(alt_map_links, sl-link);
+   if (found 
+   strcmp(found-master_name, inst_alt-master_name) != 0) {
+   error(_(alternative link %s is already 
+   managed by %s.), sl-link,
+ found-master_name);
+   }
+   if (found) {
+   struct slave_link *sl2;
+
+   for (sl2 = found-slaves; sl2; sl2 = sl2-next)
+   if (strcmp(sl2-link, sl-link) == 0)
+   break;
+   if (sl2  strcmp(sl2-name, sl-name) != 0)
+   error(_(alternative link %s is already 
+   managed by %s (slave of %s).),
+ sl-link, sl2-name,
+ found-master_name);
+   }
+
+   if (sl-link[0] != '/')
+   error(_(alternative link is not absolute as 
+   it should be: %s), sl-link);
+
+   if (!file || file[0] != '/')
+   error(_(alternative path is not absolute as 
+   it should be: %s), file);
+
+   if (strpbrk(sl-name, / \t))
+   error(_(alternative name (%s) must not contain

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 52507504e69d6621262de82096987fdfb821bf8d
Author: Guillem Jover guil...@debian.org
Date:   Sat Aug 20 12:55:33 2011 +0200

u-a: Refactor alternative argument checks into new function

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 73ac954..20c2545 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2083,6 +2083,22 @@ alternative_evolve(struct alternative *a, struct 
alternative *b,
}
 }
 
+static void
+alternative_check_args(const char *name, const char *linkname, const char 
*file)
+{
+   if (strpbrk(name, / \t))
+   error(_(alternative name (%s) must not contain '/' 
+   and spaces.), name);
+
+   if (linkname[0] != '/')
+   error(_(alternative link is not absolute as it should be: %s),
+ linkname);
+
+   if (!file || file[0] != '/')
+   error(_(alternative path is not absolute as it should be: %s),
+ file);
+}
+
 /**
  * Check the alternative installation arguments.
  *
@@ -2118,22 +2134,13 @@ alternative_check_install_args(struct alternative 
*inst_alt,
  inst_alt-master_link, found-master_name);
}
 
-   if (inst_alt-master_link[0] != '/')
-   error(_(alternative link is not absolute as it should be: %s),
- inst_alt-master_link);
-
-   if (fileset-master_file[0] != '/')
-   error(_(alternative path is not absolute as it should be: %s),
- fileset-master_file);
+   alternative_check_args(inst_alt-master_name, inst_alt-master_link,
+  fileset-master_file);
 
if (stat(fileset-master_file, st) == -1  errno == ENOENT)
error(_(alternative path %s doesn't exist.),
  fileset-master_file);
 
-   if (strpbrk(inst_alt-master_name, / \t))
-   error(_(alternative name (%s) must not contain '/' 
-   and spaces.), inst_alt-master_name);
-
for (sl = inst_alt-slaves; sl; sl = sl-next) {
const char *file = fileset_get_slave(fileset, sl-name);
 
@@ -2171,17 +2178,7 @@ alternative_check_install_args(struct alternative 
*inst_alt,
  found-master_name);
}
 
-   if (sl-link[0] != '/')
-   error(_(alternative link is not absolute as 
-   it should be: %s), sl-link);
-
-   if (!file || file[0] != '/')
-   error(_(alternative path is not absolute as 
-   it should be: %s), file);
-
-   if (strpbrk(sl-name, / \t))
-   error(_(alternative name (%s) must not contain '/' 
-   and spaces.), sl-name);
+   alternative_check_args(sl-name, sl-link, file);
}
 }
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-270-g89973c5

2011-08-20 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 89973c5bb9eed790242a7d1d35564fd954edf554
Author: Guillem Jover guil...@debian.org
Date:   Sat Aug 20 15:36:00 2011 +0200

u-a: Do not build strings from parts in alternative_check_install_args

This makes the work of translators harder.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 20c2545..8e82bb6 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -2147,15 +2147,15 @@ alternative_check_install_args(struct alternative 
*inst_alt,
found = alternative_map_find(alt_map_parent, sl-name);
if (found 
strcmp(found-master_name, inst_alt-master_name) != 0) {
-   char *msg;
-
if (strcmp(found-master_name, sl-name) == 0)
-   msg = _(it is a master alternative.);
+   error(_(alternative %s can't be slave of %s: 
+   it is a master alternative.),
+ sl-name, inst_alt-master_name);
else
-   xasprintf(msg, _(it is a slave of %s),
- found-master_name);
-   error(_(alternative %s can't be slave of %s: %s),
- sl-name, inst_alt-master_name, msg);
+   error(_(alternative %s can't be slave of %s: 
+   it is a slave of %s),
+ sl-name, inst_alt-master_name,
+ found-master_name);
}
 
found = alternative_map_find(alt_map_links, sl-link);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-277-gf341818

2011-08-22 Thread Guillem Jover
The following commit has been merged in the master branch:
commit d97161c298625c8475b0b3d2d9e89e60ae56a5ff
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 23 03:55:27 2011 +0200

Dpkg::Source::Package: Use “-z” instead of “not -s”

diff --git a/scripts/Dpkg/Source/Package/V2.pm 
b/scripts/Dpkg/Source/Package/V2.pm
index 4912dfd..12d448a 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -501,7 +501,7 @@ sub do_build {
 my $tmpdiff = $self-generate_patch($dir, order_from = $autopatch,
 handle_binary = $handle_binary,
 usage = 'build');
-unless (not -s $tmpdiff or $self-{'options'}{'single_debian_patch'}
+unless (-z $tmpdiff or $self-{'options'}{'single_debian_patch'}
 or $self-{'options'}{'auto_commit'}) {
 info(_g(you can integrate the local changes with %s),
  dpkg-source --commit);
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm 
b/scripts/Dpkg/Source/Package/V3/quilt.pm
index 4db776b..2fbcba2 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -389,7 +389,7 @@ sub register_patch {
 erasedir(File::Spec-catdir($dir, .pc, $patch_name));
 }
 # Clean up empty series
-unlink($series) if not -s $series;
+unlink($series) if -z $series;
 }
 return $patch;
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-277-gf341818

2011-08-22 Thread Guillem Jover
The following commit has been merged in the master branch:
commit f3418186f6b093162d9e6b47e73d01d795c2ef98
Author: Guillem Jover guil...@debian.org
Date:   Tue Aug 23 05:24:39 2011 +0200

dpkg-source: Make single-debian-patch not abort on upstream changes

The single-debian-patch option usage in Dpkg::Source::Package::V2
was typoed as single_debian_patch, and thus not avoiding aborting
on upstream changes. Instead of fixing the typo, let's just not
expose single-debian-patch in Dpkg::Source::Package::V2, as it's
Dpkg::Source::Package::V3::quilt specific and as such a layer
violation, the code will just set auto_commit when single-debian-patch
is specified, which is the actual intended behaviour. Reflect this
explicitly in the man page.

Regression introduced in commit 46b688e4824f00842568b517b119eec34a5f7286.

Reported-by: Bernhard R. Link brl...@debian.org

diff --git a/man/dpkg-source.1 b/man/dpkg-source.1
index e124fe6..d649b0d 100644
--- a/man/dpkg-source.1
+++ b/man/dpkg-source.1
@@ -445,7 +445,7 @@ or \fBdebian\-changes\fP, depending on 
\fB\-\-single\-debian\-patch\fP) are
 applied. The temporary directory is compared to the source package
 directory. When the diff is non-empty, the build fails unless
 \fB\-\-single\-debian\-patch\fP or \fB\-\-auto\-commit\fP
-has been used. In the latter case, the diff is stored in the automatic patch.
+has been used, in which case the diff is stored in the automatic patch.
 If the automatic patch is created/deleted, it's added/removed from the
 series file and from the quilt metadata.
 
diff --git a/scripts/Dpkg/Source/Package/V2.pm 
b/scripts/Dpkg/Source/Package/V2.pm
index 12d448a..53a6699 100644
--- a/scripts/Dpkg/Source/Package/V2.pm
+++ b/scripts/Dpkg/Source/Package/V2.pm
@@ -501,8 +501,7 @@ sub do_build {
 my $tmpdiff = $self-generate_patch($dir, order_from = $autopatch,
 handle_binary = $handle_binary,
 usage = 'build');
-unless (-z $tmpdiff or $self-{'options'}{'single_debian_patch'}
-or $self-{'options'}{'auto_commit'}) {
+unless (-z $tmpdiff or $self-{'options'}{'auto_commit'}) {
 info(_g(you can integrate the local changes with %s),
  dpkg-source --commit);
 error(_g(aborting due to unexpected upstream changes, see %s),
diff --git a/scripts/Dpkg/Source/Package/V3/quilt.pm 
b/scripts/Dpkg/Source/Package/V3/quilt.pm
index 2fbcba2..e45016f 100644
--- a/scripts/Dpkg/Source/Package/V3/quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/quilt.pm
@@ -54,6 +54,8 @@ sub parse_cmdline_option {
 return 1 if $self-SUPER::parse_cmdline_option($opt);
 if ($opt =~ /^--single-debian-patch$/) {
 $self-{'options'}{'single-debian-patch'} = 1;
+# For backwards compatibility.
+$self-{'options'}{'auto_commit'} = 1;
 return 1;
 } elsif ($opt =~ /^--allow-version-of-quilt-db=(.*)$/) {
 push @{$self-{'options'}{'allow-version-of-quilt-db'}}, $1;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, squeeze, updated. 1.15.8.11-10-g736b921

2011-08-29 Thread Guillem Jover
The following commit has been merged in the squeeze branch:
commit 736b9213f7aa8ff50916e113582af711f9ca
Author: Guillem Jover guil...@debian.org
Date:   Tue Mar 15 01:24:28 2011 +0100

Add armhf support to ostable and triplettable

Cherry picked from commit 88b0c3043a651a422cd0c43c38ab6d553e2214ea.

Closes: #594179, #639674

diff --git a/debian/changelog b/debian/changelog
index f7416c2..3a19809 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,7 @@ dpkg (1.15.8.12) UNRELEASED; urgency=low
 been fsync()ed and cannot be executed causing ETXTBSY when trying
 to open the to be installed paths for writing.
 Thanks to Jonathan Nieder jrnie...@gmail.com. Closes: #635683
+  * Add armhf support to ostable and triplettable. Closes: #594179, #639674
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann). Minor fixe(s), including improvement by Flo.
diff --git a/ostable b/ostable
index 17b7581..4c81abe 100644
--- a/ostable
+++ b/ostable
@@ -16,6 +16,7 @@
 # Debian nameGNU name  config.guess regex
 uclibceabi-linux   linux-uclibceabilinux[^-]*-uclibceabi
 uclibc-linux   linux-uclibclinux[^-]*-uclibc
+gnueabihf-linuxlinux-gnueabihf linux[^-]*-gnueabihf
 gnueabi-linux  linux-gnueabi   linux[^-]*-gnueabi
 gnuspe-linux   linux-gnuspelinux[^-]*-gnuspe
 gnulp-linuxlinux-gnulp linux[^-]*-gnulp
diff --git a/triplettable b/triplettable
index 3e076e2..f47d68c 100644
--- a/triplettable
+++ b/triplettable
@@ -5,6 +5,7 @@
 # Debian triplet Debian arch
 uclibceabi-linux-arm   uclibc-linux-armel
 uclibc-linux-cpu uclibc-linux-cpu
+gnueabihf-linux-armarmhf
 gnueabi-linux-arm  armel
 gnuspe-linux-powerpc   powerpcspe
 gnulp-linux-i386   lpia

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3416f1d5c7a78e49a52f079b1e2a8576025650cb
Author: Guillem Jover guil...@debian.org
Date:   Fri Sep 9 07:19:27 2011 +0200

libdpkg: Add a test case for fd_md5()

diff --git a/lib/dpkg/test/t-buffer.c b/lib/dpkg/test/t-buffer.c
index f90167d..a34c182 100644
--- a/lib/dpkg/test/t-buffer.c
+++ b/lib/dpkg/test/t-buffer.c
@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * t-buffer.c - test buffer handling
  *
- * Copyright © 2009-2010 Guillem Jover guil...@debian.org
+ * Copyright © 2009-2011 Guillem Jover guil...@debian.org
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -25,24 +25,56 @@
 #include dpkg/buffer.h
 #include dpkg/dpkg.h
 
+#include sys/types.h
+
+#include unistd.h
+#include stdlib.h
 #include stdio.h
 
+static const char str_empty[] = ;
+static const char ref_hash_empty[] = d41d8cd98f00b204e9800998ecf8427e;
+static const char str_test[] = this is a test string\n;
+static const char ref_hash_test[] = 475aae3b885d70a9130eec23ab33f2b9;
+
 static void
 test_buffer_hash(void)
 {
-   const char str_test[] = this is a test string\n;
-   const char str_empty[] = ;
char hash[MD5HASHLEN + 1];
 
buffer_md5(str_empty, hash, strlen(str_empty));
-   test_str(hash, ==, d41d8cd98f00b204e9800998ecf8427e);
+   test_str(hash, ==, ref_hash_empty);
 
buffer_md5(str_test, hash, strlen(str_test));
-   test_str(hash, ==, 475aae3b885d70a9130eec23ab33f2b9);
+   test_str(hash, ==, ref_hash_test);
+}
+
+static void
+test_fdio_hash(void)
+{
+   char hash[MD5HASHLEN + 1];
+   char *test_file;
+   int fd;
+
+   test_file = strdup(test.XX);
+   test_pass(test_file != NULL);
+   fd = mkstemp(test_file);
+   test_pass(fd = 0);
+
+   fd_md5(fd, hash, -1, test empty file);
+   test_str(hash, ==, ref_hash_empty);
+
+   test_pass(write(fd, str_test, strlen(str_test)) == strlen(str_test));
+   test_pass(lseek(fd, 0, SEEK_SET) == 0);
+
+   fd_md5(fd, hash, -1, test filled file);
+   test_str(hash, ==, ref_hash_test);
+
+   test_pass(unlink(test_file) == 0);
 }
 
 static void
 test(void)
 {
test_buffer_hash();
+   test_fdio_hash();
 }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3650a669fb01737444656916a6a7a09e82800679
Author: Guillem Jover guil...@debian.org
Date:   Tue May 3 10:55:45 2011 +0200

libdpkg: Rename fd_null_copy() to fd_skip()

diff --git a/dpkg-deb/extract.c b/dpkg-deb/extract.c
index f80955e..737dab7 100644
--- a/dpkg-deb/extract.c
+++ b/dpkg-deb/extract.c
@@ -175,8 +175,8 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
   } else if (arh.ar_name[0] == '_') {
 /* Members with ‘_’ are noncritical, and if we don't understand
  * them we skip them. */
-fd_null_copy(arfd, memberlen + (memberlen  1),
- _(skipped archive member data from %s), debar);
+fd_skip(arfd, memberlen + (memberlen  1),
+_(skipped archive member data from %s), debar);
   } else {
if (strncmp(arh.ar_name, ADMINMEMBER, sizeof(arh.ar_name)) == 0)
  adminmember = 1;
@@ -201,8 +201,8 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
   ctrllennum= memberlen;
 }
 if (!adminmember != !admininfo) {
-  fd_null_copy(arfd, memberlen + (memberlen  1),
-   _(skipped archive member data from %s), debar);
+  fd_skip(arfd, memberlen + (memberlen  1),
+  _(skipped archive member data from %s), debar);
 } else {
   /* Yes! - found it. */
   break;
@@ -238,8 +238,8 @@ extracthalf(const char *debar, const char *dir, const char 
*taroption,
   memberlen = ctrllennum;
 } else {
   memberlen = stab.st_size - ctrllennum - strlen(ctrllenbuf) - l;
-  fd_null_copy(arfd, ctrllennum,
-   _(skipped archive control member data from %s), debar);
+  fd_skip(arfd, ctrllennum,
+  _(skipped archive control member data from %s), debar);
 }
 
 if (admininfo = 2) {
diff --git a/dpkg-split/join.c b/dpkg-split/join.c
index 95ed64a..1dd124e 100644
--- a/dpkg-split/join.c
+++ b/dpkg-split/join.c
@@ -55,7 +55,7 @@ void reassemble(struct partinfo **partlist, const char 
*outputfile) {
 fd_in = open(pi-filename, O_RDONLY);
 if (fd_in  0)
   ohshite(_(unable to (re)open input part file `%.250s'), pi-filename);
-fd_null_copy(fd_in, pi-headerlen, _(skipping split package header));
+fd_skip(fd_in, pi-headerlen, _(skipping split package header));
 fd_fd_copy(fd_in, fd_out, pi-thispartlen, _(split package part));
 close(fd_in);
 
diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index 436a22e..4ee158c 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -59,7 +59,7 @@ struct buffer_data {
 # define fd_vbuf_copy(fd, buf, limit, ...) \
buffer_copy_IntPtr(fd, BUFFER_READ_FD, buf, BUFFER_WRITE_VBUF, \
   limit, __VA_ARGS__)
-# define fd_null_copy(fd, limit, ...) \
+# define fd_skip(fd, limit, ...) \
buffer_skip_Int(fd, BUFFER_READ_FD, limit, __VA_ARGS__)
 
 off_t buffer_copy_IntPtr(int i, int typeIn, void *p, int typeOut,
diff --git a/src/archives.c b/src/archives.c
index f03bd5d..6e36409 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -191,9 +191,9 @@ tarfile_skip_one_forward(struct tarcontext *tc, struct 
tar_entry *ti)
   if (ti-type == tar_filetype_file) {
 char fnamebuf[256];
 
-fd_null_copy(tc-backendpipe, ti-size,
- _(skipped unpacking file '%.255s' (replaced or excluded?)),
- path_quote_filename(fnamebuf, ti-name, 256));
+fd_skip(tc-backendpipe, ti-size,
+_(skipped unpacking file '%.255s' (replaced or excluded?)),
+path_quote_filename(fnamebuf, ti-name, 256));
 r = ti-size % TARBLKSZ;
 if (r  0)
   if (fd_read(tc-backendpipe, databuf, TARBLKSZ - r)  0)
diff --git a/src/processarc.c b/src/processarc.c
index fa41833..250c38c 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -846,7 +846,7 @@ void process_archive(const char *filename) {
   ohshit(_(corrupted filesystem tarfile - corrupted package archive));
 }
   }
-  fd_null_copy(p1[0], -1, _(dpkg-deb: zap possible trailing zeros));
+  fd_skip(p1[0], -1, _(dpkg-deb: zap possible trailing zeros));
   close(p1[0]);
   p1[0] = -1;
   subproc_wait_check(pid, BACKEND  --fsys-tarfile, PROCPIPE);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 7585faa92009f15b06e346cddaa5e4ce92df7079
Author: Guillem Jover guil...@debian.org
Date:   Mon May 2 10:25:38 2011 +0200

libdpkg: Namespace buffer init and done functions with buffer_filter_

This makes it clear these functions are not to initialize normal
buffer operations, but just for when a filter is in place.

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index c99af0f..03cbf86 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -54,7 +54,7 @@ buffer_md5_init(struct buffer_data *data)
 }
 
 static off_t
-buffer_init(struct buffer_data *data)
+buffer_filter_init(struct buffer_data *data)
 {
switch (data-type) {
case BUFFER_WRITE_MD5:
@@ -84,7 +84,7 @@ buffer_md5_done(struct buffer_data *data)
 }
 
 static off_t
-buffer_done(struct buffer_data *data)
+buffer_filter_done(struct buffer_data *data)
 {
switch (data-type) {
case BUFFER_WRITE_MD5:
@@ -142,9 +142,9 @@ buffer_hash(const void *input, void *output, int type, 
off_t limit)
struct buffer_data data = { .arg.ptr = output, .type = type };
off_t ret;
 
-   buffer_init(data);
+   buffer_filter_init(data);
ret = buffer_write(data, input, limit);
-   buffer_done(data);
+   buffer_filter_done(data);
 
return ret;
 }
@@ -165,7 +165,7 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
 
buf = m_malloc(bufsize);
 
-   buffer_init(write_data);
+   buffer_filter_init(write_data);
 
while (bufsize  0) {
bytesread = buffer_read(read_data, buf, bufsize);
@@ -198,7 +198,7 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
if (limit  0)
ohshit(_(short read on buffer copy for %s), desc);
 
-   buffer_done(write_data);
+   buffer_filter_done(write_data);
 
free(buf);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3c83f54bfe1f7d17c878c0897f9762ea8adc64dc
Author: Guillem Jover guil...@debian.org
Date:   Fri Jun 17 14:11:43 2011 +0200

libdpkg: Rename BUFFER_WRITE_MD5 to BUFFER_FILTER_MD5

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 03cbf86..ce620dc 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -57,7 +57,7 @@ static off_t
 buffer_filter_init(struct buffer_data *data)
 {
switch (data-type) {
-   case BUFFER_WRITE_MD5:
+   case BUFFER_FILTER_MD5:
buffer_md5_init(data);
break;
}
@@ -87,7 +87,7 @@ static off_t
 buffer_filter_done(struct buffer_data *data)
 {
switch (data-type) {
-   case BUFFER_WRITE_MD5:
+   case BUFFER_FILTER_MD5:
buffer_md5_done(data);
break;
}
@@ -108,7 +108,7 @@ buffer_write(struct buffer_data *data, const void *buf, 
off_t length)
break;
case BUFFER_WRITE_NULL:
break;
-   case BUFFER_WRITE_MD5:
+   case BUFFER_FILTER_MD5:
MD5Updatestruct buffer_md5_ctx *)data-arg.ptr)-ctx), 
buf, length);
break;
default:
diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index 4ee158c..ce89470 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -35,7 +35,7 @@ DPKG_BEGIN_DECLS
 #define BUFFER_WRITE_VBUF  1
 #define BUFFER_WRITE_FD2
 #define BUFFER_WRITE_NULL  3
-#define BUFFER_WRITE_MD5   5
+#define BUFFER_FILTER_MD5  5
 
 #define BUFFER_READ_FD 0
 
@@ -48,10 +48,10 @@ struct buffer_data {
 };
 
 # define buffer_md5(buf, hash, limit) \
-   buffer_hash(buf, hash, BUFFER_WRITE_MD5, limit)
+   buffer_hash(buf, hash, BUFFER_FILTER_MD5, limit)
 
 # define fd_md5(fd, hash, limit, ...) \
-   buffer_copy_IntPtr(fd, BUFFER_READ_FD, hash, BUFFER_WRITE_MD5, \
+   buffer_copy_IntPtr(fd, BUFFER_READ_FD, hash, BUFFER_FILTER_MD5, \
   limit, __VA_ARGS__)
 # define fd_fd_copy(fd1, fd2, limit, ...) \
buffer_copy_IntInt(fd1, BUFFER_READ_FD, fd2, BUFFER_WRITE_FD, \

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2cd316401fa2451e266562cf689bdfc7b4c501e8
Author: Guillem Jover guil...@debian.org
Date:   Mon May 2 21:51:47 2011 +0200

libdpkg: Add new BUFFER_FILTER_NULL filter action

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index ce620dc..99015d2 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -57,6 +57,8 @@ static off_t
 buffer_filter_init(struct buffer_data *data)
 {
switch (data-type) {
+   case BUFFER_FILTER_NULL:
+   break;
case BUFFER_FILTER_MD5:
buffer_md5_init(data);
break;
@@ -87,6 +89,8 @@ static off_t
 buffer_filter_done(struct buffer_data *data)
 {
switch (data-type) {
+   case BUFFER_FILTER_NULL:
+   break;
case BUFFER_FILTER_MD5:
buffer_md5_done(data);
break;
@@ -107,6 +111,7 @@ buffer_write(struct buffer_data *data, const void *buf, 
off_t length)
ret = fd_write(data-arg.i, buf, length);
break;
case BUFFER_WRITE_NULL:
+   case BUFFER_FILTER_NULL:
break;
case BUFFER_FILTER_MD5:
MD5Updatestruct buffer_md5_ctx *)data-arg.ptr)-ctx), 
buf, length);
diff --git a/lib/dpkg/buffer.h b/lib/dpkg/buffer.h
index ce89470..3677d76 100644
--- a/lib/dpkg/buffer.h
+++ b/lib/dpkg/buffer.h
@@ -35,6 +35,8 @@ DPKG_BEGIN_DECLS
 #define BUFFER_WRITE_VBUF  1
 #define BUFFER_WRITE_FD2
 #define BUFFER_WRITE_NULL  3
+
+#define BUFFER_FILTER_NULL 4
 #define BUFFER_FILTER_MD5  5
 
 #define BUFFER_READ_FD 0

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 5f40ae0644cf266f533d63cdc8643164f4d6b3c3
Author: Guillem Jover guil...@debian.org
Date:   Thu Aug 25 20:40:42 2011 +0200

dpkg: Print a message instead of asserting on readlink/stat size discrepancy

This will help the user diagnose which file was affected and in
correcting the situation, which in most cases is due to file system
breakage, or non POSIX compliance.

Closes: #639229

diff --git a/debian/changelog b/debian/changelog
index 977d27d..4967e00 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -202,6 +202,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Change Dpkg::Compression default values depending on the compressor
 used, and as such dpkg-source inherits this functionality.
 Prompted by Timo Juhani Lindfors timo.lindf...@iki.fi.
+  * Print an actual error or warning message instead of assert()ing on
+readlink()/stat() size discrepancies. Closes: #639229
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/archives.c b/src/archives.c
index 6e36409..a275b55 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -830,7 +830,9 @@ tarobject(void *ctx, struct tar_entry *ti)
   r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size);
   if (r  0)
 ohshite(_(unable to read link `%.255s'), ti-name);
-  assert(r == stab.st_size);
+  else if (r != stab.st_size)
+ohshit(_(symbolic link '%.250s' size has changed from %jd to %zd),
+   fnamevb.buf, stab.st_size, r);
   varbuf_trunc(symlinkfn, r);
   varbuf_end_str(symlinkfn);
   if (symlink(symlinkfn.buf,fnametmpvb.buf))
diff --git a/src/configure.c b/src/configure.c
index 4a38db0..c75e8c3 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -418,8 +418,12 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
   (= '%s'): %s),
pkg-name, in, result-buf, 
strerror(errno));
return -1;
+   } else if (r != stab.st_size) {
+   warning(_(symbolic link '%.250s' size has 
+ changed from %jd to %zd),
+   result-buf, stab.st_size, r);
+   return -1;
}
-   assert(r == stab.st_size); /* XXX: debug */
varbuf_trunc(target, r);
varbuf_end_str(target);
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit a23c74e708972c7e566ea8255728184393963825
Author: Guillem Jover guil...@debian.org
Date:   Thu Aug 25 20:40:02 2011 +0200

dpkg: Change type of variable r from int to ssize_t in conffderef()

diff --git a/src/configure.c b/src/configure.c
index 97689c1..4a38db0 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -375,7 +375,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
 {
static struct varbuf target = VARBUF_INIT;
struct stat stab;
-   int r;
+   ssize_t r;
int loopprotect;
 
varbuf_reset(result);
@@ -424,7 +424,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, 
const char *in)
varbuf_end_str(target);
 
debug(dbg_conffdetail,
- conffderef readlink gave %d, '%s',
+ conffderef readlink gave %zd, '%s',
  r, target.buf);
 
if (target.buf[0] == '/') {

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 2b824afa6bb06b7cb757423b248f6907e9919e86
Author: Guillem Jover guil...@debian.org
Date:   Mon May 2 21:51:47 2011 +0200

libdpkg: Detangle buffer filter logic from write logic

diff --git a/lib/dpkg/buffer.c b/lib/dpkg/buffer.c
index 99015d2..f0cf91f 100644
--- a/lib/dpkg/buffer.c
+++ b/lib/dpkg/buffer.c
@@ -66,6 +66,26 @@ buffer_filter_init(struct buffer_data *data)
return 0;
 }
 
+static off_t
+buffer_filter_update(struct buffer_data *filter, const void *buf, off_t length)
+{
+   off_t ret = length;
+
+   switch (filter-type) {
+   case BUFFER_FILTER_NULL:
+   break;
+   case BUFFER_FILTER_MD5:
+   MD5Updatestruct buffer_md5_ctx *)filter-arg.ptr)-ctx),
+ buf, length);
+   break;
+   default:
+   internerr(unknown data type '%i' in buffer_filter_update,
+ filter-type);
+   }
+
+   return ret;
+}
+
 static void
 buffer_md5_done(struct buffer_data *data)
 {
@@ -111,10 +131,6 @@ buffer_write(struct buffer_data *data, const void *buf, 
off_t length)
ret = fd_write(data-arg.i, buf, length);
break;
case BUFFER_WRITE_NULL:
-   case BUFFER_FILTER_NULL:
-   break;
-   case BUFFER_FILTER_MD5:
-   MD5Updatestruct buffer_md5_ctx *)data-arg.ptr)-ctx), 
buf, length);
break;
default:
internerr(unknown data type '%i' in buffer_write,
@@ -142,20 +158,22 @@ buffer_read(struct buffer_data *data, void *buf, off_t 
length)
 }
 
 off_t
-buffer_hash(const void *input, void *output, int type, off_t limit)
+buffer_filter(const void *input, void *output, int type, off_t limit)
 {
struct buffer_data data = { .arg.ptr = output, .type = type };
off_t ret;
 
buffer_filter_init(data);
-   ret = buffer_write(data, input, limit);
+   ret = buffer_filter_update(data, input, limit);
buffer_filter_done(data);
 
return ret;
 }
 
 static off_t
-buffer_copy(struct buffer_data *read_data, struct buffer_data *write_data,
+buffer_copy(struct buffer_data *read_data,
+struct buffer_data *filter,
+struct buffer_data *write_data,
 off_t limit, const char *desc)
 {
char *buf;
@@ -170,7 +188,7 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
 
buf = m_malloc(bufsize);
 
-   buffer_filter_init(write_data);
+   buffer_filter_init(filter);
 
while (bufsize  0) {
bytesread = buffer_read(read_data, buf, bufsize);
@@ -187,6 +205,8 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
bufsize = limit;
}
 
+   buffer_filter_update(filter, buf, bytesread);
+
byteswritten = buffer_write(write_data, buf, bytesread);
if (byteswritten  0)
break;
@@ -203,7 +223,7 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
if (limit  0)
ohshit(_(short read on buffer copy for %s), desc);
 
-   buffer_filter_done(write_data);
+   buffer_filter_done(filter);
 
free(buf);
 
@@ -212,11 +232,13 @@ buffer_copy(struct buffer_data *read_data, struct 
buffer_data *write_data,
 
 off_t
 buffer_copy_IntInt(int Iin, int Tin,
+   void *Pfilter, int Tfilter,
int Iout, int Tout,
off_t limit, const char *desc, ...)
 {
va_list args;
struct buffer_data read_data = { .type = Tin, .arg.i = Iin };
+   struct buffer_data filter = { .type = Tfilter, .arg.ptr = Pfilter };
struct buffer_data write_data = { .type = Tout, .arg.i = Iout };
struct varbuf v = VARBUF_INIT;
off_t ret;
@@ -225,7 +247,7 @@ buffer_copy_IntInt(int Iin, int Tin,
varbuf_vprintf(v, desc, args);
va_end(args);
 
-   ret = buffer_copy(read_data, write_data, limit, v.buf);
+   ret = buffer_copy(read_data, filter, write_data, limit, v.buf);
 
varbuf_destroy(v);
 
@@ -234,11 +256,13 @@ buffer_copy_IntInt(int Iin, int Tin,
 
 off_t
 buffer_copy_IntPtr(int Iin, int Tin,
+   void *Pfilter, int Tfilter,
void *Pout, int Tout,
off_t limit, const char *desc, ...)
 {
va_list args;
struct buffer_data read_data = { .type = Tin, .arg.i = Iin };
+   struct buffer_data filter = { .type = Tfilter, .arg.ptr = Pfilter };
struct buffer_data write_data = { .type = Tout, .arg.ptr = Pout };
struct varbuf v = VARBUF_INIT;
off_t ret;
@@ -247,7 +271,7 @@ buffer_copy_IntPtr(int Iin, int Tin,
varbuf_vprintf(v, desc, args);
va_end(args);
 
-   ret = buffer_copy(read_data, write_data, limit, v.buf);
+   ret = buffer_copy(read_data

[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit c7c7522dd3e29af582eddda7b10b521337a7b21c
Author: Guillem Jover guil...@debian.org
Date:   Tue Sep 6 04:19:03 2011 +0200

u-a: Split xreadlink() allocation code into areadlink()

Using a bool as an argument for a function already taking several
arguments is almost never a good interface, it's not clear from
the call sites what it refers to and as such prone to confusion.

Split the main xreadlink() code into a function that allocates but
can return NULL, and make xreadlink() use the common semantics of
never failing.

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 8e82bb6..44a3114 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -280,34 +280,44 @@ xstrdup(const char *str)
 }
 
 static char *
-xreadlink(const char *linkname, bool error_out)
+areadlink(const char *linkname)
 {
struct stat st;
char *buf;
ssize_t size;
 
/* Allocate required memory to store the value of the symlink */
-   if (lstat(linkname, st)) {
-   if (!error_out)
-   return NULL;
-   syserr(_(cannot stat file '%s'), linkname);
-   }
+   if (lstat(linkname, st))
+   return NULL;
buf = xmalloc(st.st_size + 1);
 
/* Read it and terminate the string properly */
size = readlink(linkname, buf, st.st_size);
if (size == -1) {
-   if (!error_out) {
-   free(buf);
-   return NULL;
-   }
-   syserr(_(unable to read link `%.255s'), linkname);
+   int saved_errno = errno;
+
+   free(buf);
+   errno = saved_errno;
+
+   return NULL;
}
buf[size] = '\0';
 
return buf;
 }
 
+static char *
+xreadlink(const char *linkname)
+{
+   char *buf;
+
+   buf = areadlink(linkname);
+   if (buf == NULL)
+   syserr(_(unable to read link `%.255s'), linkname);
+
+   return buf;
+}
+
 static int DPKG_ATTR_VPRINTF(2)
 xvasprintf(char **strp, const char *fmt, va_list args)
 {
@@ -1421,7 +1431,7 @@ alternative_get_current(struct alternative *a)
return NULL;
 
xasprintf(curlink, %s/%s, altdir, a-master_name);
-   file = xreadlink(curlink, true);
+   file = xreadlink(curlink);
free(curlink);
 
return file;
@@ -1757,7 +1767,7 @@ alternative_is_broken(struct alternative *a)
return true;
 
/* Check master link */
-   altlnk = xreadlink(a-master_link, false);
+   altlnk = areadlink(a-master_link);
if (!altlnk)
return true;
xasprintf(wanted, %s/%s, altdir, a-master_name);
@@ -1784,7 +1794,7 @@ alternative_is_broken(struct alternative *a)
char *sl_altlnk, *sl_current;
 
/* Verify link - /etc/alternatives/foo */
-   sl_altlnk = xreadlink(sl-link, false);
+   sl_altlnk = areadlink(sl-link);
if (!sl_altlnk)
return true;
xasprintf(wanted, %s/%s, altdir, sl-name);
@@ -1795,7 +1805,7 @@ alternative_is_broken(struct alternative *a)
}
free(sl_altlnk);
/* Verify /etc/alternatives/foo - file */
-   sl_current = xreadlink(wanted, false);
+   sl_current = areadlink(wanted);
free(wanted);
if (!sl_current)
return true;
@@ -2065,7 +2075,7 @@ alternative_evolve(struct alternative *a, struct 
alternative *b,
char *lnk;
 
xasprintf(lnk, %s/%s, altdir, sl-name);
-   new_file = xreadlink(lnk, false);
+   new_file = areadlink(lnk);
free(lnk);
}
if (strcmp(old, new) != 0  lstat(old, st) == 0 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 3518e4d159412c31c2de413b7bc358870b6c5c02
Author: Guillem Jover guil...@debian.org
Date:   Thu Sep 8 10:19:28 2011 +0200

u-a: Refactor alternative_path_classify from alternative_can_replace_path

diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c
index 03ceb6d..e7516aa 100644
--- a/utils/update-alternatives.c
+++ b/utils/update-alternatives.c
@@ -1646,25 +1646,39 @@ alternative_commit(struct alternative *a)
alternative_commit_operations_free(a);
 }
 
-static bool
-alternative_can_replace_path(const char *linkname)
+enum alternative_path_status {
+   ALT_PATH_SYMLINK,
+   ALT_PATH_MISSING,
+   ALT_PATH_OTHER,
+};
+
+static enum alternative_path_status
+alternative_path_classify(const char *linkname)
 {
struct stat st;
-   bool replace_link;
-
-   if (opt_force)
-   return true;
 
errno = 0;
if (lstat(linkname, st) == -1) {
if (errno != ENOENT)
syserr(_(cannot stat file '%s'), linkname);
-   replace_link = true;
+   return ALT_PATH_MISSING;
+   } else if (S_ISLNK(st.st_mode)) {
+   return ALT_PATH_SYMLINK;
} else {
-   replace_link = S_ISLNK(st.st_mode);
+   return ALT_PATH_OTHER;
}
+}
 
-   return replace_link;
+static bool
+alternative_can_replace_path(const char *linkname)
+{
+   if (opt_force)
+   return true;
+
+   if (alternative_path_classify(linkname) == ALT_PATH_OTHER)
+   return false;
+   else
+   return true;
 }
 
 static void

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



[SCM] dpkg's main repository branch, master, updated. 1.16.0.3-309-g2ccd37b

2011-09-09 Thread Guillem Jover
The following commit has been merged in the master branch:
commit 920596da263ed1342668a9fe5b59f8bbb52445dd
Author: Guillem Jover guil...@debian.org
Date:   Thu Sep 1 15:17:35 2011 +0200

dpkg: Fix double “error:” string in missing PATH error output

Closes: #639997

diff --git a/debian/changelog b/debian/changelog
index 468f3ac..f50c38c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -207,6 +207,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Update alternative links only if they change. This allows for a
 read-only file system and a writable database. Closes: #636700
 Based on a patch by Salvatore Bonaccorso car...@debian.org.
+  * Fix double “error:” string in dpkg missing PATH error output.
+Closes: #639997
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
diff --git a/src/help.c b/src/help.c
index fa33b1a..e9ffd2e 100644
--- a/src/help.c
+++ b/src/help.c
@@ -104,7 +104,7 @@ void checkpath(void) {
 
   path_list = getenv(PATH);
   if (!path_list)
-ohshit(_(error: PATH is not set.));
+ohshit(_(PATH is not set.));
 
   for (prog = prog_list; *prog; prog++) {
 struct stat stab;

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



<    8   9   10   11   12   13   14   15   16   17   >