;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013 Nikita Karetnikov ;;; Copyright © 2015 Mathieu Lirzin ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Tobias Geerinckx-Rice ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2016 Roel Janssen ;;; Copyright © 2016, 2017 Marius Bakke ;;; Copyright © 2017 Hartmut Goebel ;;; Copyright © 2017 Stefan Reichör ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANT
aboutsummaryrefslogtreecommitdiff
Honor the 'SOURCE_DATE_EPOCH' environment variable to allow for
determinitic builds.

--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -105,7 +105,10 @@ def compile(file, cfile=None, dfile=None, doraise=False):
     """
     with open(file, 'U') as f:
         try:
-            timestamp = long(os.fstat(f.fileno()).st_mtime)
+            if 'SOURCE_DATE_EPOCH' in os.environ:
+                timestamp = long(os.environ['SOURCE_DATE_EPOCH'])
+            else:
+                timestamp = long(os.fstat(f.fileno()).st_mtime)
         except AttributeError:
             timestamp = long(os.stat(file).st_mtime)
         codestring = f.read()
diff --git a/Python/import.c b/Python/import.c
index e47ce63..7eecf9c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -945,6 +945,11 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t
     /* Now write the true mtime (as a 32-bit field) */
     fseek(fp, 4L, 0);
     assert(mtime <= 0xFFFFFFFF);
+    if (Py_GETENV("SOURCE_DATE_EPOCH") != NULL) {
+	const char *epoch = Py_GETENV("SOURCE_DATE_EPOCH");
+	mtime = atoi(epoch);
+    }
+
     PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION);
     fflush(fp);
     fclose(fp);
.0a1") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/fdisk/gnufdisk-" version ".tar.gz")) (sha256 (base32 "1d8za79kw8ihnp2br084rgyjv9whkwp7957rzw815i0izx6xhqy9")))) (build-system gnu-build-system) (inputs `(("gettext" ,gettext-minimal) ("guile" ,guile-1.8) ("util-linux" ,util-linux) ("parted" ,parted))) ;; The build neglects to look for its own headers in its own tree. A next ;; release should fix this, but may never come: GNU fdisk looks abandoned. (arguments `(#:phases (modify-phases %standard-phases (add-after 'unpack 'skip-broken-header-probes (lambda _ (substitute* "backend/configure" (("gnufdisk-common.h .*") "\n")) #t))) #:make-flags (list (string-append "CPPFLAGS=" " -I../common/include " " -I../debug/include " " -I../exception/include")))) (home-page "https://www.gnu.org/software/fdisk/") (synopsis "Low-level disk partitioning and formatting") (description "GNU fdisk provides a GNU version of the common disk partitioning tool fdisk. fdisk is used for the creation and manipulation of disk partition tables, and it understands a variety of different formats.") (license license:gpl3+))) (define-public gptfdisk (package (name "gptfdisk") (version "1.0.3") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/gptfdisk/gptfdisk/" version "/" name "-" version ".tar.gz")) (sha256 (base32 "0p0vr67lnqdsgdv2y144xmjqa1a2nijrrd3clc8dc2f46pn5mzc9")))) (build-system gnu-build-system) (inputs `(("gettext" ,gettext-minimal) ("ncurses" ,ncurses) ("popt" ,popt) ("util-linux" ,util-linux))) ; libuuid (arguments `(#:test-target "test" #:phases (modify-phases %standard-phases ;; no configure script (delete 'configure) ;; no install target (replace 'install (lambda* (#:key outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (bin (string-append out "/bin")) (man (string-append out "/share/man/man8"))) (install-file "gdisk" bin) (install-file "sgdisk" bin) (install-file "cgdisk" bin) (install-file "fixparts" bin) (install-file "cgdisk.8" man) (install-file "fixparts.8" man) (install-file "gdisk.8" man) (install-file "sgdisk.8" man))))))) (home-page "http://www.rodsbooks.com/gdisk/") (synopsis "Low-level GPT disk partitioning and formatting") (description "GPT fdisk (aka gdisk) is a text-mode partitioning tool that works on Globally Unique Identifier (@dfn{GUID}) Partition Table (@dfn{GPT}) disks, rather than on the older Master Boot Record (@dfn{MBR}) partition scheme.") (license license:gpl2))) (define-public ddrescue (package (name "ddrescue") (version "1.22") (source (origin (method url-fetch) (uri (string-append "mirror://gnu/ddrescue/ddrescue-" version ".tar.lz")) (sha256 (base32 "19qhx9ggkkjl0g3a88g501wmybkj1y4n5lm5kp0km0blh0p7p189")))) (build-system gnu-build-system) (home-page "https://www.gnu.org/software/ddrescue/ddrescue.html") (synopsis "Data recovery utility") (native-inputs `(("lzip" ,lzip))) (description "GNU ddrescue is a fully automated data recovery tool. It copies data from one file to another, working to rescue data in case of read errors. The program also includes a tool for manipulating its log files, which are used to recover data more efficiently by only reading the necessary blocks.") (license license:gpl3+))) (define-public dosfstools (package (name "dosfstools") (version "4.1") (source (origin (method url-fetch) (uri (string-append "https://github.com/" name "/" name "/releases/download/v" version "/" name "-" version ".tar.xz")) (sha256 (base32 "0wy13i3i4x2bw1hf5m4fd0myh61f9bcrs035fdlf6gyc1jksrcp6")))) (build-system gnu-build-system) (arguments `(#:make-flags (list (string-append "PREFIX=" %output) "CC=gcc"))) (native-inputs `(("xxd" ,xxd))) ; for tests (home-page "https://github.com/dosfstools/dosfstools") (synopsis "Utilities for making and checking MS-DOS FAT file systems") (description "The dosfstools package includes the mkfs.fat and fsck.fat utilities, which respectively make and check MS-DOS FAT file systems.") (license license:gpl3+))) (define dosfstools/static (static-package (package (inherit dosfstools)))) (define-public fatfsck/static (package (name "fatfsck-static") (version (package-version dosfstools)) (build-system trivial-build-system) (source #f) (arguments `(#:modules ((guix build utils)) #:builder (begin (use-modules (guix build utils)) (let ((src (string-append (assoc-ref %build-inputs "dosfstools") "/sbin")) (exe "fsck.fat") (bin (string-append (assoc-ref %outputs "out") "/sbin"))) (mkdir-p bin) (with-directory-excursion bin (copy-file (string-append src "/" exe) exe) (remove-store-references exe) (chmod exe #o555) ;; Add fsck.vfat symlink to match the Linux driver name. (symlink exe "fsck.vfat") #t))))) (inputs `(("dosfstools" ,dosfstools/static))) (home-page (package-home-page dosfstools)) (synopsis "Statically linked fsck.fat from dosfstools") (description "This package provides a statically-linked @command{fsck.fat} and a @command{fsck.vfat} compatibility symlink for use in an initrd.") (license (package-license dosfstools)))) (define-public sdparm (package (name "sdparm") (version "1.10") (source (origin (method url-fetch) (uri (string-append "http://sg.danny.cz/sg/p/" name "-" version ".tar.xz")) (sha256 (base32 "1jjq3lzgfy4r76rc26q02lv4wm5cb4dx5nh913h489zjrr4f3jbx")))) (build-system gnu-build-system) (home-page "http://sg.danny.cz/sg/sdparm.html") (synopsis "Provide access to SCSI device parameters") (description "Sdparm reads and modifies SCSI device parameters. These devices can be SCSI disks, in which case the role of @command{sdparm} is similar to its namesake: the @command{hdparm} utility originally designed for ATA disks. However, @command{sdparm} can be used to access parameters on any device that uses a SCSI command set. Such devices include CD/DVD drives (irrespective of transport), SCSI and ATAPI tape drives, and SCSI enclosures. This utility can also send commands associated with starting and stopping the media, loading and unloading removable media and some other housekeeping functions.") (license license:bsd-3))) (define-public idle3-tools (package (name "idle3-tools") (version "0.9.1") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/idle3-tools/idle3-tools-" version ".tgz")) (sha256 (base32 "00ia7xq9yldxyl9gz0mr4xa568nav14p0fnv82f2rbbkg060cy4p")))) (build-system gnu-build-system) (arguments `(#:tests? #f ;no test suite #:phases (modify-phases %standard-phases (delete 'configure)) #:make-flags (list "CC=gcc" (string-append "manprefix=") (string-append "DESTDIR=" (assoc-ref %outputs "out"))))) (home-page "http://idle3-tools.sourceforge.net") (synopsis "Change or disable Western Digital hard drives' Idle3 timer") (description "Idle3-tools provides a utility to get, set, or disable the Idle3 timer present in many Western Digital hard drives. This timer is part of the \"IntelliPark\" feature that stops the disk when not in use. Unfortunately, the default timer setting is not well suited to Linux or other *nix systems, and can dramatically shorten the lifespan of the drive if left unchecked.") (license license:gpl3+))) (define-public gparted (package (name "gparted") (version "0.30.0") (source (origin (method url-fetch) (uri (string-append "mirror://sourceforge/gparted/gparted/gparted-" version "/gparted-" version ".tar.gz")) (sha256 (base32 "0jngbsbvg8k8vbpsphqbk8br2cbmxhabbm2c5bmxm2q5zvpr64fk")))) (build-system gnu-build-system) (arguments `(#:tests? #f ; Tests require a network connection. #:configure-flags '("--disable-scrollkeeper"))) (inputs `(("util-linux" ,util-linux) ("parted" ,parted) ("glib" ,glib) ("gtkmm" ,gtkmm-2) ("libxml2" ,libxml2) ("libxslt" ,libxslt) ("gnome-doc-utils" ,gnome-doc-utils) ("docbook-xml" ,docbook-xml-4.2) ("python" ,python-2) ("python-libxml2" ,python2-libxml2) ("which" ,which))) (native-inputs `(("intltool" ,intltool) ("pkg-config" ,pkg-config))) (home-page "https://gparted.org/") (synopsis "Partition editor to graphically manage disk partitions") (description "GParted is a GNOME partition editor for creating, reorganizing, and deleting disk partitions. It uses libparted from the parted project to detect and manipulate partition tables. Optional file system tools permit managing file systems not included in libparted.") ;; The home page says GPLv2, but the source code says GPLv2+. (license license:gpl2+))) (define-public pydf (package (name "pydf") (version "12") (source (origin (method url-fetch) (uri (pypi-uri "pydf" version)) (sha256 (base32 "0f8ly8xyp93i2hm9c0qjqd4y86nz73axw2f09z01mszwmg1sfivz")))) (build-system python-build-system) (home-page "http://kassiopeia.juls.savba.sk/~garabik/software/pydf/") (synopsis "Colourised @command{df} clone") (description "All-singing, all-dancing, fully colourised @command{df} clone written in Python. It displays the amount of disk space available on the mounted filesystems, using different colours for different types of file systems. Output format is completely customizable.") (license license:public-domain))) (define-public f3 (package (name "f3") (version "6.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/AltraMayor/f3/archive/" "v" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "1mgbzc1swvgil45md1336j0aqkmkhwmpxical0ln5g09b2qxsanp")))) (build-system gnu-build-system) (arguments '(#:tests? #f ; no check target #:make-flags (list "CC=gcc" (string-append "PREFIX=" %output)) #:phases (modify-phases %standard-phases (delete 'configure) (add-before 'build 'fix-makefile (lambda _ (substitute* "Makefile" ;; Install without setting owner and group (("\\$\\(INSTALL\\) -oroot -groot ") "$(INSTALL) ") ;; also build and install experimental tools (("^all: ") "all: $(EXPERIMENTAL_TARGETS) ") (("^install: ") "install-all: ") (("^install-experimental: ") "install: install-all ")) #t))))) (inputs `(("eudev" ,eudev) ("parted" ,parted))) (home-page "http://oss.digirati.com.br/f3/") (synopsis "Test real capacity of flash memory cards and such.") (description "F3 (Fight Flash Fraud or Fight Fake Flash) tests the full capacity of a flash card (flash drive, flash disk, pendrive). F3 writes to the card and then checks if can read it. It will assure you haven't been sold a card with a smaller capacity than stated.") (license license:gpl3+)))