#329: add md5sums for spkgs
---------------------------+------------------------------------------------
Reporter: was | Owner: pdenapo
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-4.3.3
Component: packages | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
---------------------------+------------------------------------------------
Comment(by ddrake):
Replying to [comment:11 drkirkby]:
> '''b/sage-add-integrity-check-to-spkg'''
>
> * Line 1: I thought all scripts were supposed to start with
#!/usr/bin/env bash
On Ubuntu, /bin/sh is actually dash, which aims for POSIX compliance. I
often use /bin/sh to make sure that I avoid bashisms. Although if we are
assuming that bash is available, perhaps we might as well use that.
> * Line 8 if [ "$1" = "$SPKGNAME" ] . A more portable test is if [ "x$1"
= "xPKGNAME" ]. It's not essential in modern versions of bash, but is a
good habit to get into.
Sounds good.
> * Line 16-25. It would appear to me that the assumption is made that if
bzip2 returns with a non-zero exit code, then it must be a tar file. It
could be a corrupted .spkg file, where the .spkg is a tar file.
This script is intended to be used when preparing spkg files for review,
so if you've just made the spkg file and it's already corrupted, that will
get caught in review.
> * Line 27, would 'cp' be faster/more appropriate than cat? It is on my
system, but perhaps not on more modern systems.
I suspect that cp would be faster for plain tar files, but since bzip2
doesn't have a way to specify the output file name, I chose the current
method.
> * Is there a need for line 27 at all? Could line 29 not have $1 rather
than $SPKGNAME.tar? 'tar' does not require that the file have the
extension .tar.
> * You might want to investigate if the 'file' command would save a lot
of work, as that will tell you if the file is a tar file or a bzip2
compressed file.
I've switched the script to using 'file', which should be faster.
Line 29 could use $1 if we changed the options to tar appropriately ("xf"
or "jxf"), but in any case, we need an uncompressed tar archive to do the
append.
> ''' b/sage-spkg-integrity-check'''
>
> * Lines 13 and 19. A minor point, but a more portable test for if [
"$foobar" = "" ] is if [ -z "$foobar" ]. I personlly try to use things
that are as portable of possible, so I don't get caught out if I use a
system which does not conform to the way most shells work.
Fixed.
> * Line 63. I think it would be better to say "$0 appears to be
corrupted, as the checksum is not what is expected. Expected <what you
expect> got <what you got>
Good idea.
> '''General'''
>
> I think you might speed this up by avoiding some of the 'cat' commands.
For example,
I found a way to avoid shell redirection altogether in that instance.
> Do a Google on "useless use of cat".
I like the advice "stop piping cats" :) Although for simple things, I
like using cat and a pipe, since I can easily visualize the data moving
from left to right.
With the above changes, testing all the spkgs in 4.3.4.alpha0 now takes
about 4:33 on my computer.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/329#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.