1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Merge remote-tracking branch 'origin/revo-fixes' into brian/rfm22_autoconfig

This commit is contained in:
Brian Webb 2012-12-11 18:45:06 -07:00
commit 2fcce73f0b
8 changed files with 56 additions and 11 deletions

View File

@ -158,6 +158,20 @@ class Repo:
else:
return clean
def label(self):
"""Return package label (tag if defined, or date-hash if no tag)"""
if self._tag == None:
return ''.join([self.time('%Y%m%d'), "-", self.hash(8, 'untagged'), self.dirty()])
else:
return ''.join([self.tag(''), self.dirty()])
def revision(self):
"""Return full revison string (tag if defined, or branch:hash date time if no tag"""
if self._tag == None:
return ''.join([self.branch('no-branch'), ":", self.hash(8, 'no-hash'), self.dirty(), self.time(' %Y%m%d %H:%M')])
else:
return ''.join([self.tag(''), self.dirty()])
def info(self):
"""Print some repository info"""
print "path: ", self.path()
@ -167,8 +181,10 @@ class Repo:
print "hash: ", self.hash()
print "short hash: ", self.hash(8)
print "branch: ", self.branch()
print "commit tag: ", self.tag()
print "commit tag: ", self.tag('')
print "dirty: ", self.dirty('yes', 'no')
print "label: ", self.label()
print "revision: ", self.revision()
def file_from_template(tpl_name, out_name, dict):
"""Create or update file from template using dictionary
@ -324,6 +340,12 @@ variable substitution and writes the result into output file. Output
file will be overwritten only if its content differs from expected.
Otherwise it will not be touched, so make utility will not remake
dependent targets.
Optional positional arguments may be used to add more dictionary
strings for replacement. Each argument has the form:
VARIABLE=replacement
and each ${VARIABLE} reference will be replaced with replacement
string given.
"""
# Parse command line.
@ -359,8 +381,6 @@ dependent targets.
parser.add_option('--uavodir', default = "",
help='uav object definition directory');
(args, positional_args) = parser.parse_args()
if len(positional_args) != 0:
parser.error("incorrect number of arguments, try --help for help")
# Process arguments. No advanced error handling is here.
# Any error will raise an exception and terminate process
@ -373,12 +393,18 @@ dependent targets.
ORIGIN = r.origin(),
HASH = r.hash(),
HASH8 = r.hash(8),
TAG = r.tag(''),
TAG_OR_BRANCH = r.tag(r.branch('unreleased')),
TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')),
LABEL = r.label(),
REVISION = r.revision(),
DIRTY = r.dirty(),
FWTAG = xtrim(r.tag(r.branch('unreleased')), r.dirty(), 25),
UNIXTIME = r.time(),
DATE = r.time('%Y%m%d'),
DAY=r.time('%d'),
MONTH=r.time('%m'),
YEAR=r.time('%Y'),
DATETIME = r.time('%Y%m%d %H:%M'),
BOARD_TYPE = args.type,
BOARD_REVISION = args.revision,
@ -387,6 +413,12 @@ dependent targets.
UAVOSHA1 = GetHashofDirs(args.uavodir,verbose=0,raw=0),
)
# Process positional arguments in the form of:
# VAR1=str1 VAR2="string 2"
for var in positional_args:
(key, value) = var.split('=', 1)
dictionary[key] = value
if args.info:
r.info()

View File

@ -14,8 +14,10 @@ ROOT_DIR := $(realpath $(WHEREAMI)/../)
# Set up some macros
BUILD_DIR := $(ROOT_DIR)/build
VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)"
PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY})
PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${LABEL})
PACKAGE_DIR := $(BUILD_DIR)/package-$(PACKAGE_LBL)
PACKAGE_NAME := OpenPilot
PACKAGE_SEP := -
FW_DIR := $(PACKAGE_DIR)/firmware-$(PACKAGE_LBL)
BL_DIR := $(FW_DIR)/bootloaders
BU_DIR := $(FW_DIR)/bootloader-updaters

View File

