Change creation time of files (RPM) from download time to build time

Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
0
down vote
favorite
I am going to create my own internal repository service via createrepo and want to provide an Java repository as well.
Downloading the JRE and JDK packages automatically and as described at Stack Overflow leaves me with files which have a timestamp from the time they were downloaded. The creation time of the files is set to the runtime of the download script.
For further processing I like to have the timestamps set to the build time of the RPM package (... so that I can query them via ls -al, ll, --full-time, etc.).
How to change creation time of files (RPM) from download time to build time automatically?
rpm date timestamps touch
add a comment |Â
up vote
0
down vote
favorite
I am going to create my own internal repository service via createrepo and want to provide an Java repository as well.
Downloading the JRE and JDK packages automatically and as described at Stack Overflow leaves me with files which have a timestamp from the time they were downloaded. The creation time of the files is set to the runtime of the download script.
For further processing I like to have the timestamps set to the build time of the RPM package (... so that I can query them via ls -al, ll, --full-time, etc.).
How to change creation time of files (RPM) from download time to build time automatically?
rpm date timestamps touch
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am going to create my own internal repository service via createrepo and want to provide an Java repository as well.
Downloading the JRE and JDK packages automatically and as described at Stack Overflow leaves me with files which have a timestamp from the time they were downloaded. The creation time of the files is set to the runtime of the download script.
For further processing I like to have the timestamps set to the build time of the RPM package (... so that I can query them via ls -al, ll, --full-time, etc.).
How to change creation time of files (RPM) from download time to build time automatically?
rpm date timestamps touch
I am going to create my own internal repository service via createrepo and want to provide an Java repository as well.
Downloading the JRE and JDK packages automatically and as described at Stack Overflow leaves me with files which have a timestamp from the time they were downloaded. The creation time of the files is set to the runtime of the download script.
For further processing I like to have the timestamps set to the build time of the RPM package (... so that I can query them via ls -al, ll, --full-time, etc.).
How to change creation time of files (RPM) from download time to build time automatically?
rpm date timestamps touch
edited Jul 30 at 7:38
asked Jul 30 at 7:22
U880D
399314
399314
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
After some research I've found that I can query the RPM build time via rpm -qip.
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
The date command can reformat the given date and time string
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
so that it could be later used with the touch command.
touch -m -a -t $TIMESTAMP $FILENAME
By iterating over all files within a specific directory it is possible to list all creation times of all packages contained and modify it automatically.
#!/bin/bash
for FILENAME in *.rpm; do
echo $FILENAME
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
touch -m -a -t $TIMESTAMP $FILENAME
done
1
Or you can userpm --qf ...to extract only the headers you care about:touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"
â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested withrpm -qp "$FILENAME" --qf "%BUILDTIME:daten")"and found it more elegant. Thanks for the hint and +1.
â U880D
Jul 30 at 8:04
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
After some research I've found that I can query the RPM build time via rpm -qip.
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
The date command can reformat the given date and time string
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
so that it could be later used with the touch command.
touch -m -a -t $TIMESTAMP $FILENAME
By iterating over all files within a specific directory it is possible to list all creation times of all packages contained and modify it automatically.
#!/bin/bash
for FILENAME in *.rpm; do
echo $FILENAME
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
touch -m -a -t $TIMESTAMP $FILENAME
done
1
Or you can userpm --qf ...to extract only the headers you care about:touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"
â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested withrpm -qp "$FILENAME" --qf "%BUILDTIME:daten")"and found it more elegant. Thanks for the hint and +1.
â U880D
Jul 30 at 8:04
add a comment |Â
up vote
1
down vote
After some research I've found that I can query the RPM build time via rpm -qip.
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
The date command can reformat the given date and time string
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
so that it could be later used with the touch command.
touch -m -a -t $TIMESTAMP $FILENAME
By iterating over all files within a specific directory it is possible to list all creation times of all packages contained and modify it automatically.
#!/bin/bash
for FILENAME in *.rpm; do
echo $FILENAME
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
touch -m -a -t $TIMESTAMP $FILENAME
done
1
Or you can userpm --qf ...to extract only the headers you care about:touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"
â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested withrpm -qp "$FILENAME" --qf "%BUILDTIME:daten")"and found it more elegant. Thanks for the hint and +1.
â U880D
Jul 30 at 8:04
add a comment |Â
up vote
1
down vote
up vote
1
down vote
After some research I've found that I can query the RPM build time via rpm -qip.
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
The date command can reformat the given date and time string
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
so that it could be later used with the touch command.
touch -m -a -t $TIMESTAMP $FILENAME
By iterating over all files within a specific directory it is possible to list all creation times of all packages contained and modify it automatically.
#!/bin/bash
for FILENAME in *.rpm; do
echo $FILENAME
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
touch -m -a -t $TIMESTAMP $FILENAME
done
After some research I've found that I can query the RPM build time via rpm -qip.
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
The date command can reformat the given date and time string
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
so that it could be later used with the touch command.
touch -m -a -t $TIMESTAMP $FILENAME
By iterating over all files within a specific directory it is possible to list all creation times of all packages contained and modify it automatically.
#!/bin/bash
for FILENAME in *.rpm; do
echo $FILENAME
BUILDTIME=$(rpm -qip --nosignature $FILENAME | grep -i "Build Date : " | sed -e 's/Build Date : //g')
echo $BUILDTIME
TIMESTAMP=$(date --date="$BUILDTIME" "+%Y%m%d%H%M")
echo $TIMESTAMP
touch -m -a -t $TIMESTAMP $FILENAME
done
answered Jul 30 at 7:29
U880D
399314
399314
1
Or you can userpm --qf ...to extract only the headers you care about:touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"
â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested withrpm -qp "$FILENAME" --qf "%BUILDTIME:daten")"and found it more elegant. Thanks for the hint and +1.
â U880D
Jul 30 at 8:04
add a comment |Â
1
Or you can userpm --qf ...to extract only the headers you care about:touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"
â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested withrpm -qp "$FILENAME" --qf "%BUILDTIME:daten")"and found it more elegant. Thanks for the hint and +1.
â U880D
Jul 30 at 8:04
1
1
Or you can use
rpm --qf ... to extract only the headers you care about: touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Or you can use
rpm --qf ... to extract only the headers you care about: touch "$PACKAGE" -d"$(rpm -qp "$PACKAGE" --qf "%BUILDTIME:daten")"â Ignacio Vazquez-Abrams
Jul 30 at 7:50
Just tested with
rpm -qp "$FILENAME" --qf "%BUILDTIME:daten")" and found it more elegant. Thanks for the hint and +1.â U880D
Jul 30 at 8:04
Just tested with
rpm -qp "$FILENAME" --qf "%BUILDTIME:daten")" and found it more elegant. Thanks for the hint and +1.â U880D
Jul 30 at 8:04
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f459265%2fchange-creation-time-of-files-rpm-from-download-time-to-build-time%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password