mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 20:13:32 +01:00
doc, make, scripts: Add support for [pkg.conflicts.xxx]
Since the packaging machinery is pretty complicated, the information about conflicting packages had to be passed through many APIs. The last commit contained a patch which is left in the tree to have it in one file, it actually is identical to this commit's diff, though. Git would save me that quirk. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e52879215d
commit
c42e386c76
7 changed files with 100 additions and 54 deletions
|
|
@ -55,6 +55,8 @@ cfg_value global.subpackages | grep -q run && cat << EOT
|
|||
Package: \$NAME-run
|
||||
Architecture: any
|
||||
Depends: \`format_depends "\${shlibs:Depends}, \${misc:Depends}, \$REQUIRES_RUN"\`
|
||||
# untested:
|
||||
Conflicts: \`format_depends "\${shlibs:Depends}, \${misc:Depends}, \$CONFLICTS_RUN"\`
|
||||
Description: `cfg_value summary`
|
||||
`cfg_value description | sed 's/^/ /'`
|
||||
EOT
|
||||
|
|
@ -64,6 +66,8 @@ cfg_value global.subpackages | grep -q devel && cat << EOT
|
|||
Package: \$NAME-devel
|
||||
Architecture: any
|
||||
Depends: \`format_depends "\$NAME-run = \$VERSION-\$RELEASE, \$REQUIRES_DEVEL"\`
|
||||
# untested:
|
||||
Conflicts: \`format_depends "\$NAME-run = \$VERSION-\$RELEASE, \$CONFLICTS_DEVEL"\`
|
||||
Description: \$NAME Development Package
|
||||
Development tools for \$NAME-run
|
||||
EOT
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ cfg_value global.subpackages | grep -q run && _cat << EOT
|
|||
|echo "Summary: `cfg_value summary`"
|
||||
|echo "Group: `cfg_value global.group`"
|
||||
|[ "\$REQUIRES_RUN" ] && echo "Requires: \$REQUIRES_RUN"
|
||||
|[ "\$CONFLICTS_RUN" ] && echo "Conflicts: \$CONFLICTS_RUN"
|
||||
|echo "%description -n \$NAME-run"
|
||||
|echo "Runtime package"
|
||||
|echo ""
|
||||
|
|
@ -60,6 +61,7 @@ cfg_value global.subpackages | grep -q devel && _cat << EOT
|
|||
|echo "Summary: `cfg_value summary`, development package"
|
||||
|echo "Group: `cfg_value global.group`"
|
||||
|[ "\$REQUIRES_DEVEL" ] && echo "Requires: \$REQUIRES_DEVEL"
|
||||
|[ "\$CONFLICTS_DEVEL" ] && echo "Conflicts: \$CONFLICTS_DEVEL"
|
||||
|echo "%description -n \$NAME-devel"
|
||||
|echo "Development package"
|
||||
|echo ""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ usage()
|
|||
[ "$1" ] && exit $1
|
||||
}
|
||||
|
||||
set -- `getopt P:T:V:S:N:hR:D:d: "$@"`
|
||||
set -- `getopt P:T:V:S:N:hR:D:X:Y:d: "$@"`
|
||||
|
||||
while [ "$1" != -- ]; do
|
||||
case $1 in
|
||||
|
|
@ -42,12 +42,24 @@ case $1 in
|
|||
shift
|
||||
done
|
||||
;;
|
||||
-X)
|
||||
while [ "`echo $2 | cut -c1`" != "-" ]; do
|
||||
CONFLICTS_RUN="$CONFLICTS_RUN $2"
|
||||
shift
|
||||
done
|
||||
;;
|
||||
-D)
|
||||
while [ "`echo $2 | cut -c1`" != "-" ]; do
|
||||
REQUIRES_DEVEL="$REQUIRES_DEVEL $2"
|
||||
shift
|
||||
done
|
||||
;;
|
||||
-Y)
|
||||
while [ "`echo $2 | cut -c1`" != "-" ]; do
|
||||
CONFLICTS_DEVEL="$CONFLICTS_DEVEL $2"
|
||||
shift
|
||||
done
|
||||
;;
|
||||
-P)
|
||||
PROJECT="$2"
|
||||
shift;;
|
||||
|
|
@ -81,6 +93,7 @@ if [ -z "$NAME" ]; then
|
|||
fi
|
||||
|
||||
REQUIRES="$REQUIRES_RUN $REQUIRES_DEVEL"
|
||||
CONFLICTS="$CONFLICTS_RUN $CONFLICTS_DEVEL"
|
||||
#if [ -n "$REQUIRES" ]; then
|
||||
# REQUIRES_RUN=`echo $REQUIRES |
|
||||
# sed -e '
|
||||
|
|
@ -96,6 +109,7 @@ REQUIRES="$REQUIRES_RUN $REQUIRES_DEVEL"
|
|||
|
||||
export \
|
||||
REQUIRES REQUIRES_RUN REQUIRES_DEVEL \
|
||||
CONFLICTS CONFLICTS_RUN CONFLICTS_DEVEL \
|
||||
TOPDIR \
|
||||
PROJECT NAME \
|
||||
SOURCE \
|
||||
|
|
|
|||
|
|
@ -410,6 +410,8 @@ build_pkg()
|
|||
local distribution=`os`
|
||||
local RPM_REQUIRES_RUN=`echo $RPM_REQUIRES_RUN | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g"`
|
||||
local RPM_REQUIRES_DEVEL=`echo $RPM_REQUIRES_DEVEL | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g"`
|
||||
local RPM_CONFLICTS_RUN=`echo $RPM_CONFLICTS_RUN | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g"`
|
||||
local RPM_CONFLICTS_DEVEL=`echo $RPM_CONFLICTS_DEVEL | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g"`
|
||||
|
||||
# --- create source directory tree
|
||||
create_empty_dir $src_tree "Source files compilation directory"
|
||||
|
|
@ -464,7 +466,9 @@ build_pkg()
|
|||
-S $tar_archive \
|
||||
-N $RPM_PROJECT \
|
||||
-R "$RPM_REQUIRES_RUN" \
|
||||
-X "$RPM_CONFLICTS_RUN" \
|
||||
-D "$RPM_REQUIRES_DEVEL" \
|
||||
-Y "$RPM_CONFLICTS_DEVEL" \
|
||||
-P $PROJECT \
|
||||
-d $distribution \
|
||||
> $RPM_PROJECT.$deffmt
|
||||
|
|
@ -909,7 +913,7 @@ SCM=cvs
|
|||
[ -d .git ] && SCM=git
|
||||
|
||||
|
||||
opts='ht:p:m:N:R:D:P:a:F:B:A:'
|
||||
opts='ht:p:m:N:R:D:X:Y:P:a:F:B:A:'
|
||||
args=("$@")
|
||||
global_args=()
|
||||
while [ "$1" ]; do
|
||||
|
|
@ -949,10 +953,18 @@ while [ "$1" != -- -a "$1" != "$cmd" ] ; do
|
|||
eval RPM_REQUIRES_RUN=\"$2\"
|
||||
shift
|
||||
;;
|
||||
-X)
|
||||
eval RPM_CONFLICTS_RUN=\"$2\"
|
||||
shift
|
||||
;;
|
||||
-D)
|
||||
eval RPM_REQUIRES_DEVEL=\"$2\"
|
||||
shift
|
||||
;;
|
||||
-Y)
|
||||
eval RPM_CONFLICTS_DEVEL=\"$2\"
|
||||
shift
|
||||
;;
|
||||
-P)
|
||||
eval PROJECT=\"$2\"
|
||||
shift
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ def htdocs_dir(name):
|
|||
return r
|
||||
return None
|
||||
|
||||
def pkg_requires_os_cascade():
|
||||
def os_cascade():
|
||||
os = get_os()
|
||||
name = re.sub('-.*', '', os)
|
||||
# e.g. os, linux, suse, suse-tumbleweed
|
||||
|
|
@ -202,6 +202,55 @@ def get_modules_from_project_txt(names, section, keys, add_self, scope,
|
|||
r.append(m)
|
||||
return r
|
||||
|
||||
def pkg_relations(rel_type, args_):
|
||||
parser = argparse.ArgumentParser(description='pkg-' + rel_type)
|
||||
# TODO: implement Vendor evaluation
|
||||
|
||||
parser.add_argument('--vendor', '-V', nargs='?', default='jw', help='Package Vendor')
|
||||
parser.add_argument('flavour', help='Flavour')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
parser.add_argument('--dont-strip-revision', action='store_true',
|
||||
default=False, help='Always treat VERSION macro as VERSION-REVISION')
|
||||
parser.add_argument('--dont-expand-version-macros', action='store_true',
|
||||
default=False, help='Don\'t expand VERSION and REVISION macros')
|
||||
args=parser.parse_args(args_)
|
||||
debug('flavour = ', args.flavour, ', vendor = ', args.vendor)
|
||||
version_pattern=re.compile("[0-9-.]*")
|
||||
subsecs = os_cascade()
|
||||
subsecs.append('jw')
|
||||
debug("subsecs = ", subsecs)
|
||||
r = []
|
||||
for s in subsecs:
|
||||
for m in args.module:
|
||||
value = get_value(m, 'pkg.' + rel_type + '.' + s, args.flavour)
|
||||
if not value:
|
||||
continue
|
||||
deps = value.split(',')
|
||||
for spec in deps:
|
||||
dep = re.split('([=><]+)', spec)
|
||||
for i, item in enumerate(dep):
|
||||
dep[i] = item.strip()
|
||||
if len(dep) == 3:
|
||||
dep_project = re.sub(r'-devel$|-run$', '', dep[0])
|
||||
if args.dont_expand_version_macros and dep_project in args.module:
|
||||
version = dep[2]
|
||||
else:
|
||||
version = get_value(dep_project, 'version', '')
|
||||
if dep[2] == 'VERSION':
|
||||
if args.dont_strip_revision:
|
||||
dep[2] = version
|
||||
else:
|
||||
dep[2] = version.split('-')[0]
|
||||
elif dep[2] == 'VERSION-REVISION':
|
||||
dep[2] = version
|
||||
elif version_pattern.match(dep[2]):
|
||||
# dep[2] = dep[2]
|
||||
pass
|
||||
else:
|
||||
raise Exception("Unknown version specifier in " + spec)
|
||||
r.append(' '.join(dep))
|
||||
print(', '.join(r))
|
||||
|
||||
def get_libname(names):
|
||||
vals = get_modules_from_project_txt(names, 'build', 'libname',
|
||||
scope = 1, add_self=False, names_only=True)
|
||||
|
|
@ -266,6 +315,7 @@ def cmd_test(args_):
|
|||
args=parser.parse_args(args_)
|
||||
print("blah = " + args.blah)
|
||||
|
||||
# TODO: seems at least partly redundant to cmd_pkg_requires / pkg_relations
|
||||
def cmd_requires_pkg(args_):
|
||||
parser = argparse.ArgumentParser(description='requires-pkg')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
|
|
@ -275,7 +325,7 @@ def cmd_requires_pkg(args_):
|
|||
debug("flavours = " + args.flavours)
|
||||
deps = get_modules_from_project_txt(args.module, 'pkg.requires.jw', flavours,
|
||||
scope = 2, add_self=True, names_only=True)
|
||||
subsecs = pkg_requires_os_cascade()
|
||||
subsecs = os_cascade()
|
||||
debug("subsecs = ", subsecs)
|
||||
requires = []
|
||||
for s in subsecs:
|
||||
|
|
@ -290,7 +340,7 @@ def cmd_requires_pkg(args_):
|
|||
print(r[1:])
|
||||
|
||||
def cmd_os_cascade(args_):
|
||||
print(' '.join(pkg_requires_os_cascade()))
|
||||
print(' '.join(os_cascade()))
|
||||
|
||||
def cmd_ldlibpath(args_):
|
||||
parser = argparse.ArgumentParser(description='ldlibpath')
|
||||
|
|
@ -349,6 +399,7 @@ def cmd_path(args_):
|
|||
r = r + ':' + proj_dir(m) + '/bin'
|
||||
print(r[1:])
|
||||
|
||||
# TODO: seems at least partly redundant to cmd_pkg_requires / pkg_relations
|
||||
def cmd_prereq(args_):
|
||||
parser = argparse.ArgumentParser(description='path')
|
||||
parser.add_argument('flavour', help='Flavour')
|
||||
|
|
@ -359,53 +410,10 @@ def cmd_prereq(args_):
|
|||
print(' '.join(deps))
|
||||
|
||||
def cmd_pkg_requires(args_):
|
||||
parser = argparse.ArgumentParser(description='pkg-requires')
|
||||
# TODO: implement Vendor evaluation
|
||||
return pkg_relations("requires", args_)
|
||||
|
||||
parser.add_argument('--vendor', '-V', nargs='?', default='jw', help='Package Vendor')
|
||||
parser.add_argument('flavour', help='Flavour')
|
||||
parser.add_argument('module', nargs='*', help='Modules')
|
||||
parser.add_argument('--dont-strip-revision', action='store_true',
|
||||
default=False, help='Always treat VERSION macro as VERSION-REVISION')
|
||||
parser.add_argument('--dont-expand-version-macros', action='store_true',
|
||||
default=False, help='Don\'t expand VERSION and REVISION macros')
|
||||
args=parser.parse_args(args_)
|
||||
debug('flavour = ', args.flavour, ', vendor = ', args.vendor)
|
||||
version_pattern=re.compile("[0-9-.]*")
|
||||
subsecs = pkg_requires_os_cascade()
|
||||
subsecs.append('jw')
|
||||
debug("subsecs = ", subsecs)
|
||||
r = []
|
||||
for s in subsecs:
|
||||
for m in args.module:
|
||||
value = get_value(m, 'pkg.requires.' + s, args.flavour)
|
||||
if not value:
|
||||
continue
|
||||
deps = value.split(',')
|
||||
for spec in deps:
|
||||
dep = re.split('([=><]+)', spec)
|
||||
for i, item in enumerate(dep):
|
||||
dep[i] = item.strip()
|
||||
if len(dep) == 3:
|
||||
dep_project = re.sub(r'-devel$|-run$', '', dep[0])
|
||||
if args.dont_expand_version_macros and dep_project in args.module:
|
||||
version = dep[2]
|
||||
else:
|
||||
version = get_value(dep_project, 'version', '')
|
||||
if dep[2] == 'VERSION':
|
||||
if args.dont_strip_revision:
|
||||
dep[2] = version
|
||||
else:
|
||||
dep[2] = version.split('-')[0]
|
||||
elif dep[2] == 'VERSION-REVISION':
|
||||
dep[2] = version
|
||||
elif version_pattern.match(dep[2]):
|
||||
# dep[2] = dep[2]
|
||||
pass
|
||||
else:
|
||||
raise Exception("Unknown version specifier in " + spec)
|
||||
r.append(' '.join(dep))
|
||||
print(', '.join(r))
|
||||
def cmd_pkg_conflicts(args_):
|
||||
return pkg_relations("conflicts", args_)
|
||||
|
||||
def cmd_proj_dir(args_):
|
||||
parser = argparse.ArgumentParser(description='proj-dir')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue