[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 0535fac53f385a866946e978fd35a10185d162fc Author: Guillem Jover guil...@debian.org Date: Sat Jul 10 09:12:39 2010 +0200 build: Skip all dpkg-divert tests if the binary is not available diff --git a/scripts/t/950_dpkg_divert.t b/scripts/t/950_dpkg_divert.t index bff9e1e..8d7b58d 100644 --- a/scripts/t/950_dpkg_divert.t +++ b/scripts/t/950_dpkg_divert.t @@ -28,6 +28,11 @@ my $testdir = File::Spec-rel2abs($tmpdir/testdir); my @dd = ($builddir/../src/dpkg-divert); +if (! -x @dd) { +plan skip_all = dpkg-divert not available; +exit(0); +} + plan tests = 235; sub cleanup { -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 0581dda824f26e9eec996ebf4de5f6474336bec2 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 11:44:41 2010 +0200 build: Add optional code coverage support Enable code coverage support with 'configure --enable-coverage'. Use gcov and lcov for C code coverage, and Devel::Cover and cover for Perl code coverage. diff --git a/.gitignore b/.gitignore index 4d48623..8052d2a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,10 @@ # Inherited ignores *.a *.o +*.gcno +*.gcda +*.gcov +*.lcov .*.swp .deps/ Makefile diff --git a/Makecheck.am b/Makecheck.am index b88c1ea..afeeefc 100644 --- a/Makecheck.am +++ b/Makecheck.am @@ -4,6 +4,7 @@ # # TEST_VERBOSE - set to 0 or 1 to control test suite verbosity # TEST_ENV_VARS - environment variables to be set for the test suite +# TEST_COVERAGE - set to the perl module in charge of getting test coverage # test_tmpdir - test suite temporary directory # test_cases - list of test case files # test_data - list of test data files @@ -16,6 +17,7 @@ check-local: $(test_data) $(test_cases) PATH=$(top_builddir)/src:$(top_builddir)/scripts:$(top_builddir)/utils:$(PATH) \ srcdir=$(srcdir) builddir=$(builddir) \ PERL5LIB=$(top_srcdir)/scripts PERL_DL_NONLAZY=1 \ + PERL5OPT=$(TEST_COVERAGE) \ $(PERL) -I$(top_srcdir)/scripts \ -MExtUtils::Command::MM -e test_harness($(TEST_VERBOSE), '.') \ $(addprefix $(srcdir)/,$(test_cases)) diff --git a/Makefile.am b/Makefile.am index b6d634e..a18c4e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,9 +72,50 @@ EXTRA_DIST = \ doc: doc/Doxyfile $(DOXYGEN) doc/Doxyfile -clean-local: +doc-clean: rm -rf doc/html/ +# Code coverage support + +.PHONY: coverage coverage-clean + +if COVERAGE_ENABLED +LCOV_OPTS = -q --checksum +LCOV_CAPTURE_OPTS = $(LCOV_OPTS) --no-recursion \ + -d $(top_builddir)/lib/dpkg \ + -d $(top_builddir)/src \ + -d $(top_builddir)/utils + +coverage: all + $(RM) -f *.lcov + find -name '*.gcda' -o -name '*.gcov' | xargs $(RM) -f + + $(LCOV) $(LCOV_CAPTURE_OPTS) -c -o dpkg_base.lcov -i + $(MAKE) -C lib/dpkg check + $(MAKE) -C src check + $(MAKE) -C utils check + $(LCOV) $(LCOV_CAPTURE_OPTS) -c -o dpkg_test.lcov + $(LCOV) $(LCOV_OPTS) -a dpkg_base.lcov -a dpkg_test.lcov \ + -o dpkg_merge.lcov + $(LCOV) $(LCOV_OPTS) -r dpkg_merge.lcov '/usr/include/*' -o dpkg.lcov + $(LCOV_GENHTML) -q --legend --title dpkg C code coverage \ + --html-prolog $(top_srcdir)/doc/lcov-prolog \ + --html-epilog $(top_srcdir)/doc/lcov-epilog \ + -o doc/coverage dpkg.lcov + + $(MAKE) -C scripts $@ + +coverage-clean: + rm -rf doc/coverage/ + find -name '*.gcno' -o -name '*.gcda' -o \ +-name '*.gcov' -o -name '*.lcov' | xargs rm -f +else +coverage: + @echo Need to reconfigure with --enable-coverage + +coverage-clean: +endif + .PHONY: update-po update-po: @@ -102,3 +143,4 @@ dist-hook: done ; \ fi +clean-local: doc-clean coverage-clean diff --git a/configure.ac b/configure.ac index 6d79ae5..b741769 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO]) DPKG_PROG_PO4A DPKG_PROG_PERL DPKG_PROG_POD2MAN +DPKG_CODE_COVERAGE # Checks for operating system services and capabilities. AC_SYS_LARGEFILE diff --git a/doc/.gitignore b/doc/.gitignore index acdcabb..5211926 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -1,2 +1,3 @@ Doxyfile html +coverage diff --git a/doc/lcov-epilog b/doc/lcov-epilog new file mode 100644 index 000..8bc660c --- /dev/null +++ b/doc/lcov-epilog @@ -0,0 +1,8 @@ + table width=100% border=0 cellspacing=0 cellpadding=0 +tr + td class=coverFilea href=scripts/coverage.htmlscripts/a/td +/tr + /table + br / +/body +/html diff --git a/doc/lcov-prolog b/doc/lcov-prolog new file mode 100644 index 000..49f2a4b --- /dev/null +++ b/doc/lcov-prolog @@ -0,0 +1,8 @@ +!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN +html lang=en +head + meta http-equiv=Content-Type content=text/html; charset=UTF-8 + title@pagetitle@/title + link rel=stylesheet type=text/css href=@base...@gcov.css +/head +body diff --git a/m4/dpkg-coverage.m4 b/m4/dpkg-coverage.m4 new file mode 100644 index 000..7a18795 --- /dev/null +++ b/m4/dpkg-coverage.m4 @@ -0,0 +1,51 @@ +# Copyright © 2010 Guillem Jover guil...@debian.org + +# DPKG_CODE_COVERAGE +# -- +# Add configuration option to enable code coverage support. +AC_DEFUN([DPKG_CODE_COVERAGE], +[ +AC_ARG_ENABLE(coverage, + AS_HELP_STRING([--enable-coverage], + [whether to enable code coverage]), + [], + [enable_coverage=no]) +AM_CONDITIONAL(COVERAGE_ENABLED, test x$enable_coverage = xyes) + +if
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit d647c878fb04db22dd0cfa7a57bee8f1d3caeac8 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 15:49:27 2010 +0200 dpkg-split: Namespace global option variables to not shadow local ones diff --git a/dpkg-split/dpkg-split.h b/dpkg-split/dpkg-split.h index 64b331a..4fd0bf7 100644 --- a/dpkg-split/dpkg-split.h +++ b/dpkg-split/dpkg-split.h @@ -51,10 +51,13 @@ struct partqueue { extern dofunction *action; extern const struct cmdinfo *cipaction; -extern long maxpartsize; -extern const char *depotdir, *outputfile; extern struct partqueue *queue; -extern int npquiet, msdos; + +extern long opt_maxpartsize; +extern const char *opt_depotdir; +extern const char *opt_outputfile; +extern int opt_npquiet; +extern int opt_msdos; void rerr(const char *fn) DPKG_ATTR_NORET; void rerreof(FILE *f, const char *fn) DPKG_ATTR_NORET; diff --git a/dpkg-split/join.c b/dpkg-split/join.c index 7a4e950..ad9fb06 100644 --- a/dpkg-split/join.c +++ b/dpkg-split/join.c @@ -135,13 +135,13 @@ void do_join(const char *const *argv) { for (i=0; irefi-maxpartn; i++) { if (!partlist[i]) ohshit(_(part %d is missing),i+1); } - if (!outputfile) { + if (!opt_outputfile) { p= nfmalloc(strlen(refi-package)+1+strlen(refi-version)+sizeof(DEBEXT)); strcpy(p,refi-package); strcat(p,-); strcat(p,refi-version); strcat(p,DEBEXT); -outputfile= p; +opt_outputfile = p; } - reassemble(partlist,outputfile); + reassemble(partlist, opt_outputfile); } diff --git a/dpkg-split/main.c b/dpkg-split/main.c index 82a672d..a143eb0 100644 --- a/dpkg-split/main.c +++ b/dpkg-split/main.c @@ -98,10 +98,13 @@ const char printforhelp[]= N_(Type dpkg-split --help for help.); dofunction *action=NULL; const struct cmdinfo *cipaction=NULL; -long maxpartsize= SPLITPARTDEFMAX; -const char *depotdir= ADMINDIR / PARTSDIR, *outputfile= NULL; struct partqueue *queue= NULL; -int npquiet= 0, msdos= 0; + +long opt_maxpartsize = SPLITPARTDEFMAX; +const char *opt_depotdir = ADMINDIR / PARTSDIR; +const char *opt_outputfile = NULL; +int opt_npquiet = 0; +int opt_msdos = 0; void rerr(const char *fn) { ohshite(_(error reading %.250s), fn); @@ -124,8 +127,8 @@ static void setpartsize(const struct cmdinfo *cip, const char *value) { if (newpartsize = 0 || newpartsize (INT_MAX 10)) badusage(_(part size is far too large or is not positive)); - maxpartsize= newpartsize 10; - if (maxpartsize = HEADERALLOWANCE) + opt_maxpartsize = newpartsize 10; + if (opt_maxpartsize = HEADERALLOWANCE) badusage(_(part size must be at least %d KiB (to allow for header)), (HEADERALLOWANCE 10) + 1); } @@ -151,11 +154,11 @@ static const struct cmdinfo cmdinfos[]= { { discard, 'd', 0, NULL, NULL, setaction }, { help, 'h', 0, NULL, NULL, usage }, { version, 0, 0, NULL, NULL, printversion}, - { depotdir, 0, 1, NULL, depotdir, NULL }, + { depotdir, 0, 1, NULL, opt_depotdir,NULL}, { partsize, 'S', 1, NULL, NULL, setpartsize }, - { output, 'o', 1, NULL, outputfile, NULL }, - { npquiet, 'Q', 0, npquiet, NULL, NULL, 1 }, - { msdos, 0, 0, msdos, NULL,NULL, 1 }, + { output, 'o', 1, NULL, opt_outputfile, NULL}, + { npquiet, 'Q', 0, opt_npquiet, NULL, NULL, 1 }, + { msdos, 0, 0, opt_msdos, NULL, NULL, 1 }, { NULL, 0 } }; @@ -182,12 +185,12 @@ int main(int argc, const char *const *argv) { if (!cipaction) badusage(_(need an action option)); - l= strlen(depotdir); - if (l depotdir[l-1] != '/') { + l = strlen(opt_depotdir); + if (l opt_depotdir[l - 1] != '/') { p= nfmalloc(l+2); -strcpy(p,depotdir); +strcpy(p, opt_depotdir); strcpy(p+l,/); -depotdir= p; +opt_depotdir = p; } setvbuf(stdout,NULL,_IONBF,0); diff --git a/dpkg-split/queue.c b/dpkg-split/queue.c index a2ed837..69ac976 100644 --- a/dpkg-split/queue.c +++ b/dpkg-split/queue.c @@ -84,16 +84,17 @@ void scandepot(void) { char *p; assert(!queue); - depot= opendir(depotdir); - if (!depot) ohshite(_(unable to read depot directory `%.250s'),depotdir); + depot = opendir(opt_depotdir); + if (!depot) +ohshite(_(unable to read depot directory `%.250s'), opt_depotdir); while ((de= readdir(depot))) { if (de-d_name[0] == '.') continue; pq= nfmalloc(sizeof(struct partqueue)); pq-info.fmtversion= pq-info.package= pq-info.version= NULL; pq-info.orglength= pq-info.thispartoffset= pq-info.thispartlen= 0; pq-info.headerlen= 0; -p= nfmalloc(strlen(depotdir)+strlen(de-d_name)+1); -
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 7562f4ce74a04167ef2e9927304b15ae4b8cb6e9 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 15:50:29 2010 +0200 dpkg: Rename the remove variable to skip to not shadow remove(3) diff --git a/src/filters.c b/src/filters.c index 874eb60..d512e10 100644 --- a/src/filters.c +++ b/src/filters.c @@ -64,7 +64,7 @@ bool filter_should_skip(struct TarInfo *ti) { struct filter_node *f; - bool remove = false; + bool skip = false; if (!filter_head) return false; @@ -76,11 +76,11 @@ filter_should_skip(struct TarInfo *ti) if (fnmatch(f-pattern, ti-Name[1], 0) == 0) { if (f-include) { - remove = false; + skip = false; debug(dbg_eachfile, filter including %s, ti-Name); } else { - remove = true; + skip = true; debug(dbg_eachfile, filter removing %s, ti-Name); } @@ -93,7 +93,7 @@ filter_should_skip(struct TarInfo *ti) * directories than necessary, but better err on the side of caution * than failing with “no such file or directory” (which would leave * the package in a very bad state). */ - if (remove (ti-Type == Directory || ti-Type == SymbolicLink)) { + if (skip (ti-Type == Directory || ti-Type == SymbolicLink)) { debug(dbg_eachfile, filter seeing if '%s' needs to be reincluded, ti-Name[1]); @@ -124,5 +124,5 @@ filter_should_skip(struct TarInfo *ti) } } - return remove; + return skip; } -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 20a523e176f4c3c81cdade68ba71c45c421dfadc Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 19:42:02 2010 +0200 dpkg: Rename symlink variable to target to not shadow symlink(2) diff --git a/src/configure.c b/src/configure.c index f0a7053..e717cfc 100644 --- a/src/configure.c +++ b/src/configure.c @@ -368,7 +368,7 @@ deferred_configure(struct pkginfo *pkg) int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) { - static struct varbuf symlink = VARBUF_INIT; + static struct varbuf target = VARBUF_INIT; struct stat stab; int r; int loopprotect; @@ -405,9 +405,9 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) return -1; } - varbufreset(symlink); - varbuf_grow(symlink, stab.st_size + 1); - r = readlink(result-buf, symlink.buf, symlink.size); + varbufreset(target); + varbuf_grow(target, stab.st_size + 1); + r = readlink(result-buf, target.buf, target.size); if (r 0) { warning(_(%s: unable to readlink conffile '%s'\n (= '%s'): %s), @@ -415,14 +415,14 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) return -1; } assert(r == stab.st_size); /* XXX: debug */ - symlink.used = r; - varbufaddc(symlink, '\0'); + target.used = r; + varbufaddc(target, '\0'); debug(dbg_conffdetail, conffderef readlink gave %d, '%s', - r, symlink.buf); + r, target.buf); - if (symlink.buf[0] == '/') { + if (target.buf[0] == '/') { varbufreset(result); varbufaddstr(result, instdir); debug(dbg_conffdetail, @@ -433,7 +433,8 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) if (r 0) { warning(_(%s: conffile '%.250s' resolves to degenerate filename\n ('%s' is a symlink to '%s')), - pkg-name, in, result-buf, symlink.buf); + pkg-name, in, result-buf, + target.buf); return -1; } if (result-buf[r] == '/') @@ -443,7 +444,7 @@ conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) conffderef readlink relative to '%.*s', (int)result-used, result-buf); } - varbufaddbuf(result, symlink.buf, symlink.used); + varbufaddbuf(result, target.buf, target.used); varbufaddc(result, 0); } else { warning(_(%s: conffile '%.250s' is not a plain file or symlink (= '%s')), -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit f530505861321e8d8a9e70cf5fd86278778b58d1 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 18:51:32 2010 +0200 u-a: Remove unneeded const from fileset_add_slave string arguments The arguments were later on cast to remove the constness, so just fix the prototype of the function. diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index 41a2062..5c0c939 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -529,7 +529,7 @@ fileset_free(struct fileset *fs) /* name and file must be allocated with malloc */ static void -fileset_add_slave(struct fileset *fs, const char *name, const char *file) +fileset_add_slave(struct fileset *fs, char *name, char *file) { struct slave_file *sl, *cur, *prev = NULL; @@ -546,8 +546,8 @@ fileset_add_slave(struct fileset *fs, const char *name, const char *file) /* Otherwise add new at the end */ sl = xmalloc(sizeof(*sl)); sl-next = NULL; - sl-name = (char *)name; - sl-file = (char *)file; + sl-name = name; + sl-file = file; if (prev) prev-next = sl; else -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit a9746761e3237e4cee5c5c7f5851b62b4de8ed37 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 19:00:56 2010 +0200 u-a: Rename variable index to idx to not shadow index(3) diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index 5c0c939..04c333d 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -1409,7 +1409,7 @@ alternative_select_choice(struct alternative *a) { char *current, *ret, selection[_POSIX_PATH_MAX]; struct fileset *best, *fs; - int len, index; + int len, idx; current = alternative_get_current(a); best = alternative_get_best(a); @@ -1435,16 +1435,16 @@ alternative_select_choice(struct alternative *a) mark = ; pr(%s %-12d %-*s % -10d %s, mark, 0, len, best-master_file, best-priority, _(auto mode)); - index = 1; + idx = 1; for (fs = a-choices; fs; fs = fs-next) { if (a-status == ALT_ST_MANUAL current strcmp(current, fs-master_file) == 0) mark = *; else mark = ; - pr(%s %-12d %-*s % -10d %s, mark, index, len, + pr(%s %-12d %-*s % -10d %s, mark, idx, len, fs-master_file, fs-priority, _(manual mode)); - index++; + idx++; } printf(\n); printf(_(Press enter to keep the current choice[*], @@ -1457,16 +1457,16 @@ alternative_select_choice(struct alternative *a) selection[strlen(selection) - 1] = '\0'; if (strlen(selection) == 0) return current; - index = strtol(selection, ret, 10); + idx = strtol(selection, ret, 10); if (*ret == '\0') { /* Look up by index */ - if (index == 0) { + if (idx == 0) { alternative_set_status(a, ALT_ST_AUTO); free(current); return xstrdup(best-master_file); } - index--; - for (fs = a-choices; index fs; index--) + idx--; + for (fs = a-choices; idx fs; idx--) fs = fs-next; if (fs) { alternative_set_status(a, ALT_ST_MANUAL); -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit fa610b5f505c38fad4c7c8d9b86262988a2d793d Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 19:48:22 2010 +0200 u-a: Rename link variable to linkname to not shadow link(2) diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index 04c333d..6c4d9c2 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -256,28 +256,28 @@ xstrdup(const char *str) } static char * -xreadlink(const char *link, bool error_out) +xreadlink(const char *linkname, bool error_out) { struct stat st; char *buf; ssize_t size; /* Allocate required memory to store the value of the symlink */ - if (lstat(link, st)) { + if (lstat(linkname, st)) { if (!error_out) return NULL; - error(_(cannot stat %s: %s), link, strerror(errno)); + error(_(cannot stat %s: %s), linkname, strerror(errno)); } buf = xmalloc(st.st_size + 1); /* Read it and terminate the string properly */ - size = readlink(link, buf, st.st_size); + size = readlink(linkname, buf, st.st_size); if (size == -1) { if (!error_out) { free(buf); return NULL; } - error(_(readlink(%s) failed: %s), link, strerror(errno)); + error(_(readlink(%s) failed: %s), linkname, strerror(errno)); } buf[size] = '\0'; @@ -920,13 +920,13 @@ alternative_set_status(struct alternative *a, enum alternative_status status) /* link must be allocated with malloc */ static void -alternative_set_link(struct alternative *a, char *link) +alternative_set_link(struct alternative *a, char *linkname) { - if (a-master_link == NULL || strcmp(link, a-master_link) != 0) + if (a-master_link == NULL || strcmp(linkname, a-master_link) != 0) a-modified = true; free(a-master_link); - a-master_link = link; + a-master_link = linkname; } static bool @@ -1038,7 +1038,7 @@ altdb_print_line(struct altdb_context *ctx, const char *line) static bool alternative_parse_slave(struct alternative *a, struct altdb_context *ctx) { - char *name, *link; + char *name, *linkname; struct slave_link *sl; name = altdb_get_line(ctx, _(slave name)); @@ -1052,23 +1052,23 @@ alternative_parse_slave(struct alternative *a, struct altdb_context *ctx) ctx-bad_format(ctx, _(duplicate slave %s), sl-name); } - link = altdb_get_line(ctx, _(slave link)); - if (strcmp(link, a-master_link) == 0) { - free(link); + linkname = altdb_get_line(ctx, _(slave link)); + if (strcmp(linkname, a-master_link) == 0) { + free(linkname); free(name); ctx-bad_format(ctx, _(slave link same as main link %s), a-master_link); } for(sl = a-slaves; sl; sl = sl-next) { - if (strcmp(link, sl-link) == 0) { - free(link); + if (strcmp(linkname, sl-link) == 0) { + free(linkname); free(name); ctx-bad_format(ctx, _(duplicate slave link %s), sl-link); } } - alternative_add_slave(a, name, link); + alternative_add_slave(a, name, linkname); return true; } @@ -1537,7 +1537,7 @@ alternative_commit(struct alternative *a) static void alternative_prepare_install_single(struct alternative *a, const char *name, - const char *link, const char *file) + const char *linkname, const char *file) { char *fntmp, *fn; struct stat st; @@ -1552,22 +1552,23 @@ alternative_prepare_install_single(struct alternative *a, const char *name, free(fntmp); errno = 0; - if (lstat(link, st) == -1) { + if (lstat(linkname, st) == -1) { if (errno != ENOENT) - error(_(cannot stat %s: %s), link, strerror(errno)); + error(_(cannot stat %s: %s), linkname, + strerror(errno)); create_link = true; } else { create_link = S_ISLNK(st.st_mode); } if (create_link || opt_force) { /* Create alternative link. */ - xasprintf(fntmp, %s DPKG_TMP_EXT, link); + xasprintf(fntmp, %s DPKG_TMP_EXT, linkname); checked_rm(fntmp); checked_symlink(fn, fntmp); - alternative_add_commit_op(a, opcode_mv, fntmp, link); + alternative_add_commit_op(a, opcode_mv, fntmp, linkname); free(fntmp); } else { -
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 0ffb2352819de51884f80c380819a33cce9333a7 Author: Guillem Jover guil...@debian.org Date: Sun Jul 11 19:56:05 2010 +0200 u-a: Rename altlnk to sl_altlnk to not shadow altlnk from outter scope diff --git a/utils/update-alternatives.c b/utils/update-alternatives.c index 6c4d9c2..e4c8fa3 100644 --- a/utils/update-alternatives.c +++ b/utils/update-alternatives.c @@ -1710,17 +1710,17 @@ alternative_is_broken(struct alternative *a) } free(sl_current); } else { - char *altlnk; + char *sl_altlnk; /* Slave link must not exist. */ if (lstat(sl-link, st) == 0) return true; - xasprintf(altlnk, %s/%s, altdir, sl-name); - if (lstat(altlnk, st) == 0) { - free(altlnk); + xasprintf(sl_altlnk, %s/%s, altdir, sl-name); + if (lstat(sl_altlnk, st) == 0) { + free(sl_altlnk); return true; } - free(altlnk); + free(sl_altlnk); } } -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit b4efb601b445580a3a46ce873eec3a80893dd08f Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 14:03:41 2010 +0200 Convert limiteddescription() to pkg_summary() Move clamping of summary size to callers. This makes the function more generic so that it can be reused in other contexts. diff --git a/src/enquiry.c b/src/enquiry.c index d8e1a4f..69e702d 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -118,7 +118,10 @@ static void describebriefly(struct pkginfo *pkg) { maxl= 57; l= strlen(pkg-name); if (l20) maxl -= (l-20); - limiteddescription(pkg,maxl,pdesc,l); + + pkg_summary(pkg, pdesc, l); + l = min(l, maxl); + printf( %-20s %.*s\n,pkg-name,l,pdesc); } diff --git a/src/main.h b/src/main.h index 17ba2d4..b17810b 100644 --- a/src/main.h +++ b/src/main.h @@ -171,8 +171,7 @@ void printarch(const char *const *argv); void printinstarch(const char *const *argv); void cmpversions(const char *const *argv) DPKG_ATTR_NORET; -void limiteddescription(struct pkginfo *pkg, -int maxl, const char **pdesc_r, int *l_r); +void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret); /* from select.c */ diff --git a/src/pkg-show.c b/src/pkg-show.c index c1b8789..853278e 100644 --- a/src/pkg-show.c +++ b/src/pkg-show.c @@ -31,19 +31,20 @@ #include main.h void -limiteddescription(struct pkginfo *pkg, - int maxl, const char **pdesc_r, int *l_r) +pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret) { - const char *pdesc, *p; + const char *pdesc; + size_t len; pdesc = pkg-installed.description; if (!pdesc) pdesc = _((no description available)); - p = strchr(pdesc, '\n'); - if (!p) - p = pdesc + strlen(pdesc); - *l_r = min(p - pdesc, maxl); + len = strcspn(pdesc, \n); + if (len == 0) + len = strlen(pdesc); + + *len_ret = len; *pdesc_r = pdesc; } diff --git a/src/query.c b/src/query.c index 7eb94e2..9783847 100644 --- a/src/query.c +++ b/src/query.c @@ -124,7 +124,9 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\ *head = true; } - limiteddescription(pkg,dw,pdesc,l); + pkg_summary(pkg, pdesc, l); + l = min(l, dw); + printf(format, uihrp[pkg-want], ncHUFWti[pkg-status], -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit c5309f8009d14dc6ce05a783ab89acf0c5e2a3ed Author: Guillem Jover guil...@debian.org Date: Wed Jul 14 15:23:46 2010 +0200 Switch variables from int to bool where appropriate diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c index 40d6c0f..6e03e1f 100644 --- a/dpkg-deb/build.c +++ b/dpkg-deb/build.c @@ -211,11 +211,12 @@ void do_build(const char *const *argv) { char *m; const char *debar, *directory, *const *mscriptp, *versionstring, *arch; + bool subdir; char *controlfile, *tfbuf; struct pkginfo *checkedinfo; struct arbitraryfield *field; FILE *ar, *cf; - int p1[2], p2[2], p3[2], warns, n, c, subdir, gzfd; + int p1[2], p2[2], p3[2], warns, n, c, gzfd; pid_t c1,c2,c3; struct stat controlstab, mscriptstab, debarstab; char conffilename[MAXCONFFILENAME+1]; @@ -227,7 +228,7 @@ void do_build(const char *const *argv) { directory = *argv++; if (!directory) badusage(_(--%s needs a directory argument), cipaction-olong); - subdir= 0; + subdir = false; debar = *argv++; if (debar != NULL) { if (*argv) badusage(_(--build takes at most two arguments)); @@ -236,7 +237,7 @@ void do_build(const char *const *argv) { if (errno != ENOENT) ohshite(_(unable to check for existence of archive `%.250s'),debar); } else if (S_ISDIR(debarstab.st_mode)) { -subdir= 1; +subdir = true; } } } else { diff --git a/lib/dpkg/pkg-format.c b/lib/dpkg/pkg-format.c index 25d8a95..4c44acc 100644 --- a/lib/dpkg/pkg-format.c +++ b/lib/dpkg/pkg-format.c @@ -207,10 +207,10 @@ pkg_format_show(const struct pkg_format_node *head, struct varbuf vb = VARBUF_INIT, fb = VARBUF_INIT, wb = VARBUF_INIT; while (head) { - int ok; + bool ok; char fmt[16]; - ok = 0; + ok = false; if (head-width 0) snprintf(fmt, 16, %%%s%zds, @@ -220,7 +220,7 @@ pkg_format_show(const struct pkg_format_node *head, if (head-type == string) { varbufprintf(fb, fmt, head-data); - ok = 1; + ok = true; } else if (head-type == field) { const struct fieldinfo *fip; @@ -231,7 +231,7 @@ pkg_format_show(const struct pkg_format_node *head, varbufaddc(wb, '\0'); varbufprintf(fb, fmt, wb.buf); varbufreset(wb); - ok = 1; + ok = true; break; } @@ -241,7 +241,7 @@ pkg_format_show(const struct pkg_format_node *head, for (afp = pif-arbs; afp; afp = afp-next) if (strcasecmp(head-data, afp-name) == 0) { varbufprintf(fb, fmt, afp-value); - ok = 1; + ok = true; break; } } diff --git a/src/errors.c b/src/errors.c index d115ff3..c21fbb6 100644 --- a/src/errors.c +++ b/src/errors.c @@ -65,7 +65,7 @@ void print_error_perpackage(const char *emsg, const char *arg) { nr= malloc(sizeof(struct error_report)); if (!nr) { perror(_(dpkg: failed to allocate memory for new entry in list of failed packages.)); -abort_processing = 1; +abort_processing = true; nr= emergency; } nr-what= arg; @@ -75,7 +75,7 @@ void print_error_perpackage(const char *emsg, const char *arg) { if (nerrs++ errabort) return; fprintf(stderr, _(dpkg: too many errors, stopping\n)); - abort_processing = 1; + abort_processing = true; } int reportbroken_retexitstatus(void) { diff --git a/src/main.c b/src/main.c index e1fdebb..bdf4029 100644 --- a/src/main.c +++ b/src/main.c @@ -608,7 +608,8 @@ void commandfd(const char *const *argv) { } for (;;) { -int argc= 1, mode= 0; +bool mode = false; +int argc= 1; lno= 0; push_error_handler(ejbuf, print_error_fatal, NULL); @@ -642,15 +643,15 @@ void commandfd(const char *const *argv) { skipchar = true; continue; } else if (isspace(*ptr)) { - if (mode == 1) { + if (mode == true) { *ptr = '\0'; - mode= 0; + mode = false; } } else { - if (mode == 0) { + if (mode == false) { newargs[argc]= ptr; argc++; - mode= 1; + mode = true; } } ptr++; diff --git a/src/packages.c b/src/packages.c index e10f586..71cb50e 100644 --- a/src/packages.c +++ b/src/packages.c @@ -306,7
[SCM] dpkg's main repository branch, master, updated. 1.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 92838b1a97e20b70c3a450578d2b4271143fd561 Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 14:19:15 2010 +0200 Move pkg-show module to libdpkg diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am index d41c104..7d4b26a 100644 --- a/lib/dpkg/Makefile.am +++ b/lib/dpkg/Makefile.am @@ -49,6 +49,7 @@ libdpkg_a_SOURCES = \ pkg-format.c \ pkg-list.c \ pkg-queue.c \ + pkg-show.c \ progress.c \ string.c \ subproc.c \ @@ -78,6 +79,7 @@ pkginclude_HEADERS = \ pkg-format.h \ pkg-list.h \ pkg-queue.h \ + pkg-show.h \ progress.h \ string.h \ subproc.h \ diff --git a/src/pkg-show.c b/lib/dpkg/pkg-show.c similarity index 93% rename from src/pkg-show.c rename to lib/dpkg/pkg-show.c index 853278e..d36d9bf 100644 --- a/src/pkg-show.c +++ b/lib/dpkg/pkg-show.c @@ -3,6 +3,7 @@ * pkg-show.c - primitives for pkg information display * * Copyright © 1995,1996 Ian Jackson i...@chiark.greenend.org.uk + * Copyright © 2008-2010 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,10 +26,8 @@ #include dpkg/macros.h #include dpkg/i18n.h -#include dpkg/dpkg.h #include dpkg/dpkg-db.h - -#include main.h +#include dpkg/pkg-show.h void pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret) diff --git a/lib/dpkg/pkg.h b/lib/dpkg/pkg-show.h similarity index 72% copy from lib/dpkg/pkg.h copy to lib/dpkg/pkg-show.h index 9195134..120df80 100644 --- a/lib/dpkg/pkg.h +++ b/lib/dpkg/pkg-show.h @@ -1,8 +1,8 @@ /* * dpkg - main program for package management - * pkg.h - primitives for pkg handling + * pkg-show.h - primitives for pkg information display * - * Copyright © 2009 Guillem Jover guil...@debian.org + * Copyright © 2010 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,17 +18,16 @@ * along with this program. If not, see http://www.gnu.org/licenses/. */ -#ifndef LIBDPKG_PKG_H -#define LIBDPKG_PKG_H +#ifndef DPKG_PKG_SHOW_H +#define DPKG_PKG_SHOW_H #include dpkg/macros.h +#include dpkg/dpkg-db.h DPKG_BEGIN_DECLS -typedef int pkg_sorter_func(const void *a, const void *b); - -int pkg_sorter_by_name(const void *a, const void *b); +void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret); DPKG_END_DECLS -#endif /* LIBDPKG_PKG_H */ +#endif /* DPKG_PKG_SHOW_H */ diff --git a/src/Makefile.am b/src/Makefile.am index 7c6b054..d1e432f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -33,7 +33,6 @@ dpkg_SOURCES = \ help.c \ main.c main.h \ packages.c \ - pkg-show.c \ processarc.c \ remove.c \ select.c \ @@ -60,7 +59,6 @@ dpkg_divert_LDADD = \ dpkg_query_SOURCES = \ filesdb.c filesdb.h \ divertdb.c \ - pkg-show.c \ query.c dpkg_query_LDADD = \ diff --git a/src/enquiry.c b/src/enquiry.c index 69e702d..a30b3eb 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -38,6 +38,7 @@ #include dpkg/i18n.h #include dpkg/dpkg.h #include dpkg/dpkg-db.h +#include dpkg/pkg-show.h #include dpkg/myopt.h #include filesdb.h diff --git a/src/main.h b/src/main.h index b17810b..6337191 100644 --- a/src/main.h +++ b/src/main.h @@ -171,8 +171,6 @@ void printarch(const char *const *argv); void printinstarch(const char *const *argv); void cmpversions(const char *const *argv) DPKG_ATTR_NORET; -void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret); - /* from select.c */ void getselections(const char *const *argv); diff --git a/src/query.c b/src/query.c index 9783847..2ccdf1e 100644 --- a/src/query.c +++ b/src/query.c @@ -44,6 +44,7 @@ #include dpkg/dpkg-db.h #include dpkg/pkg-array.h #include dpkg/pkg-format.h +#include dpkg/pkg-show.h #include dpkg/path.h #include dpkg/myopt.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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit f45885e71425f23a707250a87e0672ec96d82cf7 Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 16:28:39 2010 +0200 libdpkg: Make pkg_summary() return the summary instead of void Change from returning through a pointer argument to returning it from the function return value. diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c index d36d9bf..7101153 100644 --- a/lib/dpkg/pkg-show.c +++ b/lib/dpkg/pkg-show.c @@ -29,8 +29,8 @@ #include dpkg/dpkg-db.h #include dpkg/pkg-show.h -void -pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret) +const char * +pkg_summary(struct pkginfo *pkg, int *len_ret) { const char *pdesc; size_t len; @@ -44,6 +44,7 @@ pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret) len = strlen(pdesc); *len_ret = len; - *pdesc_r = pdesc; + + return pdesc; } diff --git a/lib/dpkg/pkg-show.h b/lib/dpkg/pkg-show.h index 120df80..4d56091 100644 --- a/lib/dpkg/pkg-show.h +++ b/lib/dpkg/pkg-show.h @@ -26,7 +26,7 @@ DPKG_BEGIN_DECLS -void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret); +const char *pkg_summary(struct pkginfo *pkg, int *len_ret); DPKG_END_DECLS diff --git a/src/enquiry.c b/src/enquiry.c index a30b3eb..1f46b22 100644 --- a/src/enquiry.c +++ b/src/enquiry.c @@ -120,7 +120,7 @@ static void describebriefly(struct pkginfo *pkg) { l= strlen(pkg-name); if (l20) maxl -= (l-20); - pkg_summary(pkg, pdesc, l); + pdesc = pkg_summary(pkg, l); l = min(l, maxl); printf( %-20s %.*s\n,pkg-name,l,pdesc); diff --git a/src/query.c b/src/query.c index 2ccdf1e..0607935 100644 --- a/src/query.c +++ b/src/query.c @@ -125,7 +125,7 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\ *head = true; } - pkg_summary(pkg, pdesc, l); + pdesc = pkg_summary(pkg, l); l = min(l, dw); printf(format, -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 4def4665267a8249ae2de2594422c18f7a84bc8b Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 16:35:03 2010 +0200 dpkg-query: Use pkg_summary in list1package instead of ad-hoc code diff --git a/src/query.c b/src/query.c index 0607935..609e24c 100644 --- a/src/query.c +++ b/src/query.c @@ -86,16 +86,13 @@ list1package(struct pkginfo *pkg, bool *head, struct pkg_array *array) if (w == -1) { nw=14, vw=14, dw=44; for (i = 0; i array-n_pkgs; i++) { - const char *pdesc; int plen, vlen, dlen; - pdesc = pkg-installed.description; - if (!pdesc) pdesc= _((no description available)); - plen = strlen(array-pkgs[i]-name); vlen = strlen(versiondescribe(array-pkgs[i]-installed.version, vdew_nonambig)); - dlen= strcspn(pdesc, \n); + pkg_summary(pkg, dlen); + if (plen nw) nw = plen; if (vlen vw) vw = vlen; if (dlen dw) dw = dlen; -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit e93fdb82239a07d52a377e5f4158e0ca0c58af7c Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 16:49:38 2010 +0200 Fix file names in comment header diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc index 27dfdcc..c11c994 100644 --- a/dselect/basecmds.cc +++ b/dselect/basecmds.cc @@ -1,6 +1,6 @@ /* * dselect - Debian package maintenance user interface - * bcommands.cc - base list keyboard commands display + * basecmds.cc - base list keyboard commands display * * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk * Copyright © 2000,2001 Wichert Akkerman wakke...@debian.org diff --git a/dselect/basetop.cc b/dselect/basetop.cc index 801d002..32d420f 100644 --- a/dselect/basetop.cc +++ b/dselect/basetop.cc @@ -1,6 +1,6 @@ /* * dselect - Debian package maintenance user interface - * bdrawtop.cc - base list class redraw of top + * basetop.cc - base list class redraw of top * * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk * diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h index 0e2fad8..275c149 100644 --- a/lib/dpkg/parsedump.h +++ b/lib/dpkg/parsedump.h @@ -1,6 +1,6 @@ /* * libdpkg - Debian packaging suite library routines - * parse.c - declarations for in-core database reading/writing + * parsedump.h - declarations for in-core database reading/writing * * Copyright © 1995 Ian Jackson i...@chiark.greenend.org.uk * Copyright © 2001 Wichert Akkerman diff --git a/lib/dpkg/pkg.c b/lib/dpkg/pkg.c index 81079c0..f893732 100644 --- a/lib/dpkg/pkg.c +++ b/lib/dpkg/pkg.c @@ -1,6 +1,6 @@ /* * dpkg - main program for package management - * pkg-array.c - primitives for pkg handling + * pkg.c - primitives for pkg handling * * Copyright © 1995, 1996 Ian Jackson i...@chiark.greenend.org.uk * Copyright © 2009 Guillem Jover guil...@debian.org diff --git a/lib/dpkg/progress.h b/lib/dpkg/progress.h index 5ea6dd2..4968467 100644 --- a/lib/dpkg/progress.h +++ b/lib/dpkg/progress.h @@ -1,6 +1,6 @@ /* * dpkg - main program for package management - * progress.c - generic progress reporting + * progress.h - generic progress reporting * * Copyright © 2009 Guillem Jover guil...@debian.org * diff --git a/src/errors.c b/src/errors.c index c21fbb6..88c2210 100644 --- a/src/errors.c +++ b/src/errors.c @@ -1,6 +1,6 @@ /* * dpkg - main program for package management - * main.c - main program + * errors.c - per package error handling * * Copyright © 1994,1995 Ian Jackson i...@chiark.greenend.org.uk * -- 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.15.7.2-166-g4b3828b
The following commit has been merged in the master branch: commit 4b3828ba87359a3a0171a95479834983224b2f73 Author: Guillem Jover guil...@debian.org Date: Fri Jul 16 17:06:23 2010 +0200 build: Add -Wshadow to default warnings diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4 index f46f0a7..5a0f791 100644 --- a/m4/dpkg-compiler.m4 +++ b/m4/dpkg-compiler.m4 @@ -13,7 +13,7 @@ AC_DEFUN([DPKG_COMPILER_WARNINGS], WFLAGS=-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers \ -Wmissing-declarations -Wmissing-format-attribute \ --Wvla -Winit-self -Wwrite-strings -Wcast-align +-Wvla -Winit-self -Wwrite-strings -Wcast-align -Wshadow WCFLAGS=-Wdeclaration-after-statement -Wnested-externs -Wbad-function-cast \ -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition # Temporarily here until #542031 gets fixed in ncurses -- 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