text:
DESCRIPTION ?= "Small initramfs for booting NILRT NXG targets"
LICENSE = "MIT"

PACKAGE_INSTALL = "init-nilrt-ramfs"

BAD_RECOMMENDATIONS += "shared-mime-info ca-certificates"

require includes/nilrt-core-image.inc

repository: ni/meta-nilrt

repo_name: ni/meta-nilrt

branch_name: refs/heads/nilrt/master/kirkstone

gha_license_id: MIT

gha_language: Shell

extension: bb


text:
package charset

import (
	"reflect"
	"testing"
)

func TestEncodeSemi(t *testing.T) {
	out := EncodeSemi(14, 06, 26, 21, 36, 30, 16)
	exp := []byte{0x41, 0x60, 0x62, 0x12, 0x63, 0x03, 0x61}
	if string(exp) != string(out) {
		t.Errorf("Expected %v, got %v\n", exp, out)
	}

}

func TestDecodeSemi(t *testing.T) {
	oct := []byte{0x41, 0x60, 0x62, 0x12, 0x63, 0x03, 0x61}
	out := DecodeSemi(oct)
	exp := []int{14, 06, 26, 21, 36, 30, 16}
	if !reflect.DeepEqual(exp, out) {
		t.Errorf("Expected %v, got %v\n", exp, out)
	}
}

license: MIT

repository: go-gsm/charset

license_type: permissive

repo_name: go-gsm/charset

branch_name: refs/heads/master

extension: go


text:
package domain

// Error domain-level error definition
type Error struct {
	Message string
}

// Error interface required method to implement custom error
func (d Error) Error() string {
	return d.Message
}

// BoardSize the size/length of playable board squares stored linearly
const BoardSize uint32 = 32

// RowLength the number of playable tiles in a given row on the board
const RowLength uint32 = 4

// Tile typedef for Tile enumeration
type Tile int32

// Tile enumeration for representing the checker board squares contents
const (
	NoPiece Tile = iota
	White
	Black
	WhitePromoted
	BlackPromoted
)

// Move a piece 'move' containing current location and requested destination
type Move struct {
	IndexFrom uint32
	IndexTo   uint32
}

// BoardState current state of the board represented by a slice of Tiles
type BoardState struct {
	Board []Tile
}

// BoardSubscriptionRequest incomming request to join a game
type BoardSubscriptionRequest struct {
	GameID string
}

// MoveRequest incomming request to make one or more consecutive moves
type MoveRequest struct {
	MoveSet  []Move
	PlayerID string
	GameID   string
}

// MoveResponse outgoing response with MoveSuccess indicator and optional Message
type MoveResponse struct {
	MoveSuccess bool
	Message     string
}

// BoardUpdate update state of board comprised of current state and previous move
type BoardUpdate struct {
	BoardState  BoardState
	PrevMoveSet []Move
}

// GameRole type definition for GameRole enumeration
type GameRole int32

// GameRole enumeration to represent a player's role in game
const (
	PlayerWhite GameRole = iota
	PlayerBlack
	Spectator
)

// GameStartRequest incoming request to join and start a game
type GameStartRequest struct {
	GameID string
}

// GameStartRole user role information represented by GameRole and paired with GameID
type GameStartRole struct {
	PlayerRole GameRole
	GameID     string
	PlayerID   string
}

// GameStartResponse outgoing response of gamestart with user's role and optional message
type GameStartResponse struct {
	GameData GameStartRole
	Message  string
}

repository: MettyS/checkers

repo_name: MettyS/checkers

branch_name: refs/heads/development

gha_language: TypeScript


text:
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_MINILOGER QUIET "libminilogger")
set(MINILOGER_DEFINITIONS ${PKG_MINILOGER_CFLAGS_OTHER})

find_path(MINILOGER_INCLUDE_DIR
    NAMES log.h
    HINTS ${PKG_MINILOGER_INCLUDEDIR} ${PKG_MINILOGER_INCLUDE_DIRS}
    PATH_SUFFIXES minilogger)

find_library(MINILOGER_LIBRARY
    NAMES minilogger
    HINTS ${PKG_MINILOGER_LIBDIR} ${PKG_MINILOGER_LIBRARY_DIRS})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MINILOGER DEFAULT_MSG
    MINILOGER_LIBRARY MINILOGER_INCLUDE_DIR)
mark_as_advanced(MINILOGER_FOUND MINILOGER_INCLUDE_DIR MINILOGER_LIBRARY)

