[beep/f19: 4/4] 1.3-7: changed upstream tarball, add fixes

Hans Ulrich Niedermann ndim at fedoraproject.org
Tue Nov 19 23:17:16 UTC 2013


commit 6f7f04e747e4bdbad20d4bcf1d623db074464da8
Author: Hans Ulrich Niedermann <hun at n-dimensional.de>
Date:   Wed Nov 20 00:09:17 2013 +0100

    1.3-7: changed upstream tarball, add fixes
    
    +- Use new upstream tarball beep-1.3.tar.gz (yes, it has changed!)
    +- Add a few fixes from upstream git repo
    +- Move our Makefile cleanup to upstream pull request

 0001-Fixed-Makefile.patch                          |   45 ++++++++++
 0002-Add-more-error-detection.patch                |   45 ++++++++++
 ...-also-catch-SIGTERM-for-stopping-the-beep.patch |   33 ++++++++
 ...-install-more-user-and-packaging-friendly.patch |   85 ++++++++++++++++++++
 ...reserve-file-modification-time-on-install.patch |   33 ++++++++
 beep-1.2.2-install-fixes.patch                     |   41 ----------
 beep.spec                                          |   46 ++++++++++-
 sources                                            |    2 +-
 8 files changed, 285 insertions(+), 45 deletions(-)
