aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2004-11-17 18:39:57 +0000
committerJason Woodward2004-11-17 18:39:57 +0000
commit1912526103d026ebdda45a3163df3d63f81c5970 (patch)
treed4e29d9c3d290af61c45b28a263ad9d3a4c89bb1
parent27550840d0ba30284b65465decd7eb13399195c1 (diff)
downloadslapt-get-1912526103d026ebdda45a3163df3d63f81c5970.tar.gz
added FAQ: 48. How can I search the contents of a package for a file or library?
-rw-r--r--ChangeLog1
-rw-r--r--FAQ78
-rw-r--r--FAQ.html80
3 files changed, 159 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index c34ca20..d387294 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
0.9.9d Nov 17, 2004
+ * added FAQ: 48. How can I search the contents of a package for a file or library?
* added czech translation by Oto Petrik
* made head_mirror_data clear_head_cache write_head_cache read_head_cache
gen_filename_from_url gen_head_cache_filename get_md5sum non static
diff --git a/FAQ b/FAQ
index c7e27c3..217e689 100644
--- a/FAQ
+++ b/FAQ
@@ -48,6 +48,7 @@ Frequenty Asked Questions:
45. Will slapt-get break my system?
46. What is a meta package and how can I take advantage of it?
47. How can I downgrade a package?
+48. How can I search the contents of a package for a file or library?
@@ -950,4 +951,81 @@ Frequenty Asked Questions:
Do you want to continue? [y/N]
+48. How can I search the contents of a package for a file or library?
+
+ Slapt-get does not pay attention to the contents of packages. Slackware
+ provides the MANIFEST.bz2 and the contents of /var/log/packages for such
+ functionality. Searching for which installed package owns a file is
+ accomplished the easiest by using grep with the contents of
+ /var/log/packages/.
+
+ The same can be done with the MANIFEST.bz2 file. You can use one of the
+ following solutions:
+
+ Put something like this in your shell's rc file (or /etc/profile) would do
+ just as well:
+
+ # begin
+ function search_manifest {
+ LASTPKG=
+
+ if [ -z "$1" ]; then return;fi
+
+ if [ -z "$MANIFEST" ]; then
+ echo "Please set MANIFEST env variable to point to a downloaded MANIFEST.bz2"
+ return
+ fi
+
+ if [ ! -f ${MANIFEST/MANIFEST.bz2/package_list} ]; then
+ bzgrep -n ' Package\: ' ${MANIFEST}|awk '{print $1 $3}'|sed -re "s/\|//g" >
+ ${MANIFEST/MANIFEST.bz2/package_list}
+ fi
+
+ FILE=$( echo $1 | sed -re "s/^\///");
+ LOOKUP=$(bzgrep -n $FILE $MANIFEST|cut -f1 -d':')
+
+ if [ -z "$LOOKUP" ]; then
+ echo "$1 not found in $MANIFEST"
+ return
+ fi
+
+ for pkgline in `cat ${MANIFEST/MANIFEST.bz2/package_list}|cut -f1 -d':'`
+ do
+
+ if [ $LOOKUP -gt $pkgline ]; then
+ false
+ else
+ LASTPKG=`grep -B 1 $pkgline ${MANIFEST/MANIFEST.bz2/package_list}|head -1 \
+ |cut -f2 -d':'|cut -f3 -d'/'`
+ echo $LASTPKG $1
+ return
+ fi
+
+ done
+ }
+ #end
+
+ Then you'd just call from your shell search_manifest /usr/lib/libpci.a:
+ pciutils-2.1.11-i486-5.tgz /usr/lib/libpci.a
+
+ Or you can use this solution provided by Nathan Morell <frizop at eatel.net>
+
+ #!/usr/bin/perl
+ use strict;
+ use warnings;
+ use PerlIO::gzip;
+
+ open FOO, "<:gzip", "/home/jidar/MANIFEST.gz" or die $!;
+
+ my $temp;
+ while (<FOO>){ # And it will be uncompressed...
+ if ($_ =~ m/\|\| Package: /g) {
+ $_ =~ s/\|\| Package: /PACKAGE: /g;
+ $temp = $_;
+ }
+ if ($_ =~ m/($ARGV[0])/g) {
+ print $temp . $_;
+ }
+ }
+
diff --git a/FAQ.html b/FAQ.html
index f105f0b..1ff17bb 100644
--- a/FAQ.html
+++ b/FAQ.html
@@ -62,6 +62,7 @@
<A href="#slgFAQ45">45. Will slapt-get break my system?</A>
<A href="#slgFAQ46">46. What is a meta package and how can I take advantage of it?</A>
<A href="#slgFAQ47">47. How can I downgrade a package?</A>
+<A href="#slgFAQ48">48. How can I search the contents of a package for a file or library?</A>
@@ -958,6 +959,85 @@
After unpacking 30K disk space will be freed.
Do you want to continue? [y/N]
+
+<A NAME="slgFAQ48"><B>48. How can I search the contents of a package for a file or library?</B></A>
+
+ Slapt-get does not pay attention to the contents of packages. Slackware
+ provides the MANIFEST.bz2 and the contents of /var/log/packages for such
+ functionality. Searching for which installed package owns a file is
+ accomplished the easiest by using grep with the contents of
+ /var/log/packages/.
+
+ The same can be done with the MANIFEST.bz2 file. You can use one of the
+ following solutions:
+
+ Put something like this in your shell's rc file (or /etc/profile) would do
+ just as well:
+
+ # begin
+ function search_manifest {
+ LASTPKG=
+
+ if [ -z "$1" ]; then return;fi
+
+ if [ -z "$MANIFEST" ]; then
+ echo "Please set MANIFEST env variable to point to a downloaded MANIFEST.bz2"
+ return
+ fi
+
+ if [ ! -f ${MANIFEST/MANIFEST.bz2/package_list} ]; then
+ bzgrep -n ' Package\: ' ${MANIFEST}|awk '{print $1 $3}'|sed -re "s/\|//g" >
+ ${MANIFEST/MANIFEST.bz2/package_list}
+ fi
+
+ FILE=$( echo $1 | sed -re "s/^\///");
+ LOOKUP=$(bzgrep -n $FILE $MANIFEST|cut -f1 -d':')
+
+ if [ -z "$LOOKUP" ]; then
+ echo "$1 not found in $MANIFEST"
+ return
+ fi
+
+ for pkgline in `cat ${MANIFEST/MANIFEST.bz2/package_list}|cut -f1 -d':'`
+ do
+
+ if [ $LOOKUP -gt $pkgline ]; then
+ false
+ else
+ LASTPKG=`grep -B 1 $pkgline ${MANIFEST/MANIFEST.bz2/package_list}|head -1 \
+ |cut -f2 -d':'|cut -f3 -d'/'`
+ echo $LASTPKG $1
+ return
+ fi
+
+ done
+ }
+ #end
+
+ Then you'd just call from your shell search_manifest /usr/lib/libpci.a:
+ pciutils-2.1.11-i486-5.tgz /usr/lib/libpci.a
+
+ Or you can use this solution provided by Nathan Morell <frizop at eatel.net>
+
+ #!/usr/bin/perl
+ use strict;
+ use warnings;
+ use PerlIO::gzip;
+
+ open FOO, "<:gzip", "/home/jidar/MANIFEST.gz" or die $!;
+
+ my $temp;
+ while (<FOO>){ # And it will be uncompressed...
+ if ($_ =~ m/\|\| Package: /g) {
+ $_ =~ s/\|\| Package: /PACKAGE: /g;
+ $temp = $_;
+ }
+ if ($_ =~ m/($ARGV[0])/g) {
+ print $temp . $_;
+ }
+ }
+
+
</PRE>