From 74426e6820f3a1df19ae8fba9f092dc0e6477f2a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Mar 2016 12:53:28 +0100 Subject: [PATCH] Simplify running nix-shell This also removes building a separate source tarball or building a PDF manual since it's unlikely anybody cares. --- README.md | 2 +- configure.ac | 3 -- dev-shell | 7 ----- doc/manual/Makefile.am | 33 +++----------------- doc/manual/hacking.xml | 2 +- release.nix | 71 +++++++++++++----------------------------- shell.nix | 1 + 7 files changed, 30 insertions(+), 89 deletions(-) delete mode 100755 dev-shell create mode 100644 shell.nix diff --git a/README.md b/README.md index e006b9fd..f5365a48 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ To start hacking on Hydra, run: - $ ./dev-shell + $ nix-shell $ ./configure $configureFlags --prefix=/opt/hydra $ make $ make install diff --git a/configure.ac b/configure.ac index 3051dd6e..547f41a5 100644 --- a/configure.ac +++ b/configure.ac @@ -12,9 +12,6 @@ AC_PROG_CXX CXXFLAGS+=" -std=c++11" -dnl Optional dependencies to build the manual, normally not needed -dnl since the tarball comes with the PDF and HTML manuals. -AC_PATH_PROG([DBLATEX], [dblatex]) AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_ARG_WITH([docbook-xsl], diff --git a/dev-shell b/dev-shell deleted file mode 100755 index 6ac01a2a..00000000 --- a/dev-shell +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/env bash -s=$(type -p nix-shell) -exec $s release.nix -A build.x86_64-linux --exclude tarball --command " - export NIX_REMOTE=daemon - export NIX_PATH='$NIX_PATH' - export NIX_BUILD_SHELL=$(type -p bash) - exec $s release.nix -A tarball" "$@" diff --git a/doc/manual/Makefile.am b/doc/manual/Makefile.am index 7611153d..35433c77 100644 --- a/doc/manual/Makefile.am +++ b/doc/manual/Makefile.am @@ -9,44 +9,21 @@ xsltproc_opts = \ --param section.label.includes.component.label 1 -dblatex_opts = \ - -V \ - -P doc.collab.show=0 \ - -P latex.output.revhistory=0 - # Include the manual in the tarball. dist_html_DATA = manual.html style.css -#dist_pdf_DATA = manual.pdf # Embed Docbook's callout images in the distribution. EXTRA_DIST += images manual.html: $(DOCBOOK_FILES) - if test "$(XSLTPROC)" != ""; then \ - $(XSLTPROC) $(xsltproc_opts) --nonet --xinclude \ - --output manual.html \ - $(docbookxsl)/html/docbook.xsl manual.xml; \ - else \ - echo "Please install xsltproc and rerun configure."; \ - exit 1; \ - fi - -manual.pdf: $(DOCBOOK_FILES) - if test "$(DBLATEX)" != ""; then \ - $(DBLATEX) $(dblatex_opts) manual.xml; \ - else \ - echo "Please install dblatex and rerun configure."; \ - exit 1; \ - fi + $(XSLTPROC) $(xsltproc_opts) --nonet --xinclude \ + --output manual.html \ + $(docbookxsl)/xhtml/docbook.xsl manual.xml images: $(MKDIR_P) images/callouts - if cp $(docbookxsl)/images/callouts/*.gif images/callouts; then \ - chmod +wx images images/callouts; \ - else \ - echo "Please install Docbook XSL and try again."; \ - exit 1; \ - fi + cp $(docbookxsl)/images/callouts/*.gif images/callouts + chmod +wx images images/callouts install-data-hook: images $(INSTALL) -d $(DESTDIR)$(htmldir)/images/callouts diff --git a/doc/manual/hacking.xml b/doc/manual/hacking.xml index 5a5ff9ca..20cac842 100644 --- a/doc/manual/hacking.xml +++ b/doc/manual/hacking.xml @@ -22,7 +22,7 @@ $ nix-build release.nix -A build.x86_64-linux environment variables (such as PERL5LIB) are set up so that those dependencies can be found: -$ ./dev-shell +$ nix-shell To build Hydra, you should then do: diff --git a/release.nix b/release.nix index e482b2a1..37e48060 100644 --- a/release.nix +++ b/release.nix @@ -1,4 +1,4 @@ -{ hydraSrc ? { outPath = ./.; revCount = 1234; gitTag = "abcdef"; } +{ hydraSrc ? { outPath = ./.; revCount = 1234; rev = "abcdef"; } , officialRelease ? false }: @@ -28,55 +28,14 @@ let environment.systemPackages = [ pkgs.perlPackages.LWP pkgs.perlPackages.JSON ]; }; + version = builtins.readFile ./version + "." + toString hydraSrc.revCount + "." + hydraSrc.rev; + in assert versionAtLeast (getVersion pkgs.nixUnstable) "1.11pre4244_133a421"; rec { - tarball = - with pkgs; - - releaseTools.makeSourceTarball { - name = "hydra-tarball"; - src = if lib.inNixShell then null else hydraSrc; - inherit officialRelease; - version = builtins.readFile ./version; - - buildInputs = - [ perl libxslt nukeReferences pkgconfig nixUnstable git openssl ]; - - versionSuffix = if officialRelease then "" else "pre${toString hydraSrc.revCount}-${hydraSrc.gitTag}"; - - preHook = '' - # TeX needs a writable font cache. - export VARTEXFONTS=$TMPDIR/texfonts - - addToSearchPath PATH $(pwd)/src/script - addToSearchPath PATH $(pwd)/src/hydra-eval-jobs - addToSearchPath PATH $(pwd)/src/hydra-queue-runner - addToSearchPath PERL5LIB $(pwd)/src/lib - ''; - - postUnpack = '' - # Clean up when building from a working tree. - if [ -z "$IN_NIX_SHELL" ]; then - (cd $sourceRoot && (git ls-files -o --directory | xargs -r rm -rfv)) || true - fi - ''; - - configureFlags = - [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ]; - - postDist = '' - make -C doc/manual install prefix="$out" - - echo "doc manual $out/share/doc/hydra manual.html" >> \ - "$out/nix-support/hydra-build-products" - ''; - }; - - build = genAttrs' (system: with import { inherit system; }; @@ -143,7 +102,7 @@ rec { TextDiff TextTable XMLSimple - nix git + nix git boehmgc ]; }; @@ -151,11 +110,12 @@ rec { releaseTools.nixBuild { name = "hydra"; - src = tarball; + + src = if lib.inNixShell then null else hydraSrc; buildInputs = - [ makeWrapper libtool unzip nukeReferences pkgconfig sqlite libpqxx - gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 + [ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig sqlite libpqxx + gitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxslt guile # optional, for Guile + Guix support perlDeps perl postgresql92 # for running the tests @@ -170,6 +130,19 @@ rec { gzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar ] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] ); + postUnpack = '' + # Clean up when building from a working tree. + if [ -z "$IN_NIX_SHELL" ]; then + (cd $sourceRoot && (git ls-files -o --directory | xargs -r rm -rfv)) || true + fi + ''; + + configureFlags = [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ]; + + preConfigure = "autoreconf -vfi"; + + enableParallelBuilding = true; + preCheck = '' patchShebangs . export LOGNAME=${LOGNAME:-foo} @@ -182,7 +155,7 @@ rec { wrapProgram $i \ --prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \ --prefix PATH ':' $out/bin:$hydraPath \ - --set HYDRA_RELEASE ${tarball.version} \ + --set HYDRA_RELEASE ${version} \ --set HYDRA_HOME $out/libexec/hydra \ --set NIX_RELEASE ${nix.name or "unknown"} done diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..674b0a10 --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./release.nix {}).build.x86_64-linux