Skip to content

Commit

Permalink
新增調整 PPA 發佈工具
Browse files Browse the repository at this point in the history
  • Loading branch information
matlinuxer2 committed Nov 17, 2014
1 parent d688060 commit 1383711
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 54 deletions.
4 changes: 2 additions & 2 deletions pkg/deb/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sysd (0.4.1-2utopic2) utopic; urgency=low
sysd (0.6.0) unstable; urgency=medium

* Initial release.

-- Chun-Yu Lee (Mat) <[email protected]> Mon, 04 Nov 2014 16:00:00 +0800
-- Chun-Yu Lee (Mat) <[email protected]> Fri, 14 Nov 2014 17:51:44 +0000
73 changes: 73 additions & 0 deletions pkg/deb/ppa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash

ROOT="$( cd $( dirname $0 ) && pwd -P )/../.."

get_gpg_signname(){
local result=$( gpg --list-secret-keys| grep uid | head --lines=1 | cut -c 22- )
echo $result
}

function local_dput(){
local TARGET="$1"

local DPUT_CONF="/tmp/._dput.cf"

cat > $DPUT_CONF <<EOD
[ppaa]
fqdn = ppa.launchpad.net
method = ftp
incoming = ~matlinuxer2/sysd
login = anonymous
EOD

dput -c $DPUT_CONF ppaa $TARGET

rm $DPUT_CONF
}

PKG_NAME="sysd"
PKG_VER="0.6.0"
CNT="3"
TARBALL_URL="https://github.com/hacking-thursday/sysd/releases/download/v0.6.0/sysd-0.6.0.tar.gz"
TARBALL_NAME="${PKG_NAME}-${PKG_VER}.tar.gz"
TARBALL_NAME2="${PKG_NAME}_${PKG_VER}.orig.tar.gz"
TARBALL_DIR="${TARBALL_NAME%.tar.gz}"
TEMP_DIR="__debian__$(date '+%Y-%m-%d_%H%M%S')"

if [ ! -f "$ROOT/pkg/tgz/$TARBALL_NAME" ];then
wget -O "$ROOT/pkg/tgz/$TARBALL_NAME" "$TARBALL_URL"
fi


mkdir $TEMP_DIR
pushd $TEMP_DIR
cp "$ROOT/pkg/tgz/$TARBALL_NAME" "$TARBALL_NAME2"
tar -zxvf "$TARBALL_NAME2"
cp -av ../debian "$TARBALL_DIR"

for codename in "lucid" "precise" "trusty" "utopic" ; do
cp "$TARBALL_DIR/debian/changelog" /tmp/changelog.bak
pushd "$TARBALL_DIR"
sed -i debian/control -e 's/golang-go,.*/golang-go/g'
sed -i debian/changelog -e "s/unstable;/${codename};/g"
sed -i debian/changelog -e "s/${PKG_VER})/${PKG_VER}-0)/g"
debuild -S | tee /tmp/debuild.log

CHANGES="$(sed -n 's/^.*signfile \(.*\.changes\).*$/\1/p' /tmp/debuild.log)"
rm /tmp/debuild.log
local_dput ../$CHANGES
popd

pushd "$TARBALL_DIR"
for (( i=1; i<=$CNT; i++ )); do
DEBEMAIL="$(get_gpg_signname)" debchange --local=$codename --force-distribution --distribution $codename "for $codename"
done
debuild -S | tee /tmp/debuild.log

CHANGES="$(sed -n 's/^.*signfile \(.*\.changes\).*$/\1/p' /tmp/debuild.log)"
rm /tmp/debuild.log
local_dput ../$CHANGES
popd
cp /tmp/changelog.bak "$TARBALL_DIR/debian/changelog"
done
popd
52 changes: 0 additions & 52 deletions pkg/deb/release.sh

This file was deleted.

0 comments on commit 1383711

Please sign in to comment.