Accepting request 125570 from multimedia:libs

- Fix the installation of postinit rules
- Add (empty) preinit directory for alsactl init as a placeholder

- Make beep silent as default (bnc#767270)
- Backport fixes for alsactl init
- Fix invalid .LO entry in man page

OBS-URL: https://build.opensuse.org/request/show/125570
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=67
This commit is contained in:
Stephan Kulow 2012-06-25 10:20:45 +00:00 committed by Git OBS Bridge
commit 5a0f4b3cb7
6 changed files with 210 additions and 0 deletions

View File

@ -0,0 +1,117 @@
From c68a3d02d161ccb6358620fb6442bc5c194f20f1 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 14 Jun 2012 13:14:48 +0200
Subject: [PATCH 14/15] alsactl: Read only *.conf files when a directory is
passed via INCLUDE
When alsactl init is invoked and a directory path is passed to INCLUDE
command in the config file, read only *.conf files in that directory.
This will avoid reading backup files or invalid files that have been
created accidentally.
Also by using scandir() with alphasort(), alsactl reads the files in
alphabetical order. Thus it's highly recommended to use some number
prefix to the file name for assuring the order.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsactl/alsactl_init.xml | 10 +++++++++-
alsactl/init_parse.c | 35 +++++++++++++++++++++++++----------
2 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/alsactl/alsactl_init.xml b/alsactl/alsactl_init.xml
index eefe9ef..bce26f5 100644
--- a/alsactl/alsactl_init.xml
+++ b/alsactl/alsactl_init.xml
@@ -474,7 +474,15 @@
<varlistentry>
<term><option>INCLUDE</option></term>
<listitem>
- <para>Include specified filename or all files in specified directory</para>
+ <para>Include the specified filename or files in specified directory.
+ </para>
+ <para>
+ When a directory is specified, only the files with the
+ extension ".conf" are read.
+ Also they are read in the alphabetical order.
+ Thus it's highly recommended to use some number prefix
+ (e.g. "01-something.conf") to assure the order of execucions.
+ </para>
</listitem>
</varlistentry>
diff --git a/alsactl/init_parse.c b/alsactl/init_parse.c
index 51b515c..8a7173b 100644
--- a/alsactl/init_parse.c
+++ b/alsactl/init_parse.c
@@ -1278,6 +1278,13 @@ static char *new_root_dir(const char *filename)
return res;
}
+/* return non-zero if the file name has the extension ".conf" */
+static int conf_name_filter(const struct dirent *d)
+{
+ char *ext = strrchr(d->d_name, '.');
+ return ext && !strcmp(ext, ".conf");
+}
+
static int parse_line(struct space *space, char *line, size_t linesize)
{
char *linepos;
@@ -1480,8 +1487,7 @@ static int parse_line(struct space *space, char *line, size_t linesize)
if (strcasecmp(key, "INCLUDE") == 0) {
char *rootdir, *go_to;
const char *filename;
- struct dirent *dirent;
- DIR *dir;
+ struct stat st;
int linenum;
if (op != KEY_OP_ASSIGN) {
Perror(space, "invalid INCLUDE operation");
@@ -1498,18 +1504,27 @@ static int parse_line(struct space *space, char *line, size_t linesize)
go_to = space->go_to;
filename = space->filename;
linenum = space->linenum;
- dir = opendir(string);
- if (dir) {
+ if (stat(string, &st)) {
+ Perror(space, "invalid filename '%s'", string);
+ continue;
+ }
+ if (S_ISDIR(st.st_mode)) {
+ struct dirent **list;
+ int i, num;
+ num = scandir(string, &list, conf_name_filter,
+ alphasort);
+ if (num < 0) {
+ Perror(space, "invalid directory '%s'", string);
+ continue;
+ }
count = strlen(string);
- while ((dirent = readdir(dir)) != NULL) {
- if (strcmp(dirent->d_name, ".") == 0 ||
- strcmp(dirent->d_name, "..") == 0)
- continue;
+ for (i = 0; i < num; i++) {
string[count] = '\0';
strlcat(string, "/", sizeof(string));
- strlcat(string, dirent->d_name, sizeof(string));
+ strlcat(string, list[i]->d_name, sizeof(string));
space->go_to = NULL;
space->rootdir = new_root_dir(string);
+ free(list[i]);
if (space->rootdir) {
err = parse(space, string);
free(space->rootdir);
@@ -1522,7 +1537,7 @@ static int parse_line(struct space *space, char *line, size_t linesize)
if (err)
break;
}
- closedir(dir);
+ free(list);
} else {
space->go_to = NULL;
space->rootdir = new_root_dir(string);
--
1.7.10.4

View File

@ -0,0 +1,28 @@
From c3111571dc6a45e20c79a2c4fa590101d35db822 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 14 Jun 2012 16:14:29 +0200
Subject: [PATCH 15/15] alsactl: Add reference to alsactl_init(7) in alsactl
man page
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
alsactl/alsactl.1 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1
index eb5968c..054f511 100644
--- a/alsactl/alsactl.1
+++ b/alsactl/alsactl.1
@@ -107,7 +107,8 @@ routing options, etc).
\fB
amixer(1),
alsamixer(1),
-aplay(1)
+aplay(1),
+alsactl_init(7)
\fP
.SH BUGS
--
1.7.10.4

View File

@ -0,0 +1,23 @@
From 2b31992c799488c5a93bfe0b17d64b5196b122b4 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Fri, 15 Jun 2012 16:34:55 +0200
Subject: [PATCH] aseqnet: Remove obsoleted .LO entry from man page
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
seq/aseqnet/aseqnet.1 | 1 -
1 file changed, 1 deletion(-)
diff --git a/seq/aseqnet/aseqnet.1 b/seq/aseqnet/aseqnet.1
index a1dc1d3..2cb6eb7 100644
--- a/seq/aseqnet/aseqnet.1
+++ b/seq/aseqnet/aseqnet.1
@@ -1,5 +1,4 @@
.TH aseqnet 1 "January 1, 2000"
-.LO 1
.SH NAME
aseqnet \- ALSA sequencer connectors over network
--
1.7.10.4

17
01beep.conf Normal file
View File

@ -0,0 +1,17 @@
CTL{reset}="mixer"
CTL{name}="PC Speaker Playback Volume",CTL{do_search}=="1", \
CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="PC Speaker Playback Switch",CTL{do_search}=="1", \
CTL{values}="off"
CTL{reset}="mixer"
CTL{name}="PC Beep Playback Volume",CTL{do_search}=="1", \
CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="PC Beep Playback Switch",CTL{do_search}=="1", \
CTL{values}="off"
CTL{reset}="mixer"
CTL{name}="Beep Playback Volume",CTL{do_search}=="1", \
CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="Beep Playback Switch",CTL{do_search}=="1", \
CTL{values}="off"

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Wed Jun 20 18:19:21 CEST 2012 - tiwai@suse.de
- Fix the installation of postinit rules
- Add (empty) preinit directory for alsactl init as a placeholder
-------------------------------------------------------------------
Fri Jun 15 15:41:10 CEST 2012 - tiwai@suse.de
- Make beep silent as default (bnc#767270)
- Backport fixes for alsactl init
- Fix invalid .LO entry in man page
-------------------------------------------------------------------
Tue May 29 11:25:14 CEST 2012 - tiwai@suse.de

View File

@ -42,6 +42,7 @@ Group: Productivity/Multimedia/Sound/Players
Version: 1.0.25
Release: 0
Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{package_version}.tar.bz2
Source1: 01beep.conf
# Patch: alsa-utils-git-fixes.diff
Patch1: 0001-Fix-the-examples-in-aplay.1.patch
Patch2: 0002-Trivial-fixes-in-INSTALL-file.patch
@ -55,6 +56,9 @@ Patch10: 0010-configure.in-use-AS_HELP_STRING-everywhere.patch
Patch11: 0011-alsactl-Do-not-access-other-cards-than-specified-for.patch
Patch12: 0012-aplay-print-vu-meter-to-stderr-not-stdout.patch
Patch13: 0013-alsaloop-fix-the-avail_min-setup.patch
Patch14: 0014-alsactl-Read-only-.conf-files-when-a-directory-is-pa.patch
Patch15: 0015-alsactl-Add-reference-to-alsactl_init-7-in-alsactl-m.patch
Patch16: 0016-aseqnet-Remove-obsoleted-.LO-entry-from-man-page.patch
Patch99: alsa-utils-gettext-version-removal.diff
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -81,6 +85,9 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%if %suse_version < 1020
%patch99 -p1
%endif
@ -106,6 +113,11 @@ make %{?_smp_mflags}
%install
%makeinstall
mkdir -p $RPM_BUILD_ROOT%{_datadir}/alsa/init/preinit
mkdir -p $RPM_BUILD_ROOT%{_datadir}/alsa/init/postinit
for i in %{_sourcedir}/[0-9]*.conf; do
install -c -m 0644 $i $RPM_BUILD_ROOT%{_datadir}/alsa/init/postinit
done
%find_lang %{name} --all-name
%if %use_systemd
ln -s alsa-restore.service $RPM_BUILD_ROOT/lib/systemd/system/alsasound.service