Improve linux/make_artifacts.
Structure code more cleanly. Make separate deb, tarball for pandoc-server.
This commit is contained in:
parent
88a31332cd
commit
7c34908493
1 changed files with 48 additions and 41 deletions
|
@ -34,54 +34,61 @@ cabal v2-install --bindir=$ARTIFACTS
|
|||
for f in $(find dist-newstyle -name 'pandoc' -type f -perm /400); do cp $f $ARTIFACTS/; done
|
||||
for f in $(find dist-newstyle -name 'pandoc-server' -type f -perm /400); do cp $f /$ARTIFACTS/; done
|
||||
|
||||
# make deb
|
||||
# make deb for EXE
|
||||
make_deb() {
|
||||
VERSION=`$ARTIFACTS/$EXE --version | awk '{print $2; exit;}'`
|
||||
REVISION=${REVISION:-1}
|
||||
DEBVER=$VERSION-$REVISION
|
||||
BASE=$EXE-$DEBVER-$ARCHITECTURE
|
||||
DIST=`pwd`/$BASE
|
||||
DEST=$DIST/usr
|
||||
COPYRIGHT=$DEST/share/doc/$EXE/copyright
|
||||
|
||||
VERSION=`$ARTIFACTS/pandoc --version | awk '{print $2; exit;}'`
|
||||
REVISION=${REVISION:-1}
|
||||
DEBVER=$VERSION-$REVISION
|
||||
BASE=pandoc-$DEBVER-$ARCHITECTURE
|
||||
DIST=`pwd`/$BASE
|
||||
DEST=$DIST/usr
|
||||
COPYRIGHT=$DEST/share/doc/pandoc/copyright
|
||||
mkdir -p $DEST/bin
|
||||
mkdir -p $DEST/share/man/man1
|
||||
|
||||
mkdir -p $DEST/bin
|
||||
mkdir -p $DEST/share/man/man1
|
||||
mkdir -p $DEST/share/doc/pandoc
|
||||
find $DIST -type d | xargs chmod 755
|
||||
cp $ARTIFACTS/$EXE $DEST/bin/
|
||||
strip $DEST/bin/$EXE
|
||||
cp /mnt/man/$EXE.1 $DEST/share/man/man1/$EXE.1
|
||||
gzip -9 $DEST/share/man/man1/$EXE.1
|
||||
|
||||
find $DIST -type d | xargs chmod 755
|
||||
cp $ARTIFACTS/pandoc $DEST/bin/
|
||||
strip $DEST/bin/pandoc
|
||||
cp /mnt/man/pandoc.1 $DEST/share/man/man1/pandoc.1
|
||||
gzip -9 $DEST/share/man/man1/pandoc.1
|
||||
cp /mnt/COPYRIGHT $COPYRIGHT
|
||||
echo "" >> $COPYRIGHT
|
||||
|
||||
cp /mnt/COPYRIGHT $COPYRIGHT
|
||||
echo "" >> $COPYRIGHT
|
||||
INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
|
||||
mkdir $DIST/DEBIAN
|
||||
perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
|
||||
perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
|
||||
perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
|
||||
> $DIST/DEBIAN/control
|
||||
|
||||
INSTALLED_SIZE=$(du -k -s $DEST | awk '{print $1}')
|
||||
mkdir $DIST/DEBIAN
|
||||
perl -pe "s/VERSION/$DEBVER/" linux/control.in | \
|
||||
perl -pe "s/ARCHITECTURE/$ARCHITECTURE/" | \
|
||||
perl -pe "s/INSTALLED_SIZE/$INSTALLED_SIZE/" \
|
||||
> $DIST/DEBIAN/control
|
||||
# we limit compression to avoid OOM error
|
||||
fakeroot dpkg-deb -Zgzip -z9 --build $DIST
|
||||
rm -rf $DIST
|
||||
cp $BASE.deb $ARTIFACTS/
|
||||
}
|
||||
|
||||
# we limit compression to avoid OOM error
|
||||
fakeroot dpkg-deb -Zgzip -z9 --build $DIST
|
||||
rm -rf $DIST
|
||||
cp $BASE.deb $ARTIFACTS/
|
||||
# Make tarball for EXE
|
||||
make_tarball() {
|
||||
TARGET=$EXE-$VERSION
|
||||
cd $ARTIFACTS
|
||||
rm -rf $TARGET
|
||||
mkdir $TARGET
|
||||
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
|
||||
cp /mnt/man/$EXE.1 $TARGET/share/man/man1
|
||||
mv $EXE $TARGET/bin
|
||||
strip $TARGET/bin/$EXE
|
||||
gzip -9 $TARGET/share/man/man1/$EXE.1
|
||||
|
||||
# Make tarball
|
||||
tar cvzf $TARGET-linux-$ARCHITECTURE.tar.gz $TARGET
|
||||
rm -r $TARGET
|
||||
}
|
||||
|
||||
TARGET=pandoc-$VERSION
|
||||
cd $ARTIFACTS
|
||||
rm -rf $TARGET
|
||||
mkdir $TARGET
|
||||
mkdir $TARGET/bin $TARGET/share $TARGET/share/man $TARGET/share/man/man1
|
||||
cp /mnt/man/pandoc.1 $TARGET/share/man/man1
|
||||
mv pandoc $TARGET/bin
|
||||
strip $TARGET/bin/pandoc
|
||||
gzip -9 $TARGET/share/man/man1/pandoc.1
|
||||
|
||||
tar cvzf $TARGET-linux-$ARCHITECTURE.tar.gz $TARGET
|
||||
rm -r $TARGET
|
||||
for EXE in pandoc pandoc-server
|
||||
do
|
||||
make_deb
|
||||
make_tarball
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Add table
Reference in a new issue