Просмотр исходного кода

Dpkg::Vendor: Add a new get_vendor_dir function

This makes the overridable directory accessible to code that might need
to print the vendor directory location.
Guillem Jover лет назад: 13
Родитель
Сommit
56d6ca8827
2 измененных файлов с 20 добавлено и 2 удалено
  1. 1 0
      debian/changelog
  2. 19 2
      scripts/Dpkg/Vendor.pm

+ 1 - 0
debian/changelog

@@ -84,6 +84,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
     packages with versions lesser than 0-0 (like 0~0-0). Closes: #676664
   * Fix Dpkg::Control::Hash set_options() to take a hash as argument instead
     of two scalars.
+  * Add a new Dpkg::Vendor get_vendor_dir() function.
 
   [ Updated manpages translations ]
   * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags

+ 19 - 2
scripts/Dpkg/Vendor.pm

@@ -18,7 +18,7 @@ package Dpkg::Vendor;
 use strict;
 use warnings;
 
-our $VERSION = '1.00';
+our $VERSION = '1.01';
 
 use Dpkg::ErrorHandling;
 use Dpkg::Gettext;
@@ -27,7 +27,7 @@ use Dpkg::Control::Hash;
 
 use base qw(Exporter);
 our @EXPORT_OK = qw(get_vendor_info get_current_vendor get_vendor_file
-                    get_vendor_object run_vendor_hook);
+                    get_vendor_dir get_vendor_object run_vendor_hook);
 
 my $origins = '/etc/dpkg/origins';
 $origins = $ENV{DPKG_ORIGINS_DIR} if $ENV{DPKG_ORIGINS_DIR};
@@ -59,6 +59,17 @@ The file should be named according to the vendor name.
 
 =over 4
 
+=item $dir = Dpkg::Vendor::get_vendor_dir()
+
+Returns the current dpkg origins directory name, where the vendor files
+are stored.
+
+=cut
+
+sub get_vendor_dir {
+    return $origins;
+}
+
 =item $fields = Dpkg::Vendor::get_vendor_info($name)
 
 Returns a Dpkg::Control object with the information parsed from the
@@ -159,6 +170,12 @@ sub run_vendor_hook {
 
 =back
 
+=head1 CHANGES
+
+=head2 Version 1.01
+
+New function: get_vendor_dir().
+
 =cut
 
 1;