Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on dpkg, .debs, .dscs...
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/dpkg.e>
#           or at <http://angg.twu.net/e/dpkg.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.var_lib_dpkg_info»		(to "var_lib_dpkg_info")
# «.grep-debian-docs»		(to "grep-debian-docs")
# «.dpkg.source»		(to "dpkg.source")
# «.cmpversions.c»		(to "cmpversions.c")
# «.grep-dctrl»			(to "grep-dctrl")
# «.sizeofinstalleddebs»	(to "sizeofinstalleddebs")
# «.installeddebs»		(to "installeddebs")
# «.pfilenames»			(to "pfilenames")
# «.build-depends_via_chroot»	(to "build-depends_via_chroot")
# «.testing-.debs»		(to "testing-.debs")
# «.all-installed-.debs»	(to "all-installed-.debs")
# «.potatocd-2000jun06»		(to "potatocd-2000jun06")
# «.dpkg»			(to "dpkg")
# «.install-info»		(to "install-info")
# «.dpkg:alternatives»		(to "dpkg:alternatives")
# «.dpkg:diversions»		(to "dpkg:diversions")
# «.dpkg:debversions»		(to "dpkg:debversions")
# «.dpkg:configscripts»		(to "dpkg:configscripts")
# «.dpkg-dev»			(to "dpkg-dev")
# «.dpkg-multicd»		(to "dpkg-multicd")
# «..disk/info»			(to ".disk/info")
# «.Packages.cd»		(to "Packages.cd")
# «.Contents-i386»		(to "Contents-i386")
# «.mkcontents»			(to "mkcontents")
# «.local_apt_repository»	(to "local_apt_repository")
# «.empty_packages»		(to "empty_packages")
# «.dpkg-checkbuilddeps»	(to "dpkg-checkbuilddeps")
# «.dpkg-query»			(to "dpkg-query")





#####
#
# pdsc
# 2001jan17
#
#####

# (find-angg ".zshrc" "pdsc")
# (find-es "bash" "pdsc")
# (eeman "1 dpkg-source")
# (find-fline "/usr/bin/dpkg-source/")




#####
#
# /var/lib/dpkg/info/
# 2001jan17
#
#####

# «var_lib_dpkg_info»  (to ".var_lib_dpkg_info")
#*
# The files there have very few extensions:
cd /var/lib/dpkg/info/
'ls' | awk -F . '{print $NF}' | sort | uniq | tee ~/o

# conffiles config list md5sums postinst postrm preinst prerm shlibs
# templates

# (find-fline "/usr/doc/debconf/specification.txt.gz")
# (find-efile "")
#*
l *.conffiles
l *.config
l *.copyright
l *.shlibs
l *.templates

l *.list
l *.md5sums
l *.postinst
l *.postrm
l *.preinst
l *.prerm

#*



#####
#
# greeping the main debian docs
# 2001jan17
#
#####

# «grep-debian-docs»  (to ".grep-debian-docs")
# (find-status "task-debian-devel")
# (find-status "emacsen-common")
# (find-vldifile "emacsen-common.list")
# (find-fline "/usr/doc/emacsen-common/")
# (find-status "doc-debian")
# (find-vldifile "doc-debian.list")
# (find-fline "/usr/doc/debian/")

#*
rm -Rv /tmp/debdocs/
mkdir  /tmp/debdocs/
cp -iv \
  /usr/doc/debian-policy/fhs/fhs.txt.gz			\
  /usr/doc/debian-policy/fsstnd/fsstnd-1.2.txt.gz	\
  /usr/doc/debian-policy/menu-policy.text.gz		\
  /usr/doc/debian-policy/mime-policy.text.gz		\
  /usr/doc/debian-policy/policy.text.gz			\
  /usr/doc/debian-policy/proposal.text.gz		\
  /usr/doc/debian-policy/upgrading-checklist.text.gz	\
  /usr/doc/debian-policy/virtual-package-names-list.text.gz	\
  /usr/doc/debian/FAQ/debian-faq.txt.gz			\
  /usr/doc/developers-reference/developers-reference.txt.gz	\
  /usr/doc/emacsen-common/debian-emacs-policy.gz	\
  /usr/doc/maint-guide/maint-guide.txt.gz		\
  /usr/doc/packaging-manual/packaging.text.gz		\
    /tmp/debdocs/
cd /tmp/debdocs/
gzip -dv *.gz
# (find-fline "/tmp/debdocs/")
# Now we can grep all that.

#*







#####
#
# dpkg source
# 2000nov26
#
#####

# «dpkg.source»  (to ".dpkg.source")
#*
pdsc $SDEBIAN/dists/potato/main/source/base/dpkg_1.6.14.dsc
cd /usr/src/dpkg-1.6.14/
find * -name '*.[ch]' > .files.ch
etags $(<.files.ch)

# (find-dpkgfile "configure.in" "CFLAGS=\"-D_REENTRANT -D_GNU_SOURCE -O2\"")
patch -b -p0 configure.in <<'%%%'
115c115,116
<  CFLAGS="-D_REENTRANT -D_GNU_SOURCE -O2"
---
>  #CFLAGS="-D_REENTRANT -D_GNU_SOURCE -O2"
>  CFLAGS="-D_REENTRANT -D_GNU_SOURCE -g -pg"
%%%

autoconf
#debian/rules binary		|& tee odrb
LDFLAGS=-pg debian/rules binary-dpkg	|& tee odrb
# I get an dpkg-deb error about the permissions of a dir, but that is
# irrelevant for my purposes now (that are just to recompile with -g)
#find * -perm +0111

#*
# (find-es "crim" "gprof")
# (find-node "(gprof)Call Graph")
# (find-dpkgfile "INSTALL" "LDFLAGS")
# (find-dpkgfile "Makefile.conf.in")
# (find-dpkgfile "configure")

cd /usr/src/dpkg-1.6.14/build/main/
./dpkg --compare-versions foo-3.21.deb le foo-3.2.deb
#laf gmon.out
gprof dpkg > o
gprof -b dpkg > o-b

# (find-node "(binutils)nm")
nm -As *.o > o.nm
grep -i ' T ' o.nm > o.nm-

# (find-dpkgfile "build/main/")

#*
# (gdbk-gdb t ee-dpkgdir "build/main/dpkg")
set args --compare-versions foo-3.21.deb le foo-3.2.deb
br main
br cmpversions
run

#*
# (find-dpkgfile "")
# (find-dpkgfile "debian/")
# (find-dpkgfile "debian/rules")
# (find-dpkgfile "odrb")

dpkg --compare-versions foo-3.21.deb le foo-3.2.deb




#####
#
# cmpversions.c (with functions stolen from dpkg)
# 2001mar03
#
#####

# «cmpversions.c»  (to ".cmpversions.c")
#*
# (find-fline "~/LUA/cmpversions.c")
cd ~/LUA
gcc -I/usr/src/dpkg-1.6.14/{include,build{,/include}} \
  -g -o cmpversions cmpversions.c

false
echo $?
./cmpversions foo-3.21.deb le foo-3.2.deb
echo $?

true
echo $?
./cmpversions foo-3.21.deb ge foo-3.2.deb
echo $?

#./cmpversions foo-3.21.deb mmm!! foo-3.2.deb

#*
cd ~/LUA/
etags cmpversions.c
# (code-c-d "cmpv" "~/LUA/")
# (find-cmpvtag "main")

#*
cd ~/LUA/
cflow -I/usr/src/dpkg-1.6.14/{include,build{,/include}} cmpversions.c \
  |& tee ~/o
# (find-fline "~/o")

#*






#####
#
# grep-dctrl
# 2000jun05
#
#####

# «grep-dctrl»  (to ".grep-dctrl")
# (find-status "grep-dctrl")
# (find-vldifile "grep-dctrl.list")
# (find-fline "/usr/doc/grep-dctrl/")

# (find-man "1 grep-dctrl")
# (find-man "1 grep-status")
# (find-man "1 grep-available")
# (find-fline "/etc/grep-dctrl.rc")

# (find-fline "/var/lib/dpkg/status")
# (find-packhw3 "ch-versions.html" "epoch")

grep-dctrl scheme \
    /big/potato/dists/potato/{main,contrib,non-free}/binary-i386/Packages \
    $SNUDEBIAN/dists/potato/non-US/main/binary-i386/Packages
grep-status -F Status ' installed'

grep-available -F Package -X 'a2ps'
grep-available -F Package -r 'a2ps\|acroread\|adduser'
grep-available -F Package -e 'a2ps|acroread|adduser'
grep-available -F Package -e '^a2ps$'
grep-available -F Package -e '^(a2ps|acroread|adduser)$'

# «sizeofinstalleddebs»  (to ".sizeofinstalleddebs")
# (written in 2002dec01)
#
# ~/o  - a list with the names of all installed packages: (find-fline "~/o")
# ~/o2 - a big regexp
# ~/o3 - an abridged version of /var/lib/dpkg/available that lists only the
#        installed packages: (find-fline "~/o3")
# ~/o4 - a list of the packages in ~/o3, for comparison
# ~/o5 - a list with the "Size:"s of the installed packages
#
grep-status -s Package -n -F Status ' installed' | sort | tee ~/o
cat ~/o \
  | expect -c '
      regsub -all {([.+])} [join [read stdin] "|"] {\\\1} re
      puts $re
    ' \
  | tee ~/o2
grep-available -F Package -e '^('$(cat ~/o2)')$' | tee ~/o3
cat ~/o3 | grep-dctrl -s Package -n '' | sort | tee ~/o4
diff ~/o ~/o4
cat ~/o3 | grep-dctrl -s Size -n '' | tee ~/o5
cat ~/o5 | awk '{total+=$1} END {print total}'
cat ~/o5 | gawk '
  BEGIN { mask = 4095 }
        { total += and($1, mask) ? or($1,mask)+1 : $1 }
  END   { print total }
'

#*
# «installeddebs»  (to ".installeddebs")
# (find-angg ".zshrc" "installeddebs")
grep-status -F Status ' installed' -s Package,Version
cat /var/lib/dpkg/status | installeddebs_ | sort
installeddebs | sort
#*
# (find-node "(gawk)Other Arguments")
# (find-fline "/var/state/apt/lists/")
# (find-angg ".zshrc" "installeddebs")
cd /var/state/apt/lists
cat 127.0.0.1_debian_dists_potato_contrib_binary-i386_Packages \
  | grep-dctrl . -s Filename \
  | awk '{print PREFIX $2}' PREFIX=main/


