1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Merged in james-duley/librepilot/fedora (pull request #246)

LP-317 Update RPM packaging for osgearth
This commit is contained in:
Lalanne Laurent 2016-05-23 20:15:16 +02:00
commit 77e8698499
5 changed files with 63 additions and 45 deletions

View File

@ -376,10 +376,12 @@ include $(ROOT_DIR)/package/$(UNAME).mk
# Source for distribution
#
##############################
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
FORCE:
$(DIST_VER_INFO): FORCE | $(DIST_DIR)
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
$(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR)
$(DIST_TAR): $(DIST_VER_INFO) | $(DIST_DIR)
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))"
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD
$(V1) tar --append --file="$(DIST_TAR)" \

View File

@ -252,8 +252,29 @@ class Repo:
json_data['dirty'] = False
json_path = os.path.join(path, 'version-info.json')
with open(json_path, 'w') as json_file:
json.dump(json_data, json_file)
write_if_different(json_path, json.dumps(json_data))
def write_if_different(out_name, out):
"""Write ouput to file only if it differs from current"""
# Check if output file already exists
try:
of = open(out_name, "rb")
except IOError:
# No file - create new
of = open(out_name, "wb")
of.write(out)
of.close()
else:
# File exists - overwite only if content is different
inp = of.read()
of.close()
if inp != out:
of = open(out_name, "wb")
of.write(out)
of.close()
def escape_dict(dictionary):
"""Escapes dictionary values for C"""
@ -300,22 +321,8 @@ def file_from_template(tpl_name, out_name, dictionary):
# Replace placeholders using dictionary
out = Template(tpl).substitute(dictionary)
# Check if output file already exists
try:
of = open(out_name, "rb")
except IOError:
# No file - create new
of = open(out_name, "wb")
of.write(out)
of.close()
else:
# File exists - overwite only if content is different
inp = of.read()
of.close()
if inp != out:
of = open(out_name, "wb")
of.write(out)
of.close()
write_if_different(out_name, out)
def sha1(file):
"""Provides C source representation of sha1 sum of file"""

View File