@ -29,6 +29,7 @@ DEB_MACHINE_DIR := $(DEB_CFG_I386_DIR)
DEB_MACHINE_FILES := $(DEB_CFG_I386_FILES)
endif
DEB_PACKAGE_NAME := openpilot_$(PACKAGE_LBL)_$(DEB_PLATFORM)
FULL_PACKAGE_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)$(PACKAGE_SEP)$(DEB_PLATFORM)
ALL_DEB_FILES = $(foreach f, $(DEB_CFG_CMN_FILES), $(DEB_BUILD_DIR)/$(f))
ALL_DEB_FILES += $(foreach f, $(DEB_MACHINE_FILES), $(DEB_BUILD_DIR)/$(f))
@ -39,8 +40,8 @@ linux_deb_package: $(ALL_DEB_FILES) gcs package_flight
$(V1) $(shell echo $(FW_DIR) > $(BUILD_DIR)/package_dir)
$(V1) sed -i -e "$(SED_SCRIPT)" $(DEB_BUILD_DIR)/changelog
$(V1) cd .. && dpkg-buildpackage -b -us -uc
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)/$(FULL_PACKAGE_NAME).deb
$(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)/$(FULL_PACKAGE_NAME).changes
$(V1) rm -rf $(DEB_BUILD_DIR)
$(ALL_DEB_FILES): | uavobjects

View File

@ -8,6 +8,8 @@ osx_package: gcs package_flight
BUILD_DIR="$(BUILD_DIR)" \
PACKAGE_LBL="$(PACKAGE_LBL)" \
PACKAGE_DIR="$(PACKAGE_DIR)" \
PACKAGE_NAME="$(PACKAGE_NAME)" \
PACKAGE_SEP="$(PACKAGE_SEP)" \
FW_DIR="$(FW_DIR)" \
"$(ROOT_DIR)/package/osx/package" \
)

View File

@ -11,7 +11,12 @@ NSIS_HEADER := $(BUILD_DIR)/ground/openpilotgcs/openpilotgcs.nsh
win_package: gcs package_flight
$(V1) mkdir -p "$(dir $(NSIS_HEADER))"
$(VERSION_CMD) --template="$(NSIS_TEMPLATE)" --outfile="$(NSIS_HEADER)"
$(VERSION_CMD) \
--template="$(NSIS_TEMPLATE)" \
--outfile="$(NSIS_HEADER)" \
PACKAGE_LBL="$(PACKAGE_LBL)" \
PACKAGE_NAME="$(PACKAGE_NAME)" \
PACKAGE_SEP="$(PACKAGE_SEP)"
$(V1) echo "Building Windows installer, please wait..."
$(V1) echo "If you have a script error in line 1 - use Unicode NSIS 2.46+"
$(V1) echo " http://www.scratchpaper.com"

View File

@ -1,12 +1,12 @@
#!/bin/bash
# the following environment variables must be set
: ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?}
: ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?} ${PACKAGE_NAME?} ${PACKAGE_SEP?}
# more variables
APP_PATH="${BUILD_DIR}/ground/openpilotgcs/bin/OpenPilot GCS.app"
TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg"
OUT_FILE="${PACKAGE_DIR}/OpenPilot-${PACKAGE_LBL}.dmg"
OUT_FILE="${PACKAGE_DIR}/${PACKAGE_NAME}${PACKAGE_SEP}${PACKAGE_LBL}.dmg"
VOL_NAME="OpenPilot"
# prepare the stage

View File

@ -208,6 +208,7 @@ Section "Firmware" InSecFirmware
SetOutPath "$INSTDIR\firmware"
File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_coptercontrol-${PACKAGE_LBL}.opfw"
File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_pipxtreme-${PACKAGE_LBL}.opfw"
File "${PACKAGE_DIR}\${FIRMWARE_DIR}\fw_revomini-${PACKAGE_LBL}.opfw"
SectionEnd
; Copy utility files

View File

@ -12,10 +12,12 @@
#
; Some names, paths and constants
!define PACKAGE_LBL "${DATE}-${TAG_OR_HASH8}${DIRTY}"
!define PACKAGE_LBL "${PACKAGE_LBL}"
!define PACKAGE_NAME "${PACKAGE_NAME}"
!define PACKAGE_SEP "${PACKAGE_SEP}"
!define PACKAGE_DIR "..\..\build\package-$${PACKAGE_LBL}"
!define OUT_FILE "OpenPilot-$${PACKAGE_LBL}-install.exe"
!define FIRMWARE_DIR "firmware-$${PACKAGE_LBL}"
!define OUT_FILE "$${PACKAGE_NAME}$${PACKAGE_SEP}$${PACKAGE_LBL}$${PACKAGE_SEP}install.exe"
; Installer version info
!define PRODUCT_VERSION "0.0.0.0"