From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 4AAA17ED1D for ; Sat, 17 Oct 2015 09:23:10 +0200 (CEST) IronPort-PHdr: 9a23:ZBlvFxcVgLF5DNAWsCpWYVtulGMj4u6mDksu8pMizoh2WeGdxc+7Yx7h7PlgxGXEQZ/co6odzbGG7+axAydZu87JmUtBWaIPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3BPAZ4bt74BpTVx5zukbvip9uCOU4R3mL1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu3SNp41Rr1ADTkgL3t9pIiy7UGCHj20+2AEX24Kvh1NCgnDpFGmD9ai+hf948B0wyieMIXNUbkuSDKh4rlqVBTowHMNPiU49Gz/kdB5lrNdox+/pgB0w8jSbZ3DZ9RkeaaIUtoQX2tMWo5qXCxMGI6mJ98ABuAbPOtc6ZL2p1YUoAGWCgylBeepwThN0CyllZYm2vgsRFmVlDcrGMgD5TGJ9dg= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-ig0-f178.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.213.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.213.178 as permitted sender) identity=mailfrom; client-ip=209.85.213.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ig0-f178.google.com) identity=helo; client-ip=209.85.213.178; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ig0-f178.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BJAQAm9iFWlLLVVdFeg1Q1bwasOoUojB6BWiGCQ4M6AoEhBzoSAQEBAQEBAQEQAQEBAQcLCwkfMIIhgggBAQQSEQQZARsSCwEDDAYFCw0CAgkdAgIiAREBBQEKEgYTEhCHeAEDEg2iboExPjGLSYFsgnmIYQoZJwMKVoQtAQEBAQEBAQMBAQEBGQEFDoEUhVWEfoQqEQFRB4JpgUUFhgUMhwGJEIUZgnCFFIFYSJI3g1CCIxIjgRcoA4I8DhUHgVc8NIQngUABAQE X-IPAS-Result: A0BJAQAm9iFWlLLVVdFeg1Q1bwasOoUojB6BWiGCQ4M6AoEhBzoSAQEBAQEBAQEQAQEBAQcLCwkfMIIhgggBAQQSEQQZARsSCwEDDAYFCw0CAgkdAgIiAREBBQEKEgYTEhCHeAEDEg2iboExPjGLSYFsgnmIYQoZJwMKVoQtAQEBAQEBAQMBAQEBGQEFDoEUhVWEfoQqEQFRB4JpgUUFhgUMhwGJEIUZgnCFFIFYSJI3g1CCIxIjgRcoA4I8DhUHgVc8NIQngUABAQE X-IronPort-AV: E=Sophos;i="5.17,691,1437429600"; d="scan'208";a="183218038" Received: from mail-ig0-f178.google.com ([209.85.213.178]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 17 Oct 2015 09:23:09 +0200 Received: by igdg1 with SMTP id g1so15356844igd.1 for ; Sat, 17 Oct 2015 00:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=j8gixonAQrLq4wxISSjzgDffbnU6dHXFpsHbqKBRwOk=; b=y9jOnEukgYT0wzStTD2wJ01Q3Z9RwBi4+2bZnegjw01uW56uHmT4p4UGoBL1oqiNin UWszmbxaF9k5TT24UJAq3jbmQSoCeAU/+BkzuGi5rYMG8g7Tw22FZD4vQ0eK7UxizbJ1 COgX7CzPGD8iwEEX7jNaDGwGS9bbZ985MqqfyPAoae9gUIhh3yv6bkVeCpKBNMeGt2P1 NTf7gGTzHjO5guMBFGrWpSa830sl036Dm/rys+2IeGahV3LgmKGT95J7p3k65vYg+jS7 S5RGeA5Rop6uNWCSpi4BzlRSHZ4TDezvRP2VvtShwsMMbsM2MvNZcufRdmyr2NEbiPb0 DV4w== X-Received: by 10.50.45.106 with SMTP id l10mr9829270igm.38.1445066588214; Sat, 17 Oct 2015 00:23:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.19.68 with HTTP; Sat, 17 Oct 2015 00:22:28 -0700 (PDT) In-Reply-To: <5621502C.60607@starynkevitch.net> References: <6f77545c62146e8d504a5117716d7d1f@sybille.onecert.fr> <5621502C.60607@starynkevitch.net> From: Gabriel Scherer Date: Sat, 17 Oct 2015 09:22:28 +0200 Message-ID: To: Basile Starynkevitch Cc: David CHEMOUIL , caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] releasing and publishing an OCaml program For reference, an ocamlbuild version would look like this: open Ocamlbuild_plugin let () = dispatch (function | After_rules -> rule "version file" ~prod:"version.ml" ~doc:"generate a file with version information: Version.commit is the HEAD commit at the time of building, Version.tag is the name of the last git tag" (fun _env _build -> let trim = "tr -d '\r\n'" in let commit = run_and_read ("git rev-parse HEAD |" ^ trim) in let tag = run_and_read ("git describe --abbrev=0 --tags |" ^ trim) in let code = Printf.sprintf "let commit = %S\n\ let tag = %S\n" commit tag in Echo ([code], "version.ml"); ) | _ -> () );; On Fri, Oct 16, 2015 at 9:29 PM, Basile Starynkevitch wrote: > On 10/16/2015 08:24 PM, David CHEMOUIL wrote: >> >> Hi, >> >> I am looking for a self-contained, to the point, documentation or tutorial >> detailing steps, or even commands and scripts to run in order to release and >> publish an OCaml-programmed piece of software. > > >> >> So common tasks we'd like to automate are quite simple: adding the commit >> number and/or a build number in the OCaml source code (e.g. to display it >> when running the program), > > > This is not specific to Ocaml. It is a matter of build process. > > Assuming a Linux system, you might have some rule in your Makefile similar > to the (untested) one below: > > ML_SOURCES=$(wildcard [a-z]*.ml) > ML_INTERFACES=$(wildcard [a-z]*.mli) > MD5SUM= md5sum > > _timestamp.ml: > date +'let my_timestamp="%c";;' > _timestamp.tmp > > (echo -n 'let my_lastgitcommit ="' ; \ > git log --format=oneline --abbrev=12 --abbrev-commit -q \ > | head -1 | tr -d '\n\r\f\"' ; \ > echo '";;') >> _timestamp.tmp > (echo -n 'let my_checksum ="'; cat $(sort $(ML_SOURCES)) $(sort > $(ML_INTERFACES))| $(MD5SUM) | cut -d' ' -f1 | tr -d '\n\r\f\"\\' ; echo > '";') >> _timestamp.tmp > mv _timestamp.tmp _timestamp.ml > > Cheers > > -- > Basile STARYNKEVITCH http://starynkevitch.net/Basile/ > email: basilestarynkevitchnet mobile: +33 6 8501 2359 > 8, rue de la Faiencerie, 92340 Bourg La Reine, France > *** opinions {are only mine, sont seulement les miennes} *** > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs