2 # $NetBSD: prepare-import.sh,v 1.4 2014/07/24 15:16:26 christos Exp $
4 # Use this script to recreate the 'dist' subdirectory from a newly released
5 # distfile. The script takes care of unpacking the distfile, removing any
6 # files that are not relevant to NetBSD and checking if there are any new
7 # files in the new release that need to be addressed.
9 # See the README file for general instructions.
17 CLEAN_PATTERNS
="${CLEAN_PATTERNS} [A-Z]*"
18 CLEAN_PATTERNS
="${CLEAN_PATTERNS} aclocal.m4"
19 CLEAN_PATTERNS
="${CLEAN_PATTERNS} etc"
20 CLEAN_PATTERNS
="${CLEAN_PATTERNS} configure*"
23 echo "${ProgName}:" "${@}" 1>&2
28 echo "${ProgName}:" "${@}"
32 if [ -d dist.old
]; then
33 log
"Removing dist; dist.old exists"
36 log
"Backing up dist as dist.old"
42 local distfile
="${1}"; shift
43 local distname
="${1}"; shift
45 log
"Extracting ${distfile}"
46 tar -xzf "${distfile}"
47 [ -d "${distname}" ] || err
"Distfile did not create ${distname}"
48 log
"Renaming ${distname} to dist"
53 local distfile
="${1}"; shift
54 basename "${distfile}" |
sed -e 's,\.tar.*,,'
58 log
"Removing unnecessary files from dist"
59 ( cd dist
&& rm -rf ${CLEAN_PATTERNS} )
60 find dist
-name .deps
-exec rm -fr {} +
61 find dist
-name .dirstamp
-exec rm -f {} +
65 local old_dir
="${1}"; shift
66 local new_dir
="${1}"; shift
68 local old_list
=$
(mktemp
-t tmux-import.XXXXXX
)
69 local new_list
=$
(mktemp
-t tmux-import.XXXXXX
)
70 local diff=$
(mktemp
-t tmux-import.XXXXXX
)
71 trap "rm -f '${old_list}' '${new_list}' '${diff}'; exit 1" \
74 ( cd "${old_dir}" && find . |
sort >>"${old_list}" )
75 ( cd "${new_dir}" && find . |
sort >>"${new_list}" )
77 diff -u "${old_list}" "${new_list}" | grep '^+\.' >>"${diff}" || true
78 if [ -s "${diff}" ]; then
80 diff -u "${old_list}" "${new_list}" |
grep '^+\.'
81 log
"Check if any files have to be cleaned up and update" \
82 "the prepare-import.sh script accordingly"
84 log
"No new files; all good!"
87 rm -f "${old_list}" "${new_list}" "${diff}"
91 [ ${#} -eq 1 ] || err
"Must provide a distfile name"
92 local distfile
="${1}"; shift
94 [ -f Makefile
-a -f prepare-import.sh
] || \
95 err
"Must be run from the src/external/bsd/tmux subdirectory"
97 local distname
="$(get_distname ${distfile})"
100 extract_distfile
"${distfile}" "${distname}"
102 diff_dirs dist.old dist
104 log
"Don't forget to update the -D flags in usr.bin/tmux/Makefile" \
105 "and to update the version in doc/3RDPARTY"