---
diff --git a/0001-Fixed-Makefile.patch b/0001-Fixed-Makefile.patch
new file mode 100644
index 0000000..0a8d7c3
--- /dev/null
+++ b/0001-Fixed-Makefile.patch
@@ -0,0 +1,45 @@
+From 8b32b8b088be1f29e8bfea57a97b9bfaa76ec8ee Mon Sep 17 00:00:00 2001
+From: Chris Wong <chrisyco at gmail.com>
+Date: Wed, 23 Nov 2011 10:39:53 +1300
+Subject: [PATCH 1/6] Fixed Makefile
+
+* Use /usr/share/man (see http://www.pathname.com/fhs/2.2/fhs-4.11.html#4.11.5)
+
+* Removed trailing spaces
+
+* Added optimization flag (must beep FAST!!!)
+---
+ Makefile | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index cc359c4..0f4f810 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,19 +1,19 @@
+ CC=gcc
+-FLAGS=-Wall
++FLAGS=-Wall -O2
+ EXEC_NAME=beep
+ INSTALL_DIR=/usr/bin
+ MAN_FILE=beep.1.gz
+-MAN_DIR=/usr/man/man1
++MAN_DIR=/usr/share/man/man1
+ 
+ default : beep
+ 
+-clean : 
++clean :
+ 	rm ${EXEC_NAME}
+ 
+ beep : beep.c
+ 	${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
+ 
+-install : 
++install :
+ 	cp ${EXEC_NAME} ${INSTALL_DIR}
+ 	# rm -f /usr/man/man1/beep.1.bz2
+ 	cp ${MAN_FILE} ${MAN_DIR}
+-- 
+1.8.4.2
+
diff --git a/0002-Add-more-error-detection.patch b/0002-Add-more-error-detection.patch
new file mode 100644
index 0000000..a4f0ca3
--- /dev/null
+++ b/0002-Add-more-error-detection.patch
@@ -0,0 +1,45 @@
+From d3aee6c489852108c91dc22abcacff364e9429f2 Mon Sep 17 00:00:00 2001
+From: Chris Wong <chrisyco at gmail.com>
+Date: Wed, 23 Nov 2011 11:34:55 +1300
+Subject: [PATCH 2/6] Add more error detection
+
+---
+ beep.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/beep.c b/beep.c
+index 452fc08..14fac3e 100644
+--- a/beep.c
++++ b/beep.c
+@@ -98,11 +98,11 @@ char *console_device = NULL;
+ 
+ 
+ void do_beep(int freq) {
+-  if (console_type == BEEP_TYPE_CONSOLE) {
+-    if(ioctl(console_fd, KIOCSOUND, freq != 0
+-      ? (int)(CLOCK_TICK_RATE/freq)
+-      : freq) < 0) {
+-      printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
++  int period = (freq != 0 ? (int)(CLOCK_TICK_RATE/freq) : freq);
++
++  if(console_type == BEEP_TYPE_CONSOLE) {
++    if(ioctl(console_fd, KIOCSOUND, period) < 0) {
++      putchar('\a');  /* Output the only beep we can, in an effort to fall back on usefulness */
+       perror("ioctl");
+     }
+   } else {
+@@ -113,7 +113,10 @@ void do_beep(int freq) {
+      e.code = SND_TONE;
+      e.value = freq;
+ 
+-     write(console_fd, &e, sizeof(struct input_event));
++     if(write(console_fd, &e, sizeof(struct input_event)) < 0) {
++       putchar('\a'); /* See above */
++       perror("write");
++     }
+   }
+ }
+ 
+-- 
+1.8.4.2
+
diff --git a/0004-also-catch-SIGTERM-for-stopping-the-beep.patch b/0004-also-catch-SIGTERM-for-stopping-the-beep.patch
new file mode 100644
index 0000000..89187b9
--- /dev/null
+++ b/0004-also-catch-SIGTERM-for-stopping-the-beep.patch
@@ -0,0 +1,33 @@
+From e1320c1da52ca92aa68b4224f9532982184fbe00 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A9r=C3=B4me?= <jerome at jolimont.fr>
+Date: Thu, 7 Feb 2013 12:54:53 +0100
+Subject: [PATCH 4/6] also catch SIGTERM for stopping the beep
+
+Signed-off-by: Gerfried Fuchs <rhonda at deb.at>
+---
+ beep.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/beep.c b/beep.c
+index 452fc08..9cb63bf 100644
+--- a/beep.c
++++ b/beep.c
+@@ -127,6 +127,7 @@ void handle_signal(int signum) {
+ 
+   switch(signum) {
+   case SIGINT:
++  case SIGTERM:
+     if(console_fd >= 0) {
+       /* Kill the sound, quit gracefully */
+       do_beep(0);
+@@ -321,6 +322,7 @@ int main(int argc, char **argv) {
+   parms->next       = NULL;
+ 
+   signal(SIGINT, handle_signal);
++  signal(SIGTERM, handle_signal);
+   parse_command_line(argc, argv, parms);
+ 
+   /* this outermost while loop handles the possibility that -n/--new has been
+-- 
+1.8.4.2
+
diff --git a/0005-Make-build-install-more-user-and-packaging-friendly.patch b/0005-Make-build-install-more-user-and-packaging-friendly.patch
new file mode 100644
index 0000000..b6a84e4
--- /dev/null
+++ b/0005-Make-build-install-more-user-and-packaging-friendly.patch
@@ -0,0 +1,85 @@
+From 947a7e332908dcba1c7e523fbdc927d39ee6adb1 Mon Sep 17 00:00:00 2001
+From: Hans Ulrich Niedermann <hun at n-dimensional.de>
+Date: Tue, 19 Nov 2013 23:40:50 +0100
+Subject: [PATCH 5/6] Make build/install more user and packaging friendly
+
+Make the build and install more user and packaging friendly
+by introducing the following features in the Makefile:
+
+  * Honor the $(CFLAGS) set when calling make.
+
+  * Prefix all install locations with $(DESTDIR) for
+    easy package building.
+
+  * Use GNU Makefile conventions for defining installation
+    directories. This means $(bindir) and $(man1dir)
+    instead of the former $(INSTALL_DIR) and $(MAN_DIR).
+
+  * Use install(1) for installing files and directories
+    so that permissions can be set properly.
+
+  * Stop "make clean" failing when it has nothing to do.
+
+  * Add 'uninstall' make target.
+
+  * Make 'install' target build executable if necessary.
+---
+ Makefile | 40 +++++++++++++++++++++++++++++-----------
+ 1 file changed, 29 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 0f4f810..942a7a5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,19 +1,37 @@
+ CC=gcc
+ FLAGS=-Wall -O2
++
++INSTALL=install
++
+ EXEC_NAME=beep
+-INSTALL_DIR=/usr/bin
+ MAN_FILE=beep.1.gz
+-MAN_DIR=/usr/share/man/man1
+ 
+-default : beep
++# Use GNU makefile conventions for directory names with one notable
++# exception: prefix is not /usr/local in order to keep the default
++# installation location for beep.
++prefix=/usr
++exec_prefix=$(prefix)
++bindir=$(exec_prefix)/bin
++datarootdir=$(prefix)/share
++mandir=$(datarootdir)/man
++man1dir=$(mandir)/man1
++
++.PHONY: all
++all: $(EXEC_NAME)
++
++.PHONY: clean
++clean:
++	rm -f $(EXEC_NAME)
+ 
+-clean :
+-	rm ${EXEC_NAME}
++$(EXEC_NAME): beep.c
++	$(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
+ 
+-beep : beep.c
+-	${CC} ${FLAGS} -o ${EXEC_NAME} beep.c
++install: all
++	$(INSTALL) -m 0755 -d           $(DESTDIR)$(bindir)
++	$(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
++	$(INSTALL) -m 0755 -d           $(DESTDIR)$(man1dir)
++	$(INSTALL) -m 0644 $(MAN_FILE)  $(DESTDIR)$(man1dir)/
+ 
+-install :
+-	cp ${EXEC_NAME} ${INSTALL_DIR}
+-	# rm -f /usr/man/man1/beep.1.bz2
+-	cp ${MAN_FILE} ${MAN_DIR}
++uninstall:
++	rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
++	rm -f $(DESTDIR)$(man1dir)/$(MAN_FILE)
+-- 
+1.8.4.2
+
diff --git a/0006-Preserve-file-modification-time-on-install.patch b/0006-Preserve-file-modification-time-on-install.patch
new file mode 100644
index 0000000..4db0272
--- /dev/null
+++ b/0006-Preserve-file-modification-time-on-install.patch
@@ -0,0 +1,33 @@
+From 4622dd15dc12dab47a0381a8a7188f0f0421e01d Mon Sep 17 00:00:00 2001
+From: Hans Ulrich Niedermann <hun at n-dimensional.de>
+Date: Wed, 20 Nov 2013 00:00:54 +0100
+Subject: [PATCH 6/6] Preserve file modification time on install
+
+Add -p option to install(1) invocation in order to preserve
+the timestamps of the files being installed.
+---
+ Makefile | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 942a7a5..290b8a4 100644
+--- a/Makefile
++++ b/Makefile
+@@ -27,10 +27,10 @@ $(EXEC_NAME): beep.c
+ 	$(CC) $(FLAGS) $(CFLAGS) -o $(EXEC_NAME) beep.c
+ 
+ install: all
+-	$(INSTALL) -m 0755 -d           $(DESTDIR)$(bindir)
+-	$(INSTALL) -m 0755 $(EXEC_NAME) $(DESTDIR)$(bindir)/
+-	$(INSTALL) -m 0755 -d           $(DESTDIR)$(man1dir)
+-	$(INSTALL) -m 0644 $(MAN_FILE)  $(DESTDIR)$(man1dir)/
++	$(INSTALL) -m 0755 -d              $(DESTDIR)$(bindir)
++	$(INSTALL) -m 0755 -p $(EXEC_NAME) $(DESTDIR)$(bindir)/
++	$(INSTALL) -m 0755 -d              $(DESTDIR)$(man1dir)
++	$(INSTALL) -m 0644 -p $(MAN_FILE)  $(DESTDIR)$(man1dir)/
+ 
+ uninstall:
+ 	rm -f $(DESTDIR)$(bindir)/$(EXEC_NAME)
+-- 
+1.8.4.2
+
diff --git a/beep.spec b/beep.spec
index 597d0d4..329b524 100644
--- a/beep.spec
+++ b/beep.spec
@@ -8,15 +8,46 @@
 Summary:        Beep the PC speaker any number of ways
 Name:           beep
 Version:        1.3
-Release:        6%{?dist}
+Release:        7%{?dist}
 
 Group:          Applications/System
 License:        GPLv2+
 URL:            http://www.johnath.com/beep/
+
+# Upstream github repo: https://github.com/johnath/beep
+# hun github repo:      https://github.com/ndim/beep
+
+# Alternative source URLs to download:
+# curl -L -o beep-github.tar.gz https://api.github.com/repos/johnath/beep/tarball
+# curl -L -o beep-g0d790fa.tar.gz https://api.github.com/repos/johnath/beep/tarball/0d790fa
+# curl -L -o beep-1.3-gdb6f31a.tar.gz https://api.github.com/repos/johnath/beep/tarball/db6f31a60303e41def1a1d0705164cd5b6d75492
 Source0:        http://www.johnath.com/beep/%{name}-%{version}.tar.gz
+
+
+# Fedora specific files
 Source1:        %{name}-README.fedora
 Source2:        %{name}-modprobe.conf
-Patch0:         beep-1.2.2-install-fixes.patch
+
+
+# Fix from upstream github repo
+Patch1:         0001-Fixed-Makefile.patch
+
+# Fix from upstream github repo
+Patch2:         0002-Add-more-error-detection.patch
+
+# No sense to add stuff to .gitignore in our source dir
+# Patch3:         0003-Gitignorance.patch
+
+# Fix from upstream github repo
+Patch4:         0004-also-catch-SIGTERM-for-stopping-the-beep.patch
+
+# Make build/install more user and packaging friendly
+# https://github.com/johnath/beep/pull/6
+Patch5:         0005-Make-build-install-more-user-and-packaging-friendly.patch
+
+# Preserve file modification time on install
+# https://github.com/johnath/beep/pull/6
+Patch6:         0006-Preserve-file-modification-time-on-install.patch
 
 BuildRequires:  glibc-kernheaders
 
@@ -32,7 +63,11 @@ what's interesting, but it's real good at that notifying part.
 
 %prep
 %setup -q
-%patch0 -p1 -b .install-fixes
+%patch1 -p1 -b 0001
+%patch2 -p1 -b 0002
+%patch4 -p1 -b 0004
+%patch5 -p1 -b 0005
+%patch6 -p1 -b 0006
 cp -p %{SOURCE1} README.fedora
 
 
@@ -66,6 +101,11 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Nov 19 2013 Hans Ulrich Niedermann  <hun at n-dimensional.de> - 1.3-7
+- Use new upstream tarball beep-1.3.tar.gz (yes, it has changed!)
+- Add a few fixes from upstream git repo
+- Move our Makefile cleanup to upstream pull request
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
diff --git a/sources b/sources
index 23374dc..0ac109c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-355406b51da5ea0f01affb6f6231f69a  beep-1.3.tar.gz
+49c340ceb95dbda3f97b2daafac7892a  beep-1.3.tar.gz


More information about the scm-commits mailing list