Recently, I was packaging silent_stream for Debian. sbuild was showing error because there was git in gemspec file. Specifically, this line
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(tests|spec|features)/}) }
in this file.
Thanks to Vinay who helped me in fixing this. It took some time and it is common to run into this error, I was told. So, I am documenting what worked for me.
We will use quilt and Rapahel has written a good article on how to use it to patch. You will need to setup quilt first which is explained in the article.
—————Run all these commands in debian unstable environment—————————–
-
Since I had already pushed my changes to salsa.debian.org, I had to clone the repository. We do this by using:
gbp clone --pristine-tar git@salsa.debian.org:ruby-team/ruby-silent-stream.git
cd into the repository just cloned
cd ruby-silent-stream
-
Now, insert a new empty patch
quilt new remove-git-in-gemspec.patch
-
Tell quilt that you intend to modify files
quilt add remove-git-in-gemspec.patch
-
Edit the file which requires to be fixed. In our case it is
silent_stream.gemspec
filevim silent_stream.gemspec
-
Delete lines 50,51,52 in this file
-
Replace those lines with:
spec.files = Dir.glob("**/*")
and save the file.
-
To generate the patch, run
quilt refresh
-
Add metadata to your patch header
quilt header --dep3 -e
-
Add
debian/patches
directory to git staging area:git add debian/patches
-
Restore gemspec file.
git restore silent_stream.gemspec
-
Run
debclean
debclean
-
Before running
sbuild
, I had to import tar files in parent directoryuscan --verbose -dd --download-current-version
-
Check if
sbuild
is successful.sbuild -d unstable
(where to run this command depends on how you setup sbuild and your debian unstable)
—————–Run above commands in debian unstable environment————
If the sbuild was successful, then commit and push your changes. I usually commit in my host system as signing the commits does not work for me inside chroot or the unstable environment I setup using systemd-nspawn.
git commit -S -m "add remove-git-in-gemspec.patch"
So, that’s it for this tutorial. Meet you in the next post.