Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogma-cli: Allow customization of target C filenames #80

Closed
ivanperez-keera opened this issue Mar 22, 2023 · 6 comments
Closed

ogma-cli: Allow customization of target C filenames #80

ivanperez-keera opened this issue Mar 22, 2023 · 6 comments
Assignees
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Feature Admin only: Change request pertaining to new features requested
Milestone

Comments

@ivanperez-keera
Copy link
Member

Description

Ogma does not allow users to specify the name of the target file that should be used in applications produced from FRET files.

Without that extra facility, it becomes necessary to rename and modify the Copilot/Haskell (or C) files produced, which detracts from a smooth UX process.

This also affects us when we demonstrate Ogma, since to have to modify the files produced (either via a text editor or via a sed command) in the middle of the demo. Users outside of our project do not understand why this is happening, and the extra step distracts from the presentation.

This would be easily solved if we had a way to specify the target filename via a command line flag.

Type

  • Feature: new flag added to make use of application smoother.

Additional context

None.

Requester

  • Ivan Perez

Method to check presence of bug

Not applicable (not a bug).

Expected result

Ogma provides a CLI argument for all commands producing standalone Copilot files that allows customizing the name of the target C files.

Desired result

Ogma provides a CLI argument for all commands producing standalone Copilot files that allows customizing the name of the target C files.

Proposed solution

Modify the FRET backends to include a new argument for the target filename.

Expose that flag all the way to the CLI.

Set the default value to the existing filename for backwards compatibility.

Document existence of flag (and possibly simplify README if applicable).

Adjust Dockerfiles produced by different backends if needed.

Further notes

None.

@ivanperez-keera ivanperez-keera added CR:Status:Initiated Admin only: Change request that has been initiated CR:Type:Feature Admin only: Change request pertaining to new features requested labels Mar 22, 2023
@ivanperez-keera ivanperez-keera changed the title ogma-cli: Allow customization of target Copilot file ogma-cli: Allow customization of target Copilot file Mar 22, 2023
@ivanperez-keera
Copy link
Member Author

Change Manager: Confirmed that the issue exists.

@ivanperez-keera ivanperez-keera added CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager and removed CR:Status:Initiated Admin only: Change request that has been initiated labels Mar 22, 2023
@ivanperez-keera
Copy link
Member Author

Technical Lead: Confirmed that the issue should be addressed.

@ivanperez-keera ivanperez-keera added CR:Status:Accepted Admin only: Change request accepted by technical lead and removed CR:Status:Confirmed Admin only: Change request that has been acknowledged by the change manager labels Mar 22, 2023
@ivanperez-keera
Copy link
Member Author

Technical Lead: Issue scheduled for Ogma 1.(0+X).(8+Y).

Fix assigned to: @ivanperez-keera.

@ivanperez-keera ivanperez-keera added CR:Status:Scheduled Admin only: Change requested scheduled and removed CR:Status:Accepted Admin only: Change request accepted by technical lead labels May 21, 2023
@ivanperez-keera ivanperez-keera self-assigned this May 21, 2023
@ivanperez-keera ivanperez-keera added this to the Release 1.(0+X).(8+Y) milestone May 21, 2023
@ivanperez-keera ivanperez-keera added CR:Status:Implementation Admin only: Change request that is currently being implemented and removed CR:Status:Scheduled Admin only: Change requested scheduled labels May 21, 2023
@ivanperez-keera ivanperez-keera changed the title ogma-cli: Allow customization of target Copilot file ogma-cli: Allow customization of target C file May 21, 2023
@ivanperez-keera ivanperez-keera changed the title ogma-cli: Allow customization of target C file ogma-cli: Allow customization of target C filenames May 21, 2023
ivanperez-keera added a commit that referenced this issue May 21, 2023
…filename. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the FRET component specification backend to customize the
name of the target C filenames based on an argument to the backend.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…filename. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command that exposes the component
specification backend to customize the name of the target C filenames based on
an argument to the backend, and use it when calling the internal
FRET-to-Copilot translation module.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…ilename. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command-line interface to include a new flag
for the fret-component-spec command, allowing users to customize the name of
the target C filenames generated by Copilot.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…e. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the FRET requirements DB backend to customize the name of
the target C filenames based on an argument to the backend.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…e. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command that exposes the requirements DB
backend to customize the name of the target C filenames based on an argument to
the backend, and use it when calling the internal FRET-to-Copilot translation
module.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command-line interface to include a new flag
for the fret-reqs-db command, allowing users to customize the name of the
target C filenames generated by Copilot.
ivanperez-keera added a commit that referenced this issue May 21, 2023
Prior commits have added new flags to the FRET-related commands so that users
can customize the prefix used in C filenames generated by Copilot.