#*
# «pfilenames»  (to ".pfilenames")
function pfilenames () {
  grep-dctrl . -s Filename | awk '{print PREFIX $2}' PREFIX=$1
}
cd /var/state/apt/lists
cat 127.0.0.1*potato_contrib*Packages | pfilenames contrib/
#*
cd $SSECDEBIAN/
cat dists/potato/updates/main/binary-i386/Packages \
  | pfilenames
#*





#####
#
# Checking build depends using chroot
# 2000dec02
#
#####

# «build-depends_via_chroot»  (to ".build-depends_via_chroot")
# (find-deblistsw3 "debian-devel-9912/msg00160.html")
# (find-fline "/etc/apt/")
#*
rm -Rv /tmp/debian/
mkdir  /tmp/debian/
cd     /tmp/debian/
tar -xvzf /hdd6/potatobin1/dists/potato/main/disks-i386/2.2.16-2000-07-14/base2_2.tgz

# (find-es "apache" "apt-http-local")
cat > etc/apt/sources.list <<'---'
deb http://127.0.0.1/debian potato main contrib
---
touch etc/resolv.conf

# (find-angg "EXPECT/eeg")
cat > $EEG <<'---'
apt-get update
dpkg --purge lilo
yes '' | apt-get -y install dpkg-dev
yes '' | apt-get -y install build-essential
---
eeg chroot `pwd` bin/sh
# Done.

#*




#####
#
# Testing .debs
# 2000jun20
#
#####

# «testing-.debs»  (to ".testing-.debs")
# (eeman "5 deb")
# This is not absolutely perfect, but should work in most cases.

cd $SPOTATO/
for i in $(find * -name '*.deb'); do
  echo $i; ar -p $i data.tar.gz | gzip -t
done





#####
#
# Find the files corresponding to the installed .debs
# 2000jun06
#
#####

# «all-installed-.debs»  (to ".all-installed-.debs")
# Show the names of the .debs
# of all installed packages:
#*
grep-status --show-field=Package,Version --field=Status ' installed' \
  | perl -nle '
      m/Package: (.*)/ and $s = $1;
      m/Version: ([0-9]+:)?(.*)/ and print "$s", "_$2.deb";
    ' \
  | sort \
  | tee ~/oinstalleddebs

#*
# Prepare the corresponding fgrep
# patterns. We don't care about versions now.
# No quoting or backslashing is needed:
# (eeman "fgrep" "-F, --fixed-strings")

cat ~/oinstalleddebs \
  | perl -nle ' m:([^ /_]+)_.*deb: && print "/$1_" ' \
  | sort \
  | tee ~/oinstdebs-fstems

# Find all .deb files that have the
# same stems as installed packages:

find /big/potato $SDEBIAN /usr/src/.debs/ -type f \
  | grep '\.deb$' \
  | fgrep -f ~/oinstdebs-fstems \
  | tee ~/oinstdebs-fnames

# Which stems correspond to more than one file?
# Take the stems of all the files with the same
# stems as installed packages...

cat ~/oinstdebs-fnames \
  | perl -nle ' m:([^ /_]+)_.*deb: && print "/$1_" ' \
  | sort \
  | tee ~/oinstdebs-fnames-stems

# and list those with repetitions...

uniq -d ~/oinstdebs-fnames-stems \
  | uniq

# and those which are unique.

uniq -u ~/oinstdebs-fnames-stems



# Another way to go: check which of the installed packages come from
# my (out of date) potato mirror and which do now. Now we do check the
# versions.






#####
#
# Prepare the files for a potato CD
# 2000jun06
#
#####

# «potatocd-2000jun06»  (to ".potatocd-2000jun06")

# (find-fline "~/opotato")
# (find-fline "~/ononpotato")

# /potatocd is a symlink to I-don't-remember-where.
# Don't delete it!

