Getting Relic Package Manager to your IBM i using RDi and Git

We have been suggesting for some time that any Open Source project created for the IBM i should be packaged for Relic Package Manager utilization. Initiated by Liam Allen it provides a method for allowing source to be downloaded and compiled in a consistent manner. Now, to achieve this requires that you have a copy of Relic Package Manager on your system. This becomes a catch22 situation because Relic Package Manager is not packaged in the same manner. There is not package build process for the package builder…

Liam had suggested a couple of ways to download and compile the source using FTP etc. I felt that we could use the Relic Package Manager as the basis for getting our feet wet with Git and the RDi IDE from IBM. I did look at Orion but most of what we can achieve using it relies on additional work outside of the IDE, RDi can be utilized for almost if not all of the project without going outside of the IDE. If you don’t have RDi installed with Git support you can stop reading now!

The paths and names we have used in this example can be changed to some degree, but we would suggest not to change anything from the defaults if this is your first play with RDi and Git. Follow similar naming conventions we have used to make things simple and easier to understand.

First thing we have to do is start up RDi and add a new Workspace which we called RELIC.

pic1

Create Workspace


Once the Workspace opens we can select the link to go to the workbench which opens in the Remote Systems Explorer perspective.

Remote Systems Explorer perspective

Remote Systems Explorer perspective

We need to add a connection to our IBM i which will allow us to copy the source files once we have imported them, you do not have to complete this step now but we wanted to access the library on the IBM i we had created prior to starting the IDE.

IBM i connection

IBM i connection

Create the library you want to use as your source library we chose RELICSRC on the system. You can either sign onto the IBM i or use the options available in the IDE by opening the connection you just created then right clicking on the Object option and create a new library. Then add a filter to the Object view to show the library, we added *MSGF and *FILE (PF-SRC) as the object filters. you will notice in the screen shot below that the library is empty.

View in RSE of IBM i library and content

View in RSE of IBM i library and content

Now we will add the source from the Git repository for Relic Package Manager. You need to open the Git Perspective to do this (Window.. Open Perspective.. Other) and select Git.

pic5

Open Git perspective


The perspective now gives you the option to Clone a Git Repository using the links.

Git Perspective view

Git Perspective view

You will need to have a GitHub sign on to get the source to download. If you do not have a sign in get one before you try to clone the repository. We had the URL of the repository and simply pasted into the url text box, it automatically added all of the information about the repository plus our credentials as we have used Git for previous clones. You may be asked to enter your GitHub credentials to get all of this information populated.

Repository location and credentials

Repository location and credentials

The IDE will query the repository to allow you to select the branch you want. Only one branch is available at this time which is the Master branch. In the future there could be many more dependent on how the project grows.

Select Master branch

Select Master branch

Next you need to state where the code will be copied to on your PC. We just take the defaults in this case.

Local Git file location

Local Git file location

Once you press Finish RDi will go out to the remote repository and download all of the files to your local hard drive. you can now expand the view within the Git perspective to see all of the files it downloaded. If you are going to contribute to Relic Package Manager these same files can be used to push you changes, something we encourage everyone to do.

Files installed using Clone

Files installed using Clone

The next step is to get the source from the PC git repository into the RDi local file repository, we tried to find a better solution using the import functions but nothing worked, so we had to result to some back door processing. Maybe IBM will add the import of Git to a local source location at sometime in the future?

To find the location of our source that needs to be copied we looked in the location stated above to store the Git objects. We also needed to find out where IBM stores the information about the local copies of files for our IBM i Project that will be used to compile on the remote IBM i.

In our instance the location of the git files is C:\Users\chrish\git\RelicPackageManager in this directory you will find a directory called QSOURCE which maps to the Source file that contains the source members, these are files we will copy.

First we will create a new IBM i project called RELIC. File.. New.. Project and select the IBM i project. This will create the directory skeleton we need to paste our source files into on the PC.

Create IBM i project

Create IBM i project

Enter the information requested ensuring you enter the connection to use (SAS4 in our case) and RELICSRC as the target library.

Project attributes

Project attributes


Now that we have created our project you will need to add a new Source Physical File by right clicking the RELIC project and select new.. IBM i Source Physical File option. We know the file we are going to be copying is called QSOURCE so we will just add that name.  If there were more we could also add them in the same way.

Add Source Physical File to the library

Add Source Physical File to the library

We did add the files to the RemoteSystemsTempFiles directory previously and this all seemed to work just fine, but we felt creating the source file directly under the project directory is a better option?

Now we want to add the source from the git repository to the local copy of the QSOURCE file we have just created. Depending on your installation directory (see ours above) you can go to the directory and select the objects and copy them to the clip board. Now we need to find the directory where RDi stores its temporary files. In our case the path to the storage directory is C:\Users\chrish\IBM\rationalsdp7.0\RELIC\RELIC\QSOURCE (based on out option to put it under the project directory) this is where we need to paste the files we copied to the clip board.

Once you have done this we will need to refresh the IDE listing as it will only show the source file we just created. Now you should see the files in the project listing (Note this is not the remote system explorer view, it is the project view). You should now see the files are part of the project.

Project file content

Project file content

Next we need to force the objects to the actual source file on the IBM i, the source file does not exist and neither do the members (check the remote system explorer view to confirm if you do not believe)

By right clicking the QSOURCE object and selecting the option Remote Actions Push Selected a copy of the source file and its members will be pushed to the IBM i.

Push changes to the IBM i

Push changes to the IBM i

Press F5 in the remote Systems Explorer view and you will see the source file and its members now exist on the IBM i.

Refreshed Remote Systems Explorer view

Refreshed Remote Systems Explorer view

You can now compile the objects in the same way as you would any ILE based object. You can also do either from the Project view.

Compile from project view

Compile from project view

Or from the Remote System Explorer view

Compile from Remote Systems Explorer view

Compile from Remote Systems Explorer view

That’s it! You now have an environment to allow the build of the Relic Package Manager from source on your IBM i.

Once you have built the Relic package Manager you may venture into other Open Source projects such as our FTPCLIENT at https://github.com/ChrisHird/FTPCLNT or the ZLIB source at https://github.com/ChrisHird/ZLIB

You will not need to download and set up these projects in the same manner as you did above, instructions are provided in the README.md file associated with each of the projects using the objects you just created for Relic Package Manager.

Have fun and get involved, there are lots of options for getting involved and growing the IBM i Open Source community projects. Looking forward to seeing you comments and activity in the Open Source community.

Chris…