Patchwork [2,of,5,STABLE,V2] builddeb: use sed -i

login
register
mail settings
Submitter Sean Farley
Date April 20, 2016, 6:01 p.m.
Message ID <1d7bde00335de695e91f.1461175315@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/14741/
State Accepted
Headers show

Comments

Sean Farley - April 20, 2016, 6:01 p.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1460835201 25200
#      Sat Apr 16 12:33:21 2016 -0700
# Branch stable
# Node ID 1d7bde00335de695e91f93b3f94583eb41c404bd
# Parent  a4609d5e2af8b208f4843fc4bffcd3fb15fede0d
# EXP-Topic ppa
builddeb: use sed -i

Notice that there is no space after '-i'. This makes it work on both GNU and
BSD versions of sed.

Patch

diff --git a/contrib/builddeb b/contrib/builddeb
--- a/contrib/builddeb
+++ b/contrib/builddeb
@@ -65,15 +65,12 @@  if [ "$BUILD" ]; then
     fi
 
     cp -r $PWD/contrib/debian debian
     chmod -R 0755 debian
 
-    # This looks like sed -i, but sed -i behaves just differently enough
-    # between BSD and GNU sed that I gave up and did the dumb thing.
-    sed "s/__VERSION__/$debver/" < $changelog > $changelog.tmp
-    date=$(date --rfc-2822)
-    sed "s/__DATE__/$date/" < $changelog.tmp > $changelog
+    sed -i.tmp "s/__VERSION__/$debver/" $changelog
+    sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
     rm $changelog.tmp
 
     debuild -us -uc -b
     if [ $? != 0 ]; then
         echo 'debuild failed!'