[SCM] sonic-pi/master: Refresh patches to current release.

hanno-guest at users.alioth.debian.org hanno-guest at users.alioth.debian.org
Fri Apr 15 13:08:22 UTC 2016


The following commit has been merged in the master branch:
commit 8b54f7f44727c3d5a19140bbd0babeb188be305c
Author: Hanno Zulla <hanno.zulla at epublica.de>
Date:   Fri Apr 15 15:02:14 2016 +0200

    Refresh patches to current release.

diff --git a/debian/patches/01-remove-rpi-volume.patch b/debian/patches/01-remove-rpi-volume.patch
new file mode 100644
index 0000000..9c02128
--- /dev/null
+++ b/debian/patches/01-remove-rpi-volume.patch
@@ -0,0 +1,358 @@
+Description: show Raspberry Pi soundcard controls on RPi hardware, only
+ Upstream develops mainly for Raspbian, but not for generic Linux.
+ Qt's Q_OS_LINUX is used in the original source to activate the
+ Raspberry Pi audio controls. This patch detects if the application is
+ actually running on Raspberry Pi hardware and activates the controls
+ accordingly. This patch was forwarded upstream with
+ <URL: https://github.com/samaaron/sonic-pi/pull/842> but rejected,
+ Sam wants to rethink the audio controls in the long term instead.
+Forwarded: yes
+Author: Hanno Zulla <kontakt at hanno.de>
+Last-Update: 2016-01-11
+
+Index: pkg-sonic-pi/app/gui/qt/mainwindow.cpp
+===================================================================
+--- pkg-sonic-pi.orig/app/gui/qt/mainwindow.cpp	2016-01-11 15:00:35.171184925 +0100
++++ pkg-sonic-pi/app/gui/qt/mainwindow.cpp	2016-01-11 15:00:35.147185131 +0100
+@@ -119,6 +119,10 @@
+   }
+ 
+   this->i18n = i18n;
++  
++#if defined(Q_OS_LINUX)
++  this->raspberryPiSoundcard = isRaspberryPiSoundcard();
++#endif
+ 
+   printAsciiArtLogo();
+ 
+@@ -727,6 +731,7 @@
+     }
+ 
+ 
++
+     //    std::cout << "[GUI] - exec "<< prg_path.toStdString() << " " << prg_arg.toStdString() << std::endl;
+ 
+     std::cout << "[GUI] - booting live coding server" << std::endl;
+@@ -817,9 +822,44 @@
+   tabs->setTabPosition(QTabWidget::South);
+ 
+   QGridLayout *grid = new QGridLayout;
+-
+-  QGroupBox *volBox = new QGroupBox(tr("Raspberry Pi System Volume"));
+-  volBox->setToolTip(tr("Use this slider to change the system volume of your Raspberry Pi."));
++  
++#if defined(Q_OS_LINUX)
++  if (raspberryPiSoundcard) {
++    QGroupBox *volBox = new QGroupBox(tr("Raspberry Pi System Volume"));
++    volBox->setToolTip(tr("Use this slider to change the system volume of your Raspberry Pi."));
++
++    QGroupBox *audioOutputBox = new QGroupBox(tr("Raspberry Pi Audio Output"));
++    audioOutputBox->setToolTip(tr("Your Raspberry Pi has two forms of audio output.\nFirstly, there is the headphone jack of the Raspberry Pi itself.\nSecondly, some HDMI monitors/TVs support audio through the HDMI port.\nUse these buttons to force the output to the one you want."));
++    rp_force_audio_default = new QRadioButton(tr("&Default"));
++    rp_force_audio_headphones = new QRadioButton(tr("&Headphones"));
++    rp_force_audio_hdmi = new QRadioButton(tr("&HDMI"));
++
++    connect(rp_force_audio_default, SIGNAL(clicked()), this, SLOT(setRPSystemAudioAuto()));
++    connect(rp_force_audio_headphones, SIGNAL(clicked()), this, SLOT(setRPSystemAudioHeadphones()));
++    connect(rp_force_audio_hdmi, SIGNAL(clicked()), this, SLOT(setRPSystemAudioHDMI()));
++
++    QVBoxLayout *audio_box = new QVBoxLayout;
++    audio_box->addWidget(rp_force_audio_default);
++    audio_box->addWidget(rp_force_audio_headphones);
++    audio_box->addWidget(rp_force_audio_hdmi);
++    audio_box->addStretch(1);
++    audioOutputBox->setLayout(audio_box);
++
++    QHBoxLayout *vol_box = new QHBoxLayout;
++    rp_system_vol = new QSlider(this);
++    connect(rp_system_vol, SIGNAL(valueChanged(int)), this, SLOT(changeRPSystemVol(int)));
++    vol_box->addWidget(rp_system_vol);
++    volBox->setLayout(vol_box);
++
++    QGroupBox *audio_prefs_box = new QGroupBox();
++    QGridLayout *audio_prefs_box_layout = new QGridLayout;
++
++    audio_prefs_box_layout->addWidget(audioOutputBox, 0, 0);
++    audio_prefs_box_layout->addWidget(volBox, 0, 1);
++    audio_prefs_box->setLayout(audio_prefs_box_layout);
++    prefTabs->addTab(audio_prefs_box, tr("Audio"));
++  }
++#endif
+ 
+   QGroupBox *advancedAudioBox = new QGroupBox(tr("Advanced Audio"));
+   advancedAudioBox->setToolTip(tr("Advanced audio settings for working with\nexternal PA systems when performing with Sonic Pi."));
+@@ -843,30 +883,6 @@
+   advancedAudioBox->setLayout(advanced_audio_box_layout);
+ 
+ 
+-  QGroupBox *audioOutputBox = new QGroupBox(tr("Raspberry Pi Audio Output"));
+-  audioOutputBox->setToolTip(tr("Your Raspberry Pi has two forms of audio output.\nFirstly, there is the headphone jack of the Raspberry Pi itself.\nSecondly, some HDMI monitors/TVs support audio through the HDMI port.\nUse these buttons to force the output to the one you want."));
+-  rp_force_audio_default = new QRadioButton(tr("&Default"));
+-  rp_force_audio_headphones = new QRadioButton(tr("&Headphones"));
+-  rp_force_audio_hdmi = new QRadioButton(tr("&HDMI"));
+-
+-
+-  connect(rp_force_audio_default, SIGNAL(clicked()), this, SLOT(setRPSystemAudioAuto()));
+-  connect(rp_force_audio_headphones, SIGNAL(clicked()), this, SLOT(setRPSystemAudioHeadphones()));
+-  connect(rp_force_audio_hdmi, SIGNAL(clicked()), this, SLOT(setRPSystemAudioHDMI()));
+-
+-  QVBoxLayout *audio_box = new QVBoxLayout;
+-  audio_box->addWidget(rp_force_audio_default);
+-  audio_box->addWidget(rp_force_audio_headphones);
+-  audio_box->addWidget(rp_force_audio_hdmi);
+-  audio_box->addStretch(1);
+-  audioOutputBox->setLayout(audio_box);
+-
+-  QHBoxLayout *vol_box = new QHBoxLayout;
+-  rp_system_vol = new QSlider(this);
+-  connect(rp_system_vol, SIGNAL(valueChanged(int)), this, SLOT(changeRPSystemVol(int)));
+-  vol_box->addWidget(rp_system_vol);
+-  volBox->setLayout(vol_box);
+-
+   QGroupBox *debug_box = new QGroupBox(tr("Logging"));
+   debug_box->setToolTip(tr("Configure debug behaviour"));
+ 
+@@ -984,17 +1000,7 @@
+   editor_box->setLayout(gridEditorPrefs);
+   grid->addWidget(prefTabs, 0, 0);
+ 
+-#if defined(Q_OS_LINUX)
+-  QGroupBox *audio_prefs_box = new QGroupBox();
+-  QGridLayout *audio_prefs_box_layout = new QGridLayout;
+-
+-  audio_prefs_box_layout->addWidget(audioOutputBox, 0, 0);
+-  audio_prefs_box_layout->addWidget(volBox, 0, 1);
+-  audio_prefs_box->setLayout(audio_prefs_box_layout);
+-  prefTabs->addTab(audio_prefs_box, tr("Audio"));
+-#endif
+-
+-    QGroupBox *studio_prefs_box = new QGroupBox();
++  QGroupBox *studio_prefs_box = new QGroupBox();
+   QGridLayout *studio_prefs_box_layout = new QGridLayout;
+ 
+   studio_prefs_box_layout->addWidget(advancedAudioBox, 0, 0);
+@@ -1064,9 +1070,25 @@
+   mixer_force_mono->setChecked(settings.value("prefs/mixer-force-mono", false).toBool());
+   mixer_invert_stereo->setChecked(settings.value("prefs/mixer-invert-stereo", false).toBool());
+ 
+-  rp_force_audio_default->setChecked(settings.value("prefs/rp/force-audio-default", true).toBool());
+-  rp_force_audio_headphones->setChecked(settings.value("prefs/rp/force-audio-headphones", false).toBool());
+-  rp_force_audio_hdmi->setChecked(settings.value("prefs/rp/force-audio-hdmi", false).toBool());
++#if defined(Q_OS_LINUX)
++  if (raspberryPiSoundcard) {
++    rp_force_audio_default->setChecked(settings.value("prefs/rp/force-audio-default", true).toBool());
++    rp_force_audio_headphones->setChecked(settings.value("prefs/rp/force-audio-headphones", false).toBool());
++    rp_force_audio_hdmi->setChecked(settings.value("prefs/rp/force-audio-hdmi", false).toBool());
++    int stored_vol = settings.value("prefs/rp/system-vol", 50).toInt();
++    rp_system_vol->setValue(stored_vol);
++    changeRPSystemVol(stored_vol);
++    if(settings.value("prefs/rp/force-audio-default", true).toBool()) {
++      setRPSystemAudioAuto();
++    }
++    if(settings.value("prefs/rp/force-audio-headphones", false).toBool()) {
++      setRPSystemAudioHeadphones();
++    }
++    if(settings.value("prefs/rp/force-audio-hdmi", false).toBool()) {
++      setRPSystemAudioHDMI();
++    }
++  }
++#endif
+ 
+   check_updates->setChecked(settings.value("prefs/rp/check-updates", true).toBool());
+ 
+@@ -1074,26 +1096,10 @@
+ 
+   gui_transparency_slider->setValue(settings.value("prefs/gui_transparency", 0).toInt());
+ 
+-  int stored_vol = settings.value("prefs/rp/system-vol", 50).toInt();
+-  rp_system_vol->setValue(stored_vol);
+-
+   // Ensure prefs are honoured on boot
+   update_mixer_invert_stereo();
+   update_mixer_force_mono();
+-  changeRPSystemVol(stored_vol);
+   update_check_updates();
+-
+-  if(settings.value("prefs/rp/force-audio-default", true).toBool()) {
+-    setRPSystemAudioAuto();
+-  }
+-  if(settings.value("prefs/rp/force-audio-headphones", false).toBool()) {
+-    setRPSystemAudioHeadphones();
+-  }
+-  if(settings.value("prefs/rp/force-audio-hdmi", false).toBool()) {
+-    setRPSystemAudioHDMI();
+-  }
+-
+-
+ }
+ 
+ void MainWindow::invokeStartupError(QString msg) {
+@@ -1529,31 +1535,6 @@
+ }
+ 
+ 
+-#if defined(Q_OS_LINUX)
+-void MainWindow::changeRPSystemVol(int val)
+-#else
+-void MainWindow::changeRPSystemVol(int)
+-#endif
+-{
+-#if defined(Q_OS_WIN)
+-  // do nothing
+-#elif defined(Q_OS_MAC)
+-  // do nothing
+-#else
+-  //assuming Raspberry Pi
+-  QProcess *p = new QProcess();
+-  float v = (float) val;
+-  // handle the fact that the amixer percentage range isn't linear
+-  float vol_float = std::pow(v/100.0, (float)1./3.) * 100.0;
+-  std::ostringstream ss;
+-  ss << vol_float;
+-  statusBar()->showMessage(tr("Updating System Volume..."), 2000);
+-  QString prog = "amixer cset numid=1 " + QString::fromStdString(ss.str()) + '%';
+-  p->start(prog);
+-#endif
+-
+-}
+-
+ void MainWindow::toggleDarkMode() {
+   dark_mode->toggle();
+   updateDarkMode();
+@@ -1761,51 +1742,54 @@
+   }
+ }
+ 
++#if defined(Q_OS_LINUX)
++bool MainWindow::isRaspberryPiSoundcard() {
++  // look for the Raspberry Pi soundcard name in the kernel's audio info
++  QString cardInfo = readFile("/proc/asound/card0/pcm0p/info");
++  return cardInfo.contains("bcm2835");
++}
++
++void MainWindow::changeRPSystemVol(int val)
++{
++  //assuming Raspberry Pi
++  QProcess *p = new QProcess();
++  float v = (float) val;
++  // handle the fact that the amixer percentage range isn't linear
++  float vol_float = std::pow(v/100.0, (float)1./3.) * 100.0;
++  std::ostringstream ss;
++  ss << vol_float;
++  statusBar()->showMessage(tr("Updating System Volume..."), 2000);
++  QString prog = "amixer cset numid=1 " + QString::fromStdString(ss.str()) + '%';
++  p->start(prog);
++}
++
+ void MainWindow::setRPSystemAudioHeadphones()
+ {
+-#if defined(Q_OS_WIN)
+-  //do nothing
+-#elif defined(Q_OS_MAC)
+-  //do nothing
+-#else
+   //assuming Raspberry Pi
+   statusBar()->showMessage(tr("Switching To Headphone Audio Output..."), 2000);
+   QProcess *p = new QProcess();
+   QString prog = "amixer cset numid=3 1";
+   p->start(prog);
+-#endif
+ }
+ 
+ void MainWindow::setRPSystemAudioHDMI()
+ {
+-
+-#if defined(Q_OS_WIN)
+-  //do nothing
+-#elif defined(Q_OS_MAC)
+-  //do nothing
+-#else
+   //assuming Raspberry Pi
+   statusBar()->showMessage(tr("Switching To HDMI Audio Output..."), 2000);
+   QProcess *p = new QProcess();
+   QString prog = "amixer cset numid=3 2";
+   p->start(prog);
+-#endif
+ }
+ 
+ void MainWindow::setRPSystemAudioAuto()
+ {
+-#if defined(Q_OS_WIN)
+-  //do nothing
+-#elif defined(Q_OS_MAC)
+-  //do nothing
+-#else
+   //assuming Raspberry Pi
+   statusBar()->showMessage(tr("Switching To Default Audio Output..."), 2000);
+   QProcess *p = new QProcess();
+   QString prog = "amixer cset numid=3 0";
+   p->start(prog);
+-#endif
+ }
++#endif
+ 
+ void MainWindow::showPrefsPane()
+ {
+@@ -2177,11 +2161,15 @@
+   settings.setValue("prefs/dark-mode", dark_mode->isChecked());
+   settings.setValue("prefs/mixer-force-mono", mixer_force_mono->isChecked());
+   settings.setValue("prefs/mixer-invert-stereo", mixer_invert_stereo->isChecked());
+-
+-  settings.setValue("prefs/rp/force-audio-default", rp_force_audio_default->isChecked());
+-  settings.setValue("prefs/rp/force-audio-headphones", rp_force_audio_headphones->isChecked());
+-  settings.setValue("prefs/rp/force-audio-hdmi", rp_force_audio_hdmi->isChecked());
+-  settings.setValue("prefs/rp/system-vol", rp_system_vol->value());
++  
++#if defined(Q_OS_LINUX)
++  if (raspberryPiSoundcard) {
++    settings.setValue("prefs/rp/force-audio-default", rp_force_audio_default->isChecked());
++    settings.setValue("prefs/rp/force-audio-headphones", rp_force_audio_headphones->isChecked());
++    settings.setValue("prefs/rp/force-audio-hdmi", rp_force_audio_hdmi->isChecked());
++    settings.setValue("prefs/rp/system-vol", rp_system_vol->value());
++  }
++#endif
+ 
+   settings.setValue("prefs/rp/check-updates", check_updates->isChecked());
+   settings.setValue("prefs/auto-indent-on-run", auto_indent_on_run->isChecked());
+Index: pkg-sonic-pi/app/gui/qt/mainwindow.h
+===================================================================
+--- pkg-sonic-pi.orig/app/gui/qt/mainwindow.h	2016-01-11 15:00:35.171184925 +0100
++++ pkg-sonic-pi/app/gui/qt/mainwindow.h	2016-01-11 15:00:35.171184925 +0100
+@@ -123,11 +123,7 @@
+     void onExitCleanup();
+     void toggleRecording();
+     void toggleRecordingOnIcon();
+-    void changeRPSystemVol(int val);
+     void changeGUITransparency(int val);
+-    void setRPSystemAudioAuto();
+-    void setRPSystemAudioHeadphones();
+-    void setRPSystemAudioHDMI();
+     void changeShowLineNumbers();
+     void toggleDarkMode();
+     void updateDarkMode();
+@@ -225,6 +221,17 @@
+ #endif
+ 
+     bool i18n;
++
++#if defined(Q_OS_LINUX)
++    bool raspberryPiSoundcard;
++    QSlider *rp_system_vol;
++    bool isRaspberryPiSoundcard();
++    void changeRPSystemVol(int val);
++    void setRPSystemAudioAuto();
++    void setRPSystemAudioHeadphones();
++    void setRPSystemAudioHDMI();
++#endif
++
+     static const int workspace_max = 10;
+     SonicPiScintilla *workspaces[workspace_max];
+     QWidget *prefsCentral;
+@@ -274,7 +281,6 @@
+     QRadioButton *rp_force_audio_hdmi;
+     QRadioButton *rp_force_audio_default;
+     QRadioButton *rp_force_audio_headphones;
+-    QSlider *rp_system_vol;
+     QSlider *gui_transparency_slider;
+ 
+     QWidget *infoWidg;
diff --git a/debian/patches/02-do-no-require-unused-ruby-gems.patch b/debian/patches/02-do-no-require-unused-ruby-gems.patch
new file mode 100644
index 0000000..513a21c
--- /dev/null
+++ b/debian/patches/02-do-no-require-unused-ruby-gems.patch
@@ -0,0 +1,61 @@
+Description: remove rubame gem dependency
+ This section in app/server/core.rb depends on the rubame gem, but the
+ code is only used later in app/server/bin/ws.rb - which is an
+ unmaintained part of the Sonic Pi code. The currently unmaintained
+ HTML GUI of Sonic Pi uses ws.rb as its websocket server. It is not
+ packaged in this .deb and through this patch, we can remove the rubame
+ gem dependency entirely. 
+Forwarded: no
+Author: Hanno Zulla <kontakt at hanno.de>
+Last-Update: 2016-01-22
+
+Index: pkg-sonic-pi.work/app/server/core.rb
+===================================================================
+--- pkg-sonic-pi.work.orig/app/server/core.rb	2016-01-22 15:49:32.789327374 +0100
++++ pkg-sonic-pi.work/app/server/core.rb	2016-01-22 15:49:59.161112167 +0100
+@@ -378,45 +378,6 @@
+   end
+ end
+ 
+-
+-require 'rubame'
+-
+-## Teach Rubame::Server#run to block on IO.select
+-## and therefore not thrash round in a loop
+-module Rubame
+-
+-  class Server
+-    def run(time = 0, &blk)
+-      readable, writable = IO.select(@reading, @writing)
+-
+-      if readable
+-        readable.each do |socket|
+-          client = @clients[socket]
+-          if socket == @socket
+-            client = accept
+-          else
+-            msg = read(client)
+-            client.messaged = msg
+-          end
+-
+-          blk.call(client) if client and blk
+-        end
+-      end
+-
+-      # Check for lazy send items
+-      timer_start = Time.now
+-      time_passed = 0
+-      begin
+-        @clients.each do |s, c|
+-          c.send_some_lazy(5)
+-        end
+-        time_passed = Time.now - timer_start
+-      end while time_passed < time
+-    end
+-  end
+-end
+-
+-
+ # Backport Ruby 2+ thread local variable syntax
+ if RUBY_VERSION < "2"
+   class Thread
diff --git a/debian/patches/03-use-debian-gems.patch b/debian/patches/03-use-debian-gems.patch
new file mode 100644
index 0000000..768467e
--- /dev/null
+++ b/debian/patches/03-use-debian-gems.patch
@@ -0,0 +1,53 @@
+Description: use Debian gems instead of upstream's embedded code copies
+ Upstream ships Sonic Pi for Win, OS X and Raspbian and distributes all
+ gems needed by the ruby server within the app/server/vendor/ directory
+ in the source tarball. Debian wants packagers not to use these embedded
+ code copies, but to use Debian's packaged ruby gems instead. This
+ patch removes the code that added the vendor/ directory to the ruby
+ library path. Do note that many of the gems provided by upstream
+ aren't actually used in Sonic Pi, see
+ <URL: https://github.com/samaaron/sonic-pi/issues/928> for details.
+Forwarded: no
+Author: Hanno Zulla <kontakt at hanno.de>
+Last-Update: 2016-01-22
+
+Index: sonic-pi/app/server/core.rb
+===================================================================
+--- sonic-pi.orig/app/server/core.rb	2016-02-26 15:53:36.410295019 +0100
++++ sonic-pi/app/server/core.rb	2016-02-26 15:54:38.632757162 +0100
+@@ -14,34 +14,8 @@
+ 
+ raise "Sonic Pi requires Ruby 1.9.3+ to be installed. You are using version #{RUBY_VERSION}" if RUBY_VERSION < "1.9.3"
+ 
+-## This core file sets up the load path and applies any necessary monkeypatches.
+-
+-## Ensure native lib dir is available
+-require 'rbconfig'
+-ruby_api = RbConfig::CONFIG['ruby_version']
+-os = case RUBY_PLATFORM
+-     when /.*arm.*-linux.*/
+-       :raspberry
+-     when /.*linux.*/
+-       :linux
+-     when /.*darwin.*/
+-       :osx
+-     when /.*mingw.*/
+-       :windows
+-     else
+-       RUBY_PLATFORM
+-     end
+-$:.unshift "#{File.expand_path("../rb-native", __FILE__)}/#{os}/#{ruby_api}/"
+-
+-require 'win32/process' if os == :windows
+-
+-## Ensure all libs in vendor directory are available
+-Dir["#{File.expand_path("../vendor", __FILE__)}/*/lib/"].each do |vendor_lib|
+-  $:.unshift vendor_lib
+-end
+-
+ begin
+-  require 'did_you_mean'
++  require 'did_you_mean' if RUBY_VERSION >= "2.3.0"
+ rescue LoadError
+   warn "Non-critical error: Could not load did_you_mean"
+ end
diff --git a/debian/patches/04-rename-ruby-beautify-legacy.patch b/debian/patches/04-rename-ruby-beautify-legacy.patch
new file mode 100644
index 0000000..2b233f2
--- /dev/null
+++ b/debian/patches/04-rename-ruby-beautify-legacy.patch
@@ -0,0 +1,176 @@
+Description: Use legacy version 0.92.2 of ruby-beautify gem
+ Sonic Pi wants the version 0.92.2 of the ruby-beautify gem. However,
+ that gem has seen a total rewrite since that version. The current
+ version 0.97.4 is now a different software with a different API and
+ different behaviour under the same package name. The Debian version of
+ the gem is that new and updated gem. To address this and to avoid name
+ space issues, this patch renames the old version to "legacy" and
+ installs it in /usr/lib/sonic-pi/server/vendor/
+ <URL: https://github.com/samaaron/sonic-pi/pull/943>
+ <URL: https://github.com/samaaron/sonic-pi/issues/928>
+Forwarded: no
+Author: Hanno Zulla <kontakt at hanno.de>
+Last-Update: 2016-02-04
+
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify.rb	2016-02-03 17:32:11.051445795 +0100
+@@ -1,26 +1,26 @@
+-require "ruby-beautify/version"
+-require 'ruby-beautify/block_start'
+-require 'ruby-beautify/block_end'
+-require 'ruby-beautify/block_matcher'
+-require 'ruby-beautify/language'
+-require 'ruby-beautify/line'
+-require 'ruby-beautify/config/ruby'
++require_relative "ruby-beautify-legacy/version"
++require_relative 'ruby-beautify-legacy/block_start'
++require_relative 'ruby-beautify-legacy/block_end'
++require_relative 'ruby-beautify-legacy/block_matcher'
++require_relative 'ruby-beautify-legacy/language'
++require_relative 'ruby-beautify-legacy/line'
++require_relative 'ruby-beautify-legacy/config/ruby'
+ 
+-module RBeautify
++module RBeautifyLegacy
+   def self.beautify_string(language, source, use_tabs=false)
+     dest = ""
+     block = nil
+ 
+-    unless language.is_a? RBeautify::Language
+-      language = RBeautify::Language.language(language)
++    unless language.is_a? RBeautifyLegacy::Language
++      language = RBeautifyLegacy::Language.language(language)
+     end
+ 
+     source.lines.each_with_index do |line_content, line_number|
+-      line = RBeautify::Line.new(language, line_content, line_number, block, use_tabs)
++      line = RBeautifyLegacy::Line.new(language, line_content, line_number, block, use_tabs)
+       dest += line.format
+       block = line.block
+     end
+ 
+     return dest
+   end
+-end # module RBeautify
++end # module RBeautifyLegacy
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_end.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_end.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_end.rb	2016-02-03 14:27:55.205161507 +0100
+@@ -1,4 +1,4 @@
+-module RBeautify
++module RBeautifyLegacy
+ 
+   class BlockEnd
+ 
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_matcher.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_matcher.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_matcher.rb	2016-02-03 14:28:05.525075950 +0100
+@@ -1,4 +1,4 @@
+-module RBeautify
++module RBeautifyLegacy
+ 
+   class BlockMatcher
+ 
+@@ -77,7 +77,7 @@
+ 
+     def parse_block_start(string, parent_block, offset, line_number)
+       if !string.empty? && (match = starts.match(string))
+-        RBeautify::BlockStart.new(self, parent_block, line_number, offset + match.begin(0), match[0], match.post_match)
++        RBeautifyLegacy::BlockStart.new(self, parent_block, line_number, offset + match.begin(0), match[0], match.post_match)
+       end
+     end
+ 
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_start.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_start.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/block_start.rb	2016-02-03 14:28:13.333011608 +0100
+@@ -1,4 +1,4 @@
+-module RBeautify
++module RBeautifyLegacy
+ 
+   class BlockStart
+ 
+@@ -105,11 +105,11 @@
+                 # the match then this match should be skipped
+                 return parse_explicit_block_end(match.post_match, offset + escape_chars[0].size + match[0].length)
+               else
+-                return RBeautify::BlockEnd.new(self, offset + match.begin(0), match[0], match.post_match)
++                return RBeautifyLegacy::BlockEnd.new(self, offset + match.begin(0), match[0], match.post_match)
+               end
+             end
+           elsif negate_ends_match?
+-            return RBeautify::BlockEnd.new(self, offset, '', string)
++            return RBeautifyLegacy::BlockEnd.new(self, offset, '', string)
+           end
+ 
+         end
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/config/ruby.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/config/ruby.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/config/ruby.rb	2016-02-03 14:29:11.724540127 +0100
+@@ -1,8 +1,8 @@
+ # define ruby language
+ 
+-unless RBeautify::Language.language(:ruby)
++unless RBeautifyLegacy::Language.language(:ruby)
+ 
+-  ruby = RBeautify::Language.add_language(:ruby)
++  ruby = RBeautifyLegacy::Language.add_language(:ruby)
+ 
+   pre_keyword_boundary = '(^|[^a-z0-9A-Z:._])' # like \b but with : , . _ all added to list of exceptions
+   start_statement_boundary = '(^|(;|=)\s*)'
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/language.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/language.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/language.rb	2016-02-03 14:28:19.648959801 +0100
+@@ -1,4 +1,4 @@
+-module RBeautify
++module RBeautifyLegacy
+   class Language
+ 
+     @@languages = {}
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/line.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/line.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/line.rb	2016-02-03 14:28:25.796909571 +0100
+@@ -1,4 +1,4 @@
+-module RBeautify
++module RBeautifyLegacy
+   class Line
+ 
+     attr_reader :language, :content, :line_number, :original_block, :block, :indent_character
+Index: pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/version.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/vendor/ruby-beautify/lib/ruby-beautify/version.rb	2016-02-03 14:17:26.287100863 +0100
++++ pkg-sonic-pi/app/server/vendor/ruby-beautify/lib/ruby-beautify/version.rb	2016-02-03 14:28:34.972834958 +0100
+@@ -1,3 +1,3 @@
+-module RBeautify
++module RBeautifyLegacy
+   VERSION = "0.92.2"
+ end
+Index: pkg-sonic-pi/app/server/sonicpi/lib/sonicpi/runtime.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/sonicpi/lib/sonicpi/runtime.rb	2016-02-03 14:19:15.000000000 +0100
++++ pkg-sonic-pi/app/server/sonicpi/lib/sonicpi/runtime.rb	2016-02-03 17:30:15.280535790 +0100
+@@ -36,7 +36,7 @@
+ require 'thread'
+ require 'fileutils'
+ require 'set'
+-require 'ruby-beautify'
++require_relative '../../../vendor/ruby-beautify/lib/ruby-beautify-legacy'
+ require 'securerandom'
+ require 'active_support/core_ext/integer/inflections'
+ 
+@@ -858,7 +858,7 @@
+     end
+     def beautify_ruby_source(source)
+       source = source << "\n" unless source.end_with? "\n"
+-      RBeautify.beautify_string :ruby, source
++      RBeautifyLegacy.beautify_string :ruby, source
+     end
+ 
+ 
diff --git a/debian/patches/05-doc-base-index.patch b/debian/patches/05-doc-base-index.patch
new file mode 100644
index 0000000..15b4572
--- /dev/null
+++ b/debian/patches/05-doc-base-index.patch
@@ -0,0 +1,44 @@
+Description: create index file per Debian doc-base requirements
+ Debian wants packagers to use doc-base and doc-base requires an index
+ file for HTML documents.
+Forwarded: no
+Author: Hanno Zulla <kontakt at hanno.de>
+Last-Update: 2016-02-11
+
+Index: pkg-sonic-pi/app/server/bin/qt-doc.rb
+===================================================================
+--- pkg-sonic-pi.orig/app/server/bin/qt-doc.rb	2016-02-11 12:07:05.882894560 +0100
++++ pkg-sonic-pi/app/server/bin/qt-doc.rb	2016-02-11 12:14:49.622559528 +0100
+@@ -39,6 +39,7 @@
+ 
+ docs = []
+ filenames = []
++booknames = []
+ count = 0
+ 
+ options = {}
+@@ -138,7 +139,9 @@
+   book_body = book[/<body.*?>/]
+   book.gsub!(/<\/?body.*?>/, '')
+   book.gsub!(/<meta http-equiv.*?>/, '')
+-  File.open("#{qt_gui_path}/book/Sonic Pi - #{name.capitalize}" + (lang != "en" ? " (#{lang})" : "") + ".html", 'w') do |f|
++  bookname = "Sonic Pi - #{name.capitalize}" + (lang != "en" ? " (#{lang})" : "")
++  booknames << bookname
++  File.open("#{qt_gui_path}/book/#{bookname}.html", 'w') do |f|
+     f << "<link rel=\"stylesheet\" href=\"../theme/light/doc-styles.css\" type=\"text/css\"/>\n"
+     f << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\n"
+     f << book_body << "\n"
+@@ -286,6 +289,13 @@
+   f << "  </qresource>\n</RCC>\n"
+ end
+ 
++File.open("#{qt_gui_path}/book/index.html", 'w') do |f|
++  f << "<link rel=\"stylesheet\" href=\"../theme/light/doc-styles.css\" type=\"text/css\"/>\n"
++  f << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n\n"
++  f << "<body><ul>\n"
++  f << booknames.sort.map{|n| "<li><a href=\"#{n}.html\">#{n}</a></li>\n"}.join
++  f << "</ul></body>\n"
++end  
+ 
+ ###
+ # Generate info pages

-- 
sonic-pi packaging



More information about the pkg-multimedia-commits mailing list