summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-08-06 08:14:53 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-08-06 08:14:53 +0000
commit8162137e1c032b1c66d32407d4c931a438dd77b2 (patch)
treeebfe95f44685a750de45e370a89fc78f3765f6fc
parent9e0e935ac2008088b922975fc8cb4a5b1c2310fa (diff)
avoid pulling in OpenBSD::md5 and File::Copy if we can.
-rw-r--r--usr.sbin/pkg_add/pkg_add8
-rw-r--r--usr.sbin/pkg_add/pkg_info31
2 files changed, 27 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 8040b23d160..d9b2e046b6f 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.41 2004/08/06 08:06:01 espie Exp $
+# $OpenBSD: pkg_add,v 1.42 2004/08/06 08:14:51 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -79,7 +79,6 @@ sub install
package OpenBSD::PackingElement::Sample;
use File::Copy;
-use OpenBSD::md5;
sub install
{
@@ -94,6 +93,8 @@ sub install
if (-e $filename) {
print "The existing configuration file $filename has NOT been changed\n";
if (defined $orig->{md5}) {
+ require OpenBSD::md5;
+
my $md5 = OpenBSD::md5::fromfile($filename);
if ($md5 eq $orig->{md5}) {
print "\t(but it seems to match the sample file $origname)\n";
@@ -399,7 +400,8 @@ sub borked_installation
# last file may have not copied correctly
my $last = $plist->{items}->[@{$plist->{items}}-1];
if ($last->IsFile()) {
- use OpenBSD::md5;
+ require OpenBSD::md5;
+
my $old = $last->{md5};
$last->{md5} = OpenBSD::md5::fromfile($last->{fullname});
if ($old ne $last->{md5}) {
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 596eec13741..7b58bf3dd4c 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.6 2004/08/06 08:06:01 espie Exp $
+# $OpenBSD: pkg_info,v 1.7 2004/08/06 08:14:52 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -21,7 +21,6 @@ use warnings;
use OpenBSD::PackageInfo;
use OpenBSD::PackageName;
use Getopt::Std;
-use File::Copy;
package main;
@@ -50,38 +49,52 @@ sub print_info
} else {
print $opt_p, "Information for ", $pkg, "\n\n" unless $opt_q;
if ($opt_c) {
+ require File::Copy;
+
print $opt_p, "Comment:\n" unless $opt_q;
- copy($dir.COMMENT, \*STDOUT);
+ File::Copy::copy($dir.COMMENT, \*STDOUT);
print "\n";
}
if ($opt_R && -f $dir.REQUIRED_BY) {
+ require File::Copy;
+
print $opt_p, "Required by:\n" unless $opt_q;
- copy($dir.REQUIRED_BY, \*STDOUT);
+ File::Copy::copy($dir.REQUIRED_BY, \*STDOUT);
print "\n";
}
if ($opt_d) {
+ require File::Copy;
+
print $opt_p, "Description:\n" unless $opt_q;
- copy($dir.DESC, \*STDOUT);
+ File::Copy::copy($dir.DESC, \*STDOUT);
print "\n";
}
if ($opt_D && -f $dir.DISPLAY) {
+ require File::Copy;
+
print $opt_p, "Install notice:\n" unless $opt_q;
- copy($dir.DISPLAY, \*STDOUT);
+ File::Copy::copy($dir.DISPLAY, \*STDOUT);
print "\n";
}
if ($opt_i && -f $dir.INSTALL) {
+ require File::Copy;
+
print $opt_p, "Install script:\n" unless $opt_q;
- copy($dir.INSTALL, \*STDOUT);
+ File::Copy::copy($dir.INSTALL, \*STDOUT);
print "\n";
}
if ($opt_k && -f $dir.DEINSTALL) {
+ require File::Copy;
+
print $opt_p, "De-Install script:\n" unless $opt_q;
- copy($dir.DEINSTALL, \*STDOUT);
+ File::Copy::copy($dir.DEINSTALL, \*STDOUT);
print "\n";
}
if ($opt_r && -f $dir.REQUIRE) {
+ require File::Copy;
+
print $opt_p, "Require script:\n" unless $opt_q;
- copy($dir.REQUIRE, \*STDOUT);
+ File::Copy::copy($dir.REQUIRE, \*STDOUT);
print "\n";
}
my $plist;