rm -Rv /potatocd/*
cd /potatocd/
mkdir -p dists/potato/
ln -s potato dists/stable
ln -s potato dists/frozen
ln -s potato dists/unstable
ln -s potato dists/slink

cd /potatocd/dists/potato/
mkdir -p  contrib/binary-i386/
mkdir -p     main/binary-i386/
mkdir -p non-free/binary-i386/

ln -s binary-i386  contrib/binary-all
ln -s binary-i386     main/binary-all
ln -s binary-i386 non-free/binary-all

cd /potatocd/
mkdir big
ln -s .. big/potato

mkdir -p snarf/ftp/ftp.debian.org/debian/
ln -s ../../../../dists snarf/ftp/ftp.debian.org/debian/dists

cd /potatocd/
for i in $(cut -b2- < ~/opotato); do
  echo $i
  mkdir -p $(dirname $i)
done

for i in $(cut -b2- < ~/opotato); do
  cp -ipv /$i /potatocd/$i
done


# Note that the debs I compile are generated by default with an ending
# like _i386.deb or _all.deb. We remove that before copying...
#
rm -Rv /potatocd/dists/potato/local/binary-i386/
mkdir -p /potatocd/dists/potato/local/binary-i386/devel/
cd /usr/src/.debs/
for i in \
  glimpse_4.1-2.deb	\
  ircii_4.4M-1.deb	\
  libssl09-dev_0.9.4-5.deb	\
  libssl09_0.9.4-5.deb	\
  mktclapp_3.9-1.deb	\
  openssl_0.9.4-5.deb	\
  ssh-askpass_0.99-1.deb	\
  ssh_1.2.2-1.4.deb	\
  ssleay_0.9.4-5.deb	\
  wget_1.5.3-3edrx.deb	\
; do
  cp -iv $(basename $i .deb)*.deb \
    /potatocd/dists/potato/local/binary-i386/devel/$i
done


# (find-fline "$SDEBIAN/ls-lR.i")

cd /potatocd/
for i in contrib main non-free local; do
  echo $i
  dpkg-scanpackages dists/potato/$i/binary-i386 /dev/null \
    > dists/potato/$i/binary-i386/Packages
  gzip -c9 < dists/potato/$i/binary-i386/Packages \
           > dists/potato/$i/binary-i386/Packages.gz
done

cd /potato/dists/potato/main/
cp -diPpvR disks-i386/ /potatocd/dists/potato/main/

cd /potato/dists/potato/
find | grep Release
cp -diPpvR $(find | grep Release) /potatocd/dists/potato/

cp -ipv $SDEBIAN/dists/potato/Contents-i386.gz /potatocd/dists/potato/
cp -ipv $S/http/panic.et.tudelft.nl/~costar/potato/.cd_readme_temp/README.txt \
  /potatocd/

# My page (i.e., all my public stuff)
rm /tmp/page.tgz; cd; make -f ~/TH/Makefile /tmp/page.tgz
cp -iv /tmp/page.tgz /potatocd/

# (find-fline "/potatocd/")
# (find-fline "/potatocd/dists/potato/main/disks-i386/current/")

cd /potatocd/
mkdir boot/
mkisofs -r -J -V "Potato bin 1 (Edrx 00jul14)" \
  -b dists/potato/main/disks-i386/2.2.13-2000-05-04/images-2.88/udma66/rescue.bin \
  -c boot/boot.catalog \
  -o /tmp/potato.iso . \
  |& tee ~/o

# Things to correct: the TRANS.TBLs are visible; I forgot the "tools"
# directory, the dos622 images, 4dos, pkzip, qedit and list. Also: no
# sources, no locz cgis or database dumps.

# Make the image. Dangerous! $$$ -> /dev/null!
# (find-es "hw-cdrw" "cdrecord")

/etc/init.d/cron stop
cdrecord -scanbus
cdrecord -dummy dev=0,0,0 -v  /tmp/potato.iso
cdrecord        dev=0,0,0 -v  /tmp/potato.iso
/etc/init.d/cron start




# This is just to check (visually) what can be missing.
#
# (find-es "potatocds" "potato-i386-...-list")
# (find-fline "~/POTATO/rsync/129.13.126.5/debian-cd/potato-i386-1.raw.list")
grep -v '\.deb$' ~/POTATO/rsync/129.13.126.5/debian-cd/potato-i386-1.raw.list \
  | tee ~/o
# (find-fline "~/o")





# (find-fline "~/tmp/")





#####
#
# dpkg
# 2000jun14
#
#####

# «dpkg»  (to ".dpkg")
# (find-status "dpkg")
# (find-vldifile "dpkg.list")
# (find-fline "/usr/doc/dpkg/")

# (find-fline "/usr/share/doc/dpkg")
# (find-fline "/usr/share/doc/dpkg/THANKS.gz")
# (find-fline "/usr/share/doc/dpkg/TODO.gz")
# (find-fline "/usr/share/doc/dpkg/changelog.gz")
# (find-fline "/usr/share/doc/dpkg/changelog.Debian.gz")
# (find-fline "/usr/share/doc/dpkg/copyright")
# (eeman "1 md5sum")
# (eeman "1 dpkg-deb")
# (eeman "8 dpkg-split")
# (eeman "8 dpkg")
# (eeman "8 dselect")
# (find-fline "/usr/lib/dpkg/")
# (find-fline "/usr/lib/dpkg/mksplit")
# (find-fline "/usr/lib/dpkg/methods/")
# (find-fline "/usr/lib/dpkg/methods/disk/")
# (find-fline "/usr/lib/dpkg/methods/disk/setup")
# (find-fline "/usr/lib/dpkg/methods/disk/update")
# (find-fline "/usr/lib/dpkg/methods/disk/install")
# (find-fline "/usr/lib/dpkg/methods/disk/names")
# (find-fline "/usr/lib/dpkg/methods/disk/desc.cdrom")
# (find-fline "/usr/lib/dpkg/methods/disk/desc.nfs")
# (find-fline "/usr/lib/dpkg/methods/disk/desc.harddisk")
# (find-fline "/usr/lib/dpkg/methods/disk/desc.mounted")
# (find-fline "/usr/lib/dpkg/methods/floppy/")
# (find-fline "/usr/lib/dpkg/methods/floppy/setup")
# (find-fline "/usr/lib/dpkg/methods/floppy/update")
# (find-fline "/usr/lib/dpkg/methods/floppy/install")
# (find-fline "/usr/lib/dpkg/methods/floppy/names")
# (find-fline "/usr/lib/dpkg/methods/floppy/desc.floppy")

# (eeman "8 update-rc.d")
# (find-fline "/usr/sbin/update-rc.d")

# (eeman "8 start-stop-daemon")
# (find-fline "/sbin/start-stop-daemon")

# (find-status "dpkg-doc")
# (find-vldifile "dpkg-doc.list")
# (find-fline "/usr/doc/dpkg-doc/")





#####
#
# install-info / ginstall-info
# 2000jun14 / 2012apr20 / 2019aug11
#
#####

# «install-info»  (to ".install-info")
# (find-sh "apt-file search install-info")

# 2012apr20:
# (find-status   "install-info")
# (find-vldifile "install-info.list")
# (find-udfile   "install-info/")
# (find-fline "/usr/bin/install-info")
# (find-fline "/usr/bin/ginstall-info")
# (find-fline "/usr/sbin/update-info-dir")
# (find-udfile "install-info/AUTHORS")
# (find-udfile "install-info/INTRODUCTION")
# (find-udfile "install-info/NEWS.gz")
# (find-udfile "install-info/README.gz")
# (find-udfile "install-info/README.source")
# (find-udfile "install-info/TODO.gz")
# (find-udfile "install-info/changelog.Debian.gz")
# (find-udfile "install-info/changelog.gz")
# (find-udfile "install-info/copyright")
# (find-man "8 update-info-dir")
# (find-man "1 ginstall-info")
# (find-man "1 install-info")

# (find-es "bash" "bash-3.1-info")
# (find-vldifile "zsh-doc.postinst" "install-info --section Shells Shells")
# (find-vldigrep "grep -nH -e install-info *inst")
# (find-node "(dir)Top" "ZSH")
# (find-fline "/usr/share/info/zsh.info.gz")
# (find-fline "/usr/share/info/zsh.info.gz" "START-INFO-DIR-ENTRY")

# (find-man "8 install-info")
# (find-man "8 install-info" "--section regexp title")
# (find-fline "/usr/sbin/install-info")
# (find-fline "/usr/sbin/install-info" "$infodir='/usr/info';")
# (find-fline "/usr/info/" "dir")
# (find-fline "/usr/info/dir")
# (find-fline "/usr/share/info/" "dir")
# (find-fline "/usr/share/info/dir.gz")
# (find-vldifile "dpkg.list")

# (find-dpolfile "fhs/fhs.txt.gz" "GNU Info system's primary directory")

#*
cd /var/lib/dpkg/info/
agrep -l install-info *inst* | tee ~/o

mycat $(<~/o) > ~/o2

cat ~/o2 \
  | perl -e 'undef $/; $_ = <>; s/\\\n//g; print' \
  | grep install-info \
  | tee ~/o3

# (find-es "make" "makefile_toposort")
cat ~/o \
  | perl -nle 'print "# (find-vldifile \"$_\" \"install-info\")"' \
  | tee ~/o4

# (find-fline "~/o2")
# (find-fline "~/o3")
# (find-fline "~/o4")
# (find-vldifile "emacs20.postinst" "install-info")
# (find-vldifile "emacsen-common.postinst" "install-info")
# install-info --quiet --section Emacs Emacs /usr/share/info/${file}.gz || true
# install-info --remove emacs > /dev/null 2>&1

#*
# (eeman "8 cleanup-info")
# (find-fline "/usr/sbin/cleanup-info")
# (find-vldifile "dpkg.postinst" "maintain the /usr/info/dir file")





#####
#
# dpkg and alternatives
# 2000jun14
#
#####

# «dpkg:alternatives»  (to ".dpkg:alternatives")
* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
update-alternatives --help
update-alternatives --list vncserver

# (find-man "8 update-alternatives")
# (find-fline "/etc/alternatives/")
# (find-fline "/etc/alternatives/README")
# (find-fline "/usr/sbin/update-alternatives")
# (find-fline "/usr/sbin/update-alternatives" "yourself")
# (find-fline "/usr/sbin/update-alternatives" "return to automatic")
# (find-fline "/var/lib/dpkg/alternatives/")

cd /var/lib/dpkg/info/
agrep update-alternatives *
agrep -l update-alternatives * \
  | perl -nle 'print "# (find-vldifile \"$_\" \"update-alternatives\")"' \
  > ~/o

# (find-fline "~/o")

# (find-debfaqhw3 "debian-faq-12.html#ss12.10")
# (find-debfaqhw3 "debian-faq-7.html#ss7.8")
# (find-dpolfile "virtual-package-names-list.text.gz")
# (find-packfile "packaging.text.gz" '* 2 "`update-alternatives'")




# Old notes:

update-alternatives --display wish
update-alternatives --display '*'
# (perldb "perl /usr/sbin/update-alternatives --display wish")
# (find-fline "/etc/alternatives/")
# (find-fline "/var/lib/dpkg/alternatives/")
cd /etc/alternatives/
for i in *; do echo; update-alternatives --display $i; done
# (find-vldifile "tkstep8.0.postinst")
# (find-vldifile "tkstep8.0.postrm")
# (eeman "update-alternatives")
update-alternatives --remove wish /usr/bin/wishstep8.0
laf /usr/bin/wish* /etc/alternatives/wish*





######
#
# dpkg: diversions
# 2000jun14
#
######

# «dpkg:diversions»  (to ".dpkg:diversions")
# (find-packfile "packaging.text.gz" "11. Diversions")
# (find-packhw3 "ch-diversions.html")

# (eeman "8 dpkg-divert")
# (find-fline "/usr/sbin/dpkg-divert")

# (find-status "debmake")
# (find-vldifile "debmake.list")
# (find-fline "/usr/share/debmake/debian/diversions.ex")

# (find-fline "/var/lib/dpkg/diversions")
# (find-fline "/var/lib/dpkg/diversions-old")

cd /var/lib/dpkg/info/
agrep diversions *
agrep -l diversions * \
  | perl -nle 'print "# (find-vldifile \"$_\" \"diversions\")"' \
  > ~/o

# (find-fline "~/o")
# (find-es "hurd" "dpkg-cross")




#####
#
# version numbers of .debs
# 2000apr01
#
#####

# «dpkg:debversions»  (to ".dpkg:debversions")
# (find-angg "LUA/apt-move.lua" "debversions")
(defun find-pmt (pos-spec)
  (find-fline "/usr/doc/packaging-manual/packaging.text.gz" pos-spec))

# (find-pmt "5. Version numbering")
# (find-pmt "<debian-revision>\n")
# (find-pmt "compared lexically")
# (find-pmt "--compare-versions")
# (find-man "1 dpkg" "--compare-versions")

dpkg --help |& tee ~/o
# (find-fline "~/o" "Comparison operators")

dpkg --compare-versions foo-3.21.deb le foo-3.2.deb
dpkg --compare-versions foo-3.21.deb ge foo-3.2.deb

function dcv () {
  if dpkg --compare-versions $1 lt $2; then
    echo "    $1 < $2"
  elif dpkg --compare-versions $1 eq $2; then
    echo "    $1 = $2"
  else
    echo "    $1 > $2"
  fi
}

dcv foo.deb   foo-3.1.deb
dcv foo-3.1.deb   foo.deb
dcv foo-3.1.deb   foo-3.2.deb
dcv foo-3.21.deb   foo-3.2.deb
dcv foo_3.2.deb    foo_3.2-1.deb
dcv foo_3.2-1.deb   foo_3.2.deb
dcv foo_3.2-1.deb   foo_3.2-2.deb
dcv foo_3.2-1.deb   foo_3.2-1edrx.deb
dcv foo_3.2-1edrx.deb   foo_3.2-1.deb

# Epochs (?):
Pgrepp 'm/age: libgtk/' |& l




#####
#
# Lua functions to compare versions of debs
# 2001may09
#
#####

# (find-es "lua" "debversions_lua")
(defun find-pmt (pos-spec)
  (find-fline "/usr/doc/packaging-manual/packaging.text.gz" pos-spec))

# (find-pmt "5. Version numbering")
# (find-pmt "<debian-revision>\n")
# (find-pmt "compared lexically")
# (find-pmt "--compare-versions")
# (eeman "dpkg" "--compare-versions")

(find-packfile "packaging.text.gz" "5. Version numbering")






#####
#
# how dpkg configures packages (exim)
#
#####

# «dpkg:configscripts»  (to ".dpkg:configscripts")
# (find-es "debian" "smail_config")
# (eeman "dpkg" "dpkg --configure package")

# (find-vldifile "" "exim")
# (find-vldifile "exim.list")
# (find-fline "/usr/doc/exim/")

# (find-vldifile "exim.conffiles")
# (find-vldifile "exim.preinst")
# (find-vldifile "exim.postinst")
# (find-vldifile "exim.prerm")
# (find-vldifile "exim.postrm")

# (find-fline "/usr/doc/exim/example.conf.gz")

# (find-fline "/etc/exim.conf")
# (find-fline "/etc/exim.conf" "local_domains =")
# (find-fline "/etc/exim.conf" "never_users =")
# (find-fline "/etc/exim.conf" "host_lookup =")
# (eeman "exim" "Domains required")

# (find-fline "/etc/init.d/exim")
# (find-fline "/usr/doc/exim/spec.txt.gz" "  3. HOW EXIM DELIVERS MAIL")

/etc/init.d/exim restart

mail -s `date +%T` edrx <<'---'
baaaar
---
mail -s `date +%T` edrx@localhost <<'---'
baaaarl
---

sleep 1

find /var/spool/



# (find-fline "/o/etc/smail/")
# (find-fline "/etc/smail/")
# (find-fline "/etc/smail/config")

# (find-vldifile "deliver.list")
# (find-fline "/usr/doc/deliver/")
# (find-vldifile "" "deliver")

mail -s `date +%T` edrx@inx.com.br <<'---'
blaaa
---

date +%T | mail -s `date +%T` edrx@mat.puc-rio.br




#####
#
# dpkg-dev
# 2000jun05
#
#####

# «dpkg-dev»  (to ".dpkg-dev")

# (find-status "dpkg-dev")
# (find-vldifile "dpkg-dev.list")
# (find-fline "/usr/doc/dpkg-dev/")

# (eeman "1 822-date")
# (eeman "1 dpkg-architecture")
# (eeman "1 dpkg-buildpackage")
# (eeman "1 dpkg-distaddfile")
# (eeman "1 dpkg-genchanges")
# (eeman "1 dpkg-gencontrol")
# (eeman "1 dpkg-shlibdeps")
# (eeman "1 dpkg-name")
# (eeman "1 dpkg-source")
# (eeman "1 dpkg-parsechangelog")
# (eeman "5 deb-old")
# (eeman "5 deb")
# (eeman "5 deb-control")
# (eeman "8 dpkg-scanpackages")
# (eeman "8 dpkg-scansources")

# (find-fline "/usr/bin/dpkg-name")
# (find-fline "/usr/bin/dpkg-source")
# (find-fline "/usr/bin/dpkg-genchanges")
# (find-fline "/usr/bin/dpkg-gencontrol")
# (find-fline "/usr/bin/dpkg-shlibdeps")
# (find-fline "/usr/bin/dpkg-buildpackage")
# (find-fline "/usr/bin/dpkg-distaddfile")
# (find-fline "/usr/bin/822-date")
# (find-fline "/usr/bin/dpkg-scanpackages")
# (find-fline "/usr/bin/dpkg-scansources")
# (find-fline "/usr/bin/dpkg-architecture")
# (find-fline "/usr/bin/dpkg-parsechangelog")




#####
#
# dpkg-multicd
# 2000jun05
#
#####

# «dpkg-multicd»  (to ".dpkg-multicd")
# «.disk/info»  (to "..disk/info")
# «Packages.cd»  (to ".Packages.cd")

# (find-status "dpkg-multicd")
# (find-vldifile "dpkg-multicd.list")
# (find-fline "/usr/doc/dpkg-multicd/")

# (find-fline "/usr/doc/dpkg-multicd/readme.txt.gz")
# (find-fline "/usr/lib/dpkg/methods/multicd/")
# (find-fline "/usr/bin/dpkg-scanpackages")

# (find-udfile "dpkg-multicd/readme.txt.gz" "dpkg-scanpackages -m")
# (find-udfile "dpkg-multicd/readme.txt.gz" "cannot use regular `Packages'")
# (find-udfile "dpkg-multicd/readme.txt.gz" "`.disk/info'")




#####
#
# Generating the "Contents" file with mkcontents
# 2000sep09
#
#####

# «Contents-i386»  (to ".Contents-i386")
# «mkcontents»  (to ".mkcontents")
# (find-fline "$SPOTATO/Contents-i386")
# (find-fline "~/SLINK/Contents-i386")

# The mkcontents script seems to be only available by cvs... here's
# how to get it, following a hint given by Michael Beattie
# (mickyb@es.co.nz) in debian-mentors, on 2000sep09:

#*
# rm -Rv ~/CVS/ftpmaint/
mkdir  ~/CVS/ftpmaint/
cd     ~/CVS/ftpmaint/
export CVSROOT=:pserver:anonymous@cvs.debian.org:/cvs/ftpmaint
cvs login
cvs co masterfiles
cd masterfiles
#*

# (find-fline "~/CVS/ftpmaint/masterfiles/")
# (find-fline "~/CVS/ftpmaint/masterfiles/mkcontents")






#####
#
# dbuild
#
#####

# (find-vldifile "dbuild.list")
# (find-fline "/usr/doc/dbuild/")

# (eeman "dbuild")
# (eeman "run-dbuild")

# (find-fline "/usr/bin/dbuild")
# (find-fline "/usr/bin/run-dbuild")





#####
#
# An apt repository for locally-compiled packages
# 2001jan17
#
#####

# «local_apt_repository»  (to ".local_apt_repository")
# (eeman "5 sources.list")
# (find-fline "/etc/apt/sources.list")
# (find-angg ".zshrc" "apt")
#deb file:/usr/src/.debs potato local
#deb-src file:/usr/src/.debs potato local

#*
# Get help:
dpkg-scanpackages |& tee ~/o
# (find-fline "~/o")
# (find-fline "/usr/bin/dpkg-scanpackages" "Usage:")
# Usage: dpkg-scanpackages [-m medium] binarypath overridefile pathprefix
#   e.g. dpkg-scanpackages -m 'Debian GNU/Linux binary-i386' \
# 	   binary-i386 /pub/debian/indices/override.hamm.gz \
# 	   dists/stable/ > binary-i386/Packages

#*
# This was cleaned up (?) and put in a shell function:
# (find-angg ".zshrc" "apt")
cd /usr/src/.debs/
rm -Rv dists/
( D=dists/potato/local
  DB=$D/binary-i386
  mkdir -p $DB
  cp -liv *.deb $DB
  dpkg-scanpackages $DB /dev/null '' \
    | tee $DB/Packages \
    | gzip -c6 > $DB/Packages.gz

  DS=$D/source
  mkdir -p $DS
  cp -liv /usr/src/.dscs/*.dsc $DB
  cp -liv /usr/src/.dscs/*.gz  $DB
  cp -liv /usr/src/.dscs/*.changes $DB
  dpkg-scansources $D \
    | tee $DS/Sources \
    | gzip -c9 > $DS/Sources.gz
)

#*
# Here's the typical way to use that:
aptu-local-i386
apt-get update

#*
# Test the source repository:
# (eeman "8 apt-get" "--build")
# (eeman "8 dpkg-scansources")
# (find-fline "/usr/bin/dpkg-scansources")
# (find-fline "/usr/bin/dpkg-source")

# (find-angg ".zshrc" "apt")
rm -Rv /tmp/mkt/
mkdir  /tmp/mkt/
cd     /tmp/mkt/
# apt-get source mktclapp
apt-get source --build mktclapp		|& tee oagsb
laf

#*

<apt> markybob wants you to know: If you have problems adding
unofficial sites to sources.list, try "deb URL ./" or 'man 5
sources.list' or potato: 'deb http://http.us.debian.org/debian potato
main contrib non-free' or potato non-us: 'deb
http://non-US.debian.org/debian-non-US potato/non-US main contrib
non-free', but a pretty neat sources.list is
http://www.debian.org/~edlang/sources.list, or use apt-setup in
package base-config to configure your sources.list

# (find-shttpw3 "www.debian.org/~edlang/sources.list")






#####
#
# creating empty packages
# 2001jun17
#
#####

# «empty_packages»  (to ".empty_packages")
# (find-status "pciutils")
#*
rm -Rv /tmp/luadeb/
mkdir  /tmp/luadeb/
cd     /tmp/luadeb/
# ar x /usr/src/lua_4.0-0_i386.deb
  ar x /tmp/lua_4.0-0_i386.deb
mkdir control
tar -xzf control.tar.gz -C control/
mkdir data
tar -xzf data.tar.gz -C data/

# (find-luafile "debian/tmp-lua/DEBIAN/")
# (find-luafile "debian/tmp-lua/DEBIAN/control")
# (find-status "lua")

#*
rm -Rv /tmp/luaemptydeb/
mkdir  /tmp/luaemptydeb/
cd     /tmp/luaemptydeb/
mkdir -p debian/tmp-lua/DEBIAN/
cp -v /usr/src/lua-4.0/debian/tmp-lua/DEBIAN/control debian/tmp-lua/DEBIAN/
# strace-to ~/s dpkg-gencontrol -isp -plua -Pdebian/tmp-lua
dpkg-deb --build debian/tmp-lua ..

#*
rm -Rv   /tmp/emptys/
mkdir -p /tmp/emptys/tmp/DEBIAN/
cd       /tmp/emptys/
cat > tmp/DEBIAN/control <<'---'
Package: jvim-doc
Priority: extra
Section: doc
Installed-Size: 323
Maintainer: Teruyuki Morimura <terubou@sandalwood.net>
Architecture: all
Source: jvim
Version: 3.0-2.0-2
Recommends: jvim-canna
Filename: dists/frozen/main/binary-i386/doc/jvim-doc_3.0-2.0-2.deb
Size: 242002
MD5sum: 5f5b56736560057bd7f58f2a193a690c
Description: Documentation for Japanized VIM
 JVIM 3.0 is Japanized VIM (VI cron editor) by K.Tsuchida
 <ken_t@st.rim.or.jp> on Jan 1, 2000 (patch version 2.0).
---
dpkg-deb --build tmp .

find
laf

#*



# (find-fline "/tmp/pciutils/")
# (find-luafile "odbp" "dpkg-gencontrol")
# (eeman "dpkg-gencontrol")
# (eeman "5 deb")
# (find-fline "/usr/doc/packaging-manual/packaging.text.gz")
# (find-packfile "packaging.text.gz")
# (find-packfile "packaging.text.gz" "2.2. Package control information files")
# (find-packfile "packaging.text.gz" "2.3. The main control")

perl -nle 'm/^([A-Z][^:]*:)/ && print $1' < /var/lib/dpkg/status | sort | uniq

     The fields in binary package control files are:
        * `Package' (mandatory)
        * `Version' (mandatory)
        * `Architecture' (mandatory) [1]
          [1]  This field should appear in all packages, though `dpkg'
               doesn't require it yet so that old packages can still be
               installed.
        * `Depends', `Provides' et al.
        * `Essential'
        * `Maintainer'
        * `Section', `Priority'
        * `Source'
        * `Description'
        * `Installed-Size'


# (find-status "lua")
# (find-vldifile "lua.list")
# (find-fline "/usr/doc/lua/")
# (find-fline "/var/lib/dpkg/status")
# (find-fline "/var/lib/dpkg/available")

Package:
Version:
Architecture: i386   (must add by hand cause vldistatus doesn't have it)

Conflicts:
Depends:
Pre-Depends:
Provides:
Recommends:
Replaces:
Suggests:

Essential:
Maintainer:
Section:
Priority:
Source:
Description:
Installed-Size:
meta-package:

strre_field = "([A-Zm][A-Za-z]+):([^\n]*)\n( [^\n]*\n)*"

strre_package = "([A-Zm ][^\n]*\n)+\n"
strre_field = "^([A-Zm][A-Za-z]+):([^\n]*)$"

re_package = regex(strre_package)
re_field   = regex(strre_field)

# (find-node "(lua)read")

Conffiles:
Config-Version:
Maintainer:
Status:





#####
#
# dpkg-checkbuilddeps
# 2007jun25
#
#####

# «dpkg-checkbuilddeps»  (to ".dpkg-checkbuilddeps")
# When doing:
#   cd ~/usrc/scite/scite-1.71/
#   dpkg-buildpackage -us -uc -b -rfakeroot |& tee odb
# I got this:
#   dpkg-checkbuilddeps: Unmet build dependencies: libgtk2.0-dev libglib2.0-dev dpatch
# (find-fline "/usr/bin/dpkg-buildpackage")
# (find-fline "/usr/bin/dpkg-buildpackage" "dpkg-checkbuilddeps")
# (find-fline "/usr/bin/dpkg-checkbuilddeps")

# There must be an "install builddeps with apt-get" script somewhere...




#####
#
# dpkg-query
# 2019aug17
#
#####

# «dpkg-query» (to ".dpkg-query")
# (find-es "apt" "apt-cache")
# (find-man "1 dpkg-query")
# (find-man "1 dpkg-query" "-S, --search")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
dpkg-query -S light-locker






#  Local Variables:
#  coding:               utf-8-unix
#  End: