Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
cc002579
Commit
cc002579
authored
Jul 24, 2008
by
Ian Lynagh
Browse files
Rejig how darcs-all works
It's now easier to add new repos anywhere in the source tree
parent
79c5c4d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
darcs-all
View file @
cc002579
...
...
@@ -2,15 +2,12 @@
use
strict
;
my
@top_dirs
=
("
nofib
",
"
testsuite
",
"
utils/hsc2hs
");
# Figure out where to get the other repositories from,
# based on where this GHC repo came from.
my
$defaultrepo
=
`
cat _darcs/prefs/defaultrepo
`;
chomp
$defaultrepo
;
my
$defaultrepo_base
;
my
$defaultrepo_lib
;
my
$hsc2hs_repo_loc
;
my
$checked_out_tree
;
if
(
$defaultrepo
=~
/^...*:/
)
{
# HTTP or SSH
...
...
@@ -18,15 +15,13 @@ if ($defaultrepo =~ /^...*:/) {
# catching Win32 drives ("C:\").
$defaultrepo_base
=
$defaultrepo
;
$defaultrepo_base
=~
s#/[^/]+/?$##
;
$defaultrepo_lib
=
"
$defaultrepo_base
/packages
";
$hsc2hs_repo_loc
=
$defaultrepo_base
;
$checked_out_tree
=
0
;
}
elsif
(
$defaultrepo
=~
/^(\.\.)?\//
)
{
# Local filesystem, either absolute or relative path
# (assumes a checked-out tree):
$defaultrepo_base
=
$defaultrepo
;
$defaultrepo_lib
=
"
$defaultrepo
/libraries
";
$hsc2hs_repo_loc
=
"
$defaultrepo_base
/utils
";
$checked_out_tree
=
1
;
}
else
{
die
"
Couldn't work out defaultrepo
";
...
...
@@ -35,13 +30,7 @@ else {
my
$verbose
=
2
;
my
$ignore_failure
=
0
;
# --extra says we grab the extra libs with 'get'. It has no effect on
# the other commands.
my
$extra
=
0
;
# --nofib/--testsuite tell get to also grab the respective repos.
# They have no effect on the other commands.
my
$nofib
=
0
;
my
$testsuite
=
0
;
my
%tags
;
sub
message
{
if
(
$verbose
>=
2
)
{
...
...
@@ -63,51 +52,43 @@ sub darcs {
}
sub
darcsall
{
my
@packages
;
my
$localpath
;
my
$path
;
my
$tag
;
darcs
@_
;
for
my
$dir
(
@top_dirs
)
{
if
(
-
d
$dir
&&
-
d
"
$dir
/_darcs
")
{
darcs
(
@
_
,
"
--repodir
",
$dir
);
}
else
{
message
"
==
$dir
not present or not a repository; skipping
";
}
}
for
my
$path
(
<
libraries
/*/
_darcs
>
)
{
chomp
$path
;
if
(
$path
=~
m#/(.*)/#
)
{
my
$pkg
=
$
1
;
darcs
(
@
_
,
"
--repodir
",
"
libraries/
$pkg
");
}
else
{
die
"
that pattern can't fail!
";
}
}
@packages
=
`
cat libraries/boot-packages
`;
# @packages = `cat libraries/boot-packages libraries/extra-packages`;
for
my
$pkg
(
@packages
)
{
chomp
$pkg
;
if
(
!
-
d
"
libraries/
$pkg
")
{
warning
("
$pkg
doesn't exist, use 'darcs-all get' to get it
");
}
}
}
sub
darcsgetpackage
{
my
(
$get_it
,
$r_flags
,
$repo_root
,
$package
)
=
@_
;
open
IN
,
"
< packages
"
or
die
"
Can't open packages file
";
while
(
<
IN
>
)
{
chomp
;
if
(
/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/
)
{
$localpath
=
$
1
;
$tag
=
defined
(
$
2
)
?
$
2
:
"";
if
(
$get_it
)
{
if
(
-
d
$package
)
{
warning
("
$package
already present; omitting
");
if
(
-
d
"
$localpath
/_darcs
")
{
darcs
(
@
_
,
"
--repodir
",
$localpath
);
}
elsif
(
$tag
eq
"")
{
message
"
== Required repo
$localpath
is missing! Skipping
";
}
else
{
message
"
==
$localpath
repo not present; skipping
";
}
}
els
e
{
d
arcs
(
@$r_flags
,
"
$repo_root
/
$package
")
;
els
if
(
!
/^$/
)
{
d
ie
"
Bad line:
$_
"
;
}
}
close
IN
;
}
sub
darcsget
{
my
$r_flags
;
my
$localpath
;
my
$remotepath
;
my
$path
;
my
$tag
;
if
(
!
grep
/(?:--complete|--partial)/
,
@
_
)
{
warning
("
adding --partial, to override use --complete
");
$r_flags
=
[
@
_
,
"
--partial
"];
...
...
@@ -116,27 +97,35 @@ sub darcsget {
$r_flags
=
\
@_
;
}
darcsgetpackage
(
$nofib
,
$r_flags
,
$defaultrepo_base
,
"
nofib
");
darcsgetpackage
(
$testsuite
,
$r_flags
,
$defaultrepo_base
,
"
testsuite
");
chdir
"
utils
";
darcsgetpackage
(
1
,
$r_flags
,
$hsc2hs_repo_loc
,
"
hsc2hs
");
chdir
"
..
";
open
IN
,
"
< packages
"
or
die
"
Can't open packages file
";
while
(
<
IN
>
)
{
chomp
;
if
(
/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/
)
{
$localpath
=
$
1
;
$tag
=
defined
(
$
2
)
?
$
2
:
"";
$remotepath
=
$
3
;
chdir
"
libraries
";
my
@packages
;
if
(
$extra
)
{
@packages
=
`
cat boot-packages extra-packages
`;
}
else
{
@packages
=
`
cat boot-packages
`;
}
if
(
$checked_out_tree
)
{
$path
=
"
$defaultrepo_base
/
$localpath
";
}
else
{
$path
=
"
$defaultrepo_base
/
$remotepath
";
}
for
my
$pkg
(
@packages
)
{
chomp
$pkg
;
darcsgetpackage
(
1
,
$r_flags
,
$defaultrepo_lib
,
$pkg
);
if
((
$tag
eq
"")
||
defined
(
$tags
{
$tag
}))
{
if
(
-
d
$localpath
)
{
warning
("
$localpath
already present; omitting
");
}
else
{
darcs
(
@$r_flags
,
$path
,
$localpath
);
}
}
}
elsif
(
!
/^$/
)
{
die
"
Bad line:
$_
";
}
}
close
IN
;
}
sub
main
{
...
...
@@ -154,14 +143,26 @@ sub main {
elsif
(
$arg
eq
"
-s
")
{
$verbose
=
0
;
}
# --ci says we grab cabal-install repo, and the libraries it needs
# with 'get'.
# It has no effect on the other commands.
elsif
(
$arg
eq
"
--ci
")
{
$tags
{"
ci
"}
=
1
;
}
# --extra says we grab the extra libs with 'get'.
# It has no effect on the other commands.
elsif
(
$arg
eq
"
--extra
")
{
$
extra
=
1
;
$
tags
{"
extralibs
"}
=
1
;
}
# --nofib tells get to also grab the nofib repo.
# It has no effect on the other commands.
elsif
(
$arg
eq
"
--nofib
")
{
$nofib
=
1
;
$
tags
{"
nofib
"}
=
1
;
}
# --testsuite tells get to also grab the testsuite repo.
# It has no effect on the other commands.
elsif
(
$arg
eq
"
--testsuite
")
{
$testsuite
=
1
;
$
tags
{"
testsuite
"}
=
1
;
}
else
{
unshift
@
_
,
$arg
;
...
...
libraries/boot-packages
deleted
100644 → 0
View file @
79c5c4d1
array
base
bytestring
Cabal
containers
directory
editline
filepath
ghc-prim
haskell98
hpc
integer-gmp
old-locale
old-time
packedstring
pretty
process
random
template-haskell
unix
Win32
libraries/extra-packages
deleted
100644 → 0
View file @
79c5c4d1
HUnit
QuickCheck
cgi
haskell-src
html
mtl
network
parsec
parallel
regex-base
regex-compat
regex-posix
stm
time
xhtml
packages
0 → 100644
View file @
cc002579
utils/hsc2hs hsc2hs
utils/cabal-install ci cabal-install
libraries/array packages/array
libraries/base packages/base
libraries/bytestring packages/bytestring
libraries/Cabal packages/Cabal
libraries/containers packages/containers
libraries/directory packages/directory
libraries/editline packages/editline
libraries/filepath packages/filepath
libraries/ghc-prim packages/ghc-prim
libraries/haskell98 packages/haskell98
libraries/hpc packages/hpc
libraries/integer-gmp packages/integer-gmp
libraries/old-locale packages/old-locale
libraries/old-time packages/old-time
libraries/packedstring packages/packedstring
libraries/pretty packages/pretty
libraries/process packages/process
libraries/random packages/random
libraries/template-haskell packages/template-haskell
libraries/unix packages/unix
libraries/Win32 packages/Win32
libraries/HUnit extralibs packages/HUnit
libraries/QuickCheck extralibs packages/QuickCheck
libraries/cgi extralibs packages/cgi
libraries/haskell-src extralibs packages/haskell-src
libraries/html extralibs packages/html
libraries/mtl extralibs packages/mtl
libraries/network extralibs packages/network
libraries/parsec extralibs packages/parsec
libraries/parallel extralibs packages/parallel
libraries/regex-base extralibs packages/regex-base
libraries/regex-compat extralibs packages/regex-compat
libraries/regex-posix extralibs packages/regex-posix
libraries/stm extralibs packages/stm
libraries/time extralibs packages/time
libraries/xhtml extralibs packages/xhtml
testsuite testsuite testsuite
nofib nofib nofib
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment