doc/packaging/add-pkg-conflicts-support.patch: Add file

add-pkg-conflicts-support.patch is commited as piece of documentation
on which places had to be touched as an additional option (i.e.
"Conflicts") was implemented. In the hope it might prove useful in
streamlining the packaging machinery later.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-06-26 10:30:09 +00:00
commit e52879215d
2 changed files with 355 additions and 0 deletions

4
doc/packaging/Makefile Normal file
View file

@ -0,0 +1,4 @@
TOPDIR = ../..
include $(TOPDIR)/make/proj.mk
include $(MODDIR)/make/dummy.mk

View file

@ -0,0 +1,351 @@
Index: make/rpmdist.mk
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/make/rpmdist.mk,v
retrieving revision 1.137
diff -u -r1.137 rpmdist.mk
--- make/rpmdist.mk 8 Apr 2017 13:40:04 -0000 1.137
+++ make/rpmdist.mk 26 Jun 2017 10:23:07 -0000
@@ -73,7 +73,8 @@
# to be replaced by pkg.sh
RPM_REQUIRES_DEVEL += $(call proj_query, pkg-requires --dont-expand-version-macros $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) devel $(PROJECT))
RPM_REQUIRES_RUN += $(call proj_query, pkg-requires --dont-expand-version-macros $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) run $(PROJECT))
-#RPM_REQUIRES_DEVEL += $(RPM_PROJECT)-run = __NEXT_VERSION__
+RPM_CONFLICTS_DEVEL += $(call proj_query, pkg-conflicts --dont-expand-version-macros $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) devel $(PROJECT))
+RPM_CONFLICTS_RUN += $(call proj_query, pkg-conflicts --dont-expand-version-macros $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) run $(PROJECT))
RPM_UPLOAD_OS_NAME = $(shell echo $(OS) | sed 's/-.*//')
RPM_UPLOAD_OS_VERSION = $(shell echo $(OS) | sed 's/[^-]\+-//')
@@ -88,8 +89,9 @@
include $(MODDIR)/make/upload-rules.mk
PKG_SH = $(PKG_SH_EXE) \
- -N $(RPM_PROJECT) \
- -R "$(RPM_REQUIRES_RUN)" -D "$(RPM_REQUIRES_DEVEL)" -P $(PROJECT) \
+ -N $(RPM_PROJECT) -P $(PROJECT) \
+ -R "$(RPM_REQUIRES_RUN)" -D "$(RPM_REQUIRES_DEVEL)" \
+ -X "$(RPM_CONFLICTS_RUN)" -Y "$(RPM_CONFLICTS_DEVEL)" \
-m $(MOD_SCRIPT_DIR) -a $(RPM_ARCH) -p $(DIST_PCKG_DIR) -F $(PKG_FORMAT) \
-B $(RPM_UPLOAD_URLPREFIX) -A $(RPM_UPLOAD_FILE_ATTRIB)
Index: scripts/create-mkdebian.sh
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/scripts/create-mkdebian.sh,v
retrieving revision 1.22
diff -u -r1.22 create-mkdebian.sh
--- scripts/create-mkdebian.sh 13 Jan 2017 19:26:28 -0000 1.22
+++ scripts/create-mkdebian.sh 26 Jun 2017 10:23:07 -0000
@@ -55,6 +55,8 @@
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 @@
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
Index: scripts/create-mkspec.sh
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/scripts/create-mkspec.sh,v
retrieving revision 1.20
diff -u -r1.20 create-mkspec.sh
--- scripts/create-mkspec.sh 25 Jun 2017 17:16:24 -0000 1.20
+++ scripts/create-mkspec.sh 26 Jun 2017 10:23:07 -0000
@@ -50,6 +50,7 @@
|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 @@
|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 ""
Index: scripts/mkspec-wrapper.sh
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/scripts/mkspec-wrapper.sh,v
retrieving revision 1.24
diff -u -r1.24 mkspec-wrapper.sh
--- scripts/mkspec-wrapper.sh 26 Jul 2016 15:02:21 -0000 1.24
+++ scripts/mkspec-wrapper.sh 26 Jun 2017 10:23:07 -0000
@@ -18,7 +18,7 @@
[ "$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 @@
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 @@
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 @@
export \
REQUIRES REQUIRES_RUN REQUIRES_DEVEL \
+ CONFLICTS CONFLICTS_RUN CONFLICTS_DEVEL \
TOPDIR \
PROJECT NAME \
SOURCE \
Index: scripts/pkg.sh
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/scripts/pkg.sh,v
retrieving revision 1.33
diff -u -r1.33 pkg.sh
--- scripts/pkg.sh 12 Jun 2017 09:35:57 -0000 1.33
+++ scripts/pkg.sh 26 Jun 2017 10:23:07 -0000
@@ -410,6 +410,8 @@
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 @@
-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 @@
[ -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 @@
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
Index: scripts/projects.py
===================================================================
RCS file: /home/jannet/arc/cvs/proj/jw-build/scripts/projects.py,v
retrieving revision 1.51
diff -u -r1.51 projects.py
--- scripts/projects.py 26 Jun 2017 09:33:53 -0000 1.51
+++ scripts/projects.py 26 Jun 2017 10:23:07 -0000
@@ -68,7 +68,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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')