Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nora Puchreiner
Nix
Commits
01e30360
Commit
01e30360
authored
21 years ago
by
Eelco Dolstra
Browse files
Options
Downloads
Patches
Plain Diff
* Don't use a temporary file.
parent
163db736
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/nix-pull.in
+14
-9
14 additions, 9 deletions
scripts/nix-pull.in
with
14 additions
and
9 deletions
scripts/nix-pull.in
+
14
−
9
View file @
01e30360
#! /usr/bin/perl -w
use
IPC::
Open2
;
my
$tmpfile
=
"
@localstatedir
@/nix/pull.tmp
";
my
$conffile
=
"
@sysconfdir
@/nix/prebuilts.conf
";
...
...
@@ -7,9 +9,7 @@ my @ids;
my
@subs
;
my
@sucs
;
my
$fixfile
=
"
/tmp/nix-pull-tmp.fix
";
open
FIX
,
"
>
$fixfile
";
print
FIX
"
[
";
my
$fullexpr
=
"
[
";
my
$first
=
1
;
open
CONFFILE
,
"
<
$conffile
";
...
...
@@ -61,9 +61,9 @@ while (<CONFFILE>) {
"
, (
\"
id
\"
,
\"
$id
\"
)
"
.
"
])
";
print
FIX
"
,
"
unless
(
$first
);
if
(
!
$first
)
{
$fullexpr
.=
"
,
"
}
;
$first
=
0
;
print
FIX
$fixexpr
;
$fullexpr
.=
$fixexpr
;
# !!! O(n^2)?
push
@ids
,
$id
;
...
...
@@ -81,14 +81,16 @@ while (<CONFFILE>) {
}
print
FIX
"
]
";
close
FIX
;
$fullexpr
.=
"
]
";
# Instantiate Nix expressions from the Fix expressions we created above.
print
STDERR
"
running fix...
\n
";
open
NIDS
,
"
fix
$fixfile
|
"
or
die
"
cannot run fix
";
$pid
=
open2
(
\
*READ
,
\
*WRITE
,
"
fix -
")
or
die
"
cannot run fix
";
print
WRITE
$fullexpr
;
close
WRITE
;
my
$i
=
0
;
while
(
<
NIDS
>
)
{
while
(
<
READ
>
)
{
chomp
;
die
unless
/^([0-9a-z]{32})$/
;
$nid
=
$
1
;
...
...
@@ -98,6 +100,9 @@ while (<NIDS>) {
push
@subs
,
$nid
;
}
waitpid
$pid
,
0
;
$?
==
0
or
die
"
fix failed
";
# Register all substitutes.
print
STDERR
"
registering substitutes...
\n
";
system
"
nix --substitute
@subs
";
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment