Bug#901095: patch

2021-12-17 Thread GCS
Hi Yuriy,

On Sun, Jul 22, 2018 at 9:33 PM Yuriy M. Kaminskiy  wrote:
> Attached debdiff should implement it (in a bit hackish way, but I much
> prefer to ship tcl script as tcl script over exactly same tcl script,
> but embedded in ELF executable).
 Thanks for your contribution. I'm going to split out all sqlite3
tools into a separate package.
I don't think sqlite3_analyzer would be good on its own. I'm not
entirely sure why it would be better as an unofficial Tcl script,
especially for the average user. Can you give me some pointers?

Thanks,
Laszlo/GCS



Bug#901095: patch

2018-07-22 Thread Yuriy M. Kaminskiy

Control: tags -1 patch

Attached debdiff should implement it (in a bit hackish way, but I much 
prefer to ship tcl script as tcl script over exactly same tcl script, 
but embedded in ELF executable).


(I've used this patch for some time in [locally-built] sqlite3 backports).
diff -Nru sqlite3-3.24.0/debian/changelog sqlite3-3.24.0/debian/changelog
--- sqlite3-3.24.0/debian/changelog 2018-06-06 00:47:02.0 +0300
+++ sqlite3-3.24.0/debian/changelog 2018-07-22 20:05:56.0 +0300
@@ -1,3 +1,10 @@
+sqlite3 (3.24.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add sqlite3-analyzer package. (Closes: #901095)
+
+ -- Yuriy M. Kaminskiy   Sun, 22 Jul 2018 20:05:56 
+0300
+
 sqlite3 (3.24.0-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru sqlite3-3.24.0/debian/control sqlite3-3.24.0/debian/control
--- sqlite3-3.24.0/debian/control   2018-06-06 00:47:02.0 +0300
+++ sqlite3-3.24.0/debian/control   2018-07-22 19:48:54.0 +0300
@@ -80,3 +80,17 @@
  access without running a separate RDBMS process.
  .
  This package contains the Tcl bindings.
+
+Package: sqlite3-analyzer
+Section: database
+Architecture: all
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, libsqlite3-tcl, tcl8.6, sqlite3 
(= ${binary:Version})
+Suggests: sqlite3-doc, sqlite3
+Multi-Arch: foreign
+Description: An database files analysis program for SQLite 3
+ SQLite is a C library that implements an SQL database engine. 
+ Programs that link with the SQLite library can have SQL database 
+ access without running a separate RDBMS process.
+ .
+ This package contains sqlite3_analyzer program.
diff -Nru sqlite3-3.24.0/debian/rules sqlite3-3.24.0/debian/rules
--- sqlite3-3.24.0/debian/rules 2018-06-06 00:47:02.0 +0300
+++ sqlite3-3.24.0/debian/rules 2018-07-22 20:05:56.0 +0300
@@ -81,12 +81,22 @@
$(MAKE) lemon
 endif
cd ext/misc && $(CC) -g -fPIC -I../.. -shared csv.c -o csv.so
+   {   set -ex; \
+   echo '#!/bin/sh'; \
+   echo '# -*- tcl -*-'; \
+   echo '# The next line is executed by /bin/sh, but not tcl \\'; \
+   echo 'exec tclsh8.6 "$$0" $${1+"$$@"}'; \
+   echo ''; \
+   echo 'package require sqlite3'; \
+   grep -v register_dbstat_vtab tool/spaceanal.tcl; \
+   } > sqlite3_analyzer.tcl
 
touch $@
 
 clean:
dh_testdir
dh_testroot
+   rm -f sqlite3_analyzer.tcl
rm -f configure-stamp build-stamp
rm -f config.log config.h pkgIndex.tcl configure
[ ! -f Makefile ] || $(MAKE) distclean
@@ -110,6 +120,7 @@
install -d $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/
install -m 0775 ext/misc/csv.so \
$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/
+   install -m 0775 sqlite3_analyzer.tcl $(DESTDIR)/usr/bin/sqlite3_analyzer
 
# Remove *.la files per policy 3.9.1.0
sed -i "/dependency_libs/ s/'.*'/''/" `find $(DESTDIR) -name '*.la'`
@@ -132,6 +143,7 @@
dh_testroot
 
dh_install -i --sourcedir=$(DESTDIR)
+   dh_installman -i
dh_installdocs -i
dh_installchangelogs -i www/changes.html
dh_compress -i
diff -Nru sqlite3-3.24.0/debian/sqlite3_analyzer.1 
sqlite3-3.24.0/debian/sqlite3_analyzer.1
--- sqlite3-3.24.0/debian/sqlite3_analyzer.11970-01-01 03:00:00.0 
+0300
+++ sqlite3-3.24.0/debian/sqlite3_analyzer.12018-07-22 20:05:56.0 
+0300
@@ -0,0 +1,39 @@
+.Dd 2018-07-22
+.Dt SQLITE3_ANALYZER 1
+.Os "Debian GNU/Linux"
+.Sh NAME
+.Nm sqlite3_analyzer
+.Nd SQLite3 database space usage analyzis tool
+.Sh SYNOPSIS
+.Nm
+.Op Fl -pageinfo
+.Op Fl -stats
+.Op Fl -tclsh
+.Op Fl -version
+.Ar database.sqlite
+.Sh DESCRIPTION
+.Nm
+program analyze an SQLite database file and
+output a report detailing size and storage efficiency
+information for the database and its constituent tables and indexes.
+.Pp
+.Sh OPTIONS
+.Bl -tag -width indent
+.It Fl -pageinfo
+Show how each page of the database-file is used
+.It Fl -stats
+Output SQL text that creates a new database containing
+statistics about the database that was analyzed
+.It Fl -tclsh
+Run the built-in TCL interpreter interactively (for debugging)
+.It Fl -version
+Show the version number of SQLite
+.El
+.Sh AUTHOR
+.Nm
+has been written by
+.An D. Richard Hipp Aq d...@hwaci.com .
+.Pp
+This manual page was written by
+.An Yuriy M. Kaminskiy Aq yumkam+deb...@gmail.com
+for the Debian GNU/Linux system.
diff -Nru sqlite3-3.24.0/debian/sqlite3-analyzer.install 
sqlite3-3.24.0/debian/sqlite3-analyzer.install
--- sqlite3-3.24.0/debian/sqlite3-analyzer.install  1970-01-01 
03:00:00.0 +0300
+++ sqlite3-3.24.0/debian/sqlite3-analyzer.install  2018-07-22 
19:48:54.0 +0300
@@ -0,0 +1 @@
+usr/bin/sqlite3_analyzer
diff -Nru sqlite3-3.24.0/debian/sqlite3-analyzer.manpages 
sqlite3-3.24.0/debian/sqlite3-analyzer.manpages
---