Skip to content

Commit

Permalink
Fixing lint issues on debian packaging and adding python files
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodmg committed Jul 7, 2024
1 parent 5e8cb0e commit fc42e8d
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 18 deletions.
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,54 @@ pip install -r python/requirements.txt

### Building a Debian package

Install [sbuild](https://wiki.debian.org/sbuild) using option 3 (change `unstable` to your distro, eg `bookworm` and create the `.sbuildrc` manually instead of `tee`).
Install and setup [sbuild](https://wiki.debian.org/sbuild) running the following commands:

Then simply run `sbuild --no-run-piuparts --lintian-opt="--suppress-tags=bad-distribution-in-changes-file"` in the cloned repository directory. The `.deb` packages will be in your home directory afterwards if everything went well.
```bash
sudo apt-get install sbuild schroot debootstrap apt-cacher-ng devscripts piuparts
sudo tee ~/.sbuildrc << EOF
##############################################################################
# PACKAGE BUILD RELATED (additionally produce _source.changes)
##############################################################################
# -d
$distribution = 'bookworm';
# -A
$build_arch_all = 1;
# -s
$build_source = 1;
# --source-only-changes (applicable for dput. irrelevant for dgit push-source).
$source_only_changes = 1;
# -v
$verbose = 1;
# parallel build
$ENV{'DEB_BUILD_OPTIONS'} = 'parallel=5';
##############################################################################
# POST-BUILD RELATED (turn off functionality by setting variables to 0)
##############################################################################
$run_lintian = 1;
$lintian_opts = ['-i', '-I'];
$run_piuparts = 1;
$piuparts_opts = ['--schroot', '%r-%a-sbuild', '--no-eatmydata'];
$run_autopkgtest = 1;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--', 'schroot', '%r-%a-sbuild' ];
##############################################################################
# PERL MAGIC
##############################################################################
1;
EOF
sudo sbuild-adduser $LOGNAME
newgrp sbuild
sudo ln -sf ~/.sbuildrc /root/.sbuildrc
sudo sbuild-createchroot --include=eatmydata,ccache bookworm /srv/chroot/bookworm-amd64-sbuild http://127.0.0.1:3142/ftp.us.debian.org/debian
```

Then simply run `sbuild --no-run-piuparts --lintian-opt="--suppress-tags=bad-distribution-in-changes-file"` in the cloned repository directory. The `.deb` packages will be in your home directory afterwards if everything went well.

You can install the newly built packages with the following command (replace placeholders accordingly):

```bash
sudo apt install ./linamp_[version]_[arch].deb
```

### Known issues

Expand Down
5 changes: 3 additions & 2 deletions audiosourcecd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ AudioSourceCD::AudioSourceCD(QObject *parent)

auto state = PyGILState_Ensure();

PyObject *pModuleName = PyUnicode_DecodeFSDefault("cdplayer");
//PyObject *pModuleName = PyUnicode_DecodeFSDefault("mock_cdplayer");
// Import 'linamp' python module, see python folder in the root of this repo
PyObject *pModuleName = PyUnicode_DecodeFSDefault("linamp");
//PyObject *pModuleName = PyUnicode_DecodeFSDefault("linamp-mock");
cdplayerModule = PyImport_Import(pModuleName);
Py_DECREF(pModuleName);

Expand Down
6 changes: 3 additions & 3 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Source: linamp
Section: Sound
Section: sound
Priority: optional
Maintainer: Rodrigo Méndez <[email protected]>
Maintainer: Rodrigo Méndez <[email protected]>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13),
Expand Down Expand Up @@ -36,6 +36,6 @@ Depends:
python3-musicbrainzngs,
python3-cdio,
python3-vlc
Description: Music player app for Linamp - Your favorite music player of the 90s, but in real life.
Description: Your favorite music player of the 90s, but in real life
Music player app for Linamp - Your favorite music player of the 90s, but in real life. Built
with QT6.
8 changes: 4 additions & 4 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: <https://github.com/Rodmg/linamp>
Upstream-Name: linamp
Upstream-Contact: Rodrigo Méndez <[email protected]>
Upstream-Contact: Rodrigo Méndez <[email protected]>

Files:
*
Copyright:
2024 Rodrigo Méndez <[email protected]>
License: See LICENSE in parent directory
2024 Rodrigo Méndez <[email protected]>
License: GPL-3

Files:
debian/*
Copyright:
2024 Taneli Leppä <[email protected]>
License: See LICENSE in parent directory
License: GPL-3
4 changes: 4 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ override_dh_auto_configure:
override_dh_auto_install:
mkdir -p debian/linamp/usr/bin
cp player debian/linamp/usr/bin/linamp-player

mkdir -p debian/linamp/usr/lib/python3/dist-packages/linamp
cp python/linamp/__init__.py debian/linamp/usr/lib/python3/dist-packages/linamp/__init__.py
cp python/linamp/cdplayer.py debian/linamp/usr/lib/python3/dist-packages/linamp/cdplayer.py

mkdir -p debian/linamp/usr/share/applications/
cp linamp.desktop debian/linamp/usr/share/applications/
Expand Down
1 change: 1 addition & 0 deletions linamp.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Terminal=false
#StartupWMClass=name of application
Type=Application
Categories=Audio
Keywords=linamp;music;sound;audio;player;
7 changes: 4 additions & 3 deletions player.pro
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ RESOURCES += \
DISTFILES += \
README.md \
install.sh \
python/__init__.py \
python/cdplayer.py \
python/mock_cdplayer.py \
python/linamp/__init__.py \
python/linamp/cdplayer.py \
python/linamp-mock/__init__.py \
python/linamp-mock/mock_cdplayer.py \
python/requirements.txt \
scale-skin.sh \
setup.sh \
Expand Down
Empty file removed python/__init__.py
Empty file.
1 change: 1 addition & 0 deletions python/linamp-mock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .mock_cdplayer import *
File renamed without changes.
1 change: 1 addition & 0 deletions python/linamp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .cdplayer import *
8 changes: 5 additions & 3 deletions python/cdplayer.py → python/linamp/cdplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import vlc
import cdio, pycdio
import discid
import libdiscid
import musicbrainzngs
import threading


# Debounce function from https://github.com/salesforce/decorator-operations/blob/master/decoratorOperations/debounce_functions/debounce.py
def debounce(wait_time):
"""
Expand All @@ -31,6 +32,7 @@ def call_function():

return decorator


def search_exact_tracklist(data): # function to find exalctly which cd was inserted
for x in range(0, len(data["disc"]["release-list"])):
for y in range(0, len(data["disc"]["release-list"][x]["medium-list"])):
Expand Down Expand Up @@ -68,7 +70,7 @@ def fetchdata():
is_data_tracks[t - i_first_track] = True

musicbrainzngs.set_useragent("Small_diy_cd_player", "0.1")
disc = discid.read() # id read
disc = libdiscid.read() # id read
try:
result = musicbrainzngs.get_releases_by_discid(
disc.id, includes=["artists", "recordings"]
Expand Down Expand Up @@ -205,7 +207,7 @@ def load(self):
print(f"Unknown exception: {e}")
return

#print(f">>>> {artists}, {track_titles}, {album}, {n_tracks}")
# print(f">>>> {artists}, {track_titles}, {album}, {n_tracks}")

self._set_track_info(artists, track_titles, album, durations, is_data_tracks)

Expand Down
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
discid==1.2.0
python-libdiscid==2.0.3
musicbrainzngs==0.7.1
pycdio==2.1.1
python-vlc==3.0.20123

0 comments on commit fc42e8d

Please sign in to comment.