Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install script stores start time of build #6744

Closed
haraldschilly opened this issue Aug 14, 2009 · 8 comments
Closed

install script stores start time of build #6744

haraldschilly opened this issue Aug 14, 2009 · 8 comments

Comments

@haraldschilly
Copy link
Member

In order to track the build progress, it is necessary to store the start time of the build process. (elapsed time, estimate of remaining time, ...)

This patch inserts a line in "install" which stores the seconds since 1970-1-1 in a hidden file .BUILDSTART in %SAGE_ROOT when the build process starts. This could also be useful for other applications.

Component: distribution

Author: Harald Schilly

Reviewer: Tim Dumol

Merged: Sage 4.1.2.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/6744

@haraldschilly
Copy link
Member Author

Attachment: install_script_stores_start_time.patch.gz

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 14, 2009

comment:1

The patch should be applied against the file SAGE_ROOT/spkg/install. That file is not under revision control, so one has to manually apply the patch.

@haraldschilly
Copy link
Member Author

comment:2

note: don't forget to update this file on the master-mirror, too! it lives in sage@sagemath:~/www-files/packages/install

@TimDumol
Copy link
Mannequin

TimDumol mannequin commented Aug 30, 2009

comment:3

I don't see how this can hurt anything. Tried building anyways, no problem.

@TimDumol TimDumol mannequin added the s: positive review label Aug 30, 2009
@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 31, 2009

Merged: Sage 4.1.2.alpha0

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 31, 2009

Author: Harald Schilly

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Aug 31, 2009

Reviewer: Tim Dumol

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Aug 31, 2009
@sagetrac-drkirkby
Copy link
Mannequin

sagetrac-drkirkby mannequin commented Sep 30, 2010

comment:5

Although this is marked as fixed, it should be noted that it makes use of a non-portable option to the date command so fails on some systems. See

http://www.opengroup.org/onlinepubs/009695399/utilities/date.html

for a list of portable options.

Since the file created is not actually used by anything it's not a big problem, but if anyone tried using it on a Unix system, it would likely fail. A better method is:

# Compute seconds since the Epoch.

# Call 'date'. Note that
# %Y = year including century
# %j = day number (1-365)
# %H = hour (0-23)
# %M = minute (0-59)
# %S = seconds (0-59)

if type env >/dev/null 2>&1 ; then
    set -- `env LC_ALL=C LC_TIME=C LANG=C date -u '+%Y %j %H %M %S'`
else
    set -- `date -u '+%Y %j %H %M %S'`
fi

# $1 = year including century
# $2 = day number (1-365)
# $3 = hour (0-23)
# $4 = minute (0-59)
# $5 = seconds (0-59)

if [ $? -ne 0 ] || [ $# -lt 5 ] ; then
  TIME="Error computing seconds since the Epoch"
fi

DAYS=`expr 365 \* \( $1 - 1970 \) + \( $1 - 1969 \) / 4 + $2 - 1`
TIME=`expr $5 + 60 \* \( $4 + 60 \* \( $3 + 24 \* $DAYS \) \)`
echo $TIME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant