Mirror of GNU Guix
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.0 KiB

  1. #!/bin/sh
  2. # Guix --- Nix package management from Guile. -*- coding: utf-8 -*-
  3. # Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org>
  4. #
  5. # This file is part of Guix.
  6. #
  7. # Guix is free software; you can redistribute it and/or modify it
  8. # under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 3 of the License, or (at
  10. # your option) any later version.
  11. #
  12. # Guix is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with Guix. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. # Update the local copy of Nix source code needed to build the daemon.
  21. # Assume GNU Coreutils and Git are available.
  22. #
  23. top_srcdir="${top_srcdir:-..}"
  24. log()
  25. {
  26. echo "sync-with-upstream: $@" >&2
  27. }
  28. # checked_in_p FILE
  29. checked_in_p()
  30. {
  31. ( cd "$top_srcdir" ;
  32. git ls-tree HEAD -- "nix/$1" | grep "$1" > /dev/null )
  33. }
  34. if [ ! -d "$top_srcdir/build-aux" ]
  35. then
  36. log "\`$top_srcdir' is not the valid top-level source directory"
  37. exit 1
  38. fi
  39. set -e
  40. for upstream_file in `cd "$top_srcdir/nix-upstream/src" ;
  41. find . -name \*.c -or -name \*.h -or -name \*.cc -or -name \*.hh \
  42. -or -name \*.cpp -or -name \*.hpp -or -name \*.sql`
  43. do
  44. if grep "$upstream_file" "$top_srcdir/daemon.am" > /dev/null
  45. then
  46. if checked_in_p "$upstream_file"
  47. then
  48. log "skipping \`$upstream_file', which has a checked-in copy"
  49. else
  50. ( cd "$top_srcdir/nix-upstream/src" && \
  51. cp -v --parents "$upstream_file" ../../nix )
  52. fi
  53. else
  54. log "skipping \`$upstream_file', which is not used"
  55. fi
  56. done
  57. cp -v "$top_srcdir/nix-upstream/COPYING" "$top_srcdir/nix"
  58. cp -v "$top_srcdir/nix-upstream/AUTHORS" "$top_srcdir/nix"
  59. # Substitutions.
  60. sed -i "$top_srcdir/nix/libstore/gc.cc" \
  61. -e 's|/nix/find-runtime-roots\.pl|/guix/list-runtime-roots|g'