[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
88/376: Refactor
From: |
Ludovic Courtès |
Subject: |
88/376: Refactor |
Date: |
Wed, 28 Jan 2015 22:04:14 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 56131a2709d76a1e52bada83a083bd2cfee2f716
Author: Eelco Dolstra <address@hidden>
Date: Thu Jul 24 12:24:25 2014 +0200
Refactor
---
perl/lib/Nix/CopyClosure.pm | 8 +-------
perl/lib/Nix/SSH.pm | 21 ++++++++++++++++++++-
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/perl/lib/Nix/CopyClosure.pm b/perl/lib/Nix/CopyClosure.pm
index f701a7c..061a15c 100644
--- a/perl/lib/Nix/CopyClosure.pm
+++ b/perl/lib/Nix/CopyClosure.pm
@@ -27,13 +27,7 @@ sub copyToOpen {
# Get back the set of paths that are already valid on the remote host.
my %present;
- my $n = readInt($from);
- while ($n--) {
- my $len = readInt($from);
- my $s = readN($len, $from);
- $present{$s} = 1;
- readN(8 - $len % 8, $from) if $len % 8; # skip padding
- }
+ $present{$_} = 1 foreach readStrings($from);
my @missing = grep { !$present{$_} } @closure;
return if address@hidden;
diff --git a/perl/lib/Nix/SSH.pm b/perl/lib/Nix/SSH.pm
index 3bcbabe..dd3e5ce 100644
--- a/perl/lib/Nix/SSH.pm
+++ b/perl/lib/Nix/SSH.pm
@@ -7,7 +7,8 @@ use IPC::Open2;
our @ISA = qw(Exporter);
our @EXPORT = qw(
sshOpts openSSHConnection closeSSHConnection
- readN readInt writeInt writeString writeStrings
+ readN readInt readString readStrings
+ writeInt writeString writeStrings
connectToRemoteNix
);
@@ -83,6 +84,24 @@ sub readInt {
}
+sub readString {
+ my ($from) = @_;
+ my $len = readInt($from);
+ my $s = readN($len, $from);
+ readN(8 - $len % 8, $from) if $len % 8; # skip padding
+ return $s;
+}
+
+
+sub readStrings {
+ my ($from) = @_;
+ my $n = readInt($from);
+ my @res;
+ push @res, readString($from) while $n--;
+ return @res;
+}
+
+
sub writeInt {
my ($n, $to) = @_;
syswrite($to, pack("L<x4", $n)) or die;
- 69/376: Bump, (continued)
- 69/376: Bump, Ludovic Courtès, 2015/01/28
- 62/376: Be more strict about file names in NARs, Ludovic Courtès, 2015/01/28
- 78/376: Pass -pthread only for programs that need it, Ludovic Courtès, 2015/01/28
- 80/376: Remove some dead code, Ludovic Courtès, 2015/01/28
- 72/376: Remove dead code, Ludovic Courtès, 2015/01/28
- 81/376: Add some assertions, Ludovic Courtès, 2015/01/28
- 82/376: More debugging, Ludovic Courtès, 2015/01/28
- 85/376: tests/remote-builds.nix: Don't try cache.nixos.org, Ludovic Courtès, 2015/01/28
- 79/376: Remove some obsolete files, Ludovic Courtès, 2015/01/28
- 83/376: Fix bogus pass by reference, Ludovic Courtès, 2015/01/28
- 88/376: Refactor,
Ludovic Courtès <=
- 87/376: tests/remote-builds.nix: Test failing build, Ludovic Courtès, 2015/01/28
- 89/376: build-remote.pl: Be less verbose on failing builds, Ludovic Courtès, 2015/01/28
- 86/376: nix-store --serve: Only monitor stdin during builds, Ludovic Courtès, 2015/01/28
- 77/376: nix-daemon: Less verbosity, Ludovic Courtès, 2015/01/28
- 74/376: nix-daemon: Use a thread instead of SIGPOLL to catch client disconnects, Ludovic Courtès, 2015/01/28
- 99/376: install-nix-from-closure.sh: Install cacert, Ludovic Courtès, 2015/01/28
- 93/376: nix-copy-closure: Implement --gzip via ssh's -C flag, Ludovic Courtès, 2015/01/28
- 91/376: Remove obsolete SSH master connection code, Ludovic Courtès, 2015/01/28
- 100/376: Rename nixPath to __nixPath, Ludovic Courtès, 2015/01/28
- 95/376: Change the default for use-ssh-substituter to ‘true’, Ludovic Courtès, 2015/01/28