summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--control_triggers_packages136
-rwxr-xr-xsetup.sh140
2 files changed, 276 insertions, 0 deletions
diff --git a/control_triggers_packages b/control_triggers_packages
new file mode 100644
index 00000000..97902839
--- /dev/null
+++ b/control_triggers_packages
@@ -0,0 +1,136 @@
+appstream-index
+apt-cudf
+auctex
+bamfdaemon
+bilibop-lockfs
+bilibop-rules
+bumblebee
+ca-certificates
+ca-certificates-java
+ccache
+cracklib-runtime
+cups
+dbus
+desktop-file-utils
+dictionaries-common
+distcc
+doc-base
+dovecot-core
+dovecot-imapd
+dovecot-ldap
+dovecot-lmtpd
+dovecot-lucene
+dovecot-managesieved
+dovecot-mysql
+dovecot-pgsql
+dovecot-pop3d
+dovecot-sieve
+dovecot-solr
+dovecot-sqlite
+dracut
+epoptes
+fontconfig
+fusiondirectory
+fusionforge-plugin-mediawiki
+gap-core
+gconf2
+ghc
+ghc-doc
+gnome-icon-theme
+gnome-menus
+gosa
+graphite-carbon
+guile-1.8-libs
+guile-2.0-libs
+gxine
+hicolor-icon-theme
+hoogle
+ibid
+icecc
+initramfs-tools
+install-info
+libapache2-mod-php5
+libapache2-mod-php5filter
+libc-bin
+libglib2.0-0
+libgtk2.0-0
+libgtk-3-0
+libjs-protoaculous
+libomxil-bellagio0
+libpam-unix2
+libreoffice-common
+libreoffice-presentation-minimizer
+ltsp-client-core
+man-db
+mate-icon-theme
+maxima
+mcollective
+menu
+mime-support
+munin-node
+ntfs-3g
+octave
+openstack-dashboard
+pdl
+pdns-server
+php5-common
+php5-curl
+php5-enchant
+php5-fpm
+php5-gd
+php5-gmp
+php5-imap
+php5-interbase
+php5-intl
+php5-ldap
+php5-mcrypt
+php5-mysql
+php5-mysqlnd
+php5-odbc
+php5-pgsql
+php5-pspell
+php5-readline
+php5-recode
+php5-snmp
+php5-sqlite
+php5-sybase
+php5-tidy
+php5-xmlrpc
+php5-xsl
+php-kolab
+php-kolabformat
+postgresql-common
+pypy
+python3-django-countries
+python-axiom
+python-django-countries
+python-nevow
+python-support
+python-twisted-core
+python-wokkel
+readahead-fedora
+reconf-inetd
+redmine
+resolvconf
+rkhunter
+ruby
+rygel
+sa-compile
+sgml-base
+shared-mime-info
+smlnj-runtime
+spamassassin
+sphinx-common
+swi-prolog-nox
+systemd
+tex-common
+udev
+ufw
+unhide.rb
+vlc-nox
+wims
+wims-modules
+wordpress
+xen-tools
+xfonts-traditional
+yorick-doc
diff --git a/setup.sh b/setup.sh
new file mode 100755
index 00000000..c698b989
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+set -e
+
+ARCH="amd64"
+DIST="sid"
+MIRROR="http://snapshot.debian.org/archive/debian/20141211T041251Z/"
+DIRECTORY="`pwd`/debian-$DIST-$ARCH"
+
+#FIXME: if the host has more than one arch enabled then those Packages files will be downloaded as well
+
+APT_OPTS="-y"
+APT_OPTS=$APT_OPTS" -o Apt::Architecture=$ARCH"
+APT_OPTS=$APT_OPTS" -o Dir::Etc::TrustedParts=$DIRECTORY/etc/apt/trusted.gpg.d"
+APT_OPTS=$APT_OPTS" -o Dir::Etc::Trusted=$DIRECTORY/etc/apt/trusted.gpg"
+APT_OPTS=$APT_OPTS" -o Dir=$DIRECTORY/"
+APT_OPTS=$APT_OPTS" -o Dir::Etc=$DIRECTORY/etc/apt/"
+APT_OPTS=$APT_OPTS" -o Dir::Etc::SourceList=$DIRECTORY/etc/apt/sources.list"
+APT_OPTS=$APT_OPTS" -o Dir::State=$DIRECTORY/var/lib/apt/"
+APT_OPTS=$APT_OPTS" -o Dir::State::Status=$DIRECTORY/var/lib/dpkg/status"
+APT_OPTS=$APT_OPTS" -o Dir::Cache=$DIRECTORY/var/cache/apt/"
+APT_OPTS=$APT_OPTS" -o Acquire::Check-Valid-Until=false" # because we use snapshot
+
+mkdir -p $DIRECTORY
+mkdir -p $DIRECTORY/etc/apt/
+mkdir -p $DIRECTORY/etc/apt/trusted.gpg.d/
+mkdir -p $DIRECTORY/etc/apt/sources.list.d/
+mkdir -p $DIRECTORY/etc/apt/preferences.d/
+mkdir -p $DIRECTORY/var/lib/apt/
+mkdir -p $DIRECTORY/var/lib/apt/lists/partial/
+mkdir -p $DIRECTORY/var/lib/dpkg/
+mkdir -p $DIRECTORY/var/cache/apt/
+mkdir -p $DIRECTORY/var/cache/apt/apt-file/
+
+cp /etc/apt/trusted.gpg.d/* $DIRECTORY/etc/apt/trusted.gpg.d/
+
+touch $DIRECTORY/var/lib/dpkg/status
+
+echo deb $MIRROR $DIST main > $DIRECTORY/etc/apt/sources.list
+
+apt-get $APT_OPTS update
+
+APT_FILE_OPTS="--architecture $ARCH"
+APT_FILE_OPTS=$APT_FILE_OPTS" --cache $DIRECTORY/var/cache/apt/apt-file"
+APT_FILE_OPTS=$APT_FILE_OPTS" --sources-list $DIRECTORY/etc/apt/sources.list"
+
+apt-file $APT_FILE_OPTS update
+
+printf "" > interested-file
+printf "" > interested-explicit
+printf "" > activated-file
+printf "" > activated-explicit
+
+cat control_triggers_packages | while read pkg; do
+ echo "working on $pkg..." >&2
+ apt-get $APT_OPTS download $pkg
+ dpkg-deb --control ${pkg}_*.deb
+ if [ ! -f DEBIAN/triggers ]; then
+ rm -r DEBIAN
+ rm ${pkg}_*.deb
+ continue
+ fi
+ # find all triggers that are either interest or interest-await
+ # and which are file triggers (start with a slash)
+ egrep "^\s*interest(-await)?\s+/" DEBIAN/triggers | while read line; do
+ echo "$pkg $line"
+ done >> interested-file
+ egrep "^\s*interest(-await)?\s+[^/]" DEBIAN/triggers | while read line; do
+ echo "$pkg $line"
+ done >> interested-explicit
+ egrep "^\s*activate(-await)?\s+/" DEBIAN/triggers | while read line; do
+ echo "$pkg $line"
+ done >> activated-file
+ egrep "^\s*activate(-await)?\s+[^/]" DEBIAN/triggers | while read line; do
+ echo "$pkg $line"
+ done >> activated-explicit
+ rm -r DEBIAN
+ rm ${pkg}_*.deb
+done
+
+printf "" > result-file
+
+# go through those that are interested in a path and check them against the
+# files provided by its dependency closure
+cat interested-file | while read pkg ttype ipath; do
+ echo "working on $pkg..." >&2
+ echo "getting dependency closure..." >&2
+ # go through all packages in the dependency closure and check if any
+ # of the files they ship match one of the interested paths
+ dose-ceve -c $pkg -T cudf -t deb \
+ $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ | awk '/^package:/ { print $2 }' \
+ | apt-file $APT_FILE_OPTS show -F --from-file - \
+ | sed -ne "s ^\([^:]\+\):\s\+\(${ipath}/.*\) \1\t\2 p" \
+ | while read dep cpath; do
+ [ "$pkg" != "$dep" ] || continue
+ echo "$pkg $ipath $dep $cpath"
+ done >> result-file
+done
+
+# go through those that are interested in a path and check them against the
+# packages in the dependency closure which activate such a path
+cat interested-file | while read pkg ttype ipath; do
+ echo "working on $pkg..." >&2
+ echo "getting dependency closure..." >&2
+ # go through all packages in the dependency closure and check if any
+ # of them activate a matching path
+ dose-ceve -c $pkg -T cudf -t deb \
+ $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ | awk '/^package:/ { print $2 }' \
+ | while read dep; do
+ [ "$pkg" != "$dep" ] || continue
+ # using the space as sed delimeter because ipath has slashes
+ # a space should work because neither package names nor paths have them
+ sed -ne "s ^$dep\s\+activate\(-await\)\?\s\+\($ipath.*\) \2 p" activated-file | while read cpath; do
+ echo "$pkg $ipath $dep $cpath"
+ done
+ done >> result-file
+done
+
+printf "" > result-explicit
+
+# go through those that are interested in an explicit trigger and check them
+# against the packages in their dependency closure which activate it
+#cat interested-explicit | while read pkg ttype iname; do
+echo wims-modules interest wims-reindex | while read pkg ttype iname; do
+ echo "working on $pkg..." >&2
+ echo "getting dependency closure..." >&2
+ # go through all packages in the dependency closure and check if any of
+ # them activate the trigger in which this package is interested
+ dose-ceve -c $pkg -T cudf -t deb \
+ $DIRECTORY/var/lib/apt/lists/*_dists_${DIST}_main_binary-${ARCH}_Packages \
+ | awk '/^package:/ { print $2 }' \
+ | while read dep; do
+ [ "$pkg" != "$dep" ] || continue
+ if egrep "^$dep\s+activate(-await)?\s+$iname\s*$" activated-explicit > /dev/null; then
+ echo "$pkg $iname $dep"
+ fi
+ done >> result-explicit
+done