Difference between revisions of "Maintain packages with Git"
(DRAFT - incomplete) |
|||
Line 40: | Line 40: | ||
git clone https://git.hpkg.tv/USERNAME/webif.git | git clone https://git.hpkg.tv/USERNAME/webif.git | ||
</pre> | </pre> | ||
− | Change to our repository directory and add the master repository as another remote - this you to pick up changes made to the master | + | Change to our repository directory and add the master repository as another remote - this enables you to pick up changes made to the master |
<pre> | <pre> | ||
cd /mod/git/webif | cd /mod/git/webif | ||
Line 46: | Line 46: | ||
</pre> | </pre> | ||
You now have two remotes for this project on disk: | You now have two remotes for this project on disk: | ||
− | + | # origin which points to your fork of the project. You can read and write to this remote. | |
− | + | # upstream which points to the main project’s repository. You can only read from this remote. | |
== Sync with master == | == Sync with master == | ||
You don't need this step if you have just forked and cloned the master, but if time has elapsed and master may have changed you can pull in the latest changes and push them up to your host repository | You don't need this step if you have just forked and cloned the master, but if time has elapsed and master may have changed you can pull in the latest changes and push them up to your host repository | ||
Line 68: | Line 68: | ||
== Package, Install and test fixes == | == Package, Install and test fixes == | ||
For simple changes you may be able to test the changes in isolation without needing to package and install for each update but to fully test using the webif it is best to properly package and install your changes. | For simple changes you may be able to test the changes in isolation without needing to package and install for each update but to fully test using the webif it is best to properly package and install your changes. | ||
− | Update CONTROL/control for the package to update the version number, check the dependencies section if your changes depend on new or updated packages (or remove existing dependencies). See the [[Create Packages]] page for more information on the control file structure | + | Update CONTROL/control for the package to update the version number, check the dependencies section if your changes depend on new or updated packages (or remove existing dependencies). See the "[[Create Packages]]" page for more information on the control file structure. |
+ | Create package .opk file and install it (vers#) is the number from the control file | ||
+ | <pre> | ||
+ | cd /mod/git | ||
+ | opkg-pack webif | ||
+ | opkg install webif_vers#_mipsel.opk | ||
+ | </pre> | ||
+ | If the opkg-pack fails with 'Resource temporarily unavailable' messages try again - it seems to resolve itself after a few goes. | ||
+ | Test to ensure your changes are working as intended. | ||
+ | == Commit your changes == |
Revision as of 16:58, 24 February 2020
Draft Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files.
Some, but not all, packages developed for the Humax use Git to maintain the associated source code. This allows for better tracking and control of changes and, potentially, allows for multiple users to collaborate on maintaining the package by making and testing changes on a private copy of the package and then submitting them for review and incorporation into the main package for distribution to the Humax community via the normal package update mechanism.
This wiki page attempts to describe the basics required to submit a change to a package that you don't own using the webif package as an example. It was written by a naive new user of Git and does not attempt to cover all of Git / Github and may contain errors, please correct and update this page where needed!
Git repository = Storage location for a single humax package
Contents
Initial setup
Install, using the normal Humax package install method, the following (may need to show Advanced packages):
- git
- pkgtools
- A text editor, Joe, Nano, or Vim unless you are happy with the default Vi
Create a user account on the hummy package git repository site https://git.hpkg.tv/ userid should normally be the same as your forum id, Optionally also create an id on the the public git repository github
All commands shown should be issued from a command prompt (telnet, putty, or Command Line on webif Diagnostics page)
Create a directory to hold git repositories (do not use /mod directly to avoid conflicts with installed packages)
md /mod/git cd /mod/git
Set up some defaults for Git based on your details and preferences. The credential.helper timeout will remember your password for 24 hours
git config --global user.name "USERNAME" git config --global user.email "EMAIL" git config --global core.editor "editor" git config --global credential.helper 'cache --timeout=86400'
Fork and clone reposiory
Sign in and find the package you want to work with on the host repository eg https://git.hpkg.tv/hummypkg/webif Click on the Fork button (top right) and create a forked repository (using a fork creates a private copy and insulates your changes from those on the master, it is not needed if you are the repository owner) Copy the the HHTPS url for the forked repository, ensure you are in your git folder on the humax and paste it into a git clone command
cd /mod/git git clone https://git.hpkg.tv/USERNAME/webif.git
Change to our repository directory and add the master repository as another remote - this enables you to pick up changes made to the master
cd /mod/git/webif git remote add upstream https://git.hpkg.tv/hummypkg/webif.git
You now have two remotes for this project on disk:
- origin which points to your fork of the project. You can read and write to this remote.
- upstream which points to the main project’s repository. You can only read from this remote.
Sync with master
You don't need this step if you have just forked and cloned the master, but if time has elapsed and master may have changed you can pull in the latest changes and push them up to your host repository
cd /mod/git/webif git checkout master git pull upstream master git push origin master
Create a Branch
Every related set of changes should be in its own branch, don't try an fix unrelated problems in the same branch. Branch names should be meaningful.
cd /mod/git/webif git checkout -b FixBrowseTypo
The -b flag is only needed for a new branch, not when switching to existing branch
Make your updates
Using your favourite text editor make the necessary changes to the code.
Package, Install and test fixes
For simple changes you may be able to test the changes in isolation without needing to package and install for each update but to fully test using the webif it is best to properly package and install your changes. Update CONTROL/control for the package to update the version number, check the dependencies section if your changes depend on new or updated packages (or remove existing dependencies). See the "Create Packages" page for more information on the control file structure. Create package .opk file and install it (vers#) is the number from the control file
cd /mod/git opkg-pack webif opkg install webif_vers#_mipsel.opk
If the opkg-pack fails with 'Resource temporarily unavailable' messages try again - it seems to resolve itself after a few goes. Test to ensure your changes are working as intended.