From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9085 invoked by alias); 26 May 2018 15:07:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42851 Received: (qmail 3606 invoked by uid 1010); 26 May 2018 15:07:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f53.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.53):SA:0(-1.9/5.0):. Processed in 3.821027 secs); 26 May 2018 15:07:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: doron.behar@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=lmvQjQEGAEf3w6GqaMR2dScS272Wuz/Crdl5GGVZ6G4=; b=XkJrZnLYp1i1T7e7SBaXK5K2tSGNSy+S03lJTGzfj/MdCqjkuJDnTbYkMT60TjULOS /NScurwkbnfRu78U4oDehQeMHwG9kJz3uqgQ8r+uYikhdbnpjjB6spJSeJiQTe0G0jBs HmkgpBch66x/WU1utdPGjC07JvPHaREj2g+fbMvC1/2GXAwpAuohkmJtX+TO2OS2zoBc wdmdfpn6PUrXztfLrHadQNJe7ZqJbtNVqVFnHS4lEOzhue02YPpyq5rzEFzvLliYB5Gy Ho0e1GZYx6J/gzgFDvurpyl3NA64IfJs3g02Ocuq87VuzI2vmLZUpB0pQ9c4jA9ulkAD CP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=lmvQjQEGAEf3w6GqaMR2dScS272Wuz/Crdl5GGVZ6G4=; b=ZkhqVpNmGhG7x9TtBcEGdM068K7G2BtVWT/y75H6CiLhLvB+GoPyfPA9/HJlBcF7uX d4mlsvXL9R/4f5VshcjL22eeGUvnfap925hhXuPNJ3noTGvgF53emwaXxjdUOEm6KLIz aJ089d12R2Oo/kmuveTXlgp9Tuhp5+xp/vzXjMiEL+di5rG67KYAWNrqfzmIzuY6IzI9 7oKU/QNgGVhorRLdypBxBL8NfVIa765DZniIOWcYa2QNEkzmH1KoYuPOqtnOuGZk+OWh pL6v/1PuySLxYUVxu9NxBlcmFq8rIeieMibdwLAXopgG2O1vFk2DWs2IWg0QUbhvCbSs cltw== X-Gm-Message-State: ALKqPwezH2wtpay/2muBk3crWzJdANldsficrn3zusbybn0CpoQAVx/M vlLQxm/2aZsRmXOX4J1U1qyN5ne4 X-Google-Smtp-Source: ADUXVKLMD6RlBsnex8lytnOc5h64qzOvWvRWyFNoYDNGrM2fLTwo9PNHMTNPbIWYlqnzxPSQCBbi5A== X-Received: by 2002:a1c:e80a:: with SMTP id f10-v6mr4588779wmh.16.1527347250871; Sat, 26 May 2018 08:07:30 -0700 (PDT) From: doron.behar@gmail.com To: zsh-workers@zsh.org Subject: [PATCH 23/25] Improve `___luarocks_installed_rocks_cache_policy`. Date: Sat, 26 May 2018 18:06:32 +0300 Message-Id: <20180526150634.15683-24-doron.behar@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180526150634.15683-1-doron.behar@gmail.com> References: <20180526150634.15683-1-doron.behar@gmail.com> From: Doron Behar Handle multiple trees when evaluating installed rocks cache validity - both system wide and user's. --- Completion/Unix/Command/_luarocks | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index cb42d1b36..8de95c188 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -87,14 +87,14 @@ __luarocks_lua_versions(){ # {{{ helper: installed rocks cache policy (( $+functions[___luarocks_installed_rocks_cache_policy] )) || ___luarocks_installed_rocks_cache_policy(){ - # TODO enable the user to configure manifests file that will be checked here with zstyle - # the number of seconds since 1970-01-01 the manifest file was modified - local manifest_last_date_modified="$(date -r ~/.luarocks/lib/luarocks/rocks-5.3/manifest +%s 2>/dev/null)" + # the number of seconds since 1970-01-01 the manifest files were modified + local user_manifest_last_date_modified="$(date -r ${HOME}/.luarocks/lib/luarocks/rocks-5.3/manifest +%s 2>/dev/null)" + local system_manifest_last_date_modified="$(date -r /usr/lib/luarocks/rocks-5.3/manifest +%s 2>/dev/null)" # the number of seconds since 1970-01-01 the cache file was modified local cache_last_date_modified="$(date -r $1 +%s 2>/dev/null)" - if [[ ! -z ${cache_last_date_modified} && ! -z ${manifest_last_date_modified} ]]; then + if [[ ! -z ${cache_last_date_modified} && ! -z ${user_manifest_last_date_modified} && ! -z ${system_manifest_last_date_modified} ]]; then # if the manifest file is newer then the cache: - if [ ${manifest_last_date_modified} -ge ${cache_last_date_modified} ]; then + if [ ${user_manifest_last_date_modified} -ge ${cache_last_date_modified} ] || [ ${system_manifest_last_date_modified} -ge ${cache_last_date_modified} ]; then (( 1 )) else (( 0 )) -- 2.17.0