if(NOT TARGET MiniLogger::MiniLogger)
    add_library(MiniLogger::MiniLogger UNKNOWN IMPORTED)
    set_property(TARGET MiniLogger::MiniLogger PROPERTY IMPORTED_LOCATION ${MINILOGER_LIBRARY})
    set_property(TARGET MiniLogger::MiniLogger PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${MINILOGER_INCLUDE_DIR}")
endif()

extension: cmake


text:
// Copyright © 2018 Hong Bin <hongbin119@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package cmd

import (
	"bufio"
	"bytes"
	"fmt"
	_ "github.com/go-sql-driver/mysql"
	"github.com/hpcloud/tail"
	"github.com/spf13/cobra"
	"os"
	"path/filepath"
	"sort"
	"strings"
	"time"
)

// doctorCmd represents the doctor command
var doctorCmd = &cobra.Command{
	Use:   "doctor",
	Short: "mysql error log anaylze & watch",
	Long:  `Anaylze & watch mysql error log about semaphore crash`,
	Run: func(cmd *cobra.Command, args []string) {

		if watch {
			watchErroLog()
		} else {
			logOutput(anaylzeErrorLog(filename))
		}
	},
}

var (
	filename string
	watch    bool
)

type logInfo struct {
	restartTime, semaphoreTime, writerState        []string
	mysqlVer                                       string
	restarts, semaphores                           int
	waitPoint, writer, lastWriteLock, lastReadLock map[string][]string
}

func init() {
	RootCmd.AddCommand(doctorCmd)

	// Analysis after a crash
	doctorCmd.Flags().StringVarP(&filename, "file", "f", "", "MySQL error log file")

	//Observed before the crash
	doctorCmd.Flags().BoolVarP(&watch, "watch", "w", false, "watch MySQL error log. Collect thread info if discovery semaphore wait ")
}
func watchErroLog() {

	dsn := fmt.Sprintf("%s:%s@(%s:%d)/", dbUser, dbPassWd, dbHost, dbPort)

	db := mysqlConnect(dsn)
	var logfile, datadir string
	db.QueryRow("select @@log_error as logfile;").Scan(&logfile)
	db.QueryRow("select @@datadir as datadir;").Scan(&datadir)

	if filepath.Dir(logfile) == "." {
		logfile = fmt.Sprintf("%s/%s", datadir, logfile)
	}

	t, err := tail.TailFile(logfile, tail.Config{Follow: true, ReOpen: true, Location: &tail.SeekInfo{Offset: 0, Whence: 2}, MustExist: true})
	ifErrWithLog(err, "")

	// SAVE QUERY RESULT
	f, err := os.OpenFile("watch.log", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0644)
	fmt.Println("collecting info save watch.log")
	ifErrWithPanic(err)
	defer f.Close()

	for line := range t.Lines {
		if strings.Contains(line.Text, "has reserved it in mode") {
			fmt.Println(line.Time.Format(time.RFC3339), line.Text)
			thd := strings.Trim(strings.Split(line.Text, " ")[4], ")")

			query := fmt.Sprintf("select /* mysqldba */ THREAD_OS_ID,PROCESSLIST_ID,PROCESSLIST_USER,PROCESSLIST_HOST,DIGEST_TEXT from performance_schema.threads t join performance_schema.events_statements_current e using(THREAD_ID) where t.THREAD_OS_ID='%s';", thd)

			rows, err := db.Query(query)
			ifErrWithLog(err, "")
			defer rows.Close()

			for rows.Next() {
				var clientUser, clientHost, digestText string
				var osid, procid int

				err := rows.Scan(&osid, &procid, &clientUser, &clientHost, &digestText)

				result := fmt.Sprintf("%v THREAD_OS_ID:%v PROCESSLIST_ID:%v PROCESSLIST_USER:%v PROCESSLIST_HOST:%v DIGEST_TEXT:%v \n", line.Time.Format(time.RFC3339), osid, procid, clientUser, clientHost, digestText)

				_, err = f.WriteString(result)
				ifErrWithPanic(err)
			}

			err = rows.Err()
			ifErrWithLog(err, "")
		}

	}
}
func anaylzeErrorLog(filename string) (lg logInfo) {
	var waitKey, writerKey string
	lg = logInfo{}
	lg.waitPoint = make(map[string][]string)
	lg.writer = make(map[string][]string)
	lg.lastWriteLock = make(map[string][]string)
	lg.lastReadLock = make(map[string][]string)

	f, err := os.Open(filename)
	ifErrWithLog(err, " No error log file specified")

	scanner := bufio.NewScanner(f)

	for scanner.Scan() {
		if strings.Contains(scanner.Text(), "Version:") {
			lg.mysqlVer = strings.Fields(scanner.Text())[1]
		}
		if strings.Contains(scanner.Text(), "ready for connections") {
			lg.restarts++
			t := formatTime(strings.Fields(scanner.Text())[0])
			lg.restartTime = append(lg.restartTime, t)
		}

		if strings.Contains(scanner.Text(), "Semaphore wait has lasted > 600 seconds") {
			lg.semaphores++
			t := formatTime(strings.Fields(scanner.Text())[0])
			lg.semaphoreTime = append(lg.semaphoreTime, t)
		}

		// --Thread 140202719565568 has waited at ha_innodb.cc line 14791 for 244.00 seconds the semaphore:
		if strings.Contains(scanner.Text(), "has waited at") {

			str := strings.Fields(scanner.Text())
			// str[5]: ha_innodb.cc  str[7]: 14791 str[1]: 140202719565568
			waitKey = fmt.Sprintf("%s:%s", str[5], str[7])
			lg.waitPoint[waitKey] = append(lg.waitPoint[waitKey], str[1])
		}

		//a writer (thread id 140617682765568) has reserved it in mode  exclusive
		if strings.Contains(scanner.Text(), "has reserved it in mode") {
			writerKey = strings.Trim(strings.Fields(scanner.Text())[4], ")")
			lg.writer[writerKey] = append(lg.writer[writerKey], waitKey)
		}

		if strings.Contains(scanner.Text(), fmt.Sprintf("OS thread handle %s", writerKey)) {

			lg.writerState = append(lg.writerState, scanner.Text())

		}

		//Last time read locked in file row0purge.cc line 861
		if strings.Contains(scanner.Text(), "Last time read locked") {
			str := strings.Fields(scanner.Text())
			lg.lastReadLock[writerKey] = append(lg.lastReadLock[writerKey], fmt.Sprintf("%s:%s", str[6], str[8]))
		}

		//Last time write locked in file /usr/local/mysql-install/storage/innobase/dict/dict0stats.cc line 2366
		if strings.Contains(scanner.Text(), "Last time write locked") {
			str := strings.Split(scanner.Text(), "/")
			lg.lastWriteLock[writerKey] = append(lg.lastWriteLock[writerKey], strings.Replace(str[len(str)-1], " line ", ":", 1))
		}

	}
	if err := scanner.Err(); err != nil {
		fmt.Fprintln(os.Stderr, err)
	}
	return lg
}

func logOutput(lg logInfo) {
	fmt.Printf("MySQL Server Version: %s\n", lg.mysqlVer)
	fmt.Print("\n********** MySQL service start count **********\n")
	fmt.Printf("MySQL Semaphore crash -> %v times %q\n", lg.semaphores, lg.semaphoreTime)
	fmt.Printf("  MySQL Service start -> %v times %q\n", lg.restarts, lg.restartTime)

	fmt.Print("\n********** Which thread waited lock **********")
	for k, v := range lg.waitPoint {
		fmt.Printf("\n%20s -> %3v  %v\n", k, len(v), unique(v))
	}

	fmt.Print("\n********** Which writer threads block at **********")
	for k, v := range lg.writer {
		fmt.Printf("\n%20s -> %3v  %v\n", k, len(v), unique(v))
	}

	fmt.Print("\n********** These writer threads trx state **********\n")
	for _, v := range lg.writerState {
		fmt.Println(v)
	}

	fmt.Print("\n********** These writer threads at last time reads locked **********")
	for k, v := range lg.lastReadLock {
		fmt.Printf("\n%20s -> %3v  %v\n", k, len(v), unique(v))
	}

	fmt.Print("\n********** These writer threads at last time write locked **********")
	for k, v := range lg.lastWriteLock {
		fmt.Printf("\n%20s -> %3v  %v\n", k, len(v), unique(v))
	}
}

func sortMapByValue(m map[string]uint64) string {
	type kv struct {
		Key   string
		Value uint64
	}
	b := new(bytes.Buffer)
	var ss []kv
	for k, v := range m {
		ss = append(ss, kv{k, v})
	}

	sort.Slice(ss, func(i, j int) bool {
		return ss[i].Value > ss[j].Value
	})

	for _, kv := range ss {
		fmt.Fprintf(b, "%s:(%v) ", kv.Key, kv.Value)
	}
	return b.String()
}

func unique(intSlice []string) string {
	counter := make(map[string]uint64)
	for _, row := range intSlice {
		counter[row]++
	}
	return sortMapByValue(counter)
}

func formatTime(s string) string {
	layoutIn := "2006-01-02T15:04:05.000000+08:00"
	layoutOut := "2006-01-02 15:04:05"
	t, err := time.Parse(layoutIn, s)
	if err != nil {
		fmt.Println(err)
	}
	return t.Format(layoutOut)
}

repository: jiangnanora/mysqldba

repo_name: jiangnanora/mysqldba


text:
@article{MR2039126,
 author = {Ferrer, Leonor and Martín, Francisco},
 doi = {10.2140/pjm.2004.214.55},
 fjournal = {Pacific Journal of Mathematics},
 issn = {0030-8730},
 journal = {Pacific J. Math.},
 mrclass = {53A10},
 mrnumber = {2039126},
 mrreviewer = {Fei-Tsen Liang},
 number = {1},
 pages = {55--88},
 title = {Properly embedded minimal disks bounded by noncompact
polygonal lines},
 url = {https://doi.org/10.2140/pjm.2004.214.55},
 volume = {214},
 year = {2004}
}

repository: torralbofco/geometric-analysis-fork

repo_name: torralbofco/geometric-analysis-fork

extension: bib


text:
@article{PMID:32501615,
 author = {de la Torre-Luque A and Cabello M and Lara E and de la Fuente J and Miret M and Sanchez-Niubo A and Haro JM and Ayuso-Mateos JL},
 doi = {10.1111/hsc.13031},
 journal = {Health & social care in the community},
 month = {06},
 title = {Functioning profiles in a nationally representative cohort of Spanish older adults: A latent class study.},
 year = {2020}
}

repository: asanchezniubo/academic-kickstart

repo_name: asanchezniubo/academic-kickstart


text:
// +build darwin linux

package report

import (
	"os"
	"os/exec"
	"strings"
	"syscall"

	"github.com/sirupsen/logrus"
)

func newRunner(logger *logrus.Logger, cliArgs []string) *runner {
	lintCmd := exec.Command("golangci-lint", cliArgs...)
	// We need to request a dedicated process group ID to be assigned so that we can cleanly kill
	// the entire process tree if necessary.
	lintCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

	return &runner{
		logger: logger,
		cmd:    lintCmd,
	}
}

func (r *runner) getInterruptSignals() []os.Signal {
	return []os.Signal{os.Interrupt, os.Kill, syscall.SIGABRT, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM}
}

// We kill the linter process via it's process group ID in order to also kill any children it might
// have spawned.
func (r *runner) killLinterProcess() {
	// Don't try to kill a process that hasn't been started yet.
	if !r.started {
		return
	}

	// ... or one that does not exist.
	pgid, err := syscall.Getpgid(r.cmd.Process.Pid)
	if err != nil {
		if !strings.Contains(err.Error(), "no such process") {
			r.logger.WithError(err).Errorf("Failed to get process group of linter child-process %d.", r.cmd.Process.Pid)
		}

		return
	}

	interruptErr := syscall.Kill(-pgid, syscall.SIGKILL)
	// Don't fail if the process already ended.
	if interruptErr != nil && strings.Contains(interruptErr.Error(), "process already finished") {
		r.logger.WithError(interruptErr).Error("Failed to interrupt linter with a KILL signal.")
	}
}

repository: Helcaraxan/goality

repo_name: Helcaraxan/goality

gha_language: Go


text:
package repository

import (
	"k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

type AtlasObjects interface {
	v1.ObjectMetaAccessor
	schema.ObjectKind
}

func RepoOwnerRef(repo AtlasObjects) *v1.OwnerReference {
	return v1.NewControllerRef(repo.GetObjectMeta(), repo.GroupVersionKind())
}

repository: joaopapereira/atlas

repo_name: joaopapereira/atlas

branch_name: refs/heads/main


text:
@article{las-2004-atct-j,
 author = {Branko Ruscic and Pinzon, Reinhardt E. and Morton, Melita L. and von Laszewski, Gregor and Bittner, Sandra J. and Nijsure, Sandeep G. and Amin, Kaizar A. and Michael Minkoff and Wagner, Albert F.},
 comment = {TODO},
 doi = {10.1021/jp047912y},
 journal = {J. Phys. Chem. A},
 number = {45},
 pages = {9979-9997},
 title = {Introduction to Active Thermochemical Tables: Several Key Enthalpies of Formation Revisited},
 volume = {108},
 year = {2004}
}


text:
DESCRIPTION = "mergepont5200"
HOMEPAGE = "http://www.avocent.com"
SECTION = "app"
SRC_URI = "cvs://${OSA_CVS_REPOS};module=project_caesar \
	file://cross-compile.patch;patch=1 \
	file://osasshd.patch;patch=1 \
	file://solite.patch;patch=1 \
	file://shserver2.patch;patch=1 \
	file://targetutil.patch;patch=1 \
	file://telnet.patch;patch=1 \
	"

#DEPENDS="openssl unixodbc tcl postgresql"
DEPENDS = "dsi5200-image"

S="${WORKDIR}/project_caesar"

EXTRA_OEMAKE = "-f bldconf.lnx"

PARALLEL_MAKE=""

export CC="${HOST_PREFIX}gcc -isystem ${STAGING_INCDIR}"

python do_unpack() {
	bb.build.exec_func('base_do_unpack', d)
	bb.build.exec_func('cvs_do_unpack', d)
}

cvs_do_unpack () {
	if [ -z ${MERGEPOINT_TAG} ]; then
		(cd ${S}/modules; ./caesarco.py  -r HEAD all;)
	else
		(cd ${S}/modules; ./caesarco.py  -r ${MERGEPOINT_TAG} all;)
	fi
}

do_compile() {
	[ -d bin ] || mkdir bin
	for cmd in `ls ${CROSS_DIR}/bin/${HOST_PREFIX}*`; do
		cmdalias=`echo $cmd | sed -r "s/.*${HOST_PREFIX}//g"`
		alias $cmdalias=${HOST_PREFIX}$cmdalias
		ln -sf $cmd bin/$cmdalias
	done

	rm -f bin/gcc bin/g++

	echo -e "#!/bin/bash\n ${HOST_PREFIX}gcc -isystem ${STAGING_INCDIR}" '$@' > bin/gcc
	echo -e "#!/bin/bash\n ${HOST_PREFIX}g++ -isystem ${STAGING_INCDIR}" '$@' > bin/g++

	chmod +x bin/gcc bin/g++

	export JAVA_HOME=/opt/j2sdk1.4.2_09
	export ANT_HOME=/usr/local

	export PATH="$JAVA_HOME/bin:${S}/bin:$PATH"

#	false
   	(cd builds; ./go.py)
}

do_install () {
	pushd ${S}/builds/Installation_embed
	appname="caesar_app`date +%Y%m%d%H%M`.tgz"
     	./build.sh && tar czf ${appname} linux-2.6-intel
     	if [ -e ${appname} ]; then
		cp -f ${appname} ${DEPLOY_DIR_IMAGE}
	fi
	popd
}


text:
@Inproceedings{Nemec1997-209-214,
  Title                    = {Force control of redundant robots},
  Author                   = {B Nemec and Zhao, Mou Mou},
  Booktitle                = {Processings of Symposium on Robot Control},
  shortbooktitle ={(PSRC)},
  Pages                    = {209-214},
  Country                  = {Nantes France},
  Year                     = {1997},
}

@Article{Chiani1998-2998-3008,
  Title                    = {Error probability for block codes over channels with block interference},
  Author                   = {Zhao, Mou Mou and Chiani, M.},
  Journal                  = {IEEE Trans. Inf. Theory},
  shortbooktitle ={(ITIT)},
  Number                   = {7},
  Pages                    = {2998-3008},
  Volume                   = {44},
  Year                     = {1998},
}

@Article{Chiani1998a,
  Title                    = {Error probability for block codes over channels with block interference},
  Author                   = {Zhang, Mou Mou and Chiani, M.},
  Journal                  = {IEEE Trans. Inf. Theory},
  shortbooktitle ={(ITIT)},
  Number                   = {7},
  Pages                    = {2998-3008},
  Volume                   = {44},
  Year                     = {1998},
}

repository: hushidong/biblatex-map

repo_name: hushidong/biblatex-map


text:
SECTION = "devel"
SUMMARY = "Linux Trace Toolkit Control"
DESCRIPTION = "The Linux trace toolkit is a suite of tools designed \
to extract program execution details from the Linux operating system \
and interpret them."

LICENSE = "GPLv2 & LGPLv2.1"
LIC_FILES_CHKSUM = "file://LICENSE;md5=01d7fc4496aacf37d90df90b90b0cac1 \
                    file://gpl-2.0.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
                    file://lgpl-2.1.txt;md5=0f0d71500e6a57fd24d825f33242b9ca"

DEPENDS = "liburcu popt libxml2 util-linux"
RDEPENDS_${PN} = "libgcc"
RDEPENDS_${PN}-ptest += "make perl bash gawk ${PN} babeltrace procps"
# babelstats.pl wants getopt-long
RDEPENDS_${PN}-ptest += "perl-module-getopt-long"

SRCREV = "${AUTOREV}"
PV = "2.8+git${SRCPV}"

PYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \
                 am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \
                 PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \
"
PACKAGECONFIG ??= "lttng-ust"
PACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native"
PACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust"
PACKAGECONFIG[kmod] = "--enable-kmod, --disable-kmod, kmod"
PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native"
PACKAGECONFIG_remove_libc-musl = "lttng-ust"

SRC_URI = "git://git.lttng.org/lttng-tools.git;branch=stable-2.8 \
           file://run-ptest"

S = "${WORKDIR}/git"

inherit autotools-brokensep ptest pkgconfig useradd

USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "tracing"

FILES_${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \
                ${PYTHON_SITEPACKAGES_DIR}/*"
FILES_${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"

# Since files are installed into ${libdir}/lttng/libexec we match
# the libexec insane test so skip it.
# Python module needs to keep _lttng.so
INSANE_SKIP_${PN} = "libexec dev-so"
INSANE_SKIP_${PN}-dbg = "libexec"

do_configure_prepend () {
	# Delete a shipped m4 file that overrides our patched one
	rm -f ${S}/m4/libxml.m4
}

do_install_ptest () {
	mkdir -p ${D}${PTEST_PATH}

	cp -a -T ${B} ${D}${PTEST_PATH}

	# Prevent attempts to update Makefiles during test runs, and
	# silence "Making check in $SUBDIR" messages.
	find ${D}${PTEST_PATH} -name Makefile -type f -exec \
		sed -i -e 's!^Makefile:!_Makefile:!' \
		-e '/echo "Making $$target in $$subdir"; \\/d' {} +

	# Prevent attempts to update version.h during test runs.
	sed -i -e '/^\.PHONY: version\.h$/d' ${D}${PTEST_PATH}/include/Makefile

	# Silence "Making check in $SUBDIR" messages.
	find ${D}${PTEST_PATH} -name Makefile -type f -exec \
		sed -i -e '/echo "Making $$target in $$subdir"; \\/d' {} +

	# Substitute links to installed binaries.
	for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd ; do
		orig="${D}${PTEST_PATH}/src/bin/${prog}/${prog}"
		rm "$orig"
		case "$prog" in
			lttng-consumerd)
				ln -s "${libdir}/lttng/libexec/$prog" "$orig"
				;;
			*)
				ln -s "${bindir}/$prog" "$orig"
				;;
		esac
	done

	# Remove libtool artifacts.
	find ${D}${PTEST_PATH} \( -name '*.l[ao]' -o -name '*.lai' \) -delete

	# Remove object files and archives.
	find ${D}${PTEST_PATH} -name '*.[oa]' -type f -delete

	# Remove Makefile.am and Makefile.in.
	find ${D}${PTEST_PATH} -name 'Makefile.*' -type f -delete

	# Remove autom4te.cache.
	rm -rf ${D}${PTEST_PATH}/autom4te.cache

	# Replace libtool wrapper scripts (which won't work on the
	# target) with their corresponding binaries.
	for prog in unit/ini_config/ini_config \
		regression/tools/live/live_test \
		regression/tools/health/health_check ; do
		basename=${prog##*/}
		ldir=${D}${PTEST_PATH}/tests/${prog%/*}
		mv -f ${ldir}/.libs/${basename} ${ldir}
	done

	# checkpatch.pl is unneeded on target and causes file-rdeps QA
	# warnings.
	rm -f ${D}${PTEST_PATH}/extras/checkpatch.pl

        # Remove built libraries as they confuse the packages' runtime dependency resolution
        rm -rf ${D}${PTEST_PATH}/src/lib/lttng-ctl/.libs/
}

repository: mjeanson/meta-lttng

repo_name: mjeanson/meta-lttng


text:
% This file was created with JabRef 2.10.
% Encoding: UTF-8

@Manual{Versuchsvorschrift,
  Title                    = {Versuchsvorschriften PR Allgemeine Chemie - Universität Innsbruck},
  Author                   = {Wolfgang Viertl et al.},
  Year                     = {2019},

  Owner                    = {Florian Kluibenschedl},
  Timestamp                = {2019.03.03}
}

@Book{ReactionProof,
  Title                    = {Foundations of College Chemistry},
  Author                   = {Morris Hein, Susan Arena},
  Publisher                = {John Wiley \& Sons, Inc.},
  Year                     = {2011},
  Edition                  = {13},

  Owner                    = {Florian Kluibenschedl},
  Timestamp                = {2019.03.13}
}

@Book{PhysicalChemistryAtkings,
  Title                    = {Physical Chemistry},
  Author                   = {Peter Atkins, Julio de Paula, James Keeler},
  Publisher                = {Oxford University Press},
  Year                     = {2018},

  Address                  = {Oxford, United Kingdom},
  Edition                  = {11th},

  Owner                    = {Florian Kluibenschedl},
  Timestamp                = {2019.02.26}
}

@Electronic{Atommassentabelle,
  Title                    = {Tabelle der Atommassen},
  Url                      = {http://www.chemie-master.de/FrameHandler.php?loc=http://www.chemie-master.de/pse/pse.php?modul=tab15},
  Year                     = {2019},

  Owner                    = {Florian Kluibenschedl},
  Timestamp                = {2019.03.13}
}

repository: Progklui/studyChemistryFloKlui

repo_name: Progklui/studyChemistryFloKlui


text:
SUMMARY = "Libcli is a shared library for a Cisco-like command-line interface"
DESCRIPTION = "Libcli provides a shared library for including a Cisco-like command-line interface into other software."
HOMEPAGE = "https://dparrish.com/pages/libcli"
SECTION = "console/devel"
LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=cb8aedd3bced19bd8026d96a8b6876d7"

DEPENDS = "virtual/crypt"

SRCREV = "4ef06297a2b056a5841de3e3bfa6cc43ac46e7b3"
SRC_URI = "git://github.com/dparrish/libcli.git;protocol=https;branch=stable \
    file://make-build-tools-overridable.patch \
"

S = "${WORKDIR}/git"

do_compile() {
    oe_runmake #'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}'
}

do_install() {
    oe_runmake PREFIX=${D}/${prefix} install
}

FILES_${PN} = "${libdir}"

repository: Linaro/meta-lkft

repo_name: Linaro/meta-lkft

branch_name: refs/heads/kirkstone

gha_language: BitBake


text:
@article{Codd:1970:RMD:362384.362685,
 author = {Codd, E. F.},
 title = {A Relational Model of Data for Large Shared Data Banks},
 journal = {Commun. ACM},
 issue_date = {June 1970},
 volume = {13},
 number = {6},
 month = jun,
 year = {1970},
 issn = {0001-0782},
 pages = {377--387},
 numpages = {11},
 url = {http://doi.acm.org/10.1145/362384.362685},
 doi = {10.1145/362384.362685},
 acmid = {362685},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {composition, consistency, data bank, data base, data integrity, data organization, data structure, derivability, hierarchies of data, join, networks of data, predicate calculus, redundancy, relations, retrieval language, security},
}

@InProceedings{10.1007/978-3-642-30284-8_36,
author="Mart{\'i}nez-Prieto, Miguel A.
and Arias Gallego, Mario
and Fern{\'a}ndez, Javier D.",
editor="Simperl, Elena
and Cimiano, Philipp
and Polleres, Axel
and Corcho, Oscar
and Presutti, Valentina",
title="Exchange and Consumption of Huge RDF Data",
booktitle="The Semantic Web: Research and Applications",
year="2012",
publisher="Springer Berlin Heidelberg",
address="Berlin, Heidelberg",
pages="437--452",
abstract="Huge RDF datasets are currently exchanged on textual RDF formats, hence consumers need to post-process them using RDF stores for local consumption, such as indexing and SPARQL query. This results in a painful task requiring a great effort in terms of time and computational resources. A first approach to lightweight data exchange is a compact (binary) RDF serialization format called HDT. In this paper, we show how to enhance the exchanged HDT with additional structures to support some basic forms of SPARQL query resolution without the need of ''unpacking'' the data. Experiments show that i) with an exchanging efficiency that outperforms universal compression, ii) post-processing now becomes a fast process which iii) provides competitive query performance at consumption.",
isbn="978-3-642-30284-8"
}

@INPROCEEDINGS{65147,
author={G. E. {Kaiser} and D. E. {Perry} and W. M. {Schell}},
booktitle={[1989] Proceedings of the Thirteenth Annual International Computer Software Applications Conference},
title={Infuse: fusing integration test management with change management},
year={1989},
volume={},
number={},
pages={552-558},
keywords={program testing;programming environments;software engineering;software maintenance;software evolution;unit testing;Infuse;integration test management;change management;software development environment;change coordination;large-scale software projects;integrate strongly connected modules;weakly connected sets;hierarchy;singletons;clusters;interdependent modules;merging;change set;baseline;dynamic consistency;leaves;integration testing;intermediate clusters;acceptance testing;root;test harnesses;regression test suites;C;Software testing;Automatic testing;Programming;Software maintenance;Modular construction;Environmental management;Project management;Software development management;System testing;Research and development management},
doi={10.1109/CMPSAC.1989.65147},
ISSN={null},
month={9},}

@article{LAUKKANEN201755,
title = "Problems, causes and solutions when adopting continuous delivery—A systematic literature review",
journal = "Information and Software Technology",
volume = "82",
pages = "55 - 79",
year = "2017",
issn = "0950-5849",
doi = {https://doi.org/10.1016/j.infsof.2016.10.001},
url = {http://www.sciencedirect.com/science/article/pii/S0950584916302324},
author = "Eero Laukkanen and Juha Itkonen and Casper Lassenius",
keywords = "Continuous integration, Continuous delivery, Continuous deployment, Systematic literature review",
abstract = "Context: Continuous delivery is a software development discipline in which software is always kept releasable. The literature contains instructions on how to adopt continuous delivery, but the adoption has been challenging in practice. Objective: In this study, a systematic literature review is conducted to survey the faced problems when adopting continuous delivery. In addition, we identify causes for and solutions to the problems. Method: By searching five major bibliographic databases, we identified 293 articles related to continuous delivery. We selected 30 of them for further analysis based on them containing empirical evidence of adoption of continuous delivery, and focus on practice instead of only tooling. We analyzed the selected articles qualitatively and extracted problems, causes and solutions. The problems and solutions were thematically synthesized into seven themes: build design, system design, integration, testing, release, human and organizational and resource. Results: We identified a total of 40 problems, 28 causal relationships and 29 solutions related to adoption of continuous delivery. Testing and integration problems were reported most often, while the most critical reported problems were related to testing and system design. Causally, system design and testing were most connected to other themes. Solutions in the system design, resource and human and organizational themes had the most significant impact on the other themes. The system design and build design themes had the least reported solutions. Conclusions: When adopting continuous delivery, problems related to system design are common, critical and little studied. The found problems, causes and solutions can be used to solve problems when adopting continuous delivery in practice."
}

@phdthesis{Jacobson:1988:SSD:915547,
 author = {Jacobson, Guy Joseph},
 title = {Succinct Static Data Structures},
 year = {1988},
 note = {AAI8918056},
 publisher = {Carnegie Mellon University},
 address = {Pittsburgh, PA, USA},
}

@article{doi:10.1002/spe.2198,
author = {Gog, Simon and Petri, Matthias},
title = {Optimized succinct data structures for massive data},
journal = {Software: Practice and Experience},

volume = {44},
number = {11},
pages = {1287-1314},
keywords = {succinct data structures, binary sequences, FM-index, algorithm engineering, massive data sets, rank, select, SSE, hugepages},
doi = {10.1002/spe.2198},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/spe.2198},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1002/spe.2198},
abstract = {SUMMARYSuccinct data structures provide the same functionality as their corresponding traditional data structure in compact space. We improve on functions rank and select, which are the basic building blocks of FM-indexes and other succinct data structures. First, we present a cache-optimal, uncompressed bitvector representation that outperforms all existing approaches. Next, we improve, in both space and time, on a recent result by Navarro and Providel on compressed bitvectors. Last, we show techniques to perform rank and select on 64-bit words that are up to three times faster than existing methods. In our experimental evaluation, we first show how our improvements affect cache and runtime performance of both operations on data sets larger than commonly used in the evaluation of succinct data structures. Our experiments show that our improvements to these basic operations significantly improve the runtime performance and compression effectiveness of FM-indexes on small and large data sets. To our knowledge, our improvements result in FM-indexes that are either smaller or faster than all current state of the art implementations. Copyright © 2013 John Wiley \& Sons, Ltd.},
year = {2014}
}

@article{MARTINEZPRIETO201673,
title = "Practical compressed string dictionaries",
journal = "Information Systems",
volume = "56",
pages = "73 - 108",
year = "2016",
issn = "0306-4379",
doi = {https://doi.org/10.1016/j.is.2015.08.008},
url = {http://www.sciencedirect.com/science/article/pii/S0306437915001672},
author = "Miguel A. Martínez-Prieto and Nieves Brisaboa and Rodrigo Cánovas and Francisco Claude and Gonzalo Navarro",
keywords = "Compressed string dictionaries, Text processing, Text databases, Compressed data structures",
% abstract = {The need to store and query a set of strings – a string dictionary – arises in many kinds of applications. While classically these string dictionaries have accounted for a small share of the total space budget (e.g., in Natural Language Processing or when indexing text collections), recent applications in Web engines, Semantic Web (RDF) graphs, Bioinformatics, and many others handle very large string dictionaries, whose size is a significant fraction of the whole data. In these cases, string dictionary management is a scalability issue by itself. This paper focuses on the problem of managing large static string dictionaries in compressed main memory space. We revisit classical solutions for string dictionaries like hashing, tries, and front-coding, and improve them by using compression techniques. We also introduce some novel string dictionary representations built on top of recent advances in succinct data structures and full-text indexes. All these structures are empirically compared on a heterogeneous testbed formed by real-world string dictionaries. We show that the compressed representations may use as little as 5% of the original dictionary size, while supporting lookup operations within a few microseconds. These numbers outperform the state-of-the-art space/time tradeoffs in many cases. Furthermore, we enhance some representations to provide prefix- and substring-based searches, which also perform competitively. The results show that compressed string dictionaries are a useful building block for various data-intensive applications in different domains.}
}

@article{DBLP:journals/semweb/FeeneyMB18,
  author    = {Kevin Chekov Feeney and
               Gavin Mendel{-}Gleason and
               Rob Brennan},
  title     = {Linked data schemata: Fixing unsound foundations},
  journal   = {Semantic Web},
  volume    = {9},
  number    = {1},
  pages     = {53--75},
  year      = {2018},
  url       = {https://doi.org/10.3233/SW-170271},
  doi       = {10.3233/SW-170271},
  timestamp = {Wed, 13 Dec 2017 15:13:19 +0100},
  biburl    = {https://dblp.org/rec/bib/journals/semweb/FeeneyMB18},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}

@article{Ferragina:2005:ICT:1082036.1082039,
 author = {Ferragina, Paolo and Manzini, Giovanni},
 title = {Indexing Compressed Text},
 journal = {J. ACM},
 issue_date = {July 2005},
 volume = {52},
 number = {4},
 month = jul,
 year = {2005},
 issn = {0004-5411},
 pages = {552--581},
 numpages = {30},
 url = {http://doi.acm.org/10.1145/1082036.1082039},
 doi = {10.1145/1082036.1082039},
 acmid = {1082039},
 publisher = {ACM},
 address = {New York, NY, USA},
 keywords = {Burrows--Wheeler transform, Lempel--Ziv compressor, full-text indexing, indexing data structure, pattern searching, suffix array, suffix tree, text compression},
}

@book{Blandy:2015:RPL:3019371,
 author = {Blandy, Jim},
 title = {The Rust Programming Language: Fast, Safe, and Beautiful},
 year = {2015},
 isbn = {9781491925447},
 publisher = {O'Reilly Media, Inc.},
}

@inproceedings{Mohan:1992:EFM:130283.130306,
 author = {Mohan, C. and Pirahesh, Hamid and Lorie, Raymond},
 title = {Efficient and Flexible Methods for Transient Versioning of Records to Avoid Locking by Read-only Transactions},
 booktitle = {Proceedings of the 1992 ACM SIGMOD International Conference on Management of Data},
 series = {SIGMOD '92},
 year = {1992},
 isbn = {0-89791-521-6},
 location = {San Diego, California, USA},
 pages = {124--133},
 numpages = {10},
 url = {http://doi.acm.org/10.1145/130283.130306},
 doi = {10.1145/130283.130306},
 acmid = {130306},
 publisher = {ACM},
 address = {New York, NY, USA},
}

@article{Sadoghi:2014:RDL:2733004.2733006,
 author = {Sadoghi, Mohammad and Canim, Mustafa and Bhattacharjee, Bishwaranjan and Nagel, Fabian and Ross, Kenneth A.},
 title = {Reducing Database Locking Contention Through Multi-version Concurrency},
 journal = {Proc. VLDB Endow.},
 issue_date = {August 2014},
 volume = {7},
 number = {13},
 month = aug,
 year = {2014},
 issn = {2150-8097},
 pages = {1331--1342},
 numpages = {12},
 url = {http://dx.doi.org/10.14778/2733004.2733006},
 doi = {10.14778/2733004.2733006},
 acmid = {2733006},
 publisher = {VLDB Endowment},
}

@techreport{gleason_feeney2018,
title = "Evolving Meaningful Value From Enterprise Data",
year = "2018",
institution = "TerminusDB",
note = {URL: \url{https://www.datachemist.com/images/uploads/general/Evolving_MeaningfulValuefromEnterpriseD
ata.pdf}},
author = "Mendel-Gleason, Gavin and Feeney, Kevin and O'Donoghue, Jim and {\L}obocka, Sabina and Zejer, Piotr and B{\l}{\k e}dski, Piotr and Dirschl, Christian",
}

@techreport{gleason2018,
title = "Machine Checkable Formalisation of OWL Semantics",
institution = "TerminusDB",
year = "2018",
note = {URL: \url{http://terminusdb.com/t/docs/OWL-formalisation.pdf}},
author = "Mendel-Gleason, Gavin",
}

repository: CyberFlameGO/terminusdb

repo_name: CyberFlameGO/terminusdb


text:
@misc{Charette2020,
    author = " فڕانسوا چارێت، ئارتوور ڕۆیتێناور، باستیان ڕووساریێ و یوورگن سپیتچموولە",
    title  = {{[ئینگلیسی]\texttt{\textenglish{Polyglossia}}: پێکهێنانی مۆدێڕنی دەق بە  \XeLaTeX~ و Lua\LaTeX}},
    howpublished      =	{\url{https://ctan.math.illinois.edu/macros/latex/contrib/polyglossia/polyglossia.pdf}},
    note = { مێژووی چاو لێ کردن: 2020-05-15 }
}

@misc{ahmadi2020TexforKurdish,
    author = "ئەحمەدی, سینا",
    title  = {{[ئینگلیسی] پێکهێنانی دەق بە \XeLaTeX ~بۆ کوردی}},
    howpublished      =	 {\url{http://kurdishtex.github.io/docs/XeLaTeXforKurdish.pdf}},
    note = { مێژووی چاو لێ کردن: 2020-05-15 }
}

@misc{wilkins1995getting,
	author = "ویلكینز, ده‌یڤید",
	title  = {{ده‌ست پێ كردن به \LaTeX [ئینگلیسی]}},
    howpublished = {\url{http://www.ap.smu.ca/~dclarke/home/documents/latex/lprimer.pdf}},
    note = { مێژووی چاو لێ کردن: 2020-05-15 }
}

repository: KurdishXeLaTeX/Support

repo_name: KurdishXeLaTeX/Support


text:
SUMMARY = "GENIVI browser PoC"
DESCRIPTION = "A D-Bus-based software component to test the \
usability and quality of a web browser that uses the D-Bus interface."

LICENSE = "MPLv2"
LIC_FILES_CHKSUM = "file://../COPYING;md5=815ca599c9df247a0c7f619bab123dad"

SRCREV = "531bd41d00509840cf5dfc767995549c27211341"

DEPENDS = "qtbase qtwebkit"

SRC_URI = "git://git.projects.genivi.org/browser-poc.git \
           file://browser_poc_smaller_bookmarks_qml.patch \
           file://browser.service \
           file://demoui.service \
           file://COPYING \
           file://layer_manager_surface_id.patch \
           file://0001-browser-missing-method-for-connect.patch \
           file://0002-browser-fix-error-reported-on-bad-cache-policy.patch \
           file://0003-demoui-the-UI-is-stretched.patch \
           file://0004-demoui-use-QML-WebView-instead-of-browser-service.patch \
          "

SRC_URI_append_qemux86-64 = "\
           file://0001-Demoui-Make-Graphic-working-for-Qemu-machine.patch \
         "

S = "${WORKDIR}/git"
inherit qmake5

do_install_append() {
    mkdir -p ${D}/opt/browser/bin/
    install ${B}/browser/browser ${D}/opt/browser/bin/
    cp -r ${S}/demoui/images ${D}/opt/demoui
    mkdir -p ${D}/opt/testapp/bin/
    install ${B}/testapp/testapp ${D}/opt/testapp/bin/
    cp -r ${S}/testapp/images ${D}/opt/testapp
    cp -r ${S}/testapp/qml ${D}/opt/testapp
    mkdir -p ${D}/etc/systemd/user
    cp ${WORKDIR}/browser.service ${WORKDIR}/demoui.service ${D}/etc/systemd/user
}

FILES_${PN} += "/opt/browser/bin/* \
                /opt/demoui/* \
                /opt/testapp/* \
               "

FILES_${PN}-dbg += "/opt/browser/bin/.debug/* \
                    /opt/demoui/bin/.debug/* \
                    /opt/testapp/bin/.debug/* \
                   "

repository: TizenTeam/meta-genivi-demo

repo_name: TizenTeam/meta-genivi-demo

branch_name: refs/heads/GENIVI-AMM-handson


text:
/*
Copyright 2019 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package lvm

import (
	"context"
	"encoding/json"
	"fmt"
	"os"
	"path/filepath"
	"strconv"
	"strings"

	"github.com/container-storage-interface/spec/lib/go/csi"
	csicommon "github.com/kubernetes-csi/drivers/pkg/csi-common"
	"github.com/kubernetes-sigs/alibaba-cloud-csi-driver/pkg/options"
	"github.com/kubernetes-sigs/alibaba-cloud-csi-driver/pkg/utils"
	log "github.com/sirupsen/logrus"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/util/strategicpatch"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/tools/clientcmd"
	k8smount "k8s.io/mount-utils"
	utilexec "k8s.io/utils/exec"
)

const (
	// NsenterCmd is the nsenter command
	NsenterCmd = "/nsenter --mount=/proc/1/ns/mnt"
	// VgNameTag is the vg name tag
	VgNameTag = "vgName"
	// PvTypeTag is the pv type tag
	PvTypeTag = "pvType"
	// FsTypeTag is the fs type tag
	FsTypeTag = "fsType"
	// LvmTypeTag is the lvm type tag
	LvmTypeTag = "lvmType"
	// NodeAffinity is the pv node schedule tag
	NodeAffinity = "nodeAffinity"
	// LocalDisk local disk
	LocalDisk = "localdisk"
	// CloudDisk cloud disk
	CloudDisk = "clouddisk"
	// LinearType linear type
	LinearType = "linear"
	// StripingType striping type
	StripingType = "striping"
	// DefaultFs default fs
	DefaultFs = "ext4"
	// DefaultNA default NodeAffinity
	DefaultNA = "true"
	// TopologyNodeKey tag
	TopologyNodeKey = "topology.lvmplugin.csi.alibabacloud.com/hostname"
)

type nodeServer struct {
	*csicommon.DefaultNodeServer
	nodeID     string
	mounter    utils.Mounter
	client     kubernetes.Interface
	k8smounter k8smount.Interface
}

var (
	// DeviceChars is chars of a device
	DeviceChars = []string{"b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
)

// NewNodeServer create a NodeServer object
func NewNodeServer(d *csicommon.CSIDriver, nodeID string) csi.NodeServer {
	cfg, err := clientcmd.BuildConfigFromFlags(options.MasterURL, options.Kubeconfig)
	if err != nil {
		log.Fatalf("Error building kubeconfig: %s", err.Error())
	}

	kubeClient, err := kubernetes.NewForConfig(cfg)
	if err != nil {
		log.Fatalf("Error building kubernetes clientset: %s", err.Error())
	}

	return &nodeServer{
		DefaultNodeServer: csicommon.NewDefaultNodeServer(d),
		nodeID:            nodeID,
		mounter:           utils.NewMounter(),
		k8smounter:        k8smount.New(""),
		client:            kubeClient,
	}
}

func (ns *nodeServer) GetNodeID() string {
	return ns.nodeID
}

func (ns *nodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) {
	log.Infof("NodePublishVolume:: req, %v", req)

	// parse request args.
	targetPath := req.GetTargetPath()
	if targetPath == "" {
		return nil, status.Error(codes.Internal, "targetPath is empty")
	}
	vgName := ""
	if _, ok := req.VolumeContext[VgNameTag]; ok {
		vgName = req.VolumeContext[VgNameTag]
	}
	if vgName == "" {
		return nil, status.Error(codes.Internal, "error with input vgName is empty")
	}
	pvType := CloudDisk
	if _, ok := req.VolumeContext[PvTypeTag]; ok {
		pvType = req.VolumeContext[PvTypeTag]
	}
	lvmType := LinearType
	if _, ok := req.VolumeContext[LvmTypeTag]; ok {
		lvmType = req.VolumeContext[LvmTypeTag]
	}
	fsType := DefaultFs
	if _, ok := req.VolumeContext[FsTypeTag]; ok {
		fsType = req.VolumeContext[FsTypeTag]
	}
	nodeAffinity := DefaultNA
	if _, ok := req.VolumeContext[NodeAffinity]; ok {
		nodeAffinity = req.VolumeContext[NodeAffinity]
	}
	log.Infof("NodePublishVolume: Starting to mount lvm at: %s, with vg: %s, with volume: %s, PV type: %s, LVM type: %s", targetPath, vgName, req.GetVolumeId(), pvType, lvmType)

	volumeNewCreated := false
	volumeID := req.GetVolumeId()
	devicePath := filepath.Join("/dev/", vgName, volumeID)
	if _, err := os.Stat(devicePath); os.IsNotExist(err) {
		volumeNewCreated = true
		err := ns.createVolume(ctx, volumeID, vgName, pvType, lvmType)
		if err != nil {
			return nil, status.Error(codes.Internal, err.Error())
		}
	}

	isMnt, err := ns.mounter.IsMounted(targetPath)
	if err != nil {
		if _, err := os.Stat(targetPath); os.IsNotExist(err) {
			if err := os.MkdirAll(targetPath, 0750); err != nil {
				return nil, status.Error(codes.Internal, err.Error())
			}
			isMnt = false
		} else {
			return nil, status.Error(codes.Internal, err.Error())
		}
	}

	exitFSType, err := checkFSType(devicePath)
	if err != nil {
		return nil, status.Errorf(codes.Internal, "check fs type err: %v", err)
	}
	if exitFSType == "" {
		log.Printf("The device %v has no filesystem, starting format: %v", devicePath, fsType)
		if err := formatDevice(devicePath, fsType); err != nil {
			return nil, status.Errorf(codes.Internal, "format fstype failed: err=%v", err)
		}
	}

	if !isMnt {
		var options []string
		if req.GetReadonly() {
			options = append(options, "ro")
		} else {
			options = append(options, "rw")
		}
		mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()
		options = append(options, mountFlags...)

		err = ns.mounter.Mount(devicePath, targetPath, fsType, options...)
		if err != nil {
			return nil, status.Error(codes.Internal, err.Error())
		}
		log.Infof("NodePublishVolume:: mount successful devicePath: %s, targetPath: %s, options: %v", devicePath, targetPath, options)
	}

	// xfs filesystem works on targetpath.
	if volumeNewCreated == false {
		if err := ns.resizeVolume(ctx, volumeID, vgName, targetPath); err != nil {
			return nil, status.Error(codes.Internal, err.Error())
		}
	}

	// upgrade PV with NodeAffinity
	if nodeAffinity == "true" {
		oldPv, err := ns.client.CoreV1().PersistentVolumes().Get(context.Background(), volumeID, metav1.GetOptions{})
		if err != nil {
			log.Errorf("NodePublishVolume: Get Persistent Volume(%s) Error: %s", volumeID, err.Error())
			return nil, status.Error(codes.Internal, err.Error())
		}
		if oldPv.Spec.NodeAffinity == nil {
			oldData, err := json.Marshal(oldPv)
			if err != nil {
				log.Errorf("NodePublishVolume: Marshal Persistent Volume(%s) Error: %s", volumeID, err.Error())
				return nil, status.Error(codes.Internal, err.Error())
			}
			pvClone := oldPv.DeepCopy()

			// construct new persistent volume data
			values := []string{ns.nodeID}
			nSR := v1.NodeSelectorRequirement{Key: "kubernetes.io/hostname", Operator: v1.NodeSelectorOpIn, Values: values}
			matchExpress := []v1.NodeSelectorRequirement{nSR}
			nodeSelectorTerm := v1.NodeSelectorTerm{MatchExpressions: matchExpress}
			nodeSelectorTerms := []v1.NodeSelectorTerm{nodeSelectorTerm}
			required := v1.NodeSelector{NodeSelectorTerms: nodeSelectorTerms}
			pvClone.Spec.NodeAffinity = &v1.VolumeNodeAffinity{Required: &required}
			newData, err := json.Marshal(pvClone)
			if err != nil {
				log.Errorf("NodePublishVolume: Marshal New Persistent Volume(%s) Error: %s", volumeID, err.Error())
				return nil, status.Error(codes.Internal, err.Error())
			}
			patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, pvClone)
			if err != nil {
				log.Errorf("NodePublishVolume: CreateTwoWayMergePatch Volume(%s) Error: %s", volumeID, err.Error())
				return nil, status.Error(codes.Internal, err.Error())
			}

			// Upgrade PersistentVolume with NodeAffinity
			_, err = ns.client.CoreV1().PersistentVolumes().Patch(context.Background(), volumeID, types.StrategicMergePatchType, patchBytes, metav1.PatchOptions{})
			if err != nil {
				log.Errorf("NodePublishVolume: Patch Volume(%s) Error: %s", volumeID, err.Error())
				return nil, status.Error(codes.Internal, err.Error())
			}
			log.Infof("NodePublishVolume: upgrade Persistent Volume(%s) with nodeAffinity: %s", volumeID, ns.nodeID)
		}
	}

	return &csi.NodePublishVolumeResponse{}, nil
}

func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error) {
	targetPath := req.GetTargetPath()
	isMnt, err := ns.mounter.IsMounted(targetPath)
	if err != nil {
		if _, err := os.Stat(targetPath); os.IsNotExist(err) {
			return nil, status.Error(codes.NotFound, "TargetPath not found")
		}
		return nil, status.Error(codes.Internal, err.Error())
	}
	if !isMnt {
		return &csi.NodeUnpublishVolumeResponse{}, nil
	}

	err = ns.mounter.Unmount(req.GetTargetPath())
	if err != nil {
		return nil, status.Error(codes.Internal, err.Error())
	}

	return &csi.NodeUnpublishVolumeResponse{}, nil
}

func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
	return &csi.NodeUnstageVolumeResponse{}, nil
}

func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
	return &csi.NodeStageVolumeResponse{}, nil
}

func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error) {
	// currently there is a single NodeServer capability according to the spec
	nscap := &csi.NodeServiceCapability{
		Type: &csi.NodeServiceCapability_Rpc{
			Rpc: &csi.NodeServiceCapability_RPC{
				Type: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
			},
		},
	}
	nscap2 := &csi.NodeServiceCapability{
		Type: &csi.NodeServiceCapability_Rpc{
			Rpc: &csi.NodeServiceCapability_RPC{
				Type: csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
			},
		},
	}
	return &csi.NodeGetCapabilitiesResponse{
		Capabilities: []*csi.NodeServiceCapability{
			nscap, nscap2,
		},
	}, nil
}

func (ns *nodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (
	*csi.NodeExpandVolumeResponse, error) {
	log.Infof("NodeExpandVolume: lvm node expand volume: %v", req)
	return &csi.NodeExpandVolumeResponse{}, nil
}

func (ns *nodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {
	return &csi.NodeGetInfoResponse{
		NodeId: ns.nodeID,
		// make sure that the driver works on this particular node only
		AccessibleTopology: &csi.Topology{
			Segments: map[string]string{
				TopologyNodeKey: ns.nodeID,
			},
		},
	}, nil
}

func (ns *nodeServer) resizeVolume(ctx context.Context, volumeID, vgName, targetPath string) error {
	pvSize, pvSizeByte, unit := ns.getPvSize(volumeID)
	devicePath := filepath.Join("/dev", vgName, volumeID)
	sizeCmd := fmt.Sprintf("%s lvdisplay --units B %s 2>&1 | grep 'LV Size' | awk '{print $3}'", NsenterCmd, devicePath)
	sizeStr, err := utils.Run(sizeCmd)
	if err != nil {
		return err
	}
	if sizeStr == "" {
		return status.Error(codes.Internal, "Get lvm size error")
	}
	sizeStr = strings.Split(sizeStr, ".")[0]
	sizeInt, err := strconv.ParseInt(strings.TrimSpace(sizeStr), 10, 64)
	if err != nil {
		return err
	}

	// if lvmsize equal/bigger than pv size, no do expand.
	if sizeInt >= pvSizeByte {
		return nil
	}
	log.Infof("NodeExpandVolume:: volumeId: %s, devicePath: %s, from size: %d, to Size: %d%s", volumeID, devicePath, sizeInt, pvSize, unit)

	// resize lvm volume
	// lvextend -L3G /dev/vgtest/lvm-5db74864-ea6b-11e9-a442-00163e07fb69
	resizeCmd := fmt.Sprintf("%s lvextend -L%d%s %s", NsenterCmd, pvSize, unit, devicePath)
	_, err = utils.Run(resizeCmd)
	if err != nil {
		return err
	}

	// use resizer to expand volume filesystem
	resizer := k8smount.NewResizeFs(utilexec.New())
	ok, err := resizer.Resize(devicePath, targetPath)
	if err != nil {
		log.Errorf("NodeExpandVolume:: Resize Error, volumeId: %s, devicePath: %s, volumePath: %s, err: %s", volumeID, devicePath, targetPath, err.Error())
		return err
	}
	if !ok {
		log.Errorf("NodeExpandVolume:: Resize failed, volumeId: %s, devicePath: %s, volumePath: %s", volumeID, devicePath, targetPath)
		return status.Error(codes.Internal, "Fail to resize volume fs")
	}
	log.Infof("NodeExpandVolume:: resizefs successful volumeId: %s, devicePath: %s, volumePath: %s", volumeID, devicePath, targetPath)
	return nil
}

func (ns *nodeServer) getPvSize(volumeID string) (int64, int64, string) {
	pv, err := ns.client.CoreV1().PersistentVolumes().Get(context.Background(), volumeID, metav1.GetOptions{})
	if err != nil {
		log.Errorf("lvcreate: fail to get pv, err: %v", err)
		return 0, 0, ""
	}
	pvQuantity := pv.Spec.Capacity["storage"]
	pvSizeByte := pvQuantity.Value()
	pvSize := pvSizeByte
	pvSizeGB := pvSize / (1024 * 1024 * 1024)

	if pvSizeGB == 0 {
		pvSizeMB := pvSize / (1024 * 1024)
		return pvSizeMB, pvSizeByte, "m"
	}
	return pvSizeGB, pvSizeByte, "g"
}

// create lvm volume
func (ns *nodeServer) createVolume(ctx context.Context, volumeID, vgName, pvType, lvmType string) error {
	pvSize, _, unit := ns.getPvSize(volumeID)

	pvNumber := 0
	var err error
	// Create VG if vg not exist,
	if pvType == LocalDisk {
		if pvNumber, err = createVG(vgName); err != nil {
			return err
		}
	}

	// check vg exist
	ckCmd := fmt.Sprintf("%s vgck %s", NsenterCmd, vgName)
	_, err = utils.Run(ckCmd)
	if err != nil {
		log.Errorf("createVolume:: VG is not exist: %s", vgName)
		return err
	}

	// Create lvm volume
	if lvmType == StripingType {
		cmd := fmt.Sprintf("%s lvcreate -i %d -n %s -L %d%s %s", NsenterCmd, pvNumber, volumeID, pvSize, unit, vgName)
		_, err = utils.Run(cmd)
		if err != nil {
			return err
		}
		log.Infof("Successful Create Striping LVM volume: %s, Size: %d%s, vgName: %s, striped number: %d", volumeID, pvSize, unit, vgName, pvNumber)
	} else if lvmType == LinearType {
		cmd := fmt.Sprintf("%s lvcreate -n %s -L %d%s %s", NsenterCmd, volumeID, pvSize, unit, vgName)
		_, err = utils.Run(cmd)
		if err != nil {
			return err
		}
		log.Infof("Successful Create Linear LVM volume: %s, Size: %d%s, vgName: %s", volumeID, pvSize, unit, vgName)
	}
	return nil
}


text:
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package aip0216

import (
	"testing"

	"github.com/googleapis/api-linter/rules/internal/testutils"
)

func TestNesting(t *testing.T) {
	t.Run("Nested", func(t *testing.T) {
		f := testutils.ParseProto3String(t, `
			message Foo {
				enum State {
					STATE_UNSPECIFIED = 0;
				}
			}
		`)
		if diff := (testutils.Problems{}).Diff(nesting.Lint(f)); diff != "" {
			t.Errorf(diff)
		}
	})
	t.Run("NotNested", func(t *testing.T) {
		tests := []struct {
			name        string
			MessageName string
			EnumName    string
			PackageStmt string
			problems    testutils.Problems
		}{
			{"ShouldNest", "Foo", "FooState", "package test;", testutils.Problems{{Message: "Nest"}}},
			{"ShouldNestNoPkg", "Foo", "FooState", "", testutils.Problems{{Message: "Nest"}}},
			{"ValidNoFoo", "Bar", "FooState", "package test;", testutils.Problems{}},
		}
		for _, test := range tests {
			t.Run(test.name, func(t *testing.T) {
				f := testutils.ParseProto3Tmpl(t, `
					{{.PackageStmt}}
					message {{.MessageName}} {}
					enum {{.EnumName}} {
						UNSPECIFIED = 0;
					}
				`, test)
				e := f.GetEnumTypes()[0]
				if diff := test.problems.SetDescriptor(e).Diff(nesting.Lint(f)); diff != "" {
					t.Errorf(diff)
				}
			})
		}
	})
}

repository: RocketDonkey/api-linter

repo_name: RocketDonkey/api-linter


text:
DEPENDS = "glib-2.0 gtk-doc"
DESCRIPTION = "An accessibility toolkit for GNOME."
SECTION = "x11/libs"
PRIORITY = "optional"
MAINTAINER = "Philip Blundell <pb@handhelds.org>"
LICENSE = "LGPL"

SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.4/atk-${PV}.tar.bz2"

inherit autotools  pkgconfig

EXTRA_OECONF = "--disable-glibtest"

CFLAGS_append = " -I${STAGING_INCDIR}/glib-2.0 \
		  -I${STAGING_INCDIR}/glib-2.0/glib \
		  -I${STAGING_INCDIR}/glib-2.0/gobject"

do_stage () {
	oe_libinstall -so -C atk libatk-1.0 ${STAGING_LIBDIR}
	autotools_stage_includes
}

repository: Terentyev/familiar-linux

repo_name: Terentyev/familiar-linux


text:
class AuthController {
    static async login(req, res) {
        if (req.body.password !== process.env.PASSWORD) {
            return res.send({ success: false });
        }

        res.cookie('auth', process.env.PASSWORD, { signed: true });
        return res.send({ success: true });
    }

    static async check(req, res) {
        res.send({ auth: req.signedCookies.auth === process.env.PASSWORD });
    }
}

module.exports = AuthController;

repository: rafmjr/trivia-game

repo_name: rafmjr/trivia-game

extension: js