Updating a Debian Package
30 December 2023 — Barış Salman
Links
Debian is known for being a stable distribution with the cost of older packages.
However, Debian has branches with newer packages that can be more suitable for personal computing.
One is testing
where packages are tested before they’re settled as the stable
release and the other is unstable/sid
where it is more like a rolling distribution.
I have never added any third-party repositories.
I have been using unstable for four years now and it has been rock solid in my case.
Sometimes I come across something that has been updated in the upstream but the Debian package haven’t caught up. In that case, we can either compile the package from the source or build a deb package by pulling from the upstream. I was checking the scrcpy and added the camera mirroring which I wanted. I was doing the camera mirroring with scrcpy by opening the open camera app on my phone and hiding the UI.
I performed all of these in a virtual machine, because I don’t wanna install build dependencies to my system and VM is a more sterile environment.
First, we need the Debian package source.
git clone https://salsa.debian.org/yangfl-guest/scrcpy
Second, we are going to add the upstream.
git remote add upstream https://github.com/Genymobile/scrcpy git fetch upstream
Third we are going to merge the upstream to Debian.
git merge origin/upstream
Here is the main issue why I think this repo is not building. Debian packages Android sdk files but it got stuck at version 23. It installs them under /usr/lib/android-sdk. We need to update these too. For this, we need the sdkmanager from the cmd tools from android studio.
./sdkmanager --sdk_root=/usr/lib/android-sdk "platforms;android-34" "build-tools;34.0.0" "extras;google;m2repository" "extras;android;m2repository"
We also need to point to the updated libraries from the debian/rules file. We bump the version number too.
find debian/ -type f -exec sed -i "s/2\.1\.1/2\.3\.1/g" {} \;
bar@debiantestin:~/scrcpy$ git diff diff --git a/debian/changelog b/debian/changelog index 9ab8307b..31946e07 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -scrcpy (2.1.1-1) unstable; urgency=medium +scrcpy (2.3.1-1) unstable; urgency=medium * New upstream release (Closes: #1042468) diff --git a/debian/rules b/debian/rules index 5be351c7..5d46e280 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,7 @@ override_dh_auto_configure-arch: dh_auto_configure -a -- -Dcompile_server=false override_dh_auto_build-indep: ;- BUILD_DIR=build_manual ANDROID_PLATFORM=23 ANDROID_BUILD_TOOLS=debian server/build_without_gradle.sh ;+ BUILD_DIR=build_manual ANDROID_PLATFORM=34 ANDROID_BUILD_TOOLS=34.0.0 server/build_without_gradle.sh # dirty hack for reproducible jar build cd build_manual; \ unzip scrcpy-server; \
Lastly, we built the Debian package as instructed in the wiki.
debuild command is part of the devscripts package.
Besides installing dependencies with build-dep command I also needed the android-libboringssl
package.
sudo apt-get build-dep scrcpy debuild -i -us -uc -b
We can now install our package with apt and share our findings with the maintainer.
sudo apt install ./scrcpy-server_2.3.1-1_all.deb sudo apt install ./scrcpy_2.3.1-1_amd64.deb