Compare commits
4 commits
4ec7e1b6c1
...
34936d25f0
| Author | SHA1 | Date | |
|---|---|---|---|
| 34936d25f0 | |||
| 8b92756595 | |||
| c3a3d1df1c | |||
| 3465d3ee9f |
12 changed files with 160 additions and 58 deletions
8
ctl
8
ctl
|
|
@ -11,21 +11,23 @@ if [ "$action" = "init" ]; then
|
||||||
BASE=`pwd`
|
BASE=`pwd`
|
||||||
python3 -m venv --system-site-packages .
|
python3 -m venv --system-site-packages .
|
||||||
|
|
||||||
|
branch=`cat .git/HEAD | sed 's@/@\n@g' | tail -n1`
|
||||||
|
|
||||||
# Work around broken venv module in Ubuntu 16.04 / Debian 9
|
# Work around broken venv module in Ubuntu 16.04 / Debian 9
|
||||||
if [ ! -e bin/pip ]; then
|
if [ ! -e bin/pip ]; then
|
||||||
bin/python3 -m pip install -U --ignore-installed "pip<9"
|
bin/python3 -m pip install -U --ignore-installed "pip<9"
|
||||||
fi
|
fi
|
||||||
if [ ! -d static/oxjs ]; then
|
if [ ! -d static/oxjs ]; then
|
||||||
git clone --depth 1 https://git.0x2620.org/oxjs.git static/oxjs
|
git clone --depth 1 -b $branch https://git.0x2620.org/oxjs.git static/oxjs
|
||||||
fi
|
fi
|
||||||
mkdir -p src
|
mkdir -p src
|
||||||
if [ ! -d src/oxtimelines ]; then
|
if [ ! -d src/oxtimelines ]; then
|
||||||
git clone --depth 1 https://git.0x2620.org/oxtimelines.git src/oxtimelines
|
git clone --depth 1 -b $branch https://git.0x2620.org/oxtimelines.git src/oxtimelines
|
||||||
fi
|
fi
|
||||||
for package in oxtimelines python-ox; do
|
for package in oxtimelines python-ox; do
|
||||||
cd ${BASE}
|
cd ${BASE}
|
||||||
if [ ! -d src/${package} ]; then
|
if [ ! -d src/${package} ]; then
|
||||||
git clone --depth 1 https://git.0x2620.org/${package}.git src/${package}
|
git clone --depth 1 -b $branch https://git.0x2620.org/${package}.git src/${package}
|
||||||
fi
|
fi
|
||||||
cd ${BASE}/src/${package}
|
cd ${BASE}/src/${package}
|
||||||
${BASE}/bin/python setup.py develop
|
${BASE}/bin/python setup.py develop
|
||||||
|
|
|
||||||
|
|
@ -713,7 +713,8 @@
|
||||||
{
|
{
|
||||||
"id": "dateofcensorcertificate",
|
"id": "dateofcensorcertificate",
|
||||||
"title": "Date of Censor Certificate",
|
"title": "Date of Censor Certificate",
|
||||||
"type": "date"
|
"find": true,
|
||||||
|
"type": ["date"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "certificationcentre",
|
"id": "certificationcentre",
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,11 @@ def buildCondition(k, op, v, user, exclude=False, owner=None):
|
||||||
key_type = get_key_type(k)
|
key_type = get_key_type(k)
|
||||||
facet_keys = models.Document.facet_keys
|
facet_keys = models.Document.facet_keys
|
||||||
if k == 'id':
|
if k == 'id':
|
||||||
v = ox.fromAZ(v)
|
if op == '&' and isinstance(v, list):
|
||||||
|
v = [ox.fromAZ(id_) for id_ in v]
|
||||||
|
k += get_operator(op)
|
||||||
|
else:
|
||||||
|
v = ox.fromAZ(v)
|
||||||
q = Q(**{k: v})
|
q = Q(**{k: v})
|
||||||
if exclude:
|
if exclude:
|
||||||
q = ~Q(id__in=models.Document.objects.filter(q))
|
q = ~Q(id__in=models.Document.objects.filter(q))
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@ def parseCondition(condition, user, owner=None):
|
||||||
key_type = (utils.get_by_id(settings.CONFIG['itemKeys'], k) or {'type': 'string'}).get('type')
|
key_type = (utils.get_by_id(settings.CONFIG['itemKeys'], k) or {'type': 'string'}).get('type')
|
||||||
if isinstance(key_type, list):
|
if isinstance(key_type, list):
|
||||||
key_type = key_type[0]
|
key_type = key_type[0]
|
||||||
|
type_is_list = True
|
||||||
|
else:
|
||||||
|
type_is_list = False
|
||||||
key_type = {
|
key_type = {
|
||||||
'title': 'string',
|
'title': 'string',
|
||||||
'person': 'string',
|
'person': 'string',
|
||||||
|
|
@ -114,7 +117,7 @@ def parseCondition(condition, user, owner=None):
|
||||||
if exclude:
|
if exclude:
|
||||||
q = ~Q(id__in=models.Item.objects.filter(q))
|
q = ~Q(id__in=models.Item.objects.filter(q))
|
||||||
return q
|
return q
|
||||||
elif key_type == "string":
|
elif key_type == "string" or (key_type == 'date' and type_is_list):
|
||||||
in_find = not k.startswith('public_id')
|
in_find = not k.startswith('public_id')
|
||||||
if in_find:
|
if in_find:
|
||||||
value_key = 'find__value'
|
value_key = 'find__value'
|
||||||
|
|
@ -166,7 +169,7 @@ def parseCondition(condition, user, owner=None):
|
||||||
else:
|
else:
|
||||||
q = Q(id=0)
|
q = Q(id=0)
|
||||||
return q
|
return q
|
||||||
elif key_type == 'date':
|
elif key_type == 'date' and not type_is_list:
|
||||||
def parse_date(d):
|
def parse_date(d):
|
||||||
while len(d) < 3:
|
while len(d) < 3:
|
||||||
d.append(1)
|
d.append(1)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ def get_operator(op, type='str'):
|
||||||
'<=': '__lte',
|
'<=': '__lte',
|
||||||
'^': '__startswith',
|
'^': '__startswith',
|
||||||
'$': '__endswith',
|
'$': '__endswith',
|
||||||
|
'&': '__in',
|
||||||
},
|
},
|
||||||
'istr': {
|
'istr': {
|
||||||
'==': '__iexact',
|
'==': '__iexact',
|
||||||
|
|
@ -20,6 +21,7 @@ def get_operator(op, type='str'):
|
||||||
'<=': '__lte',
|
'<=': '__lte',
|
||||||
'^': '__istartswith',
|
'^': '__istartswith',
|
||||||
'$': '__iendswith',
|
'$': '__iendswith',
|
||||||
|
'&': '__in',
|
||||||
},
|
},
|
||||||
'int': {
|
'int': {
|
||||||
'==': '',
|
'==': '',
|
||||||
|
|
@ -27,6 +29,7 @@ def get_operator(op, type='str'):
|
||||||
'>=': '__gte',
|
'>=': '__gte',
|
||||||
'<': '__lt',
|
'<': '__lt',
|
||||||
'<=': '__lte',
|
'<=': '__lte',
|
||||||
|
'&': '__in',
|
||||||
}
|
}
|
||||||
}[type].get(op, {
|
}[type].get(op, {
|
||||||
'str': '__contains',
|
'str': '__contains',
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,32 @@ pandora.ui.addItemDialog = function(options) {
|
||||||
pandora.api.getMediaUrlInfo({
|
pandora.api.getMediaUrlInfo({
|
||||||
url: input
|
url: input
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
onInfo(result.data.items.map(getVideoInfo));
|
if (requslt.data.items.length) {
|
||||||
|
onInfo(result.data.items.map(getVideoInfo));
|
||||||
|
} else {
|
||||||
|
$screen.stop();
|
||||||
|
that.close();
|
||||||
|
var error = Ox.Dialog({
|
||||||
|
buttons: [
|
||||||
|
{},
|
||||||
|
Ox.Button({
|
||||||
|
id: 'close',
|
||||||
|
title: Ox._('Close')
|
||||||
|
}).bindEvent({
|
||||||
|
click: function() {
|
||||||
|
error.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
|
closeButton: true,
|
||||||
|
content: Ox.Element().css({padding: '32px'}).html('Import failed'),
|
||||||
|
height: 96,
|
||||||
|
keys: {escape: 'close'},
|
||||||
|
removeOnClose: true,
|
||||||
|
title: Ox._('Import Error'),
|
||||||
|
width: 192
|
||||||
|
}).open()
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,14 +78,14 @@ pandora.ui.editDialog = function() {
|
||||||
pandora.api.find({
|
pandora.api.find({
|
||||||
keys: keys,
|
keys: keys,
|
||||||
query: {
|
query: {
|
||||||
conditions: ids.map(function(id) {
|
conditions: [
|
||||||
return {
|
{
|
||||||
key: 'id',
|
key: 'id',
|
||||||
operator: '==',
|
operator: '&',
|
||||||
value: id
|
value: ids
|
||||||
};
|
}
|
||||||
}),
|
],
|
||||||
operator: '|'
|
operator: '&'
|
||||||
}
|
}
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
var data = {},
|
var data = {},
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,14 @@ pandora.ui.editDocumentsDialog = function() {
|
||||||
pandora.api.findDocuments({
|
pandora.api.findDocuments({
|
||||||
keys: keys,
|
keys: keys,
|
||||||
query: {
|
query: {
|
||||||
conditions: ids.map(function(id) {
|
conditions: [
|
||||||
return {
|
{
|
||||||
key: 'id',
|
key: 'id',
|
||||||
operator: '==',
|
operator: '&',
|
||||||
value: id
|
value: ids
|
||||||
};
|
}
|
||||||
}),
|
],
|
||||||
operator: '|'
|
operator: '&'
|
||||||
}
|
}
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
var data = {},
|
var data = {},
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,13 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
listWidth = 0,
|
listWidth = 0,
|
||||||
margin = 16,
|
margin = 16,
|
||||||
// these may contain commas, and are thus separated by semicolons
|
// these may contain commas, and are thus separated by semicolons
|
||||||
specialListKeys = ['alternativeTitles', 'productionCompany'],
|
specialListKeys = ['alternativeTitles', 'productionCompany'].concat(
|
||||||
|
pandora.site.itemKeys.filter(function(key) {
|
||||||
|
return key.type[0] == 'date'
|
||||||
|
}).map(function(key) {
|
||||||
|
return key.id;
|
||||||
|
})
|
||||||
|
),
|
||||||
nameKeys = pandora.site.itemKeys.filter(function(key) {
|
nameKeys = pandora.site.itemKeys.filter(function(key) {
|
||||||
return key.sortType == 'person';
|
return key.sortType == 'person';
|
||||||
}).map(function(key) {
|
}).map(function(key) {
|
||||||
|
|
@ -625,6 +631,7 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
|
|
||||||
function editMetadata(key, value) {
|
function editMetadata(key, value) {
|
||||||
if (value != data[key]) {
|
if (value != data[key]) {
|
||||||
|
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
|
||||||
var edit = {id: isMultiple ? ui.listSelection : data.id};
|
var edit = {id: isMultiple ? ui.listSelection : data.id};
|
||||||
if (key == 'alternativeTitles') {
|
if (key == 'alternativeTitles') {
|
||||||
edit[key] = value ? Ox.decodeHTMLEntities(value).split('; ').map(function(value) {
|
edit[key] = value ? Ox.decodeHTMLEntities(value).split('; ').map(function(value) {
|
||||||
|
|
@ -645,12 +652,12 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
: [];
|
: [];
|
||||||
} else if (key == 'imdbId') {
|
} else if (key == 'imdbId') {
|
||||||
edit[key] = value.match(/\d{7}/)[0];
|
edit[key] = value.match(/\d{7}/)[0];
|
||||||
} else if (key == 'dateofcensorcertificate') {
|
|
||||||
value = cleanupDate(value);
|
|
||||||
edit[key] = value;
|
|
||||||
} else {
|
} else {
|
||||||
edit[key] = value;
|
edit[key] = value;
|
||||||
}
|
}
|
||||||
|
if (itemKey && itemKey.type && itemKey.type[0] == 'date') {
|
||||||
|
edit[key] = edit[key].map(cleanupDate);
|
||||||
|
}
|
||||||
pandora.api.edit(edit, function(result) {
|
pandora.api.edit(edit, function(result) {
|
||||||
if (!isMultiple) {
|
if (!isMultiple) {
|
||||||
var src;
|
var src;
|
||||||
|
|
@ -717,12 +724,14 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
return '<span class="OxLight">' + str + '</span>';
|
return '<span class="OxLight">' + str + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatLink(value, key) {
|
function formatLink(value, key, linkValue) {
|
||||||
return (Ox.isArray(value) ? value : [value]).map(function(value) {
|
linkValue = linkValue || value
|
||||||
|
linkValue = Ox.isArray(linkValue) ? linkValue: [linkValue]
|
||||||
|
return (Ox.isArray(value) ? value : [value]).map(function(value, idx) {
|
||||||
return key
|
return key
|
||||||
? '<a href="/' + (
|
? '<a href="/' + (
|
||||||
key == 'alternativeTitles' ? 'title' : key
|
key == 'alternativeTitles' ? 'title' : key
|
||||||
) + '=' + pandora.escapeQueryValue(value) + '">' + value + '</a>'
|
) + '=' + pandora.escapeQueryValue(linkValue[idx]) + '">' + value + '</a>'
|
||||||
: value;
|
: value;
|
||||||
}).join(Ox.contains(specialListKeys, key) ? '; ' : ', ');
|
}).join(Ox.contains(specialListKeys, key) ? '; ' : ', ');
|
||||||
}
|
}
|
||||||
|
|
@ -744,7 +753,17 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
var ret;
|
var ret;
|
||||||
if (key == 'year') {
|
if (key == 'year') {
|
||||||
ret = formatLink(value, 'year');
|
ret = formatLink(value, 'year');
|
||||||
} else if (['releasedate', 'dateofcensorcertificate'].indexOf(key) > -1) {
|
} else if (
|
||||||
|
listKeys.indexOf(key) > -1 && Ox.getObjectById(pandora.site.itemKeys, key).type[0] == 'date'
|
||||||
|
) {
|
||||||
|
ret = value.split('; ').map(function(date) {
|
||||||
|
date = cleanupDate(date)
|
||||||
|
return date ? formatLink(Ox.formatDate(date,
|
||||||
|
['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length],
|
||||||
|
true
|
||||||
|
), key, date) : '';
|
||||||
|
}).join('; ');
|
||||||
|
} else if (['releasedate'].indexOf(key) > -1) {
|
||||||
value = cleanupDate(value);
|
value = cleanupDate(value);
|
||||||
ret = value ? Ox.formatDate(value,
|
ret = value ? Ox.formatDate(value,
|
||||||
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length],
|
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length],
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,13 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
}).map(function(key){
|
}).map(function(key){
|
||||||
return key.id;
|
return key.id;
|
||||||
}),
|
}),
|
||||||
|
specialListKeys = [].concat(
|
||||||
|
pandora.site.itemKeys.filter(function(key) {
|
||||||
|
return key.type[0] == 'date'
|
||||||
|
}).map(function(key) {
|
||||||
|
return key.id;
|
||||||
|
})
|
||||||
|
),
|
||||||
posterKeys = nameKeys.concat(['title', 'year']),
|
posterKeys = nameKeys.concat(['title', 'year']),
|
||||||
statisticsWidth = 128,
|
statisticsWidth = 128,
|
||||||
|
|
||||||
|
|
@ -364,16 +371,37 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
|
|
||||||
$('<div>').css({height: '16px'}).appendTo($statistics);
|
$('<div>').css({height: '16px'}).appendTo($statistics);
|
||||||
|
|
||||||
|
function cleanupDate(value) {
|
||||||
|
if (/\d{2}-\d{2}-\d{4}/.test(value)) {
|
||||||
|
value = Ox.reverse(value.split('-')).join('-')
|
||||||
|
}
|
||||||
|
if (/\d{4}i\/\d{2}\/\d{d}/.test(value)) {
|
||||||
|
value = value.split('/').join('-')
|
||||||
|
}
|
||||||
|
if (/\d{2}\/\d{2}\/\d{4}/.test(value)) {
|
||||||
|
value = Ox.reverse(value.split('/')).join('-')
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
function editMetadata(key, value) {
|
function editMetadata(key, value) {
|
||||||
if (value != data[key]) {
|
if (value != data[key]) {
|
||||||
|
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
|
||||||
var edit = {id: isMultiple ? ui.listSelection : data.id};
|
var edit = {id: isMultiple ? ui.listSelection : data.id};
|
||||||
if (key == 'title') {
|
if (key == 'title') {
|
||||||
edit[key] = value;
|
edit[key] = value;
|
||||||
} else if (listKeys.indexOf(key) >= 0) {
|
} else if (listKeys.indexOf(key) >= 0) {
|
||||||
edit[key] = value ? value.split(', ') : [];
|
edit[key] = value ? value.split(', ') : [];
|
||||||
|
} else if (specialListKeys.indexOf(key) > -1) {
|
||||||
|
edit[key] = value
|
||||||
|
? Ox.decodeHTMLEntities(value).split('; ').map(Ox.encodeHTMLEntities)
|
||||||
|
: [];
|
||||||
} else {
|
} else {
|
||||||
edit[key] = value ? value : null;
|
edit[key] = value ? value : null;
|
||||||
}
|
}
|
||||||
|
if (itemKey && itemKey.type && itemKey.type[0] == 'date') {
|
||||||
|
edit[key] = edit[key].map(cleanupDate);
|
||||||
|
}
|
||||||
pandora.api.edit(edit, function(result) {
|
pandora.api.edit(edit, function(result) {
|
||||||
if (!isMultiple) {
|
if (!isMultiple) {
|
||||||
var src;
|
var src;
|
||||||
|
|
@ -425,20 +453,40 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
return '<span class="OxLight">' + str + '</span>';
|
return '<span class="OxLight">' + str + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatLink(value, key) {
|
|
||||||
return (Ox.isArray(value) ? value : [value]).map(function(value) {
|
function formatLink(value, key, linkValue) {
|
||||||
|
linkValue = linkValue || value
|
||||||
|
linkValue = Ox.isArray(linkValue) ? linkValue: [linkValue]
|
||||||
|
return (Ox.isArray(value) ? value : [value]).map(function(value, idx) {
|
||||||
return key
|
return key
|
||||||
? '<a href="/' + key + '=' + value + '">' + value + '</a>'
|
? '<a href="/' + (
|
||||||
|
key == 'alternativeTitles' ? 'title' : key
|
||||||
|
) + '=' + pandora.escapeQueryValue(linkValue[idx]) + '">' + value + '</a>'
|
||||||
: value;
|
: value;
|
||||||
}).join(', ');
|
}).join(Ox.contains(specialListKeys, key) ? '; ' : ', ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatValue(key, value) {
|
function formatValue(key, value) {
|
||||||
var ret;
|
var ret;
|
||||||
if (nameKeys.indexOf(key) > -1) {
|
if (nameKeys.indexOf(key) > -1) {
|
||||||
ret = formatLink(value.split(', '), 'name');
|
ret = formatLink(value.split(', '), 'name');
|
||||||
|
} else if (
|
||||||
|
listKeys.indexOf(key) > -1 && Ox.getObjectById(pandora.site.itemKeys, key).type[0] == 'date'
|
||||||
|
) {
|
||||||
|
ret = value.split('; ').map(function(date) {
|
||||||
|
date = cleanupDate(date)
|
||||||
|
return date ? formatLink(Ox.formatDate(date,
|
||||||
|
['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length],
|
||||||
|
true
|
||||||
|
), key, date) : '';
|
||||||
|
}).join('; ');
|
||||||
} else if (listKeys.indexOf(key) > -1) {
|
} else if (listKeys.indexOf(key) > -1) {
|
||||||
ret = formatLink(value.split(', '), key);
|
ret = formatLink(value.split(', '), key);
|
||||||
|
} else if (specialListKeys.indexOf(key) > -1) {
|
||||||
|
ret = formatLink(
|
||||||
|
Ox.decodeHTMLEntities(value).split('; ').map(Ox.encodeHTMLEntities),
|
||||||
|
key
|
||||||
|
);
|
||||||
} else if (['year', 'country'].indexOf(key) > -1) {
|
} else if (['year', 'country'].indexOf(key) > -1) {
|
||||||
ret = formatLink(value, key);
|
ret = formatLink(value, key);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -458,6 +506,7 @@ pandora.ui.infoView = function(data, isMixed) {
|
||||||
|
|
||||||
function getValue(key, value) {
|
function getValue(key, value) {
|
||||||
return !value ? ''
|
return !value ? ''
|
||||||
|
: Ox.contains(specialListKeys, key) ? value.join('; ')
|
||||||
: Ox.contains(listKeys, key) ? value.join(', ')
|
: Ox.contains(listKeys, key) ? value.join(', ')
|
||||||
: value;
|
: value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
42
update.py
42
update.py
|
|
@ -121,6 +121,11 @@ def run_git(path, *args):
|
||||||
def get_version(path):
|
def get_version(path):
|
||||||
return run_git(path, 'rev-list', 'HEAD', '--count')
|
return run_git(path, 'rev-list', 'HEAD', '--count')
|
||||||
|
|
||||||
|
def get_branch(path=None):
|
||||||
|
if not path:
|
||||||
|
path = '.'
|
||||||
|
return get('cat', os.path.join(path, '.git/HEAD')).strip().split('/')[-1]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
base = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
|
base = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
|
||||||
|
|
@ -254,49 +259,38 @@ if __name__ == "__main__":
|
||||||
run('./pandora/manage.py', 'createcachetable')
|
run('./pandora/manage.py', 'createcachetable')
|
||||||
else:
|
else:
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
release = get_release()
|
branch = get_branch()
|
||||||
repos = release['repositories']
|
development = branch == 'master'
|
||||||
|
elif len(sys.argv) == 3 and sys.argv[1] == 'switch':
|
||||||
|
branch = sys.argv[2]
|
||||||
development = False
|
development = False
|
||||||
else:
|
else:
|
||||||
release = {
|
branch = 'master'
|
||||||
'date': 'development'
|
|
||||||
}
|
|
||||||
development = True
|
development = True
|
||||||
os.chdir(base)
|
os.chdir(base)
|
||||||
current = ''
|
current = ''
|
||||||
new = ''
|
new = ''
|
||||||
if development:
|
|
||||||
if get('git', 'symbolic-ref', 'HEAD').strip().split('/')[-1] != 'master':
|
|
||||||
print('update only possible if you are on master branch')
|
|
||||||
sys.exit(1)
|
|
||||||
for repo in sorted(repos, key=lambda r: repos[r]['path']):
|
for repo in sorted(repos, key=lambda r: repos[r]['path']):
|
||||||
path = os.path.join(base, repos[repo]['path'])
|
path = os.path.join(base, repos[repo]['path'])
|
||||||
if exists(path):
|
if exists(path):
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
|
current_branch = get_branch(path)
|
||||||
|
if current_branch != branch:
|
||||||
|
run('git', 'checkout', branch)
|
||||||
revno = get_version(path)
|
revno = get_version(path)
|
||||||
if repo == 'pandora':
|
if repo == 'pandora':
|
||||||
pandora_old_revno = revno
|
pandora_old_revno = revno
|
||||||
current += revno
|
current += revno
|
||||||
url = repos[repo]['url']
|
url = repos[repo]['url']
|
||||||
if 'revision' in repos[repo]:
|
print('Checking', repo)
|
||||||
if revno != repos[repo]['revision']:
|
run('git', 'pull')
|
||||||
run('git', 'fetch')
|
|
||||||
run('git', 'checkout', repos[repo]['commit'])
|
|
||||||
else:
|
|
||||||
print('Checking', repo)
|
|
||||||
#run('git', 'checkout', 'master', '-q')
|
|
||||||
run('git', 'pull')
|
|
||||||
revno = get_version(path)
|
revno = get_version(path)
|
||||||
new += revno
|
new += revno
|
||||||
if repo == 'pandora':
|
if repo == 'pandora':
|
||||||
pandora_new_revno = revno
|
pandora_new_revno = revno
|
||||||
else:
|
else:
|
||||||
os.chdir(os.path.dirname(path))
|
os.chdir(os.path.dirname(path))
|
||||||
if 'revision' in repos[repo]:
|
run('git', 'clone', '--depth', '1', repos[repo]['url'])
|
||||||
run('git', 'clone', repos[repo]['url'])
|
|
||||||
run_git(path, 'checkout', repos[repo]['commit'])
|
|
||||||
else:
|
|
||||||
run('git', 'clone', '--depth', '1', repos[repo]['url'])
|
|
||||||
setup = os.path.join(base, repos[repo]['path'], 'setup.py')
|
setup = os.path.join(base, repos[repo]['path'], 'setup.py')
|
||||||
if repo in ('python-ox', 'oxtimelines') and os.path.exists(setup):
|
if repo in ('python-ox', 'oxtimelines') and os.path.exists(setup):
|
||||||
os.chdir(os.path.dirname(setup))
|
os.chdir(os.path.dirname(setup))
|
||||||
|
|
@ -317,7 +311,7 @@ if __name__ == "__main__":
|
||||||
'BEGIN;\n-- Model missing for table: cache\nCOMMIT;'
|
'BEGIN;\n-- Model missing for table: cache\nCOMMIT;'
|
||||||
]:
|
]:
|
||||||
print('Database has changed, please make a backup and run %s db' % sys.argv[0])
|
print('Database has changed, please make a backup and run %s db' % sys.argv[0])
|
||||||
elif not development:
|
elif branch != 'master':
|
||||||
print('pan.do/ra is at the latest release,\nyou can run "%s dev" to update to the development version' % sys.argv[0])
|
print('pan.do/ra is at the latest release,\nyou can run "%s switch master" to switch to the development version' % sys.argv[0])
|
||||||
elif current != new:
|
elif current != new:
|
||||||
reload_notice(base)
|
reload_notice(base)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ PANDORA=${PANDORA-pandora}
|
||||||
POSTGRES=${POSTGRES-local}
|
POSTGRES=${POSTGRES-local}
|
||||||
RABBITMQ=${RABBITMQ-local}
|
RABBITMQ=${RABBITMQ-local}
|
||||||
NGINX=${NGINX-local}
|
NGINX=${NGINX-local}
|
||||||
|
BRANCH=${BRANCH-stable}
|
||||||
|
|
||||||
echo Installing pandora with user: $PANDORA
|
echo Installing pandora with user: $PANDORA
|
||||||
getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA
|
getent passwd $PANDORA > /dev/null 2>&1 || adduser --disabled-password --gecos "" $PANDORA
|
||||||
|
|
@ -111,6 +112,7 @@ fi
|
||||||
#pandora
|
#pandora
|
||||||
git clone https://git.0x2620.org/pandora.git /srv/pandora
|
git clone https://git.0x2620.org/pandora.git /srv/pandora
|
||||||
cd /srv/pandora
|
cd /srv/pandora
|
||||||
|
git checkout $BRANCH
|
||||||
./ctl init
|
./ctl init
|
||||||
|
|
||||||
HOST=$(hostname -s)
|
HOST=$(hostname -s)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue