The previous patch didn't work correctly when m-a was called with "-a
-f get". Now aptitude reinstalls correctly the package.
Have a nice day,
Javi (vicho)
diff -r d64b0a90eb02 -r 7a7f47e916b8 modass/packages/generic.sh
--- a/modass/packages/generic.sh Fri May 04 17:10:36 2007 +0200
+++ b/modass/packages/generic.sh Sun May 06 18:25:32 2007 +0200
@@ -203,7 +203,20 @@ unpack() {
}
download() {
- action $ROOT_CMD apt-get $REINSTALL install $sourcepkg
+ action $ROOT_CMD $APT_GET_CMD $REINSTALL install $sourcepkg
+}
+
+reinstall() {
+ if action $ROOT_CMD dpkg --get-selections | grep $sourcepkg | grep -q '[^de]install' ; then
+ if [ "$APT_GET_CMD" = "apt-get" ]; then
+ export REINSTALL="${REINSTALL} --reinstall"
+ download
+ else
+ action $ROOT_CMD $APT_GET_CMD $REINSTALL reinstall $sourcepkg
+ fi
+ else
+ download
+ fi
}
# wipes the builddir
diff -r d64b0a90eb02 -r 7a7f47e916b8 module-assistant
--- a/module-assistant Fri May 04 17:10:36 2007 +0200
+++ b/module-assistant Sun May 06 18:25:32 2007 +0200
@@ -95,6 +95,7 @@ Options:
-O, --not-unpack Don't unpack the source at all
-s, --apt-search Search for installation candidates in the Debian archive
-S, --sudo-cmd An alternative command for sudo
+ -a, --aptitude Use aptitude instead of apt-get and apt-cache whenever possible
-f, --force Force duplicated work: source package reinstallation,
rebuild though existing packages are found, etc.
-t, --text-mode Text mode, no dialog boxes
@@ -128,6 +129,7 @@ my $distrib_id = get_distrib_id();
my $distrib_id = get_distrib_id();
my $usrc="/usr/src";
+my $apt_get, $apt_cache;
my $opt_help;
my @opt_kerneldirs;
@@ -144,6 +146,7 @@ my $opt_unponce;
my $opt_unponce;
my $opt_notunp;
my $sudo;
+my $use_aptitude;
%options = (
"q|quiet" => \$opt_quiet,
@@ -160,17 +163,28 @@ my $sudo;
"t|text-mode" => \$opt_nogui,
"u|userdir|user-dir=s" => \$opt_userdir,
"s|apt-search" => \$opt_search,
- "S|sudo-cmd=s" => \$sudo
+ "S|sudo-cmd=s" => \$sudo,
+ "a|aptitude" => \$use_aptitude
);
&help unless ( GetOptions(%options));
&help if ($opt_help);
$ENV{"VERBOSE"}=1 if($opt_verbose);
-$ENV{"REINSTALL"} .= " -y --force-yes ";
+$ENV{"REINSTALL"} .= ' -y -o APT::Get::="--force-yes" ';
#$ENV{"APT_LISTCHANGES_FRONTEND"} = "mail" if $opt_noninter; # STFU
my $buildNumber = time();
$opt_nogui=1 if $opt_noninter;
+
+if(defined($use_aptitude)) {
+ $apt_get = "aptitude";
+ $apt_cache = "aptitude";
+}
+else {
+ $apt_get = "apt-get";
+ $apt_cache = "apt-cache";
+
+}
my $command=shift(@ARGV);
@[EMAIL PROTECTED];
@@ -410,7 +424,7 @@ wrap('','',gettext("Bad luck, the kernel
wrap('','',gettext("Bad luck, the kernel headers for the target kernel version could not be found and you did not specify other valid kernel headers to use.")) . "
" if !$kernelwarned;
- if (length(`apt-cache show $kheadpkg 2>/dev/null`) ) {
+ if (length(`$apt_cache show $kheadpkg 2>/dev/null`) ) {
printmsg "\n" .sprintf(
gettext(
"However, you can install the header files for your kernel which are provided by the %s package. For most modules packages, these files are perfectly sufficient without having the original kernel source.
@@ -580,7 +594,7 @@ sub prep {
}
else {
$opt_verbose=1;
- withecho($sudo, "apt-get", ($opt_noninter?"-y":undef), "install", "$kheaders-$todo");
+ withecho($sudo, $apt_get, ($opt_noninter?"-y":undef), "install", "$kheaders-$todo");
if($my_kvers eq $todo) {
$symfrom="$kheaders-$todo";
}
@@ -596,7 +610,7 @@ sub prep {
}
# if(`apt-cache policy build-essential` =~ /Installed:..none/) {
print STDERR gettext("Installing packages needed for the build environment...") . "\n" if (!opt_quiet);
- withecho($sudo, "apt-get". ($opt_noninter?"-y":undef), "install", "build-essential");
+ withecho($sudo, $apt_get. ($opt_noninter?"-y":undef), "install", "build-essential");
# }
print STDERR "\n". gettext("Done!") . "\n";
%ENV=%envbackup;
@@ -686,6 +700,7 @@ sub get {
my $faillog="";
%envbackup=%ENV;
$ENV{ROOT_CMD}=$sudo if ($sudo && !$ENV{ROOT_CMD});
+ $ENV{APT_GET_CMD}=$apt_get;
SKIP: foreach $target (@_) {
my $pkg;
my $reti=0;
@@ -695,9 +710,7 @@ sub get {
if($opt_force) {
- $ENV{"REINSTALL"} .= " --reinstall " unless ($ENV{"REINSTALL"}=~/--reinstall/);
-
- $reti=pexec($pkg, "VERB", "download");
+ $reti=pexec($pkg, "VERB", "reinstall");
$newstuff++;
}
else {
@@ -1011,7 +1024,7 @@ sub install {
if($ret > $ret_save) {
$ret--;
print STDERR "\nI: " . gettext("Direct installation failed, trying to post-install the dependencies") . "\n\n";
- $ret += withecho($sudo, "apt-get", $opt_noninter?"-fy":"-f","install");
+ $ret += withecho($sudo, $apt_get, $opt_noninter?"-fy":"-f","install");
}
}
@@ -1171,7 +1184,7 @@ sub init_packs_desc {
else {
# precache once with cummulative apt-get run
if(!(keys %descache)) {
- open($getdesc, "apt-cache show ".join(' ',keys %packs)." 2>/dev/null |");
+ open($getdesc, "$apt_cache show ".join(' ',keys %packs)." 2>/dev/null |");
while(<$getdesc>) {
$pkg=$1 if(/^Package: (.*)\n/);
if(/^Description: (.*)\n/) {
@@ -1215,10 +1228,10 @@ sub fakesrc {
my $symverfile="$usrc/$kheaders-$kvers/Module.symvers";
my $compileh="$usrc/$kheaders-$kvers/include/linux/compile.h";
print gettext("Experimental kernel source recreating method...\nGetting source...") . "\n";
- return 0 if withecho($sudo, "apt-get", ($opt_noninter?"-y":undef), "install", "$ksource-$knmbr");
+ return 0 if withecho($sudo, $apt_get, ($opt_noninter?"-y":undef), "install", "$ksource-$knmbr");
if(! -f $confile) {
print gettext("Config not found, getting headers to extract the config...") . "\n";
- return 0 if withecho($sudo, "apt-get", ($opt_noninter?"-y":undef), "install", "$kheaders-$kvers");
+ return 0 if withecho($sudo, $apt_get, ($opt_noninter?"-y":undef), "install", "$kheaders-$kvers");
$confile="$usrc/$kheaders-$kvers/.config";
}
$tmpdir="$writedir/tmp-".rand;