···2020 http://kent.dl.sourceforge.net/sourceforge/
2121 ];
22222323- sf = sourceforge;
2424-2523 # GNU (http://www.gnu.org/prep/ftp.html).
2624 gnu = [
2725 # This one redirects to a (supposedly) nearby and (supposedly) up-to-date
+1-1
pkgs/build-support/release/source-tarball.nix
···99, versionSuffix ?
1010 if officialRelease
1111 then ""
1212- else if src ? rev then "pre${toString src.rev}" else ""
1212+ else "pre${toString (src.rev or src.revCount or "")}"
1313, src, stdenv, autoconf, automake, libtool
1414, ... } @ args:
1515
+79
pkgs/build-support/replace-dependency.nix
···11+{ runCommand, nix, lib }:
22+33+# Replace a single dependency in the requisites tree of drv, propagating
44+# the change all the way up the tree, without a full rebuild. This can be
55+# useful, for example, to patch a security hole in libc and still use your
66+# system safely without rebuilding the world. This should be a short term
77+# solution, as soon as a rebuild can be done the properly rebuild derivation
88+# should be used. The old dependency and new dependency MUST have the same-length
99+# name, and ideally should have close-to-identical directory layout.
1010+#
1111+# Example: safeFirefox = replaceDependency {
1212+# drv = firefox;
1313+# oldDependency = glibc;
1414+# newDependency = overrideDerivation glibc (attrs: {
1515+# patches = attrs.patches ++ [ ./fix-glibc-hole.patch ];
1616+# });
1717+# };
1818+# This will rebuild glibc with your security patch, then copy over firefox
1919+# (and all of its dependencies) without rebuilding further.
2020+{ drv, oldDependency, newDependency }:
2121+2222+with lib;
2323+2424+let
2525+ references = import (runCommand "references.nix" { exportReferencesGraph = [ "graph" drv ]; } ''
2626+ (echo {
2727+ while read path
2828+ do
2929+ echo " \"$path\" = ["
3030+ read count
3131+ read count
3232+ while [ "0" != "$count" ]
3333+ do
3434+ read ref_path
3535+ if [ "$ref_path" != "$path" ]
3636+ then
3737+ echo " (builtins.storePath $ref_path)"
3838+ fi
3939+ count=$(($count - 1))
4040+ done
4141+ echo " ];"
4242+ done < graph
4343+ echo }) > $out
4444+ '').outPath;
4545+4646+ discard = builtins.unsafeDiscardStringContext;
4747+4848+ oldStorepath = builtins.storePath (discard (toString oldDependency));
4949+5050+ referencesOf = drv: getAttr (discard (toString drv)) references;
5151+5252+ dependsOnOld = drv: elem oldStorepath (referencesOf drv) ||
5353+ any dependsOnOld (referencesOf drv);
5454+5555+ drvName = drv:
5656+ discard (substring 33 (stringLength (builtins.baseNameOf drv)) (builtins.baseNameOf drv));
5757+5858+ rewriteHashes = drv: hashes: runCommand (drvName drv) { nixStore = "${nix}/bin/nix-store"; } ''
5959+ $nixStore --dump ${drv} | sed 's|${baseNameOf drv}|'$(basename $out)'|g' | sed -e ${
6060+ concatStringsSep " -e " (mapAttrsToList (name: value:
6161+ "'s|${baseNameOf name}|${baseNameOf value}|g'"
6262+ ) hashes)
6363+ } | $nixStore --restore $out
6464+ '';
6565+6666+ rewrittenDeps = listToAttrs [ {name = discard (toString oldDependency); value = newDependency;} ];
6767+6868+ rewrittenDerivations = drv:
6969+ if dependsOnOld drv
7070+ then listToAttrs [ {
7171+ name = discard (toString drv);
7272+7373+ value = rewriteHashes drv (rewrittenDeps // (fold (drv: acc:
7474+ (rewrittenDerivations drv) // acc
7575+ ) {} (referencesOf drv)));
7676+ } ]
7777+ else {};
7878+in assert (stringLength (drvName (toString oldDependency)) == stringLength (drvName (toString newDependency)));
7979+getAttr (discard (toString drv)) (rewrittenDerivations drv)
···33 (http://pypi.python.org/pypi/setuptools/), which represents a large
44 number of Python packages nowadays. */
5566-{ python, setuptools, wrapPython, lib, offlineDistutils, setuptoolsSite }:
66+{ python, setuptools, wrapPython, lib, offlineDistutils, recursivePthLoader }:
7788{ name, namePrefix ? "python-"
99···2323 ''
2424 easy_install --always-unzip --prefix="$out" .
2525 ''
2626-2626+2727, preConfigure ? "true"
28282929, buildPhase ? "true"
···48484949 name = namePrefix + name;
50505151+ # checkPhase after installPhase to run tests on installed packages
5152 phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase";
52535354 buildInputs = [ python wrapPython setuptools ] ++ buildInputs ++ pythonPath;
54555555- # setuptoolsSite is responsible for loading pth files
5656- propagatedBuildInputs = propagatedBuildInputs ++ [ setuptoolsSite ];
5757-5858- buildInputStrings = map toString buildInputs;
5656+ propagatedBuildInputs = propagatedBuildInputs ++ [ recursivePthLoader ];
59576060- pythonPath = [ setuptools] ++ pythonPath;
5858+ pythonPath = [ setuptools ] ++ pythonPath;
61596260 preConfigure = ''
6361 PYTHONPATH="${offlineDistutils}/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
···8381 # Remove any site.py files generated by easy_install as these
8482 # cause collisions. If pth files are to be processed a
8583 # corresponding site.py needs to be included in the PYTHONPATH.
8686- #
8787- # leave them until we have a better solution: see #209
8888- #rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
8484+ rm -f "$out/lib/${python.libPrefix}"/site-packages/site.py*
89859086 ${postInstall}
9187 '';
+3
pkgs/development/python-modules/generic/wrap.sh
···5151 local inputs="$2"
5252 if [ foo"$inputs" != foo ]; then
5353 for x in $inputs; do
5454+ if $(echo -n $x |grep -q python-recursive-pth-loader); then
5555+ continue
5656+ fi
5457 if test -d "$x"/lib/@libPrefix@/site-packages; then
5558 echo $x/lib/@libPrefix@/site-packages \
5659 >> "$out"/lib/@libPrefix@/site-packages/${name}-nix-python-$category.pth
···12121313 buildInputs = [ python pkgconfig glib ];
14141515+ # in a "normal" setup, pygobject and pygtk are installed into the
1616+ # same site-packages: we need a pth file for both. pygtk.py would be
1717+ # used to select a specific version, in our setup it should have no
1818+ # effect, but we leave it in case somebody expects and calls it.
1519 postInstall = ''
1616- # All python code is installed into a "gtk-2.0" sub-directory. That
1717- # sub-directory may be useful on systems which share several library
1818- # versions in the same prefix, i.e. /usr/local, but on Nix that directory
1919- # is useless. Furthermore, its existence makes it very hard to guess a
2020- # proper $PYTHONPATH that allows "import gtk" to succeed.
2121- cd $(toPythonPath $out)/gtk-2.0
2222- for n in *; do
2323- ln -s "gtk-2.0/$n" "../$n"
2424- done
2020+ mv $out/lib/${python.libPrefix}/site-packages/{pygtk.pth,${name}.pth}
2521 '';
26222723 meta = {
+26-17
pkgs/development/python-modules/pygtk/default.nix
···11-{ stdenv, fetchurl, makeWrapper, python, pkgconfig, glib, gtk, pygobject, pycairo
22-, libglade ? null }:
11+{ stdenv, fetchurl, python, pkgconfig, glib, gtk, pygobject, pycairo
22+, buildPythonPackage, libglade ? null }:
3344-stdenv.mkDerivation rec {
44+buildPythonPackage rec {
55 name = "pygtk-2.22.0";
6677 src = fetchurl {
···1010 };
11111212 buildInputs =
1313- [ makeWrapper python pkgconfig glib gtk ]
1313+ [ pkgconfig glib gtk ]
1414 ++ stdenv.lib.optional (libglade != null) libglade;
15151616 propagatedBuildInputs = [ pygobject pycairo ];
17171818+ installCommand = "make install";
1919+ checkPhase = stdenv.lib.optionalString (libglade == null)
2020+ ''
2121+ sed -i -e "s/glade = importModule('gtk.glade', buildDir)//" \
2222+ tests/common.py
2323+ sed -i -e "s/, glade$//" \
2424+ -e "s/.*testGlade.*//" \
2525+ -e "s/.*(glade.*//" \
2626+ tests/test_api.py
2727+ '' + ''
2828+ sed -i -e "s/sys.path.insert(0, os.path.join(buildDir, 'gtk'))//" \
2929+ -e "s/sys.path.insert(0, buildDir)//" \
3030+ tests/common.py
3131+ make check
3232+ '';
3333+ # XXX: TypeError: Unsupported type: <class 'gtk._gtk.WindowType'>
3434+ # The check phase was not executed in the previous
3535+ # non-buildPythonPackage setup - not sure why not.
3636+ doCheck = false;
3737+1838 postInstall = ''
1939 rm $out/bin/pygtk-codegen-2.0
2040 ln -s ${pygobject}/bin/pygobject-codegen-2.0 $out/bin/pygtk-codegen-2.0
2121-2222- # All python code is installed into a "gtk-2.0" sub-directory. That
2323- # sub-directory may be useful on systems which share several library
2424- # versions in the same prefix, i.e. /usr/local, but on Nix that directory
2525- # is useless. Furthermore, its existence makes it very hard to guess a
2626- # proper $PYTHONPATH that allows "import gtk" to succeed.
2727- cd $(toPythonPath $out)/gtk-2.0
2828- for n in *; do
2929- ln -s "gtk-2.0/$n" "../$n"
3030- done
3131-3232- wrapProgram $out/bin/pygtk-demo --prefix PYTHONPATH ":" \
3333- $(toPythonPath "${pygobject} ${pycairo} $out")
4141+ ln -s ${pygobject}/lib/${python.libPrefix}/site-packages/${pygobject.name}.pth \
4242+ $out/lib/${python.libPrefix}/site-packages/${name}.pth
3443 '';
3544}
···11+{stdenv, fetchurl, leptonica, zlib, libwebp, giflib, libjpeg, libpng, libtiff }: stdenv.mkDerivation {
22+ name = "jbig2enc-0.28";
33+44+ src = fetchurl {
55+ url = http://github.com/agl/jbig2enc/archive/0.28-dist.tar.gz;
66+ sha256 = "1wc0lmqz4jag3rhhk1xczlqpfv2qqp3fz7wzic2lba3vsbi1rrw3";
77+ };
88+99+ propagatedBuildInputs = [ leptonica zlib libwebp giflib libjpeg libpng libtiff ];
1010+1111+ # This is necessary, because the resulting library has
1212+ # /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib
1313+ # in its rpath, which means that patchelf --shrink-rpath removes
1414+ # the /nix/store one. By cleaning up before fixup, we ensure that
1515+ # the /tmp/nix-build-jbig2enc/src/.libs directory is gone.
1616+ preFixup = ''
1717+ make clean
1818+ '';
1919+}