nix-channel --update: allow updating only the specified channels
This commit is contained in:
parent
147f10157f
commit
afa7b8a479
2 changed files with 14 additions and 10 deletions
|
@ -22,7 +22,7 @@
|
||||||
<arg choice='plain'><option>--add</option> <replaceable>url</replaceable> <arg choice='opt'><replaceable>name</replaceable></arg></arg>
|
<arg choice='plain'><option>--add</option> <replaceable>url</replaceable> <arg choice='opt'><replaceable>name</replaceable></arg></arg>
|
||||||
<arg choice='plain'><option>--remove</option> <replaceable>url</replaceable></arg>
|
<arg choice='plain'><option>--remove</option> <replaceable>url</replaceable></arg>
|
||||||
<arg choice='plain'><option>--list</option></arg>
|
<arg choice='plain'><option>--list</option></arg>
|
||||||
<arg choice='plain'><option>--update</option></arg>
|
<arg choice='plain'><option>--update</option> <arg rep='repeat'><replaceable>names</replaceable></arg></arg>
|
||||||
</group>
|
</group>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
|
@ -67,14 +67,15 @@ condition="manual">See also <xref linkend="sec-channels"
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry><term><option>--update</option></term>
|
<varlistentry><term><option>--update</option> [<replaceable>names</replaceable>…]</term>
|
||||||
|
|
||||||
<listitem><para>Downloads the Nix expressions of all subscribed
|
<listitem><para>Downloads the Nix expressions of all subscribed
|
||||||
channels, makes them the default for <command>nix-env</command>
|
channels (or only those included in
|
||||||
operations (by symlinking them from the directory
|
<replaceable>names</replaceable> if specified), makes them the
|
||||||
<filename>~/.nix-defexpr</filename>), and performs a
|
default for <command>nix-env</command> operations (by symlinking
|
||||||
<command>nix-pull</command> on the manifests of all channels to
|
them from the directory <filename>~/.nix-defexpr</filename>), and
|
||||||
make pre-built binaries available.</para></listitem>
|
performs a <command>nix-pull</command> on the manifests of all
|
||||||
|
channels to make pre-built binaries available.</para></listitem>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,8 @@ sub removeChannel {
|
||||||
# Fetch Nix expressions and pull manifests from the subscribed
|
# Fetch Nix expressions and pull manifests from the subscribed
|
||||||
# channels.
|
# channels.
|
||||||
sub update {
|
sub update {
|
||||||
|
my @channelNames = @_;
|
||||||
|
|
||||||
readChannels;
|
readChannels;
|
||||||
|
|
||||||
# Create the manifests directory if it doesn't exist.
|
# Create the manifests directory if it doesn't exist.
|
||||||
|
@ -87,6 +89,8 @@ sub update {
|
||||||
# Download each channel.
|
# Download each channel.
|
||||||
my $exprs = "";
|
my $exprs = "";
|
||||||
foreach my $name (keys %channels) {
|
foreach my $name (keys %channels) {
|
||||||
|
next if scalar @channelNames > 0 && ! grep { $_ eq $name } @{channelNames};
|
||||||
|
|
||||||
my $url = $channels{$name};
|
my $url = $channels{$name};
|
||||||
my $origUrl = "$url/MANIFEST";
|
my $origUrl = "$url/MANIFEST";
|
||||||
|
|
||||||
|
@ -141,7 +145,7 @@ Usage:
|
||||||
nix-channel --add URL [CHANNEL-NAME]
|
nix-channel --add URL [CHANNEL-NAME]
|
||||||
nix-channel --remove CHANNEL-NAME
|
nix-channel --remove CHANNEL-NAME
|
||||||
nix-channel --list
|
nix-channel --list
|
||||||
nix-channel --update
|
nix-channel --update [CHANNEL-NAME...]
|
||||||
EOF
|
EOF
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
@ -182,8 +186,7 @@ while (scalar @ARGV) {
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($arg eq "--update") {
|
elsif ($arg eq "--update") {
|
||||||
usageError if scalar @ARGV != 0;
|
update(@ARGV);
|
||||||
update;
|
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue