Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jberryman
GHC
Commits
bace2ef8
Commit
bace2ef8
authored
Jun 02, 2019
by
jberryman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utility for unpacking/repacking ar library files
parent
7e2ed2a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
SHIMS_PATH/unarar.sh
SHIMS_PATH/unarar.sh
+44
-0
No files found.
SHIMS_PATH/unarar.sh
0 → 100755
View file @
bace2ef8
#!/usr/bin/zsh
# Not portable, sorry...
set
-e
set
-o
pipefail
# set -x
# Another variation on these reopt script. THis unpacks an archive and pauses
# while the programmer fiddles with it, then repacks and backs up original.
# Calls `reopt` on objects in archive and repacks
TARGET_AR
=
$(
realpath
"
$@
"
)
echo
-n
"
$TARGET_AR
: "
TMP_DIR
=
$(
mktemp
-d
)
cd
"
$TMP_DIR
"
# Individual libraries can and do have identical names, which makes this a huge pain.
# We unpack each member into a separate numbered directory, and repack in the same order
O_NUM
=
1
for
cnt nm
in
`
ar t
"
$TARGET_AR
"
|
sort
|
uniq
-c
`
;
do
for
c
in
{
1..
$cnt
}
;
do
mkdir
$O_NUM
cd
$O_NUM
ar xN
$c
"
$TARGET_AR
"
$nm
cd
..
((
O_NUM++
))
done
done
echo
echo
"Pausing while you fiddle with contents of
$TARGET_AR
, unpacked at:"
echo
"
$TMP_DIR
"
read
"?Enter to continue and repack"
# rearchive; use zsh numeric blob qualifier.
ar cq repackaged.a
*
/
*
(
n
)
# Backup original
cp
--force
--backup
=
numbered
"
$TARGET_AR
"
"
$TARGET_AR
"
cp
repackaged.a
"
$TARGET_AR
"
rm
-r
"
$TMP_DIR
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment