27 workspace_source_folder, package_name, packagepath, ubuntu_version, ros_distro, already_visited
29 print(
"-----------------------")
30 print(
"Working folder: " + str(os.getcwd()))
31 print(
"Building debian package: " + str(package_name))
33 "bloom-generate rosdebian --os-name ubuntu --os-version "
41 bloomprocess = subprocess.Popen(cmd, shell=
True)
44 develpackagefolder =
None
45 for root, dirs, files
in os.walk(workspace_source_folder, topdown=
False):
46 if "package.xml" in files
and package_name == root.split(
"/")[-1]:
48 develpackagefolder = root
51 localpackagepath = develpackagefolder
53 print(
"current directory:")
55 print(
"debian files:")
59 shutil.move(
"debian", os.path.join(localpackagepath,
"debian"))
61 os.chdir(localpackagepath)
62 fakerootprocess = subprocess.Popen(
"fakeroot debian/rules binary", shell=
True)
63 fakerootprocess.wait()
65 os.chdir(localpackagepath)
66 shutil.rmtree(
"debian")
67 shutil.rmtree(
"obj-x86_64-linux-gnu")
69 os.chdir(workspace_source_folder)
73 firstregexstr =
".*ros-" + ros_distro +
r"-.*\.deb"
74 regexstr =
".*ros-" + ros_distro +
"-" + package_name.replace(
"_",
"-") +
r".*\.deb"
75 print(
"Finding deb package: " + str(regexstr))
78 for root, dirs, files
in os.walk(workspace_source_folder, topdown=
False):
79 thisfolderfiles = thisfolderfiles + [os.path.join(root, f)
for f
in files]
81 debianfiles = [f
for f
in thisfolderfiles
if re.search(firstregexstr, f)]
82 print(
"DETECTED DEBIAN FILES:")
84 print(
"VISITED DEBIAN FILES:")
85 print(already_visited)
88 f
for f
in debianfiles
if re.search(regexstr, f)
and f
not in already_visited
91 print(
"Debian file found: ")
94 installdebiantask = subprocess.Popen(
"sudo dpkg -i " + debianfilename, shell=
True)
95 installdebiantask.wait()
101 workspace_source_folder, package_names, identified_install_packages, osversion, rosversion
103 os.chdir(workspace_source_folder)
105 for pname
in package_names:
108 workspace_source_folder,
110 identified_install_packages[pname],
120 identified_install_packages = {}
121 exclude_with_words = [
"ridgeback",
"mecanum",
"catkin"]
122 for pname
in packagesl:
123 packpath = rospack.get_path(pname)
125 if workspace_folder
in packpath:
126 if any([
True for excludedword
in exclude_with_words
if excludedword
in pname]):
129 identified_install_packages[pname] = packpath
130 return identified_install_packages
134 for debf
in debianfiles:
135 print(
"pushing debfile")
136 push_debian_task = subprocess.Popen(
137 "package_cloud push "
149 push_debian_task.wait()
153 for debf
in debianfiles:
154 shortdebfile = debf.split(
"/")[-1]
155 print(
"yanking debfile")
156 push_debian_task = subprocess.Popen(
157 "package_cloud yank "
169 push_debian_task.wait()
176 workspace_source_folder = os.path.join(workspace_folder, relative_smacc_folder)
179 smacc_manual_order_packages = [
184 "sr_event_countdown",
186 "multirole_sensor_client",
187 "ros_publisher_client",
190 "forward_global_planner",
191 "forward_local_planner",
192 "backward_global_planner",
193 "undo_path_global_planner",
194 "backward_local_planner",
195 "move_group_interface_client",
198 "sm_dance_bot_strikes_back",
203 workspace_source_folder,
204 smacc_manual_order_packages,
205 identified_install_packages,
210 create_repo_task = subprocess.Popen(
"package_cloud repository create smacc", shell=
True)
211 create_repo_task.wait()
217 return smacc_debian_files
220if __name__ ==
"__main__":
232 repo_owner =
"pibgeus"
236 rospack = rospkg.RosPack()
237 packages = rospack.list()
238 packagesl = list(packages)
240 parser = argparse.ArgumentParser()
241 parser.add_argument(
"-smacc_src_folder", help=
"smacc workspace folder", default=
"src/SMACC")
243 "-smacc_viewer_src_folder", help=
"relative smacc src folder", default=
"src/SMACC_Viewer"
245 parser.add_argument(
"-repo_owner", help=
"Repo owner", default=
"pibgeus")
246 parser.add_argument(
"-token", help=
"Repo token", default=
"")
248 "-ros_version", help=
"The version of ros, ie: kinetic", default=
"kinetic", type=str
251 "-ubuntu_version", help=
"The version of ros, ie: xenial", default=
"xenial", type=str
253 parser.add_argument(
"-help", help=
"Help command")
255 argcomplete.autocomplete(parser)
257 args = parser.parse_args()
262 osversion = args.ubuntu_version
263 ros_version = args.ros_version
265 print(
"args:" + str(args))
266 print(
"rosversion: " + ros_version)
267 print(
"ubuntu: " + osversion)
269 relative_smacc_folder = args.smacc_src_folder
270 workspace_folder = os.path.abspath(os.path.join(os.getcwd(),
"."))
272 repo_owner = args.repo_owner
274 print(
"CREATING TOKEN FILE FOR PACKAGE CLOUD:")
275 homefolder = os.getenv(
"HOME")
276 packagecloud_token_filepath = os.path.join(homefolder,
".packagecloud")
278 outfile = open(packagecloud_token_filepath,
"w")
279 outfile.write(
'{"token":"%s"}' % args.token)
284 print(
"SMACC DEBIAN'S: " + str(smacc_debians))
def remove_debian_files(repo_owner, reponame, osname, osversion, debianfiles)
def iterate_debian_generation(workspace_source_folder, package_names, identified_install_packages, osversion, rosversion)
def push_debian_files(repo_owner, reponame, osname, osversion, debianfiles)
def build_deb_package(workspace_source_folder, package_name, packagepath, ubuntu_version, ros_distro, already_visited)
def get_identified_packages(workspace_folder)
def create_and_push_smacc_debians(osname, osversion, rosversion)