Skip to content

Latest commit

 

History

History
150 lines (112 loc) · 5.99 KB

sp-openwrt-release.md

File metadata and controls

150 lines (112 loc) · 5.99 KB

sp-openwrt-release

Serval Project, March 2014

This Bash script automates the task of updating a Serval Project OpenWRT package within the Serval OpenWRT feed to refer to a newer revision of its underlying Git repository. This effectively amounts to releasing a newer version of the package for OpenWRT.

For command-line usage information, see the script's built-in help:

$ sp-openwrt-release --help
...
$

The sp-openwrt-release script is designed for use by experienced Serval developers with an understanding of Git, the OpenWRT build system and GNU make. Unless the --quiet option is given, it prints all significant commands as it invokes them, so that any failure can be interpreted in the context that it occurred.

Set the feed repository clone

If you have a local clone of the Serval OpenWRT feed repository, and want the sp-openwrt-release script to use it instead of creating a temporary clone, then set the following environment variable (this can be done in a Bash startup file like $HOME/.profile so that the setting is permanent):

$ export SERVAL_OPENWRT_PACKAGES_REPO="$HOME/src/openwrt-packages"
$

This can be useful if, for example, you wish to inspect the results of the script and possibly modify them before committing and pushing to GitHub, or you have already committed other changes to the feed repository that you wish to push in a single operation.

Add a new package

sp-openwrt-release does not have any option for adding a new OpenWRT package. See the Serval OpenWRT feed README for instructions.

Update an existing package

To release a newer version of an existing package, you must first:

  • choose which feed branch (denoted FEEDBRANCH below) you want to release it on (see the Serval OpenWRT feed README);

  • have a Git clone of the Serval repository you want to release (an existing clone will serve, as sp-openwrt-release does not modify it); the path to this clone's root directory is denoted REPOPATH below;

  • ensure that the clone has its GitHub origin as one of its Git remotes (this is always the case for repositories that have been cloned directly from GitHub);

  • choose the Git revision of REPOPATH (denoted REV below) which you wish to release;

  • ensure the revision REV has been pushed to GitHub.

The sp-openwrt-release script does NOT support specifying a package by name or Makefile path, because if more than one package builds from the same source repository, they must all be updated at once, to avoid inconsistencies. The only way of specifying which package(s) to release is by the Git repository that the package downloads and builds.

To perform the release, issue the command:

$ sp-openwrt-release --push --commit FEEDBRANCH CLONEPATH=REV
...
$

For example:

$ sp-openwrt-release --push --commit development ~/src/serval-dna=devlopment
...
$

As the logged output will show, this will perform the following operations:

  1. checks that REV names a valid revision that has already been pushed to GitHub,

  2. fetches the Serval OpenWRT feed repository then checks out the FEEDBRANCH branch and fast forwards the FEEDBRANCH to its upstream origin's head,

  3. finds all Makefiles in FEEDBRANCH whose URL matches CLONEPATH's GitHub origin,

  4. computes the version string of revision REV in CLONEPATH by invoking the clone's version_string.sh executable if it exists, otherwise uses Git describe,

  5. edits all the matching Makefiles to set the variables: PKG_VERSION to the version string, PKG_SOURCE_VERSION to the SHA1 identifier of REV (or tag name if REV is a tag), and increment PKG_RELEASE,

  6. commits the changes to the matching Makefiles with a suitable commit message (this step is only done if the --commit option is given),

  7. pushes the changes to GitHub to publish them (this step is only done if the --push option is given).

Create a new feed branch

Not implemented.

More information