This commit documents the existence of such a flag in the README.
ivanperez-keera added a commit that referenced this issue May 21, 2023
One of the examples included in the README was using sed to modify the prefix
used by Copilot to generate C files. This extra step is no longer necessary,
since the customization can now be performed directly via a new flag to
FRET-related Ogma commands.

This commit modifies the FPrime example to use the new flag --target-file-name
to select the name of the C files generated by Copilot, instead of manually
performing such a change by calling sed on the Copilot/Haskell file.
ivanperez-keera added a commit that referenced this issue May 21, 2023
Prior commits have added new flags to the FRET-related commands so that users
can customize the prefix used in C filenames generated by Copilot.

This commit documents the existence of such a flag in the README.
ivanperez-keera added a commit that referenced this issue May 21, 2023
One of the examples included in the README was using sed to modify the prefix
used by Copilot to generate C files. This extra step is no longer necessary,
since the customization can now be performed directly via a new flag to
FRET-related Ogma commands.

This commit modifies the FPrime example to use the new flag --target-file-name
to select the name of the C files generated by Copilot, instead of manually
performing such a change by calling sed on the Copilot/Haskell file.
ivanperez-keera added a commit that referenced this issue May 21, 2023
Prior commits have added new flags to the FRET-related commands so that users
can customize the prefix used in C filenames generated by Copilot.

This commit documents the existence of such a flag in the README.
ivanperez-keera added a commit that referenced this issue May 21, 2023
One of the examples included in the README was using sed to modify the prefix
used by Copilot to generate C files. This extra step is no longer necessary,
since the customization can now be performed directly via a new flag to
FRET-related Ogma commands.

This commit modifies the FPrime example to use the new flag --target-file-name
to select the name of the C files generated by Copilot, instead of manually
performing such a change by calling sed on the Copilot/Haskell file.
@ivanperez-keera
Copy link
Member Author

Implementor: Solution implemented, review requested.

@ivanperez-keera ivanperez-keera added CR:Status:Verification Admin only: Change request that is currently being verified and removed CR:Status:Implementation Admin only: Change request that is currently being implemented labels May 21, 2023
ivanperez-keera added a commit that referenced this issue May 21, 2023
A new field has been added to the FRET component spec backend to take the
prefix for the target C files generated by Copilot. That new field is not
optional.

The tests are currently failing because the value for the field is not
being passed in a call to the backend.

This commit modifies the tests for the component-spec backend to include
the target file prefix "fret", which was originally the default, in
the call to the backend.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…ilename. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command-line interface to include a new flag
for the fret-component-spec command, allowing users to customize the name of
the target C filenames generated by Copilot.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…e. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the FRET requirements DB backend to customize the name of
the target C filenames based on an argument to the backend.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…e. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command that exposes the requirements DB
backend to customize the name of the target C filenames based on an argument to
the backend, and use it when calling the internal FRET-to-Copilot translation
module.
ivanperez-keera added a commit that referenced this issue May 21, 2023
A new field has been added to the FRET requirements DB backend to take the
prefix for the target C files generated by Copilot. That new field is not
optional.

