Merge branch '7.0' of https://git.launchpad.net/epics-base into PSI-7.0
This commit is contained in:
+46
-16
@@ -1,22 +1,26 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Make tar for git repo w/ one level of sub modules.
|
||||
#
|
||||
set -e
|
||||
set -e -u
|
||||
|
||||
die() {
|
||||
echo "$1" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
TOPREV="$1"
|
||||
FINALTAR="$2"
|
||||
PREFIX="$3"
|
||||
maybedie() {
|
||||
if [ "$DEVMODE" ]; then
|
||||
echo "Warning: $1" >&2
|
||||
else
|
||||
echo "Error: $1" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
if ! [ "$TOPREV" ]
|
||||
then
|
||||
usage() {
|
||||
cat <<EOF >&2
|
||||
usage: $0 <rev> [<outfile> [<prefix>]]
|
||||
usage: $0 [-v] [-s] <rev> [<outfile> [<prefix>]]
|
||||
|
||||
<rev> may be any git revision spec. (tag, branch, or commit id).
|
||||
|
||||
@@ -24,9 +28,33 @@ usage: $0 <rev> [<outfile> [<prefix>]]
|
||||
If <outfile> is omitted, "base-<rev>.tar.gz" will be used.
|
||||
If provided, <prefix> must end with "/". If <prefix> is omitted,
|
||||
the default is "base-<rev>/".
|
||||
|
||||
Options:
|
||||
|
||||
-v Enable verbose prints
|
||||
-d Enable permissive developer mode
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
export DEVMODE=
|
||||
|
||||
while getopts "vd" OPT
|
||||
do
|
||||
case "$OPT" in
|
||||
v) set -x;;
|
||||
d) DEVMODE=1;;
|
||||
?) echo "Unknown option"
|
||||
usage;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
TOPREV="$1"
|
||||
FINALTAR="$2"
|
||||
PREFIX="${3:-}"
|
||||
|
||||
[ "$TOPREV" ] || usage
|
||||
|
||||
case "$FINALTAR" in
|
||||
"")
|
||||
@@ -59,16 +87,13 @@ case "$PREFIX" in
|
||||
esac
|
||||
|
||||
# Check for both <tag> and R<tag>
|
||||
if [ "$TOPREV" = "HEAD" ]
|
||||
then
|
||||
true
|
||||
elif ! [ `git tag -l $TOPREV` ]
|
||||
if ! [ `git tag -l $TOPREV` ]
|
||||
then
|
||||
if [ `git tag -l R$TOPREV` ]
|
||||
then
|
||||
TOPREV="R$TOPREV"
|
||||
else
|
||||
die "No tags exist '$TOPREV' or 'R$TOPREV'"
|
||||
maybedie "No tags exist '$TOPREV' or 'R$TOPREV'"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -94,7 +119,12 @@ git ls-tree -r $TOPREV | \
|
||||
while read HASH MODDIR
|
||||
do
|
||||
echo "Visiting $HASH $MODDIR"
|
||||
git -C $MODDIR archive --prefix=${PREFIX}${MODDIR}/ $HASH | tar -C "$TDIR"/tar -x
|
||||
if [ -e $MODDIR/.git ]
|
||||
then
|
||||
git -C $MODDIR archive --prefix=${PREFIX}${MODDIR}/ $HASH | tar -C "$TDIR"/tar -x
|
||||
else
|
||||
maybedie " Submodule not checked out."
|
||||
fi
|
||||
done
|
||||
|
||||
# make a list of files copied and filter out undesirables
|
||||
@@ -134,5 +164,5 @@ tar -t $TAROPT -f "$FINALTAR" > "$TDIR"/list.3
|
||||
# make sure we haven't picked up anything extra
|
||||
if ! diff -u "$TDIR"/list.2 "$TDIR"/list.3
|
||||
then
|
||||
echo "Oops! Tarfile diff against plan shown above"
|
||||
die "Oops! Tarfile diff against plan shown above"
|
||||
fi
|
||||
|
||||
+2
-2
@@ -51,10 +51,10 @@ jobs:
|
||||
- dist: xenial
|
||||
|
||||
- dist: bionic
|
||||
env: EXTRA="CMD_CXXFLAGS=-std=c++11"
|
||||
env: STATIC=YES EXTRA="CMD_CXXFLAGS=-std=c++11"
|
||||
|
||||
- dist: trusty
|
||||
env: STATIC=YES EXTRA="CMD_CXXFLAGS=-std=c++11"
|
||||
env: EXTRA="CMD_CXXFLAGS=-std=c++11"
|
||||
|
||||
- dist: bionic
|
||||
compiler: clang
|
||||
|
||||
+1
-5
@@ -58,12 +58,8 @@ include $(CONFIG)/CONFIG_BASE_VERSION
|
||||
include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common
|
||||
-include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common
|
||||
|
||||
# Parse configure/RELEASE
|
||||
# except when building Base itself, where this file is empty,
|
||||
# and would error in src/tools/ anyway.
|
||||
ifndef BASE_TOP
|
||||
# Parse configure/RELEASE to find all upstream modules
|
||||
RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops)
|
||||
endif
|
||||
|
||||
ifdef T_A
|
||||
|
||||
|
||||
@@ -50,9 +50,11 @@ realclean:
|
||||
# Append all our live submodule failure files
|
||||
FAILURE_FILES = $(addsuffix /$(TEST_FAILURE_FILENAME), $(LIVE_SUBMODULES))
|
||||
|
||||
define combine_failure_files
|
||||
@$(TOUCH) $(FAILURE_FILES)
|
||||
@$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE)
|
||||
endef
|
||||
runtests: | $(addsuffix $(DIVIDER)runtests, $(LIVE_SUBMODULES))
|
||||
@$(TOUCH) $(FAILURE_FILES)
|
||||
@$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE)
|
||||
$(if $(FAILURE_FILES), $(combine_failure_files))
|
||||
test-results: | $(addsuffix $(DIVIDER)test-results, $(LIVE_SUBMODULES))
|
||||
@$(TOUCH) $(FAILURE_FILES)
|
||||
@$(CAT) $(FAILURE_FILES) >> $(TEST_FAILURE_FILE)
|
||||
$(if $(FAILURE_FILES), $(combine_failure_files))
|
||||
|
||||
@@ -736,6 +736,8 @@ long dbValueSize(short dbr_type)
|
||||
sizeof(epicsFloat64), /* DOUBLE */
|
||||
sizeof(epicsEnum16)}; /* ENUM */
|
||||
|
||||
if(dbr_type>=NELEMENTS(size))
|
||||
return 0;
|
||||
return(size[dbr_type]);
|
||||
}
|
||||
|
||||
@@ -796,15 +798,12 @@ int dbLoadRecords(const char* file, const char* subs)
|
||||
static long getLinkValue(DBADDR *paddr, short dbrType,
|
||||
char *pbuf, long *nRequest)
|
||||
{
|
||||
dbCommon *precord = paddr->precord;
|
||||
dbFldDes *pfldDes = paddr->pfldDes;
|
||||
/* size of pbuf storage in bytes, including space for trailing nil */
|
||||
int maxlen;
|
||||
DBENTRY dbEntry;
|
||||
long status;
|
||||
long nReq = nRequest ? *nRequest : 1;
|
||||
|
||||
/* dbFindRecord() below will always succeed as we have a
|
||||
/* below will always succeed as we have a
|
||||
* valid DBADDR, so no point to check again.
|
||||
* Request for zero elements always succeeds
|
||||
*/
|
||||
@@ -830,10 +829,8 @@ static long getLinkValue(DBADDR *paddr, short dbrType,
|
||||
return S_db_badDbrtype;
|
||||
}
|
||||
|
||||
dbInitEntry(pdbbase, &dbEntry);
|
||||
status = dbFindRecord(&dbEntry, precord->name);
|
||||
if (!status) status = dbFindField(&dbEntry, pfldDes->name);
|
||||
if (!status) {
|
||||
dbInitEntryFromAddr(paddr, &dbEntry);
|
||||
{
|
||||
const char *rtnString = dbGetString(&dbEntry);
|
||||
|
||||
strncpy(pbuf, rtnString, maxlen-1);
|
||||
@@ -843,7 +840,7 @@ static long getLinkValue(DBADDR *paddr, short dbrType,
|
||||
if(nRequest) *nRequest = nReq;
|
||||
}
|
||||
dbFinishEntry(&dbEntry);
|
||||
return status;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static long getAttrValue(DBADDR *paddr, short dbrType,
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
#include "recGbl.h"
|
||||
#include "recSup.h"
|
||||
|
||||
/* from dbAccessDefs.h which can't be included here */
|
||||
#define S_db_badDbrtype (M_dbAccess| 3)
|
||||
|
||||
/* defined in dbContext.cpp
|
||||
* Setup local CA access
|
||||
*/
|
||||
@@ -457,6 +460,9 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
|
||||
long status = 0;
|
||||
short link_action = 0;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
assert(pca);
|
||||
/* put the new value in */
|
||||
epicsMutexMustLock(pca->lock);
|
||||
|
||||
@@ -382,7 +382,7 @@ The B<DPVT> field is is for private use of the device support modules.
|
||||
prompt("DSET address")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("unambiguous_dset *dset")
|
||||
extra("unambiguous_dset *dset")
|
||||
}
|
||||
field(DPVT,DBF_NOACCESS) {
|
||||
prompt("Device Private")
|
||||
@@ -491,7 +491,7 @@ field which is then used to acquire a timestamp.
|
||||
prompt("Break Point")
|
||||
special(SPC_NOMOD)
|
||||
interest(1)
|
||||
extra("char bkpt")
|
||||
extra("epicsUInt8 bkpt")
|
||||
}
|
||||
field(UDF,DBF_UCHAR) {
|
||||
prompt("Undefined")
|
||||
|
||||
@@ -159,6 +159,9 @@ long dbPutConvertJSON(const char *json, short dbrType,
|
||||
size_t jlen = strlen(json);
|
||||
long status;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
parser->depth = 0;
|
||||
parser->dbrType = dbrType;
|
||||
parser->dbrSize = dbValueSize(dbrType);
|
||||
|
||||
@@ -553,7 +553,12 @@ static long lnkCalc_getValue(struct link *plink, short dbrType, void *pbuffer,
|
||||
dbCommon *prec = plink->precord;
|
||||
int i;
|
||||
long status;
|
||||
FASTCONVERT conv = dbFastPutConvertRoutine[DBR_DOUBLE][dbrType];
|
||||
FASTCONVERT conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
conv = dbFastPutConvertRoutine[DBR_DOUBLE][dbrType];
|
||||
|
||||
/* Any link errors will trigger a LINK/INVALID alarm in the child link */
|
||||
for (i = 0; i < clink->nArgs; i++) {
|
||||
@@ -624,7 +629,12 @@ static long lnkCalc_putValue(struct link *plink, short dbrType,
|
||||
dbCommon *prec = plink->precord;
|
||||
int i;
|
||||
long status;
|
||||
FASTCONVERT conv = dbFastGetConvertRoutine[dbrType][DBR_DOUBLE];
|
||||
FASTCONVERT conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
conv = dbFastGetConvertRoutine[dbrType][DBR_DOUBLE];
|
||||
|
||||
/* Any link errors will trigger a LINK/INVALID alarm in the child link */
|
||||
for (i = 0; i < clink->nArgs; i++) {
|
||||
|
||||
@@ -361,6 +361,9 @@ static long lnkConst_loadScalar(struct link *plink, short dbrType, void *pbuffer
|
||||
const_link *clink = CONTAINER(plink->value.json.jlink, const_link, jlink);
|
||||
long status;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
switch (clink->type) {
|
||||
case si64:
|
||||
if (clink->jlink.debug)
|
||||
@@ -451,12 +454,17 @@ static long lnkConst_loadArray(struct link *plink, short dbrType, void *pbuffer,
|
||||
long *pnReq)
|
||||
{
|
||||
const_link *clink = CONTAINER(plink->value.json.jlink, const_link, jlink);
|
||||
short dbrSize = dbValueSize(dbrType);
|
||||
short dbrSize;
|
||||
char *pdest = pbuffer;
|
||||
int nElems = clink->nElems;
|
||||
FASTCONVERT conv;
|
||||
long status;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
dbrSize = dbValueSize(dbrType);
|
||||
|
||||
if (nElems > *pnReq)
|
||||
nElems = *pnReq;
|
||||
|
||||
|
||||
@@ -142,7 +142,12 @@ static long lnkState_getValue(struct link *plink, short dbrType, void *pbuffer,
|
||||
{
|
||||
state_link *slink = CONTAINER(plink->value.json.jlink,
|
||||
struct state_link, jlink);
|
||||
FASTCONVERT conv = dbFastPutConvertRoutine[DBR_SHORT][dbrType];
|
||||
FASTCONVERT conv;
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
conv = dbFastPutConvertRoutine[DBR_SHORT][dbrType];
|
||||
|
||||
slink->val = slink->invert ^ dbStateGet(slink->state);
|
||||
return conv(&slink->val, pbuffer, NULL);
|
||||
|
||||
@@ -113,7 +113,6 @@ static long cvt_dbaddr(DBADDR *paddr)
|
||||
{
|
||||
arrRecord *prec = (arrRecord *) paddr->precord;
|
||||
|
||||
paddr->pfield = prec->bptr;
|
||||
paddr->no_elements = prec->nelm;
|
||||
paddr->field_type = prec->ftvl;
|
||||
paddr->field_size = dbValueSize(prec->ftvl);
|
||||
@@ -126,6 +125,7 @@ static long get_array_info(DBADDR *paddr, long *no_elements, long *offset)
|
||||
{
|
||||
arrRecord *prec = (arrRecord *) paddr->precord;
|
||||
|
||||
paddr->pfield = prec->bptr;
|
||||
*no_elements = prec->nord;
|
||||
*offset = prec->off;
|
||||
|
||||
|
||||
@@ -416,7 +416,7 @@ static void testArrayLink(unsigned nsrc, unsigned ntarg)
|
||||
dbScanLock((dbCommon*)ptarg);
|
||||
fillArray(buftarg, ptarg->nelm, 1);
|
||||
ptarg->nord = ptarg->nelm;
|
||||
db_post_events(ptarg, ptarg->bptr, DBE_VALUE|DBE_ALARM|DBE_ARCHIVE);
|
||||
db_post_events(ptarg, &ptarg->val, DBE_VALUE|DBE_ALARM|DBE_ARCHIVE);
|
||||
dbScanUnlock((dbCommon*)ptarg);
|
||||
|
||||
waitForUpdateN(psrclnk, 2);
|
||||
@@ -540,7 +540,7 @@ static void testreTargetTypeChange(void)
|
||||
dbScanLock((dbCommon*)ptarg1);
|
||||
fillArrayDouble(buftarg1, ptarg1->nelm, 1);
|
||||
ptarg1->nord = ptarg1->nelm;
|
||||
db_post_events(ptarg1, ptarg1->bptr, DBE_VALUE|DBE_ALARM|DBE_ARCHIVE);
|
||||
db_post_events(ptarg1, &ptarg1->val, DBE_VALUE|DBE_ALARM|DBE_ARCHIVE);
|
||||
dbScanUnlock((dbCommon*)ptarg1);
|
||||
|
||||
epicsEventMustWait(waitEvent); /* wait for update */
|
||||
|
||||
@@ -119,11 +119,26 @@ void testLongField(void)
|
||||
testdbGetArrFieldEqual("lnktest.NAME$", DBR_CHAR, 8, 8, "lnktest");
|
||||
}
|
||||
|
||||
static
|
||||
void testPutArr(void)
|
||||
{
|
||||
epicsUInt32 buf[10];
|
||||
testDiag("testPutArr()");
|
||||
|
||||
testdbGetArrFieldEqual("arr", DBR_LONG, 1, 0, NULL);
|
||||
|
||||
buf[0] = 1; buf[1] = 2; buf[2] = 3; buf[3] = 0;
|
||||
testdbPutArrFieldOk("arr", DBF_ULONG, 3, buf);
|
||||
|
||||
buf[3] = 0xdeadbeef;
|
||||
testdbGetArrFieldEqual("arr", DBR_LONG, 4, 3, buf);
|
||||
}
|
||||
|
||||
void dbTestIoc_registerRecordDeviceDriver(struct dbBase *);
|
||||
|
||||
MAIN(dbPutGet)
|
||||
{
|
||||
testPlan(41);
|
||||
testPlan(44);
|
||||
testdbPrepare();
|
||||
|
||||
testdbReadDatabase("dbTestIoc.dbd", NULL, NULL);
|
||||
@@ -142,6 +157,8 @@ MAIN(dbPutGet)
|
||||
testLongAttr();
|
||||
testLongField();
|
||||
|
||||
testPutArr();
|
||||
|
||||
testIocShutdownOk();
|
||||
|
||||
testdbCleanup();
|
||||
|
||||
@@ -39,3 +39,8 @@ record(x, "lnktarget") {}
|
||||
record(x, "lnktest") {
|
||||
field(INP, "lnktarget NPP NMS")
|
||||
}
|
||||
|
||||
record(arr, "arr") {
|
||||
field(FTVL, "ULONG")
|
||||
field(NELM, "10")
|
||||
}
|
||||
|
||||
@@ -117,9 +117,14 @@ long z_putval(struct link *plink, short dbrType,
|
||||
const void *pbuffer, long nRequest)
|
||||
{
|
||||
long ret;
|
||||
long (*pconv)(epicsInt32 *, const void *, const dbAddr *) = dbFastPutConvertRoutine[DBF_LONG][dbrType];
|
||||
long (*pconv)(epicsInt32 *, const void *, const dbAddr *);
|
||||
zpriv *priv = CONTAINER(plink->value.json.jlink, zpriv, base);
|
||||
|
||||
if(INVALID_DB_REQ(dbrType))
|
||||
return S_db_badDbrtype;
|
||||
|
||||
pconv = dbFastPutConvertRoutine[DBF_LONG][dbrType];
|
||||
|
||||
if(nRequest==0) return 0;
|
||||
|
||||
epicsMutexLock(priv->lock);
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
LIBCOM_API void epicsStdCall
|
||||
epicsSocketEnableAddressReuseDuringTimeWaitState ( SOCKET s )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/*
|
||||
* Note: WINSOCK appears to assign a different functionality for
|
||||
* SO_REUSEADDR compared to other OS. With WINSOCK SO_REUSEADDR indicates
|
||||
* that simultaneously servers can bind to the same TCP port on the same host!
|
||||
* Also, servers are always enabled to reuse a port immediately after
|
||||
* they exit ( even if SO_REUSEADDR isnt set ).
|
||||
*/
|
||||
#else
|
||||
int yes = true;
|
||||
int status;
|
||||
status = setsockopt ( s, SOL_SOCKET, SO_REUSEADDR,
|
||||
@@ -31,6 +40,7 @@ LIBCOM_API void epicsStdCall
|
||||
"epicsSocketEnableAddressReuseDuringTimeWaitState: "
|
||||
"unable to set SO_REUSEADDR?\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
+141
-141
@@ -48,38 +48,38 @@ sub ReplaceFilename { # (filename)
|
||||
my($file) = $_[0];
|
||||
$file =~ s|.*/CVS/?.*||; # Ignore CVS files and Replace.pl scripts
|
||||
$file =~ s|.*/$apptypename/Replace\.pl$||;
|
||||
|
||||
|
||||
if($opt_i) {
|
||||
# Handle name@arch stuff, copy only the closest matching file
|
||||
# NB: Won't work with directories, don't use '@' in a directory name!
|
||||
my($base,$filearch) = split /@/, $file;
|
||||
if ($base ne $file) { # This file is arch-specific
|
||||
my($os,$cpu,$toolset) = split /-/, $arch, 3;
|
||||
if (-r "$base\@$arch") { # A version exists for this arch
|
||||
$base = '' unless ($filearch eq $arch && -s $file);
|
||||
} elsif (-r "$base\@$os") { # A version exists for this os
|
||||
$base = '' unless ($filearch eq $os && -s $file);
|
||||
} elsif ( $ENV{EPICS_HOST_ARCH} !~ "$os-$cpu" &&
|
||||
# Handle name@arch stuff, copy only the closest matching file
|
||||
# NB: Won't work with directories, don't use '@' in a directory name!
|
||||
my($base,$filearch) = split /@/, $file;
|
||||
if ($base ne $file) { # This file is arch-specific
|
||||
my($os,$cpu,$toolset) = split /-/, $arch, 3;
|
||||
if (-r "$base\@$arch") { # A version exists for this arch
|
||||
$base = '' unless ($filearch eq $arch && -s $file);
|
||||
} elsif (-r "$base\@$os") { # A version exists for this os
|
||||
$base = '' unless ($filearch eq $os && -s $file);
|
||||
} elsif ( $ENV{EPICS_HOST_ARCH} !~ "$os-$cpu" &&
|
||||
-r "$base\@Cross" ) { # Cross version exists
|
||||
$base = '' unless ($filearch eq "Cross" && -s $file);
|
||||
} elsif (-r "$base\@Common") { # Default version exists
|
||||
$base = '' unless ($filearch eq "Common" && -s $file);
|
||||
} else { # No default version
|
||||
$base = '';
|
||||
}
|
||||
$file = $base; # Strip the @... part from the target name
|
||||
}
|
||||
$file =~ s|/$apptypename|/iocBoot|; # templateBoot => iocBoot
|
||||
$base = '' unless ($filearch eq "Cross" && -s $file);
|
||||
} elsif (-r "$base\@Common") { # Default version exists
|
||||
$base = '' unless ($filearch eq "Common" && -s $file);
|
||||
} else { # No default version
|
||||
$base = '';
|
||||
}
|
||||
$file = $base; # Strip the @... part from the target name
|
||||
}
|
||||
$file =~ s|/$apptypename|/iocBoot|; # templateBoot => iocBoot
|
||||
}
|
||||
if ($ioc) {
|
||||
$file =~ s|/iocBoot/ioc|/iocBoot/$ioc|; # name the ioc subdirectory
|
||||
$file =~ s|_IOC_|$ioc|;
|
||||
$file =~ s|/iocBoot/ioc|/iocBoot/$ioc|; # name the ioc subdirectory
|
||||
$file =~ s|_IOC_|$ioc|;
|
||||
} else {
|
||||
$file =~ s|.*/iocBoot/ioc/?.*||; # Not doing IOCs here
|
||||
$file =~ s|.*/iocBoot/ioc/?.*||; # Not doing IOCs here
|
||||
}
|
||||
if ($app) {
|
||||
$file =~ s|/$apptypename|/$appdir|; # templateApp => namedApp
|
||||
$file =~ s|/$appdir/configure|/configure/$apptype|;
|
||||
$file =~ s|/$apptypename|/$appdir|; # templateApp => namedApp
|
||||
$file =~ s|/$appdir/configure|/configure/$apptype|;
|
||||
}
|
||||
$file =~ s|_APPNAME_|$appname|;
|
||||
$file =~ s|_APPTYPE_|$apptype|;
|
||||
@@ -129,14 +129,14 @@ if ($opt_i) {
|
||||
|
||||
$appname=$appnameIn if $appnameIn;
|
||||
foreach $ioc ( @names ) {
|
||||
($appname = $ioc) =~ s/App$// if !$appnameIn;
|
||||
($csafeappname = $appname) =~ s/$bad_ident_chars/_/og;
|
||||
$ioc = "ioc" . $ioc unless ($ioc =~ m/ioc/);
|
||||
if (-d "iocBoot/$ioc") {
|
||||
print "iocBoot/$ioc exists, not modified.\n";
|
||||
next;
|
||||
}
|
||||
find({wanted => \&FCopyTree, follow => 1}, "$top/$apptypename/ioc");
|
||||
($appname = $ioc) =~ s/App$// if !$appnameIn;
|
||||
($csafeappname = $appname) =~ s/$bad_ident_chars/_/og;
|
||||
$ioc = "ioc" . $ioc unless ($ioc =~ m/ioc/);
|
||||
if (-d "iocBoot/$ioc") {
|
||||
print "iocBoot/$ioc exists, not modified.\n";
|
||||
next;
|
||||
}
|
||||
find({wanted => \&FCopyTree, follow => 1}, "$top/$apptypename/ioc");
|
||||
}
|
||||
exit 0; # finished here for -i (no xxxApps)
|
||||
}
|
||||
@@ -149,10 +149,10 @@ foreach $app ( @names ) {
|
||||
($csafeappname = $appname) =~ s/$bad_ident_chars/_/og;
|
||||
$appdir = $appname . "App";
|
||||
if (-d "$appdir") {
|
||||
print "$appname exists, not modified.\n";
|
||||
next;
|
||||
print "$appname exists, not modified.\n";
|
||||
next;
|
||||
}
|
||||
print "Creating $appname from template type $apptypename\n" if $opt_d;
|
||||
print "Creating $appname from template type $apptypename\n" if $opt_d;
|
||||
find({wanted => \&FCopyTree, follow => 1}, "$top/$apptypename/");
|
||||
}
|
||||
|
||||
@@ -163,22 +163,22 @@ exit 0; # END OF SCRIPT
|
||||
#
|
||||
sub get_commandline_opts { #no args
|
||||
getopts("a:b:dhilp:T:t:u:") or Cleanup(1);
|
||||
|
||||
|
||||
# Options help
|
||||
Cleanup(0) if $opt_h;
|
||||
|
||||
# Locate epics_base
|
||||
my ($command) = UnixPath($0);
|
||||
if ($opt_b) { # first choice is -b base
|
||||
$epics_base = UnixPath($opt_b);
|
||||
$epics_base = UnixPath($opt_b);
|
||||
} elsif ($release{"EPICS_BASE"}) { # second choice is configure/RELEASE
|
||||
$epics_base = UnixPath($release{"EPICS_BASE"});
|
||||
$epics_base =~s|^\$\(TOP\)/||;
|
||||
$epics_base = UnixPath($release{"EPICS_BASE"});
|
||||
$epics_base =~s|^\$\(TOP\)/||;
|
||||
} elsif ($ENV{EPICS_MBA_BASE}) { # third choice is env var EPICS_MBA_BASE
|
||||
$epics_base = UnixPath($ENV{EPICS_MBA_BASE});
|
||||
} elsif ($command =~ m|/bin/|) { # assume script was run with full path to base
|
||||
$epics_base = $command;
|
||||
$epics_base =~ s|^(.*)/bin/.*makeBaseApp.*|$1|;
|
||||
$epics_base = $command;
|
||||
$epics_base =~ s|^(.*)/bin/.*makeBaseApp.*|$1|;
|
||||
}
|
||||
$epics_base and -d "$epics_base" or Cleanup(1, "Can't find EPICS base");
|
||||
$app_epics_base = LocalPath($epics_base);
|
||||
@@ -186,11 +186,11 @@ sub get_commandline_opts { #no args
|
||||
|
||||
# Locate template top directory
|
||||
if ($opt_T) { # first choice is -T templ-top
|
||||
$top = UnixPath($opt_T);
|
||||
$top = UnixPath($opt_T);
|
||||
} elsif ($release{"TEMPLATE_TOP"}) { # second choice is configure/RELEASE
|
||||
$top = UnixPath($release{"TEMPLATE_TOP"});
|
||||
$top =~s|^\$\(EPICS_BASE\)|$epics_base|;
|
||||
$top =~s|^\$\(TOP\)/||;
|
||||
$top = UnixPath($release{"TEMPLATE_TOP"});
|
||||
$top =~s|^\$\(EPICS_BASE\)|$epics_base|;
|
||||
$top =~s|^\$\(TOP\)/||;
|
||||
}
|
||||
$top = $ENV{EPICS_MBA_TEMPLATE_TOP} unless $top && -d $top; # third choice is env var
|
||||
$top = $epics_base . "/templates/makeBaseApp/top" unless $top && -d $top; # final
|
||||
@@ -201,101 +201,101 @@ sub get_commandline_opts { #no args
|
||||
|
||||
# Print application type list?
|
||||
if ($opt_l) {
|
||||
ListAppTypes();
|
||||
exit 0; # finished for -l command
|
||||
ListAppTypes();
|
||||
exit 0; # finished for -l command
|
||||
}
|
||||
|
||||
|
||||
if (!@ARGV){
|
||||
if ($opt_t) {
|
||||
if ($opt_i) {
|
||||
my @iocs = map {s/iocBoot\///; $_} glob 'iocBoot/ioc*';
|
||||
if (@iocs) {
|
||||
print "The following IOCs already exist here:\n",
|
||||
map {" $_\n"} @iocs;
|
||||
}
|
||||
print "Name the IOC(s) to be created.\n",
|
||||
"Names given will have \"ioc\" prepended to them.\n",
|
||||
"IOC names? ";
|
||||
} else {
|
||||
print "Name the application(s) to be created.\n",
|
||||
"Names given will have \"App\" appended to them.\n",
|
||||
"Application names? ";
|
||||
}
|
||||
$namelist = <STDIN>;
|
||||
chomp($namelist);
|
||||
@names = split /[\s,]/, $namelist;
|
||||
} else {
|
||||
Cleanup(1);
|
||||
}
|
||||
if ($opt_t) {
|
||||
if ($opt_i) {
|
||||
my @iocs = map {s/iocBoot\///; $_} glob 'iocBoot/ioc*';
|
||||
if (@iocs) {
|
||||
print "The following IOCs already exist here:\n",
|
||||
map {" $_\n"} @iocs;
|
||||
}
|
||||
print "Name the IOC(s) to be created.\n",
|
||||
"Names given will have \"ioc\" prepended to them.\n",
|
||||
"IOC names? ";
|
||||
} else {
|
||||
print "Name the application(s) to be created.\n",
|
||||
"Names given will have \"App\" appended to them.\n",
|
||||
"Application names? ";
|
||||
}
|
||||
$namelist = <STDIN>;
|
||||
chomp($namelist);
|
||||
@names = split /[\s,]/, $namelist;
|
||||
} else {
|
||||
Cleanup(1);
|
||||
}
|
||||
} else {
|
||||
@names = @ARGV;
|
||||
}
|
||||
@names = @ARGV;
|
||||
}
|
||||
|
||||
# ioc architecture and application name
|
||||
if ($opt_i && @names) {
|
||||
|
||||
# ioc architecture
|
||||
opendir BINDIR, "$epics_base/bin" or die "Can't open $epics_base/bin: $!";
|
||||
my @archs = grep !/^\./, readdir BINDIR; # exclude .files
|
||||
closedir BINDIR;
|
||||
if ($opt_a) {
|
||||
$arch = $opt_a;
|
||||
} elsif (@archs == 1) {
|
||||
$arch = $archs[0];
|
||||
print "Using target architecture $arch (only one available)\n";
|
||||
} else {
|
||||
print "The following target architectures are available in base:\n";
|
||||
foreach $arch (@archs) {
|
||||
print " $arch\n";
|
||||
}
|
||||
print "What architecture do you want to use? ";
|
||||
$arch = <STDIN>;
|
||||
chomp($arch);
|
||||
}
|
||||
grep /^$arch$/, @archs or Cleanup(1, "Target architecture $arch not available");
|
||||
# ioc architecture
|
||||
opendir BINDIR, "$epics_base/bin" or die "Can't open $epics_base/bin: $!";
|
||||
my @archs = grep !/^\./, readdir BINDIR; # exclude .files
|
||||
closedir BINDIR;
|
||||
if ($opt_a) {
|
||||
$arch = $opt_a;
|
||||
} elsif (@archs == 1) {
|
||||
$arch = $archs[0];
|
||||
print "Using target architecture $arch (only one available)\n";
|
||||
} else {
|
||||
print "The following target architectures are available in base:\n";
|
||||
foreach $arch (@archs) {
|
||||
print " $arch\n";
|
||||
}
|
||||
print "What architecture do you want to use? ";
|
||||
$arch = <STDIN>;
|
||||
chomp($arch);
|
||||
}
|
||||
grep /^$arch$/, @archs or Cleanup(1, "Target architecture $arch not available");
|
||||
|
||||
# Application name
|
||||
if ($opt_p){
|
||||
$appnameIn = $opt_p if ($opt_p);
|
||||
} else {
|
||||
my @apps = glob '*App';
|
||||
if (@apps) {
|
||||
print "The following applications are available:\n",
|
||||
map {s/App$//; " $_\n"} @apps;
|
||||
}
|
||||
print "What application should the IOC(s) boot?\n",
|
||||
"The default uses the IOC's name, even if not listed above.\n",
|
||||
"Application name? ";
|
||||
$appnameIn = <STDIN>;
|
||||
chomp($appnameIn);
|
||||
}
|
||||
if ($opt_p){
|
||||
$appnameIn = $opt_p if ($opt_p);
|
||||
} else {
|
||||
my @apps = glob '*App';
|
||||
if (@apps) {
|
||||
print "The following applications are available:\n",
|
||||
map {s/App$//; " $_\n"} @apps;
|
||||
}
|
||||
print "What application should the IOC(s) boot?\n",
|
||||
"The default uses the IOC's name, even if not listed above.\n",
|
||||
"Application name? ";
|
||||
$appnameIn = <STDIN>;
|
||||
chomp($appnameIn);
|
||||
}
|
||||
}
|
||||
|
||||
# Application type
|
||||
$appext = $opt_i ? "Boot" : "App";
|
||||
if ($opt_t) { # first choice is -t type
|
||||
$apptype = $opt_t;
|
||||
$apptype =~ s/$appext$//;
|
||||
$apptype = $opt_t;
|
||||
$apptype =~ s/$appext$//;
|
||||
} elsif ($ENV{EPICS_MBA_DEF_APP_TYPE}) { # second choice is environment var
|
||||
$apptype = $ENV{EPICS_MBA_DEF_APP_TYPE};
|
||||
$apptype =~ s/(App)|(Boot)$//;
|
||||
$apptype = $ENV{EPICS_MBA_DEF_APP_TYPE};
|
||||
$apptype =~ s/(App)|(Boot)$//;
|
||||
} elsif (-d "$top/default$appext") { # third choice is default
|
||||
$apptype = "default";
|
||||
$apptype = "default";
|
||||
} elsif (-d "$top/example$appext") { # fourth choice is example
|
||||
$apptype = "example";
|
||||
$apptype = "example";
|
||||
}
|
||||
$apptype or Cleanup(1, "No application type set");
|
||||
$apptypename = $apptype . $appext;
|
||||
(-r "$top/$apptypename") or
|
||||
Cleanup(1, "Can't access template directory '$top/$apptypename'.\n");
|
||||
Cleanup(1, "Can't access template directory '$top/$apptypename'.\n");
|
||||
|
||||
print "\nCommand line / environment options validated:\n"
|
||||
. " Templ-Top: $top\n"
|
||||
. "Templ-Type: $apptype\n"
|
||||
. "Templ-Name: $apptypename\n"
|
||||
. " opt_i: $opt_i\n"
|
||||
. " arch: $arch\n"
|
||||
. "EPICS-Base: $epics_base\n\n" if $opt_d;
|
||||
. " Templ-Top: $top\n"
|
||||
. "Templ-Type: $apptype\n"
|
||||
. "Templ-Name: $apptypename\n"
|
||||
. " opt_i: $opt_i\n"
|
||||
. " arch: $arch\n"
|
||||
. "EPICS-Base: $epics_base\n\n" if $opt_d;
|
||||
}
|
||||
|
||||
#
|
||||
@@ -309,13 +309,13 @@ sub ListAppTypes { # no args
|
||||
my @boots = grep /.*Boot$/, @allfiles;
|
||||
print "Valid application types are:\n";
|
||||
foreach $name (@apps) {
|
||||
$name =~ s|App||;
|
||||
printf "\t$name\n" if ($name && -r "$top/$name" . "App");
|
||||
$name =~ s|App||;
|
||||
printf "\t$name\n" if ($name && -r "$top/$name" . "App");
|
||||
}
|
||||
print "Valid iocBoot types are:\n";
|
||||
foreach $name (@boots) {
|
||||
$name =~ s|Boot||;
|
||||
printf "\t$name\n" if ($name && -r "$top/$name" . "Boot");;
|
||||
$name =~ s|Boot||;
|
||||
printf "\t$name\n" if ($name && -r "$top/$name" . "Boot");;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,28 +327,28 @@ sub CopyFile { # (source)
|
||||
$target = ReplaceFilename($source);
|
||||
|
||||
if ($target and !-e $target) {
|
||||
open(INP, "<$source") and open(OUT, ">$target")
|
||||
or die "$! Copying $source -> $target";
|
||||
open(INP, "<$source") and open(OUT, ">$target")
|
||||
or die "$! Copying $source -> $target";
|
||||
|
||||
print "Copying file $source -> $target\n" if $opt_d;
|
||||
while (<INP>) {
|
||||
print OUT ReplaceLine($_);
|
||||
}
|
||||
close INP; close OUT;
|
||||
print "Copying file $source -> $target\n" if $opt_d;
|
||||
while (<INP>) {
|
||||
print OUT ReplaceLine($_);
|
||||
}
|
||||
close INP; close OUT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Find() callback for file or structure copy
|
||||
#
|
||||
sub FCopyTree {
|
||||
chdir $app_top; # Sigh
|
||||
if (-d "$File::Find::name"
|
||||
and ($dir = ReplaceFilename($File::Find::name))) {
|
||||
print "Creating directory $dir\n" if $opt_d;
|
||||
mkpath($dir) unless (-d "$dir");
|
||||
and ($dir = ReplaceFilename($File::Find::name))) {
|
||||
print "Creating directory $dir\n" if $opt_d;
|
||||
mkpath($dir) unless (-d "$dir");
|
||||
} else {
|
||||
CopyFile($File::Find::name);
|
||||
CopyFile($File::Find::name);
|
||||
}
|
||||
chdir $File::Find::dir;
|
||||
}
|
||||
@@ -360,9 +360,9 @@ sub Cleanup { # (return-code [ messsage-line1, line 2, ... ])
|
||||
my ($rtncode, @message) = @_;
|
||||
|
||||
if (@message) {
|
||||
print join("\n", @message), "\n";
|
||||
print join("\n", @message), "\n";
|
||||
} else {
|
||||
Usage();
|
||||
Usage();
|
||||
}
|
||||
exit $rtncode;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ EPICS_MBA_DEF_APP_TYPE Application type you want to use as default
|
||||
EPICS_MBA_TEMPLATE_TOP Template top directory
|
||||
EPICS_MBA_BASE Location of EPICS base
|
||||
|
||||
Example: Create exampleApp
|
||||
Example: Create exampleApp
|
||||
|
||||
<base>/bin/<arch>/makeBaseApp.pl -t example example
|
||||
<base>/bin/<arch>/makeBaseApp.pl -i -t example example
|
||||
@@ -422,10 +422,10 @@ sub GetUser {
|
||||
$user = Win32::LoginName() if !$user && $^ eq 'MSWin32';
|
||||
|
||||
unless ($user) {
|
||||
print "Strange, I cannot figure out your user name!\n";
|
||||
print "What should you be called ? ";
|
||||
$user = <STDIN>;
|
||||
chomp $user;
|
||||
print "Strange, I cannot figure out your user name!\n";
|
||||
print "What should you be called ? ";
|
||||
$user = <STDIN>;
|
||||
chomp $user;
|
||||
}
|
||||
$user =~ tr/-a-zA-Z0-9_:;[]<>//cd; # Sanitize; these are the legal chars
|
||||
die "No user name" unless $user;
|
||||
|
||||
@@ -19,7 +19,7 @@ use Getopt::Std;
|
||||
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||
|
||||
use FindBin qw($Bin);
|
||||
use lib ("$Bin/../../lib/perl");
|
||||
use lib ("$Bin/../../lib/perl", $Bin);
|
||||
|
||||
use EPICS::Path;
|
||||
use EPICS::Release;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Operator of Los Alamos National Laboratory.
|
||||
# EPICS BASE Versions 3.13.7
|
||||
# and higher are distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
|
||||
# Converts text file in DOS CR/LF format to unix ISO format
|
||||
@@ -23,9 +23,9 @@ foreach( @files ) {
|
||||
open(OUTPUT, ">$_");
|
||||
binmode OUTPUT, ":raw";
|
||||
while(<INPUT>) {
|
||||
# Remove CR-LF sequences
|
||||
s/\r\n/\n/;
|
||||
print OUTPUT;
|
||||
# Remove CR-LF sequences
|
||||
s/\r\n/\n/;
|
||||
print OUTPUT;
|
||||
}
|
||||
close INPUT;
|
||||
close OUTPUT;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Operator of Los Alamos National Laboratory.
|
||||
# EPICS BASE Versions 3.13.7
|
||||
# and higher are distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
#
|
||||
# makeMakefile.pl
|
||||
@@ -24,16 +24,16 @@ $b_t="";
|
||||
|
||||
if ($type ne "")
|
||||
{
|
||||
$b_t = "B_T=$type";
|
||||
$b_t = "B_T=$type";
|
||||
}
|
||||
|
||||
if ($dir =~ m'O.(.+)')
|
||||
{
|
||||
$t_a = $1;
|
||||
$t_a = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Cannot extract T_A from $dir";
|
||||
die "Cannot extract T_A from $dir";
|
||||
}
|
||||
|
||||
mkdir ($dir, 0777) unless -d $dir;
|
||||
|
||||
Reference in New Issue
Block a user