diff to PackageLocator.pm to support multiple installpath entries

2011-09-07 Thread Marian Hettwer

Hi there,

see attached diff to PackageLocator.pm.
It seems like in it's current version it doesn't support multiple 
installpath entries, like:


installpath = ftp://mymirror/localrepo
installpath += ftp://mymirror/officialrepo

Before it was only honoring the first entry, no matter whether += or = 
for the first entry.


However, now it works as documented in pkg.conf(5)

best regards,
Marian

http://crivens.terrorteam.de/~rabauke/OpenBSD/PackageLocator.pm.diff

or

Index: usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
===
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm,v
retrieving revision 1.99
diff -p -u -r1.99 PackageLocator.pm
--- usr.sbin/pkg_add/OpenBSD/PackageLocator.pm	26 Aug 2011 08:46:10 
-	1.99
+++ usr.sbin/pkg_add/OpenBSD/PackageLocator.pm	7 Sep 2011 10:19:24 
-

@@ -40,7 +40,7 @@ sub build_default_path
return;
}
	$default_path-add(OpenBSD::PackageRepository-new(./, 
$state)-can_be_empty);

-   if (my $i = $state-config-value(installpath)) {
+   for my $i ($state-config-value(installpath)) {
$default_path-add(OpenBSD::PackageRepository-new($i, $state));
}
}



Re: diff to PackageLocator.pm to support multiple installpath entries

2011-09-07 Thread Marc Espie
On Wed, Sep 07, 2011 at 12:26:30PM +0200, Marian Hettwer wrote:
 Hi there,
 
 see attached diff to PackageLocator.pm.
 It seems like in it's current version it doesn't support multiple
 installpath entries, like:
 
 installpath = ftp://mymirror/localrepo
 installpath += ftp://mymirror/officialrepo
 
 Before it was only honoring the first entry, no matter whether += or
 = for the first entry.
 
 However, now it works as documented in pkg.conf(5)
 
 best regards,
 Marian
 
 http://crivens.terrorteam.de/~rabauke/OpenBSD/PackageLocator.pm.diff
 
 or
 
 Index: usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
 ===
 RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm,v
 retrieving revision 1.99
 diff -p -u -r1.99 PackageLocator.pm
 --- usr.sbin/pkg_add/OpenBSD/PackageLocator.pm26 Aug 2011 08:46:10
 - 1.99
 +++ usr.sbin/pkg_add/OpenBSD/PackageLocator.pm7 Sep 2011 10:19:24
 -
 @@ -40,7 +40,7 @@ sub build_default_path
   return;
   }
   $default_path-add(OpenBSD::PackageRepository-new(./,
 $state)-can_be_empty);
 - if (my $i = $state-config-value(installpath)) {
 + for my $i ($state-config-value(installpath)) {
   $default_path-add(OpenBSD::PackageRepository-new($i, $state));
   }
 }
2 points:

1/ pkg.conf(5) does not actually say that all variables are lists. And it was
not really intended for installpath (in particular, if you make installpath
into a list, your next binary upgrade of the base system is going to give
really funny results).

2/ the whole repository/locator/handle mess is under reconstruction, as it is
a total mess, and doesn't even do what I want it to do correctly.  Not exactly
the right time to tweak minor bits in code that's directly headed to the
trashcan...