File: query.go

package info (click to toggle)
aptly 1.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,928 kB
  • sloc: python: 10,398; sh: 252; makefile: 184
file content (29 lines) | stat: -rw-r--r-- 782 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Package query implements query language for
package query

import (
	"github.com/aptly-dev/aptly/deb"
)

/*

  Query language resembling Debian dependencies and reprepro
  queries: http://mirrorer.alioth.debian.org/reprepro.1.html

  Query := A | A '|' Query
  A := B | B ',' A
  B := C | '!' B
  C := '(' Query ')' | D
  D := <field> <condition> <arch_condition> | <pkg>_<version>_<arch>
  field := <package-name> | <field> | $special_field
  condition := '(' <operator> value ')' |
  arch_condition := '{' arch '}' |
  operator := | << | < | <= | > | >> | >= | = | % | ~
*/

// Parse parses input package query into PackageQuery tree ready for evaluation
func Parse(query string) (result deb.PackageQuery, err error) {
	l, _ := lex("", query)
	result, err = parse(l)
	return
}