# along with Elixir. If not, see <http://www.gnu.org/licenses/>. # Throughout, an "idx" is the sequential number associated with a blob. # This is different from that blob's Git hash. from sys import argv from lib import scriptLines import lib import data import os from data import PathList from threading import Thread, Lock, Event, Condition verbose = False db = data.DB(lib.getDataDir(), readonly=False) hash_file_lock = Lock() #Lock for db.hash and db.file defs_lock = Lock() #Lock for db.defs tag_ready = Condition() #Waiting for new tags new_idxes = [] # (new idxes, Event idxes ready, Event defs ready) tags_done = False #True if all tags have been added to new_idxes class UpdateIdVersion(Thread): def __init__(self, tag_buf): Thread.__init__(self, name="UpdateIdVersionElixir") self.tag_buf = tag_buf
# along with Elixir. If not, see <http://www.gnu.org/licenses/>. from sys import argv from lib import script, scriptLines import lib import data import os from data import PathList try: dbDir = os.environ['LXR_DATA_DIR'] except KeyError: print(argv[0] + ': LXR_DATA_DIR needs to be set') exit(1) db = data.DB(dbDir, readonly=False) def updateBlobIDs(tag): if db.vars.exists('numBlobs'): idx = db.vars.get('numBlobs') else: idx = 0 blobs = scriptLines('list-blobs', '-f', tag) newBlobs = [] for blob in blobs: hash, filename = blob.split(b' ', maxsplit=1) if not db.blob.exists(hash): db.blob.put(hash, idx)
from sys import argv from threading import Thread, Lock, Event, Condition import lib from lib import script, scriptLines import data from data import PathList from find_compatible_dts import FindCompatibleDTS verbose = False dts_comp_support = int(script('dts-comp')) compatibles_parser = FindCompatibleDTS() db = data.DB(lib.getDataDir(), readonly=False, dtscomp=dts_comp_support) # Number of cpu threads (+2 for version indexing) cpu = 10 threads_list = [] hash_file_lock = Lock() # Lock for db.hash and db.file blobs_lock = Lock() # Lock for db.blobs defs_lock = Lock() # Lock for db.defs refs_lock = Lock() # Lock for db.refs docs_lock = Lock() # Lock for db.docs comps_lock = Lock() # Lock for db.comps comps_docs_lock = Lock() # Lock for db.comps_docs tag_ready = Condition() # Waiting for new tags new_idxes = [
# # You should have received a copy of the GNU Affero General Public License # along with Elixir. If not, see <http://www.gnu.org/licenses/>. from lib import script, scriptLines import lib import data import os try: dbDir = os.environ['LXR_DATA_DIR'] except KeyError: print ('LXR_DATA_DIR needs to be set') exit (1) db = data.DB (dbDir, readonly=True) from io import BytesIO def query (cmd, *args): buffer = BytesIO() def echo (arg): buffer.write (arg) if cmd == 'versions': for p in scriptLines ('list-tags', '-h'): if db.vers.exists (p.split(b' ')[2]): echo (p + b'\n') elif cmd == 'latest':
# # Elixir is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with Elixir. If not, see <http://www.gnu.org/licenses/>. from lib import script, scriptLines import lib import data import os from collections import OrderedDict db = data.DB(lib.getDataDir(), readonly=True) from io import BytesIO class SymbolInstance(object): def __init__(self, path, line, type=None): self.path = path self.line = line self.type = type def __repr__(self): type_repr = "" if self.type: type_repr = f" , type: {self.type}"
import flask from flask import redirect from flask import session from flask import url_for import data app = flask.Flask(__name__, static_folder='./KMS', template_folder='./KMS/templates', static_url_path='', instance_relative_config=True) app.config.from_object('config') #app.config.from_pyfile('config.py') database = data.DB() def login_require(session): if 'user' in session: return False else: session.clear() return True @app.route('/') def dashboard(): if login_require(session): return redirect(url_for('login'))