drop sbuild patch as 0.64.3-1 includes it
This commit is contained in:
parent
24b88174a4
commit
9701359741
4 changed files with 17 additions and 104 deletions
|
@ -1,88 +0,0 @@
|
||||||
From df094f79a67c0835b0fddd73019b09951ed26987 Mon Sep 17 00:00:00 2001
|
|
||||||
From: josch <j.schauer@email.de>
|
|
||||||
Date: Wed, 4 Jun 2014 22:57:36 +0200
|
|
||||||
Subject: [PATCH] add pre-realbuild-commands and post-realbuild-commands
|
|
||||||
|
|
||||||
---
|
|
||||||
lib/Sbuild/Build.pm | 15 +++++++++++++++
|
|
||||||
lib/Sbuild/Conf.pm | 2 ++
|
|
||||||
lib/Sbuild/Options.pm | 10 ++++++++++
|
|
||||||
3 files changed, 27 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
|
|
||||||
index a24b575..c8552de 100644
|
|
||||||
--- a/lib/Sbuild/Build.pm
|
|
||||||
+++ b/lib/Sbuild/Build.pm
|
|
||||||
@@ -1060,6 +1060,12 @@ sub run_external_commands {
|
|
||||||
} elsif ($stage eq "chroot-setup-commands") {
|
|
||||||
$self->log_subsection("Chroot Setup Commands");
|
|
||||||
$chroot = 1;
|
|
||||||
+ } elsif ($stage eq "pre-realbuild-commands") {
|
|
||||||
+ $self->log_subsection("Pre RealBuild Commands");
|
|
||||||
+ $chroot = 1;
|
|
||||||
+ } elsif ($stage eq "post-realbuild-commands") {
|
|
||||||
+ $self->log_subsection("Post RealBuild Commands");
|
|
||||||
+ $chroot = 1;
|
|
||||||
} elsif ($stage eq "chroot-cleanup-commands") {
|
|
||||||
$self->log_subsection("Chroot Cleanup Commands");
|
|
||||||
$chroot = 1;
|
|
||||||
@@ -1383,6 +1389,10 @@ sub build {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ $self->run_external_commands("pre-realbuild-commands",
|
|
||||||
+ $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'),
|
|
||||||
+ $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR'));
|
|
||||||
+
|
|
||||||
$self->set('Build Start Time', time);
|
|
||||||
$self->set('Build End Time', $self->get('Build Start Time'));
|
|
||||||
|
|
||||||
@@ -1564,6 +1574,11 @@ sub build {
|
|
||||||
$self->log_sep();
|
|
||||||
$self->log("Build finished at $finish_date\n");
|
|
||||||
|
|
||||||
+
|
|
||||||
+ $self->run_external_commands("post-realbuild-commands",
|
|
||||||
+ $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'),
|
|
||||||
+ $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR'));
|
|
||||||
+
|
|
||||||
my @space_files = ("$dscdir");
|
|
||||||
|
|
||||||
$self->log_subsubsection("Finished");
|
|
||||||
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
|
|
||||||
index 25ec66d..a396821 100644
|
|
||||||
--- a/lib/Sbuild/Conf.pm
|
|
||||||
+++ b/lib/Sbuild/Conf.pm
|
|
||||||
@@ -975,6 +975,8 @@ sub setup ($) {
|
|
||||||
DEFAULT => {
|
|
||||||
"pre-build-commands" => [],
|
|
||||||
"chroot-setup-commands" => [],
|
|
||||||
+ "pre-realbuild-commands" => [],
|
|
||||||
+ "post-realbuild-commands" => [],
|
|
||||||
"chroot-cleanup-commands" => [],
|
|
||||||
"post-build-commands" => [],
|
|
||||||
},
|
|
||||||
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
|
|
||||||
index 4a232bf..fbca939 100644
|
|
||||||
--- a/lib/Sbuild/Options.pm
|
|
||||||
+++ b/lib/Sbuild/Options.pm
|
|
||||||
@@ -267,6 +267,16 @@ sub set_options {
|
|
||||||
push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"chroot-setup-commands"}},
|
|
||||||
\@command);
|
|
||||||
},
|
|
||||||
+ "pre-realbuild-commands=s" => sub {
|
|
||||||
+ my @command = split(/\s+/, $_[1]);
|
|
||||||
+ push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"pre-realbuild-commands"}},
|
|
||||||
+ \@command);
|
|
||||||
+ },
|
|
||||||
+ "post-realbuild-commands=s" => sub {
|
|
||||||
+ my @command = split(/\s+/, $_[1]);
|
|
||||||
+ push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"post-realbuild-commands"}},
|
|
||||||
+ \@command);
|
|
||||||
+ },
|
|
||||||
"chroot-cleanup-commands=s" => sub {
|
|
||||||
my @command = split(/\s+/, $_[1]);
|
|
||||||
push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"chroot-cleanup-commands"}},
|
|
||||||
--
|
|
||||||
1.9.2
|
|
||||||
|
|
19
README.md
19
README.md
|
@ -5,7 +5,8 @@ Use `fatrace` to record all file access during an `sbuild` run and find those
|
||||||
build dependencies which have their files never needed. You need superuser
|
build dependencies which have their files never needed. You need superuser
|
||||||
privileges to run this script because of `fatrace`. You need to copy
|
privileges to run this script because of `fatrace`. You need to copy
|
||||||
`findunusedbd.sh` into `/home` so best run all of this inside a chroot to
|
`findunusedbd.sh` into `/home` so best run all of this inside a chroot to
|
||||||
prevent a mess.
|
prevent a mess (in case you use a chroot, don't forget to mount /proc and
|
||||||
|
install fatrace).
|
||||||
|
|
||||||
Run it like follows:
|
Run it like follows:
|
||||||
|
|
||||||
|
@ -15,12 +16,8 @@ This will call sbuild like this for each `dsc` given:
|
||||||
|
|
||||||
$ sbuild \
|
$ sbuild \
|
||||||
--chroot-setup-commands='/home/findunusedbd.sh chroot-setup' \
|
--chroot-setup-commands='/home/findunusedbd.sh chroot-setup' \
|
||||||
--pre-realbuild-commands='/home/findunusedbd.sh pre-realbuild' \
|
--starting-build-commands='/home/findunusedbd.sh starting-build' \
|
||||||
--post-realbuild-commands='/home/findunusedbd.sh post-realbuild'
|
--finished-build-commands='/home/findunusedbd.sh finished-build'
|
||||||
|
|
||||||
This needs the --pre-realbuild-commands and --post-realbuild-commands to exist
|
|
||||||
which can be added to sbuild by applying
|
|
||||||
`0001-add-pre-realbuild-commands-and-post-realbuild-comman.patch` to it.
|
|
||||||
|
|
||||||
The first pass will use `fatrace` to find build dependencies on packages with
|
The first pass will use `fatrace` to find build dependencies on packages with
|
||||||
files that are never used during the whole build. Since many of these are gonna
|
files that are never used during the whole build. Since many of these are gonna
|
||||||
|
@ -31,7 +28,7 @@ rebuild.
|
||||||
Both passes are done for `--arch-all` and `--no-arch-all`. Any unused
|
Both passes are done for `--arch-all` and `--no-arch-all`. Any unused
|
||||||
dependencies can then be found by investigating the `*.arch-all.unusedbd.real`
|
dependencies can then be found by investigating the `*.arch-all.unusedbd.real`
|
||||||
and `*.no-arch-all.unusedbd.real`. The result from the former can permanently
|
and `*.no-arch-all.unusedbd.real`. The result from the former can permanently
|
||||||
be dropped from the `Build-Depends`. The result from the latter can be added to
|
be dropped from the `Build-Depends`. The result from the latter can be moved to
|
||||||
`Build-Depends-Indep`.
|
`Build-Depends-Indep`.
|
||||||
|
|
||||||
Schroot setup
|
Schroot setup
|
||||||
|
@ -49,10 +46,13 @@ Make apt ignore the `Valid-Until` header:
|
||||||
|
|
||||||
$ echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/80-nocheckvaliduntil
|
$ echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/80-nocheckvaliduntil
|
||||||
|
|
||||||
Install `equivs`:
|
Install `equivs` and `dctrl-tools`:
|
||||||
|
|
||||||
$ apt-get install equivs dctrl-tools --no-install-recommends
|
$ apt-get install equivs dctrl-tools --no-install-recommends
|
||||||
|
|
||||||
|
The last action will also install file, gettext-base, gettext and debhelper so
|
||||||
|
these cannot be found as unused anymore.
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ Bugs
|
||||||
- when investigating which build dependencies are unused, virtual packages are not taken into account
|
- when investigating which build dependencies are unused, virtual packages are not taken into account
|
||||||
- maybe the fake equivs package can be built outside the schroot to avoid the additional dependencies for installing equivs
|
- maybe the fake equivs package can be built outside the schroot to avoid the additional dependencies for installing equivs
|
||||||
- fatrace suffers from [bug#722901](https://bugs.debian.org/722901) which can be seen when trying to compile `lsof`
|
- fatrace suffers from [bug#722901](https://bugs.debian.org/722901) which can be seen when trying to compile `lsof`
|
||||||
|
- if sbuild fails somehow (for example by the mirror becoming unavailable and sbuild failing with `E: apt-get update failed`) then the finished-build-commands are not run and the started processes never quit
|
||||||
|
|
||||||
Feature Requests
|
Feature Requests
|
||||||
----------------
|
----------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
# start this script without arguments and then start sbuild as:
|
# start this script without arguments and then start sbuild as:
|
||||||
#
|
#
|
||||||
# sbuild --chroot-setup-commands='/home/prebuildcmd.sh chroot-setup' --pre-realbuild-commands='/home/prebuildcmd.sh pre-realbuild' --post-realbuild-commands='/home/prebuildcmd.sh post-realbuild'
|
# sbuild --chroot-setup-commands='/home/findunusedbd.sh chroot-setup' --starting-build-commands='/home/findunusedbd.sh starting-build' --finished-build-commands='/home/findunusedbd.sh finished-build'
|
||||||
|
|
||||||
get_metaset() {
|
get_metaset() {
|
||||||
name=$1
|
name=$1
|
||||||
|
@ -87,7 +87,7 @@ elif [ "$#" -eq 2 ]; then
|
||||||
tmpdir="$2"
|
tmpdir="$2"
|
||||||
dpkg --list | awk '$1 == "ii" { print $2"="$3 }' | sort > "${tmpdir}/initialselection.list"
|
dpkg --list | awk '$1 == "ii" { print $2"="$3 }' | sort > "${tmpdir}/initialselection.list"
|
||||||
;;
|
;;
|
||||||
pre-realbuild)
|
starting-build)
|
||||||
tmpdir="$2"
|
tmpdir="$2"
|
||||||
# get the current selection so that the parent script can find the additional packages that were installed
|
# get the current selection so that the parent script can find the additional packages that were installed
|
||||||
dpkg --list | awk '$1 == "ii" { print $2"="$3 }' | sort > "${tmpdir}/fullselection.list"
|
dpkg --list | awk '$1 == "ii" { print $2"="$3 }' | sort > "${tmpdir}/fullselection.list"
|
||||||
|
@ -135,7 +135,7 @@ elif [ "$#" -eq 2 ]; then
|
||||||
# wait for fatrace to be forked
|
# wait for fatrace to be forked
|
||||||
cat "${tmpdir}/myfifo" > /dev/null
|
cat "${tmpdir}/myfifo" > /dev/null
|
||||||
;;
|
;;
|
||||||
post-realbuild)
|
finished-build)
|
||||||
tmpdir="$2"
|
tmpdir="$2"
|
||||||
# signal that the build is done
|
# signal that the build is done
|
||||||
echo > "${tmpdir}/myfifo"
|
echo > "${tmpdir}/myfifo"
|
||||||
|
@ -188,7 +188,7 @@ elif [ "$#" -eq 2 ]; then
|
||||||
else
|
else
|
||||||
echo "usage: " >&2
|
echo "usage: " >&2
|
||||||
echo " $0 tmpdir"
|
echo " $0 tmpdir"
|
||||||
echo " $0 [chroot-setup|pre-realbuild|post-realbuild] tmpdir"
|
echo " $0 [chroot-setup|starting-build|finished-build] tmpdir"
|
||||||
echo " $0 equivs pkgname"
|
echo " $0 equivs pkgname"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
6
run.sh
6
run.sh
|
@ -20,8 +20,8 @@ build () {
|
||||||
/home/findunusedbd.sh "$tmpdir" &
|
/home/findunusedbd.sh "$tmpdir" &
|
||||||
sbuild --$archall --quiet \
|
sbuild --$archall --quiet \
|
||||||
--chroot-setup-commands="/home/findunusedbd.sh chroot-setup $tmpdir" \
|
--chroot-setup-commands="/home/findunusedbd.sh chroot-setup $tmpdir" \
|
||||||
--pre-realbuild-commands="/home/findunusedbd.sh pre-realbuild $tmpdir" \
|
--starting-build-commands="/home/findunusedbd.sh starting-build $tmpdir" \
|
||||||
--post-realbuild-commands="/home/findunusedbd.sh post-realbuild $tmpdir" \
|
--finished-build-commands="/home/findunusedbd.sh finished-build $tmpdir" \
|
||||||
"$dsc"
|
"$dsc"
|
||||||
ret=$?
|
ret=$?
|
||||||
rm -f *.deb *.udeb *.changes
|
rm -f *.deb *.udeb *.changes
|
||||||
|
@ -71,7 +71,7 @@ check () {
|
||||||
# we need to run it as a pre-realbuild-commands hook because it needs all
|
# we need to run it as a pre-realbuild-commands hook because it needs all
|
||||||
# dependencies to be installed
|
# dependencies to be installed
|
||||||
sbuild --$archall --quiet \
|
sbuild --$archall --quiet \
|
||||||
--pre-realbuild-commands="/home/findunusedbd.sh equivs $bd" \
|
--starting-build-commands="/home/findunusedbd.sh equivs $bd" \
|
||||||
"$dscname"
|
"$dscname"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo $bd >> "${unusedbdname}".real
|
echo $bd >> "${unusedbdname}".real
|
||||||
|
|
Loading…
Reference in a new issue