diff options
author | Pascal Rigaux <pixel@mandriva.com> | 1999-12-19 20:49:19 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 1999-12-19 20:49:19 +0000 |
commit | a033de58c091af821e3323963be6ce6dcf101afc (patch) | |
tree | a5f452a614e3e4a64cbd96035c754f55dc733818 | |
parent | 1dee2c62b8b19cefa4dbf096027428ef786ec057 (diff) | |
download | urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.gz urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.bz2 urpmi-a033de58c091af821e3323963be6ce6dcf101afc.tar.xz urpmi-a033de58c091af821e3323963be6ce6dcf101afc.zip |
no_comment
-rw-r--r-- | Makefile | 7 | ||||
-rwxr-xr-x | _irpm | 2 | ||||
-rw-r--r-- | autoirpm.README | 2 | ||||
-rw-r--r-- | autoirpm.uninstall | 2 | ||||
-rw-r--r-- | autoirpm.update | 6 | ||||
-rw-r--r-- | autoirpm.update-all.cc | 2 | ||||
-rw-r--r-- | rpm-find-leaves | 20 | ||||
-rwxr-xr-x | urpmi | 29 | ||||
-rw-r--r-- | urpmi.8 | 8 | ||||
-rwxr-xr-x | urpmi.addmedia | 20 | ||||
-rw-r--r-- | urpmi.addmedia.8 | 8 | ||||
-rw-r--r-- | urpmi.removemedia.8 | 8 |
12 files changed, 70 insertions, 44 deletions
@@ -3,7 +3,8 @@ BINDIR = $(PREFIX)/usr/bin MANDIR = $(PREFIX)/usr/man SBINDIR = $(PREFIX)/usr/sbin XBINDIR = $(PREFIX)/usr/X11R6/bin -URPMIDIR = $(PREFIX)/etc/urpmi +URPMIDIR = $(PREFIX)/var/lib/urpmi +URPMIDIR2 = $(PREFIX)/etc/urpmi LOCALEDIR = $(PREFIX)/usr/share/locale @@ -11,10 +12,10 @@ LOCALEDIR = $(PREFIX)/usr/share/locale install: autoirpm.update-all $(MAKE) -C po $@ - install -d $(BINDIR) $(SBINDIR) $(XBINDIR) $(URPMIDIR) $(MANDIR)/man8 + install -d $(BINDIR) $(SBINDIR) $(XBINDIR) $(URPMIDIR) $(URPMIDIR2) $(MANDIR)/man8 install -m 4755 urpmi $(BINDIR) install _irpm rpm-find-leaves $(BINDIR) - install -m 644 autoirpm.deny $(URPMIDIR) + install -m 644 autoirpm.deny $(URPMIDIR2) for i in *.8; do bzip2 -c $$i > $(MANDIR)/man8/$$i.bz2 ; done install urpmi.addmedia autoirpm.update autoirpm.uninstall $(SBINDIR) install -s autoirpm.update-all $(SBINDIR) @@ -3,7 +3,7 @@ $automatic = 0; $timeout = 15; -$DIR = "/etc/urpmi"; +$DIR = "/var/lib/urpmi"; $BASE = "$DIR/autoirpm"; $INSTALL_SCRIPT_REP = "$BASE.scripts"; diff --git a/autoirpm.README b/autoirpm.README index 61e2afa0..dd341bec 100644 --- a/autoirpm.README +++ b/autoirpm.README @@ -7,7 +7,7 @@ List of packages not to autoinstall: - the one containing netscape (just a wrapper) -ALL BELOW IS MAYBE OBSOLETE +ALL BELOW IS (was MAYBE, is COMPLETELY) OBSOLETE The idea is to auto-install rpms on demand, when needed. For this, every diff --git a/autoirpm.uninstall b/autoirpm.uninstall index d0483a03..cd03a7de 100644 --- a/autoirpm.uninstall +++ b/autoirpm.uninstall @@ -1,6 +1,6 @@ #!/usr/bin/perl -$DIR = "/etc/urpmi"; +$DIR = "/var/lib/urpmi"; $BASE = "$DIR/autoirpm"; $AUTO_INSTALL_BIN_LIST = "$BASE.binaries"; $INSTALL_SCRIPT_REP = "$BASE.scripts"; diff --git a/autoirpm.update b/autoirpm.update index 3dfff948..7be979ea 100644 --- a/autoirpm.update +++ b/autoirpm.update @@ -1,11 +1,13 @@ #!/usr/bin/perl -$DIR = "/etc/urpmi"; +$DIR = "/var/lib/urpmi"; +$DIR2 = "/etc/urpmi"; $BASE = "$DIR/autoirpm"; +$BASE2 = "$DIR2/autoirpm"; $AUTO_INSTALL_BIN_LIST = "$BASE.binaries"; $INSTALL_SCRIPT_REP = "$BASE.scripts"; -system("autoirpm.update-all $BASE.allow $BASE.deny $DIR/hdlist.* > $AUTO_INSTALL_BIN_LIST"); +system("gzip -dc $DIR/hdlist.*.gz | autoirpm.update-all $BASE2.allow $BASE2.deny - > $AUTO_INSTALL_BIN_LIST"); $? == 0 or die "autoirpm.upgrade-all failed\n"; open F, $AUTO_INSTALL_BIN_LIST or die; diff --git a/autoirpm.update-all.cc b/autoirpm.update-all.cc index db2ee5a2..3d13899e 100644 --- a/autoirpm.update-all.cc +++ b/autoirpm.update-all.cc @@ -35,7 +35,7 @@ int main(int argc, char **argv) { for (int i = 3; i < argc; i++) { Header header; - FD_t fd = fdOpen(argv[i], O_RDONLY, 0); + FD_t fd = strcmp(argv[i], "-") == 0 ? fdDup(STDIN_FILENO) : fdOpen(argv[i], O_RDONLY, 0); if (fdFileno(fd) < 0) { fprintf(stderr, "%s: cannot open file %s\n", argv[0], argv[i]); exit(1); diff --git a/rpm-find-leaves b/rpm-find-leaves index 30f3f2f1..f94190c5 100644 --- a/rpm-find-leaves +++ b/rpm-find-leaves @@ -1,7 +1,19 @@ #!/usr/bin/perl +local $_ = join '', @ARGV; + +/-h/ and die "usage: rpm-find-leaves [--show-unknown]\n"; + +$show_unknown = /-show-unknown/; + $r = join '|', map { chop; $l{$_} = 1; quotemeta } `rpm -qa --queryformat "%{NAME}\n"`; -$R = qr/ $r/; -open F, "/etc/urpmi/depslist" or die "can't find depslist\n"; -$R && /(\S+)-[^-]+-[^-]+ / && delete $l{$1} foreach <F>; -print "$_\n" foreach keys %l; +$R = qr/ ($r)-\d/; +$R2 = qr/$r /; +open F, "/var/lib/urpmi/depslist" or die "can't find depslist\n"; +F: foreach (<F>) { + my ($p) = /(\S+)-[^-]+-[^-]+ /; + $p =~ $R2 or next; # not installed + $L{$p} = 1; + delete $l{$1} while /$R/g; +} +$show_unknown || $L{$_} and print "$_\n" foreach keys %l; @@ -5,10 +5,7 @@ load_po(); $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"; $< = $>; - -open LOG, ">>/var/log/urpmi.log" or die; -print LOG scalar localtime, " urpmi called with @ARGV\n"; -close LOG; +log_it(scalar localtime, " urpmi called with @ARGV\n"); if (@ARGV and $ARGV[0] eq '--auto') { $auto = 1; @@ -27,18 +24,19 @@ while (@ARGV and $ARGV[0] eq '--comment') { @ARGV or die "usage: urpmi [--auto] package_name [package_names...]\n"; -$dir = "/etc/urpmi"; +$dir = "/var/lib/urpmi"; +$dir2 = "/etc/urpmi"; $depsfile = "$dir/depslist"; $rpmlistfiles = "$dir/list.*"; open SAVEOUT, ">&STDOUT"; open SAVEERR, ">&STDERR"; -open STDOUT, "|tee -a /var/log/urpmi.installed" or die; +open STDOUT, "|tee -a /var/log/urpmi.log" or die; open STDERR, "|tee -a /var/log/urpmi.log" or die; select STDERR; $| = 1; # make unbuffered select STDOUT; $| = 1; # make unbuffered -open F, $depsfile or die(); +open F, $depsfile or die "missing dependencies file ($depsfile)"; foreach (<F>) { my ($pack, $size, $deps) = /(\S+)\s+(\S+)\s+(.*)/ or die("urpmi: bad format file $depsfile\n"); $size{$pack} = $size; @@ -61,7 +59,7 @@ foreach (@ARGV) { unless ($pack) { my $l = $found{$_}; $l or $l = $foundi{$_}; if (@$l == 0) { warn(_("no package named %s\n", $_)); $ok = 0; } - elsif (@$l > 1) { warn(_("The following packages contain %s: %s\n", $_, join(', ', @$l))); $ok = 0; } + elsif (@$l > 1) { warn(_("The following packages contain %s: %s\n", $_, join(' ', @$l))); $ok = 0; } $pack = $$l[0]; } push @packages, $pack; @@ -109,7 +107,7 @@ foreach $l (@to_install) { push @{$removables{$n}->{list}}, $_; } else { if (s|^file:/||) { - if (|^(/mnt/.*?)/|) { + if (m|^(/mnt/.*?)/|) { -e $_ || $try2mount{$1} or $try2mount{$1} = 1, `mount $1 2>/dev/null`; } } @@ -117,6 +115,8 @@ foreach $l (@to_install) { } } +install(@to_install_long) unless $removables{0} || $removables{1}; + foreach (sort keys %removables) { my $f = @{$removables{$_}->{list}}[0]; my $dev = $removables{$_}->{device}; @@ -137,7 +137,8 @@ foreach (sort keys %removables) { install(@{$removables{$_}->{list}}); } -install(@to_install_long); +install(@to_install_long) if $removables{0} || $removables{1}; + $something_was_installed or message(_("everything already installed")); sub install { @@ -145,7 +146,7 @@ sub install { $something_was_installed = 1; print SAVEOUT _("installing %s\n", join(' ', @_)); - print scalar localtime, " @_\n"; + log_it(scalar localtime, " @_\n"); $X ? `grpmi @_` : `rpm -U @_`; $? and message(_("Installation failed")), exit 1; } @@ -224,6 +225,12 @@ sub difference2(\@\@) { my %l; @l{@{$_[1]}} = (); grep { !exists $l{$_} } @{$_[0 sub _ { my $s = shift @_; sprintf translate($s), @_ } sub translate { $I18N{$_[0]} || $_[0]; } +sub log_it { + local *LOG; + open LOG, ">>/var/log/urpmi.log" or die; + print LOG @_; +} + sub untaint { my @r = (); foreach (@_) { @@ -42,11 +42,11 @@ installs all required dependencies without asking. .br The \fBurpmi\fP executable (perl script) .PP -/etc/urpmi/list.* +/var/lib/urpmi/list.* .br Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). .PP -/etc/urpmi/hdlist.* +/var/lib/urpmi/hdlist.* .br Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). .PP @@ -54,11 +54,11 @@ Contain information about all known packages, it's a summary of rpm headers. Th .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/etc/urpmi/depslist +/var/lib/urpmi/depslist .br A simple text file containning all dependencies of all known packages. .PP -/etc/urpmi/depslist +/var/lib/urpmi/depslist.html .br The same but in html format, user readable. .SH "SEE ALSO" diff --git a/urpmi.addmedia b/urpmi.addmedia index ec941731..b1bc5f5c 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -1,8 +1,9 @@ #!/usr/bin/perl -my $DIR = "/etc/urpmi"; +my $DIR = "/var/lib/urpmi"; +my $DIR2 = "/etc/urpmi"; my $DEPSLIST = "$DIR/depslist"; -my $CFG = "$DIR/urpmi.cfg"; +my $CFG = "$DIR2/urpmi.cfg"; $| = 1; @@ -18,11 +19,13 @@ sub substInFile(&@) { my @entries = map { /list.(.*)/ } glob("$DIR/list.*"); if ($0 =~ /removemedia/) { - local ($_) = @ARGV or die "missing the entry to remove\n(one of " . join(", ", @entries) . ")\n"; + local ($_) = @ARGV or @entries ? + die "missing the entry to remove\n(one of " . join(", ", @entries) . ")\n" : + die "nothing to remove (use urpmi.addmedia to add a media)\n"; foreach $e (/^--?a/ ? @entries : @ARGV) { my $f; - $f = "$DIR/hdlist.$e"; unlink $f || unlink "$f.gz" or die "failed to remove $f"; - $f = "$DIR/list.$e"; unlink $f or die "failed to remove $f"; + $f = "$DIR/hdlist.$e"; unlink($f) || unlink("$f.gz") or warn "failed to remove $f"; + $f = "$DIR/list.$e"; unlink($f) or warn "failed to remove $f"; substInFile { s/^/\#/ if /^$e\s/ } $CFG; } system("urpmi.update"); @@ -34,7 +37,7 @@ if ($0 =~ /removemedia/) { } if (glob("$DIR/hdlist.*")) { print "generating dependencies list\n"; - system("gzip $DIR/hdlist.* 2>/dev/null"); # gzip + system("gzip -f $DIR/hdlist.* 2>/dev/null"); # gzip system("gzip -dc $DIR/hdlist.* | gendepslist -h $DEPSLIST -"); system("autoirpm.update"); } else { @@ -84,6 +87,7 @@ my $RPMLIST = "$DIR/list.$name"; -e $DIR || mkdir $DIR, 0755 or die "can't create $DIR"; !-e $HDLIST || unlink $HDLIST or die "can't remove $HDLIST"; +!-e "$HDLIST.gz" || unlink "$HDLIST.gz" or die "can't remove $HDLIST.gz"; my $mask = umask 077; open LIST, ">$RPMLIST" or die "can't output $RPMLIST"; @@ -93,9 +97,9 @@ if (my ($prefix, $dir) = $url =~ m,^(removable_.*?|file):/(.*),) { my $hdlist = ''; my $flush = sub {}; if (-e (my $f = "$dir/Mandrake/base/hdlist")) { - system("cp -f $f $HDLIST"); + system("gzip -f $f > $HDLIST.gz"); } else { - $flush = sub { system("rpm2header $hdlist >> $HDLIST") if $hdlist }; + $flush = sub { system("rpm2header $hdlist | gzip >> $HDLIST.gz") if $hdlist }; } print "scanning $dir..."; open F, "find $dir -follow -name '*.rpm'|"; diff --git a/urpmi.addmedia.8 b/urpmi.addmedia.8 index dd9799ce..a4ab6eae 100644 --- a/urpmi.addmedia.8 +++ b/urpmi.addmedia.8 @@ -45,11 +45,11 @@ Removable device: .br The \fBurpmi\fP executable (perl script) .PP -/etc/urpmi/list.* +/var/lib/urpmi/list.* .br Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). .PP -/etc/urpmi/hdlist.* +/var/lib/urpmi/hdlist.* .br Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). .PP @@ -57,11 +57,11 @@ Contain information about all known packages, it's a summary of rpm headers. Th .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/etc/urpmi/depslist +/var/lib/urpmi/depslist .br A simple text file containing all dependencies of all known packages. .PP -/etc/urpmi/depslist.html +/var/lib/urpmi/depslist.html .br The same but in html format, user readable. .SH "SEE ALSO" diff --git a/urpmi.removemedia.8 b/urpmi.removemedia.8 index d4c84ca4..b53bde82 100644 --- a/urpmi.removemedia.8 +++ b/urpmi.removemedia.8 @@ -14,11 +14,11 @@ urpmi.removemedia removes from all configuration files all references to the nam .br The \fBurpmi\fP executable (perl script) .PP -/etc/urpmi/list.* +/var/lib/urpmi/list.* .br Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). .PP -/etc/urpmi/hdlist.* +/var/lib/urpmi/hdlist.* .br Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). .PP @@ -26,11 +26,11 @@ Contain information about all known packages, it's a summary of rpm headers. Th .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/etc/urpmi/depslist +/var/lib/urpmi/depslist .br A simple text file containing all dependencies of all known packages. .PP -/etc/urpmi/depslist.html +/var/lib/urpmi/depslist.html .br The same but in html format, user readable. .SH "SEE ALSO" |