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

login
register
mail settings
Submitter Sean Farley
Date April 18, 2016, 5:52 p.m.
Message ID <da3179bb3ca884e26103.1461001929@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/14721/
State Superseded
Headers show

Comments

Sean Farley - April 18, 2016, 5:52 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 da3179bb3ca884e261034064c546d184dcd32a3a
# Parent  db33d0e7476c79ac0bc8048992ec6d24d6062c87
# 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!'