[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add ant-build-system.
From: |
Pjotr Prins |
Subject: |
Re: [PATCH] Add ant-build-system. |
Date: |
Thu, 10 Mar 2016 18:02:46 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Awesome package. Thanks Ricardo, we will use it.
On Thu, Mar 10, 2016 at 05:17:59PM +0100, Ludovic Courtès wrote:
> Ricardo Wurmus <address@hidden> skribis:
>
> > Ricardo Wurmus <address@hidden> writes:
> >
> >> Ludovic Courtès <address@hidden> writes:
> >>
> >>>> The build.xml it generates contains a target “touch” which is run before
> >>>> wrapping up the compiled .class files in a jar archive; this target
> >>>> ensures that the timestamps of all archived files are reset, so the
> >>>> produced jars can be (and in case of the above-mentioned packages)
> >>>> deterministic.
> >>>
> >>> Cool.
> >>>
> >>> What should we do about packages that do provide a ‘build.xml’? I
> >>> suppose their jars will most likely include timestamps by default,
> >>> right?
> >>>
> >>> If that is the case, maybe we should instead add an additional phase
> >>> that would, say, unpack all the installed tarballs, reset timestamps,
> >>> and repack them?
> >>
> >> Yes, I think a generic build phase like that would be better.
> >
> > I have addressed the other issues with the build system already, so
> > here’s just an additional patch that adds a generic “repack” build phase
> > as discussed.
> >
> > I think it’s easier to review it this way, so I didn’t squash the
> > patches. If these changes are okay I’ll fold them into the (corrected)
> > patch adding the ant-build-system and push.
>
> Thanks, it’s indeed easier this way.
>
> > +(define* (repack #:key outputs
> > + #:allow-other-keys)
> > + "Unpack all jar archives, reset the timestamp of all contained files, and
> > +repack them. This is necessary to ensure that archives are reproducible."
>
> I would call it ‘strip-jar-timestamps’ for clarify.
>
> (BTW, Debian’s ‘strip-nondeterminism’ tool does this kind of things too;
> I’m not suggesting that we should use it here, though.)
>
> > + (define (repack-archive jar)
> > + (format #t "repacking ~a\n" jar)
> > + (let ((dir (mkdtemp! "jar-contents.XXXXXX")))
> > + (and (with-directory-excursion dir
> > + (zero? (system* "jar" "xf" jar)))
> > + ;; The manifest file contains timestamps
> > + (for-each delete-file (find-files dir "MANIFEST.MF"))
> > + (delete-file jar)
> > + (ftw dir (lambda (file stat flag)
> > + (utime file 0 0)
> > + #t))
>
> I’d suggest copying ‘reset-timestamps’ from (gnu build install).
> Eventually we’ll move it to (guix build utils).
>
> > + (format #t "~a\n" (string-join (list "jar" "-Mcf" jar "-C" dir
> > ".")))
> > + (zero? (system* "jar" "-Mcf" jar "-C" dir "."))
> > + (utime jar 0 0)
> > + #t)))
>
> The return value of ‘zero?’ is ignored. What about making it:
>
> (unless (zero? …)
> (error "'jar' failed"))
>
> OK with these changes!
>
> Ludo’.
>
--