nlbdev / pipeline

NLB branch of the super-project that aggregates all Pipeline related code. See https://github.com/daisy/pipeline for the main branch.
http://repo.nlb.no/pipeline
3 stars 1 forks source link

Possibility to provide only temp-dir to scripts #185

Open bertfrees opened 6 years ago

bertfrees commented 6 years ago

It would be allowed to not specify pef-output-dir when temp-dir is specified. In this case pef-output-dir will then be computed from temp-dir. The same goes for brf-output-dir when include-brf is true, preview-output-dir when include-preview is true, and obfl-output-dir when include-obfl is true.

This will reduce the boiler plate in our tests.

This:

<x:option name="pef-output-dir" select="resolve-uri('1/pef-output-dir',$temp-dir)"/>
<x:option name="preview-output-dir" select="resolve-uri('1/preview-output-dir',$temp-dir)"/>
<x:option name="temp-dir" select="resolve-uri('1/temp-dir',$temp-dir)"/>

could be replaced with:

<x:option name="temp-dir" select="resolve-uri('1',$temp-dir)"/>

Note that the generated directory names should be predictable.

bertfrees commented 6 years ago

We would kind of be replacing functionality from the framework though. Maybe a better solution would be to support this in XProcSpec, but that would mean XProcSpec would have to understand the px:output="result" attributes which makes it specific to Pipeline.

josteinaj commented 6 years ago

I've been meaning to fix the issue where we have to specify 1/, 2/ etc. all the time, but haven't had the time. It seems there's no issue in the xprocspec tracker for it either, so I created one: daisy/xprocspec#66

bertfrees commented 6 years ago

OK, that would indeed be an easier solution! Then we can just do the following:

<x:scenario label="_">
    <x:call step="my:script">
        <x:option name="pef-output-dir" select="resolve-uri('pef-output-dir',$temp-dir)"/>
        <x:option name="preview-output-dir" select="resolve-uri('preview-output-dir',$temp-dir)"/>
        <x:option name="temp-dir" select="resolve-uri('temp-dir',$temp-dir)"/>
    </x:call>
    <x:scenario label="scenario 1">
        <x:call>
            <x:option name="some-other-option" select="..."/>
        </x:call>
        <x:context>...</x:context>
        <x:expect>...</x:expect>
    </x:scenario>
    <x:scenario label="scenario 2">
        <x:context>...</x:context>
        <x:expect>...</x:expect>
    </x:scenario>
</x:scenario>

It does however mean that, because we move temp-dir to the front, we can't use the original temp-dir anymore for other options. See https://github.com/daisy/xprocspec/issues/44.

josteinaj commented 6 years ago

Right, true. Unless, I suppose when merging the options/parameters, we could make sure that the temp-dir is always last:

<!-- source -->
<x:scenario label="_">
    <x:call step="my:script">
        <x:option name="temp-dir" select="resolve-uri('temp-dir',$temp-dir)"/>
    </x:call>
    <x:scenario label="scenario 1">
        <x:call>
            <x:option name="pef-output-dir" select="resolve-uri('pef-output-dir',$temp-dir)"/>
        </x:call>
        <x:context>...</x:context>
        <x:expect>...</x:expect>
    </x:scenario>
</x:scenario>

<!-- merged -->
<x:scenario label="_ scenario 1">
    <x:call step="my:script">
        <x:option name="pef-output-dir" select="resolve-uri('pef-output-dir',$temp-dir)"/>
        <x:option name="temp-dir" select="resolve-uri('temp-dir',$temp-dir)"/>
    </x:call>
    <x:context>...</x:context>
    <x:expect>...</x:expect>
</x:scenario>

It would be changed here: https://github.com/daisy/xprocspec/blob/1285a1f1e7802d0ecc9b51267f6ab56ce59c1b37/src/main/resources/content/xml/xproc/preprocess/infer-scenarios.xsl#L133