@ -9,6 +9,7 @@ endif
DEB_NAME := $(ORG_SMALL_NAME)
DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz
DEB_ORIG_FW := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig-firmware.tar.gz
DEB_SRC_CHANGES := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_source.changes
DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER)
DEB_ARCH := $(shell dpkg --print-architecture)
DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH)
@ -37,7 +38,7 @@ package: debian
@$(ECHO) "Building Linux package, please wait..."
$(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control
$(V1) sed -i -e 's,config_new.*, --help > /dev/null,' debian/rules
$(V1) dpkg-buildpackage -b -us -uc -nc $(DPKG_BUILDPACKAGE_OPTS)
$(V1) dpkg-buildpackage -b -us -uc -nc
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)
$(V1) rm -r debian
@ -56,8 +57,23 @@ ifeq ($(DEB_DIST), trusty)
endif
.PHONY: package_src
package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR)
$(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc $(DPKG_BUILDPACKAGE_OPTS)
package_src: $(DEB_SRC_CHANGES)
.PHONY: package_src_upload
package_src_upload: $(DEB_SRC_CHANGES)
$(V1) debsign $(DEB_SRC_CHANGES)
$(V1) dput $(DPUT_URL) $(DEB_SRC_CHANGES)
# Only include the orig if it we haven't alreadly built it,
# because if we have it is likely to be uploaded already
ifeq ($(wildcard $(DEB_ORIG_SRC)),)
DPKG_INCLUDE_ORIG := -sa
else
DPKG_INCLUDE_ORIG := -sd
endif
$(DEB_SRC_CHANGES): $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR)
$(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc $(DPKG_INCLUDE_ORIG)
$(DEB_ORIG_SRC): $(DIST_TAR_GZ) | $(PACKAGE_DIR)
$(V1) cp $(DIST_TAR_GZ) $(DEB_ORIG_SRC)

View File

@ -25,7 +25,7 @@ SPEC_FILE_IN := $(ROOT_DIR)/package/linux/rpmspec.in
.PHONY: rpmspec
rpmspec: $(SPEC_FILE)
$(SPEC_FILE): $(SPEC_FILE_IN) | $(RPM_DIRS)
$(SPEC_FILE): $(SPEC_FILE_IN) $(DIST_VER_INFO) | $(RPM_DIRS)
$(V1) cp -f $(SPEC_FILE_IN) $(SPEC_FILE)
$(V1) $(SED_SCRIPT) $(SPEC_FILE)
@ -38,6 +38,10 @@ $(RPM_PACKAGE_FILE): RPMBUILD_OPTS := -bb
package_src: $(RPM_PACKAGE_SRC)
$(RPM_PACKAGE_SRC): RPMBUILD_OPTS := -bs
.PHONY: package_src_upload
package_src_upload: $(RPM_PACKAGE_SRC)
copr-cli build --nowait $(COPR_PROJECT) $(RPM_PACKAGE_SRC)
$(RPM_PACKAGE_FILE) $(RPM_PACKAGE_SRC): $(SPEC_FILE) $(DIST_TAR_GZ) $(FW_DIST_TAR_GZ) | $(RPM_DIRS)
@$(ECHO) "Building $(call toprel,$@), please wait..."
$(V1) ln -sf $(DIST_TAR_GZ) $(PACKAGE_DIR)/SOURCES

View File

@ -24,6 +24,8 @@ BuildRequires: qt5-qtserialport-devel
BuildRequires: qt5-qtsvg-devel
BuildRequires: qt5-qttools-devel
BuildRequires: qt5-qttranslations
BuildRequires: OpenSceneGraph-devel
%{!?fc22:BuildRequires: osgearth-devel}
BuildRequires: dwz
BuildRequires: pkgconfig
BuildRequires: python
@ -38,6 +40,8 @@ Requires: qt5-qtmultimedia
Requires: qt5-qtscript
Requires: qt5-qtserialport
Requires: qt5-qtsvg
Requires: OpenSceneGraph-libs
%{!?fc22:Requires: osgearth}
%description
@ -55,7 +59,8 @@ make config_new \
prefix=%{_prefix} \
QMAKE=qmake-qt5 \
udevrulesdir=%{_udevrulesdir} \
WITH_PREBUILT_FW=$(pwd)/build/firmware
WITH_PREBUILT_FW=$(pwd)/build/firmware \
GCS_EXTRA_CONF='osg%{!?fc22: osgearth}'
make %{?_smp_mflags} opfw_resource gcs
@ -77,26 +82,10 @@ rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
%doc README.md CREDITS.txt WHATSNEW.txt
%doc GPLv3.txt
%{_bindir}/librepilot-gcs
%{_udevrulesdir}/45-librepilot.rules
%{_datadir}/applications/librepilot.desktop
%{_datadir}/librepilot-gcs/*
%{_datadir}/pixmaps/librepilot.png
%{_libdir}/librepilot-gcs/plugins/LibrePilot/*.pluginspec
%{_libdir}/librepilot-gcs/plugins/LibrePilot/*.so
#
%{_libdir}/librepilot-gcs/libAggregation.so.1*
%{_libdir}/librepilot-gcs/libExtensionSystem.so.1*
%{_libdir}/librepilot-gcs/libGLC_lib.so.1*
%{_libdir}/librepilot-gcs/libopmapwidget.so.1*
%{_libdir}/librepilot-gcs/libQScienceSpinBox.so.1*
%{_libdir}/librepilot-gcs/libQtConcurrent.so.1*
%{_libdir}/librepilot-gcs/libQwt.so.1*
%{_libdir}/librepilot-gcs/libsdlgamepad.so.1*
%{_libdir}/librepilot-gcs/libUtils.so.1*
%{_libdir}/librepilot-gcs/libVersionInfo.so.1*
#
%{_libdir}/librepilot-gcs/lib*.so
%{_bindir}/*
%{_udevrulesdir}/*
%{_datadir}/*
%{_libdir}/*
%changelog