Sometimes you will need to change the upstream source for various reasons. We'll try to document all know cases and their solutions.
We prefer to run all provided tests and sometimes upstream does not add tests in the gems but they will be available from their upstream source repo (usually github).
Run gem2deb to create initial dsc. Use git-import-dsc --pristine-tar to import it.
Use github tags to download the latest version. Update debian/watch to point to github.com (see debian/watch#GitHub) and run uscan --verbose --download-current-version. OR You can copy the link to zip file and use wget to download the tarball (just change .zip to .tar.gz) It is a good idea to add gh to the version in case the same version is already in the archive, so we know we downloaded from github.
Remove the upstream tag by git tag -d upstream/xxx. Use git-import-orig to import the github tarball and mention upstream version as 3.0.7gh.
Update changelog entry. For example, 3.0.7gh-1, if upstream version is 3.0.7
Update watch file so it uses github tags if you chose to download tar.gz directly earlier. ruby-subexec has an example
Open a github issue with upstream to include tests in gem. Usually upstreams respond favorably.
Create debian/README.source and mention why we are using github tarball instead of gem file.
Missing tests and missing tags
- Download master branch as a tarball and use +git.yyyymmdd.1234567 suffix, where yyyymmdd correspond to the date of the last commit in master, and 1234567 are the first digits of the commit's SHA.
- Run gem2deb to create initial dsc. Use git-import-dsc --pristine-tar to import it
- Import the upstream tarball with git import orig and provide upstream version like 3.0.7+git.20130622.ab34f107, if the latest known upstream version is 3.0.7, and the last commit in the master branch is on 2013/06/22.
- Update changelog entry as above.
- Create debian/README.source and mention why we are using github master tarball instead of gem file.
- Request upstream to tag releases and include tests in releases.
- add a dversionmangle and a comment to look at README.source in debian/watch
version=3 # Using github master tarball, see README.source opts=dversionmangle=s/\+git\.[0-9]*\.[a-zA-Z0-9]*// \ http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/messagebus_ruby_api .*/messagebus_ruby_api-(.*).tar.gz
If it has embedded libraries in vendor directory / non distribuable files
For embedded libraries removed, the suffix is +ds or +debian. For non distribuable files removed, the suffix is +dfsg.
The first possibility is to use a repack.sh script ruby-fakeweb has an example - look at line 32 for what files to be removed.
- run gem2deb, copy repack.sh, create README.source (look at ruby-fakeweb for examples).
Create new orig.tar.gz by running sh debian/repack.sh --upstream-version <upstream version> <path to upstream tarball>
- Use dh-make-ruby to create new debian package from repacked orig.source
- run git-import-dsc to import the repacked source.
- copy repack.sh, create README.source, gbp.conf, update changelog (look at ruby-fakeweb for examples).
- a dmangleversion option has to be added to debian/watch to suppress the suffix when looking for corresponding upstream version
- Another (preferred?) method when the package is already in a Git repository is to take advantage of Git, and use git-buildpackage to filter out unwanted files from the tarball
If you know already the files to exclude, create a debian/gbp.conf file with a filter option in the [git-import-orig] section, and set filter-pristine-tar to True. See ruby-ref, mdpress or ruby-distribution for examples.
You can import the upstream tarball to clean in the upstream branch without merging with master, start a dfsg branch from there, remove the files, tag the corresponding commit with upstream/version+dfsg (or +ds) and merge this branch to master. use then git buildpackage --git-no-pristine-tar --git-upstream-branch=dfsg to create a new tarball from the dfsg branch, and then import it in the pristine-tar branch with pristine-tar commit ../nameofthetarball_version+dfsg.orig.tar.gz. See the corresponding section in the git-buildpackage manual.
3. Easier Method
Step a. Create debian/gbp.conf with specifying the files/directories you need to filter out. Example is
[git-import-orig] filter = ['ext/version_sorter/frameworks', 'ext/version_sorter/version_sorter.xcodeproj'] filter-pristine-tar = True
Remember not to put the trailing '/' at the end of directory names.
Step b. run
Step c. When it ask for version, add version number+dfsh eg: 0.5.0+dfsg
Step d. Check git pristine branch and git tag for existence of +dfsg stuff
Step e. Update changelog file to mention version as +dfsg eg :
ruby-version-sorter (1.1.0+dfsg-1) unstable; urgency=medium
Step f. Update watch file - Insert
after the first line (i.e the line with version= )
Step g. Build package