The tests are currently failing because the value for the field is not
being passed in a call to the backend.

This commit modifies the tests for the reqs DB backend to include the target
file prefix "fret", which was originally the default, in the call to the
backend.
ivanperez-keera added a commit that referenced this issue May 21, 2023
…. Refs #80.

Ogma does not allow users to specify the name of the target file that should be
used in applications produced from FRET files. Without that extra facility, it
becomes necessary to rename and modify the Copilot/Haskell (or C) files
produced, which detracts from a smooth UX process.

This commit modifies the top-level command-line interface to include a new flag
for the fret-reqs-db command, allowing users to customize the name of the
target C filenames generated by Copilot.
ivanperez-keera added a commit that referenced this issue May 21, 2023
Prior commits have added new flags to the FRET-related commands so that users
can customize the prefix used in C filenames generated by Copilot.

This commit documents the existence of such a flag in the README.
ivanperez-keera added a commit that referenced this issue May 21, 2023
One of the examples included in the README was using sed to modify the prefix
used by Copilot to generate C files. This extra step is no longer necessary,
since the customization can now be performed directly via a new flag to
FRET-related Ogma commands.

This commit modifies the FPrime example to use the new flag --target-file-name
to select the name of the C files generated by Copilot, instead of manually
performing such a change by calling sed on the Copilot/Haskell file.
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles passes the tests. Details:
      Docker image:

      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN apt-get install --yes git
      
      # We install the application first and then test it, in case any tests need to
      # run the tool.
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd .. && \
          cabal v1-install $NAME/$PAT**/ --enable-tests && \
          cabal v1-install $NAME/$PAT**/ --enable-tests --run-tests -j1

      Command:

      $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=62a7b97b865cbb8a63c34ea86d485558377324b2" -it ogma-test
    • The solution proposed fixes the issues described. Details:
      The following docker script prints Success if the fret-component-spec command accepts the new flag, and the C code is generated in files with the custom filenames.

      FROM ubuntu:trusty
      
      ENV DEBIAN_FRONTEND=noninteractive
      
      RUN apt-get update
      
      RUN apt-get install --yes software-properties-common
      RUN add-apt-repository ppa:hvr/ghc
      RUN apt-get update
      
      RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4
      RUN apt-get install --yes libz-dev
      
      ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH
      
      RUN cabal update
      RUN cabal v1-sandbox init
      RUN cabal v1-install alex happy
      RUN cabal v1-install copilot-3.15
      RUN apt-get install --yes git
      
      CMD git clone $REPO && \
          cd $NAME && \
          git checkout $COMMIT && \
          cd .. && \
          cabal v1-install $NAME/$PAT**/ && \
          ogma fret-component-spec --fret-file-name $NAME/ogma-cli/examples/fret-reqs-small.json --target-file-name smvcs > SMVCS.hs && \
          cabal v1-exec -- runhaskell SMVCS.hs && \
          gcc -c smvcs.c && \
          echo "Success"

      Command:

      $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e PAT="ogma-" -e "COMMIT=62a7b97b865cbb8a63c34ea86d485558377324b2" -it ogma-verify-80
  • Implementation is documented. Details:
    The README is updated to document the new flag. An example in the README where the target filenames were being adjusted by hand is also updated.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No examples affected.
  • Required version bumps are evaluated. Details:
    No bump needed (new feature without affecting pre-existing interface; defaults used by new feature chosen to enable backwards compatibility).

@ivanperez-keera
Copy link
Member Author

Change Manager: Implementation ready to be merged.

@ivanperez-keera ivanperez-keera added CR:Status:Closed Admin only: Change request that has been completed and removed CR:Status:Verification Admin only: Change request that is currently being verified labels May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR:Status:Closed Admin only: Change request that has been completed CR:Type:Feature Admin only: Change request pertaining to new features requested
Projects
None yet
Development

No branches or pull requests

1 participant