mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-03 12:32:33 +12:00
Adds: automated script to build rpm packages
This script was based on the steps contained in the following two guides: Package Manuskript for Linux with rpm --> .rpm https://github.com/olivierkes/manuskript/wiki/Package-Manuskript-for-Linux-with-rpm Package Manuskript for Linux with dpkg --> .deb https://github.com/olivierkes/manuskript/wiki/Package-Manuskript-for-Linux-with-dpkg
This commit is contained in:
parent
18fa2bec26
commit
9672d3efc7
90
package/create_rpm.sh
Executable file
90
package/create_rpm.sh
Executable file
|
@ -0,0 +1,90 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Name: create_rpm.sh
|
||||
#
|
||||
# Description: Create Fedora style RPM package for Manuskript
|
||||
#
|
||||
# Usage: create_rpm.sh [AppVersion PkgNumber]
|
||||
#
|
||||
# Parameters: Appversion - defaults to manuskript/version.py value.
|
||||
# PkgNumber - default to 1.
|
||||
|
||||
|
||||
# Function to echo command and then run command
|
||||
# Usage: echo_do eval "command-to-run"
|
||||
function echo_do() {
|
||||
echo "\$ $@" | sed 's/eval //'
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Program vars
|
||||
ScriptPath="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
Root="$ScriptPath/../"
|
||||
|
||||
# Manuskript Vars
|
||||
AppName=manuskript
|
||||
Version=$(grep -E "__version__.*\".*\"" "$Root/manuskript/version.py" \
|
||||
| cut -d\" -f2) # Look for version in manuskript/version
|
||||
AppVersion=${1:-$Version}
|
||||
PkgNumber=${2:-1}
|
||||
PkgVersion=$AppVersion-$PkgNumber
|
||||
Dest="$Root/rpmbuild"
|
||||
|
||||
echo "### Using package directory: $Dest"
|
||||
|
||||
echo "### Creating folder structure"
|
||||
echo_do eval "mkdir -p $Dest/{BUILD,RPMS,SOURCES,SPECS,tmp}"
|
||||
echo_do eval "mkdir -p $Dest/RPMS/noarch"
|
||||
|
||||
echo "### Defining rpm macros"
|
||||
cat <<EOF >~/.rpmmacros
|
||||
%_topdir %(echo $Dest)
|
||||
%_tmppath %{_topdir}/tmp
|
||||
EOF
|
||||
|
||||
# Getting manuskript files, by downloading
|
||||
# pushd $Dest/
|
||||
# wget https://github.com/olivierkes/manuskript/archive/$AppVersion.tar.gz
|
||||
# tar -xvf $AppVersion.tar.gz
|
||||
# rm $AppVersion.tar.gz
|
||||
# popd
|
||||
|
||||
# Using the current direction as source
|
||||
|
||||
echo "### Creating tarball folder structure"
|
||||
echo_do eval "mkdir -p $Dest/$AppName-$AppVersion/{usr/share/applications,usr/bin/}"
|
||||
|
||||
echo "### Copying manuskript content"
|
||||
echo_do eval "rsync -a --exclude=.git --include='*.msk' \
|
||||
--exclude-from='$Root/.gitignore' \
|
||||
--exclude=rpmbuild \
|
||||
--exclude={.codeclimate.yml,.gitignore,.travis.yml} \
|
||||
$ScriptPath/../ $Dest/$AppName-$AppVersion/usr/share/manuskript"
|
||||
# Note: Files manuskript and manuskript.desktop are same as in Debian
|
||||
echo_do eval "cp $ScriptPath/create_deb/manuskript $Dest/$AppName-$AppVersion/usr/bin/manuskript"
|
||||
echo_do eval "chmod 0755 $Dest/$AppName-$AppVersion/usr/bin/manuskript"
|
||||
echo_do eval "cp $ScriptPath/create_deb/manuskript.desktop \
|
||||
$Dest/$AppName-$AppVersion/usr/share/applications/manuskript.desktop"
|
||||
|
||||
echo "### Creating SPECS/manuskript.spec file"
|
||||
echo_do eval "cp $ScriptPath/create_rpm/manuskript.spec \
|
||||
$Dest/SPECS/manuskript.spec"
|
||||
echo_do eval "sed -i \"s/{AppVersion}/$AppVersion/\" \
|
||||
$Dest/SPECS/manuskript.spec"
|
||||
echo_do eval "sed -i \"s/{PkgNumber}/$PkgNumber/\" \
|
||||
$Dest/SPECS/manuskript.spec"
|
||||
|
||||
echo "### Creating tarball"
|
||||
echo_do eval "tar -C $Dest -cf $Dest/SOURCES/$AppName-$AppVersion.tar.gz \
|
||||
$AppName-$AppVersion"
|
||||
|
||||
echo "### Removing temporary tarball directory"
|
||||
echo_do eval "rm -rf $Dest/$AppName-$AppVersion"
|
||||
|
||||
echo "### Building the RPM package…"
|
||||
echo_do eval "pushd $Dest"
|
||||
echo_do eval "rpmbuild --target=noarch -bb SPECS/manuskript.spec"
|
||||
echo_do eval "popd"
|
||||
|
||||
echo "### Done"
|
||||
echo "### RPM File: $Dest/RPMS/noarch/$AppName-$PkgVersion.noarch.rpm"
|
62
package/create_rpm/manuskript.spec
Normal file
62
package/create_rpm/manuskript.spec
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Don't try fancy stuff like debuginfo, which is useless on binary-only
|
||||
# packages. Don't strip binary too
|
||||
# Be sure buildpolicy set to do nothing
|
||||
%define name manuskript
|
||||
%define version {AppVersion}
|
||||
%define release {PkgNumber}
|
||||
%define __spec_install_post %{nil}
|
||||
%define debug_package %{nil}
|
||||
%define __os_install_post %{_dbpath}/brp-compress
|
||||
|
||||
Summary: Manuskript open source tool for writers
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
License: GPL3+
|
||||
Group: Applications/Editors
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_builddir}/%{name}-%{version}-%{release}-root
|
||||
URL: http://www.theologeek.ch/manuskript/
|
||||
SOURCE0 : %{name}-%{version}.tar.gz
|
||||
Packager: Curtis Gedak <gedakc@gmail.com>
|
||||
Provides: Manuskript
|
||||
Requires: python3, python3-qt5, python3-lxml, zlib, python3-markdown, pandoc
|
||||
%if 0%{?suse_version}
|
||||
# Assume openSUSE
|
||||
# Note - have to build rpm on openSUSE for this to work.
|
||||
Requires: libQt5Svg5, python3-pyenchant
|
||||
%else
|
||||
# Assume Fedora and others
|
||||
Requires: python3-qt5-webkit, qt5-qtsvg, python3-enchant
|
||||
%endif
|
||||
|
||||
%description
|
||||
Manuskript is an open source tool for writers. It
|
||||
provides a rich environment to help writers create
|
||||
their first draft and then further refine and edit
|
||||
their masterpiece.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
# Empty section.
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}
|
||||
|
||||
# in builddir
|
||||
cp -a * %{buildroot}
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
/usr/bin/manuskript
|
||||
/usr/share/applications/manuskript.desktop
|
||||
/usr/share/manuskript/*
|
||||
|
||||
%changelog
|
||||
# Empty section.
|
Loading…
Reference in a new issue