Howto remove empty dirs in post-deactivate?

Joshua Root jmr at macports.org
Wed Apr 16 15:24:07 PDT 2014


On 2014-4-17 08:12 , Peter Danecek wrote:
> 
> Now, however I came across a different issue. I realise I need to clean a cache directory as well. So I added the code below.
> 
> ---
>    # purge fetch-crl cache
>    delete [ glob ${prefix}/var/cache/fetch-crl/*.state ]
> ---
> 
> The problem here is that the glob list becomes too long and the command fails on deactivations. 
> 
> So how could I deal with this?
> ~petr
> 
> 
> 
> ---
> Error: org.macports.deactivate for port igtf-ca-bundle returned: /opt/local/var/cache/fetch-crl/AAACertificateServices.0.state /opt/local/var/cache/fetch-crl/AddTrust-External-CA-Root.0.state /opt/local/var/cache/fetch-crl/AEGIS.0.state /opt/local/var/cache/fetch-crl/ANSPGrid.0.state /opt/local/var/cache/fetch-crl/ArmeSFo.0.state /opt/local/var/cache/fetch-crl/ASGCCA-2007.0.state /opt/local/var/cache/fetch-crl/AustrianGrid.0.state /opt/local/var/cache/fetch-crl/BalticGrid.0.state /opt/local/var/cache/fetch-crl/BEGrid2008.0.state /opt/local/var/cache/fetch-crl/BG-ACAD-CA.0.state /opt/local/var/cache/fetch-crl/BrGrid.0.state /opt/local/var/cache/fetch-crl/BYGCA.0.state /opt/local/var/cache/fetch-crl/CALG.0.state /opt/local/var/cache/fetch-crl/CERN-GridCA.0.state /opt/local/var/cache/fetch-crl/CERN-Root-2.0.state /opt/local/var/cache/fetch-crl/CERN-Root.0.state /opt/local/var/cache/fetch-crl/CERN-TCA.0.state /opt/local/var/cache/fetch-crl/CESNET-CA-3.0.state /opt/local/var/cache/fetch
 -
crl/CESNET-CA-Root.0.state /opt/local/var/cache/fetch-crl/cilogon-silver.0.state /opt/local/var/cache/fetch-crl/CNIC.0.state /opt/local/var/cache/fetch-crl/CNRS2-Grid-FR.0.state /opt/local/var/cache/fetch-crl/CNRS2-Projets.0.state /opt/local/var/cache/fetch-crl/CNRS2.0.state /opt/local/var/cache/fetch-crl/CyGrid.0.state /opt/local/var/cache/fetch-crl/DFN-GridGermany-Root.0.state /opt/local/var/cache/fetch-crl/DFN-SLCS.0.state /opt/local/var/cache/fetch-crl/DigiCertAssuredIDRootCA-Root.0.state /opt/local/var/cache/fetch-crl/DigiCertGridCA-1-Classic.0.state /opt/local/var/cache/fetch-crl/DigiCertGridCA-1G2-Classic.0.state /opt/local/var/cache/fetch-crl/DigiCertGridRootCA-Root.0.state /opt/local/var/cache/fetch-crl/DigiCertGridTrustCA-Classic.0.state /opt/local/var/cache/fetch-crl/DigiCertGridTrustCAG2-Classic.0.state /opt/local/var/cache/fetch-crl/DZeScience.0.state /opt/local/var/cache/fetch-crl/EG-GRID.0.state /opt/local/var/cache/fetch-crl/FNAL-SLCS.0.state /opt/local/var/cache/fetc
 h
-crl/GermanGrid.0.state /opt/local/var/cache/fetch-crl/GridCanada.0.state /opt/local/var/cache/fetch-crl/HellasGrid-CA-2006.0.state /opt/local/var/cache/fetch-crl/HellasGrid-Root.0.state /opt/local/var/cache/fetch-crl/HIAST.0.state /opt/local/var/cache/fetch-crl/HKU.0.state /opt/local/var/cache/fetch-crl/IGCA.0.state /opt/local/var/cache/fetch-crl/IHEP-2013.0.state /opt/local/var/cache/fetch-crl/IHEP.0.state /opt/local/var/cache/fetch-crl/INFN-CA-2006.0.state /opt/local/var/cache/fetch-crl/IRAN-GRID.0.state /opt/local/var/cache/fetch-crl/KEK.0.state /opt/local/var/cache/fetch-crl/KISTI-2007.0.state /opt/local/var/cache/fetch-crl/LACGridCA.0.state /opt/local/var/cache/fetch-crl/LIPCA.0.state /opt/local/var/cache/fetch-crl/MaGrid.0.state /opt/local/var/cache/fetch-crl/MARGI.0.state /opt/local/var/cache/fetch-crl/MD-Grid.0.state /opt/local/var/cache/fetch-crl/MREN-CA.0.state /opt/local/var/cache/fetch-crl/MYIFAM.0.state /opt/local/var/cache/fetch-crl/NAREGI.0.state /opt/local/var/cache/
 f
etch-crl/NCHC.0.state /opt/local/var/cache/fetch-crl/NCSA-mics.0.state /opt/local/var/cache/fetch-crl/NCSA-slcs-2013.0.state /opt/local/var/cache/fetch-crl/NCSA-slcs.0.state /opt/local/var/cache/fetch-crl/NCSA-tfca-2013.0.state /opt/local/var/cache/fetch-crl/NCSA-tfca.0.state /opt/local/var/cache/fetch-crl/NECTEC.0.state /opt/local/var/cache/fetch-crl/NERSC-SLCS.0.state /opt/local/var/cache/fetch-crl/NICS-MyProxy.0.state /opt/local/var/cache/fetch-crl/NIIF.0.state /opt/local/var/cache/fetch-crl/NIKHEF.0.state /opt/local/var/cache/fetch-crl/NorduGrid.0.state /opt/local/var/cache/fetch-crl/PK-Grid-2007.0.state /opt/local/var/cache/fetch-crl/pkIRISGrid.0.state /opt/local/var/cache/fetch-crl/PolishGrid.0.state /opt/local/var/cache/fetch-crl/PRAGMA-UCSD.0.state /opt/local/var/cache/fetch-crl/PSC-Myproxy-CA.0.state /opt/local/var/cache/fetch-crl/QuoVadis-Root-CA1.0.state /opt/local/var/cache/fetch-crl/RDIG.0.state /opt/local/var/cache/fetch-crl/REUNA-ca.0.state /opt/local/var/cache/fetch-c
 r
l/RomanianGRID.0.state /opt/local/var/cache/fetch-crl/SDG.0.state /opt/local/var/cache/fetch-crl/SEE-GRID.0.state /opt/local/var/cache/fetch-crl/seegrid-ca-2013.0.state /opt/local/var/cache/fetch-crl/SiGNET-CA.0.state /opt/local/var/cache/fetch-crl/SlovakGrid.0.state /opt/local/var/cache/fetch-crl/SRCE.0.state /opt/local/var/cache/fetch-crl/SWITCH-QuoVadis-Grid-ICA.0.state /opt/local/var/cache/fetch-crl/TERENA-eScience-SSL-CA.0.state /opt/local/var/cache/fetch-crl/TERENAeSciencePersonalCA.0.state /opt/local/var/cache/fetch-crl/TRGrid.0.state /opt/local/var/cache/fetch-crl/UGRID.0.state /opt/local/var/cache/fetch-crl/UKeScienceCA-2A.0.state /opt/local/var/cache/fetch-crl/UKeScienceCA-2B.0.state /opt/local/var/cache/fetch-crl/UKeScienceRoot-2007.0.state /opt/local/var/cache/fetch-crl/ULAGrid-CA-2008.0.state /opt/local/var/cache/fetch-crl/UNAMgrid-ca.0.state /opt/local/var/cache/fetch-crl/UniandesCA.0.state /opt/local/var/cache/fetch-crl/UNLPGrid.0.state /opt/local/var/cache/fetch-crl/U
 T
N-USERFirst-Hardware.0.state /opt/local/var/cache/fetch-crl/UTNAAAClient.0.state: file name too long
> Warning: targets not executed for igtf-ca-bundle: org.macports.deactivate
> Please see the log file for port igtf-ca-bundle for details:
>    /opt/local/var/macports/logs/_opt_local_var_macports_registry_portfiles_igtf-ca-bundle_1.56_0/igtf-ca-bundle/main.log
> Warning: Failed to execute portfile from registry for igtf-ca-bundle @1.56_0

You have to use eval; the return value from glob is being passed to
delete as a single argument. Also, delete doesn't accept multiple args
in the current release (file delete does).

- Josh


More information about the macports-dev mailing list